whitespace cosmetics: Remove all trailing whitespace.
[mplayer.git] / vidix / cyberblade_vid.c
index d1908b7..f46095a 100644 (file)
@@ -1,7 +1,12 @@
 /*
  * VIDIX driver for VIA Cyberblade/i1 chipsets.
+ * Brightness/Contrast controls disabled for the time being - they were
+ * seriously degrading picture quality, especially with TV-Out.
+ *
  * Copyright (C) 2002 Alastair M. Robinson
  * http://www.blackfiveservices.co.uk/EPIAVidix.shtml
+ * based on Permedia 3 driver by Måns Rullgård
+ * thanks to Gilles Frattini for bugfixes
  *
  * This file is part of MPlayer.
  *
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with MPlayer; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Based on Permedia 3 driver by Måns Rullgård
- * Thanks to Gilles Frattini for bugfixes.
- *
- * Changes:
- *   18/01/03
- *     MMIO is no longer used, sidestepping cache issues on EPIA-800
- *     TV-Out modes are now better supported - this should be the end
- *       of the magenta stripes :)
- *     Brightness/Contrast controls disabled for the time being - they were
- *       seriously degrading picture quality, especially with TV-Out.
- *
- * To Do:
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/* To Do:
  *   Implement Hue/Saturation controls
  *   Support / Test multiple frames
  *   Test colour-key code more extensively
 #include <inttypes.h>
 #include <unistd.h>
 
+#include "config.h"
 #include "vidix.h"
-#include "vidixlib.h"
 #include "fourcc.h"
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
-#include "config.h"
 
 #include "cyberblade_regs.h"
 
@@ -65,7 +59,7 @@ static FILE *logfile=0;
 #define LOGWRITE(x)
 #endif
 
-/* Helper functions for reading registers. */    
+/* Helper functions for reading registers. */
 
 static void CROUTW(int reg,int val)
 {
@@ -143,11 +137,13 @@ static int cyberblade_probe(int verbose, int force)
                                dname = pci_device_name(VENDOR_TRIDENT, lst[i].device);
                                dname = dname ? dname : "Unknown chip";
                                printf("[cyberblade] Found chip: %s\n", dname);
-                               if ((lst[i].command & PCI_COMMAND_IO) == 0)
+#if 0
+                                if ((lst[i].command & PCI_COMMAND_IO) == 0)
                                {
                                        printf("[cyberblade] Device is disabled, ignoring\n");
                                        continue;
                                }
+#endif
                                cyberblade_cap.device_id = lst[i].device;
                                err = 0;
                                memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
@@ -163,7 +159,7 @@ static int cyberblade_probe(int verbose, int force)
 
 static int cyberblade_init(void)
 {
-       cyberblade_mem = map_phys_mem(pci_info.base0, 0x800000); 
+       cyberblade_mem = map_phys_mem(pci_info.base0, 0x800000);
        enable_app_io();
        save_colourkey[0]=SRINB(0x50);
        save_colourkey[1]=SRINB(0x51);
@@ -195,7 +191,7 @@ static void cyberblade_destroy(void)
        SROUTB(0x56,save_colourkey[5]);
        SROUTB(0x11, protect);
        disable_app_io();
-       unmap_phys_mem(cyberblade_mem, 0x800000); 
+       unmap_phys_mem(cyberblade_mem, 0x800000);
 }
 
 
@@ -229,7 +225,6 @@ static int cyberblade_query_fourcc(vidix_fourcc_t *to)
                to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
                return 0;
        }
-       else
                to->depth = to->flags = 0;
        return ENOSYS;
 }
@@ -242,7 +237,7 @@ static vidix_grkey_t cyberblade_grkey;
 static int cyberblade_get_gkeys(vidix_grkey_t *grkey)
 {
        memcpy(grkey, &cyberblade_grkey, sizeof(vidix_grkey_t));
-       return(0);
+       return 0;
 }
 
 static int cyberblade_set_gkeys(const vidix_grkey_t *grkey)
@@ -276,7 +271,7 @@ static int cyberblade_set_gkeys(const vidix_grkey_t *grkey)
                SROUTB(0x56, 0x00); /* Colour Key Mask */
        }
        SROUTB(0x11,protect);
-       return(0);
+       return 0;
 }
 
 
@@ -446,19 +441,19 @@ static int cyberblade_config_playback(vidix_playback_t *info)
                        Overflow=CRINB(0x07);
                        VDisp |= (Overflow & 2) <<7;
                        VDisp |= (Overflow & 0x40) << 3;
+
                        TVHTotal=CRINB(0xe0)*8;
                        TVVTotal=CRINB(0xe6);
                        TVOverflow=CRINB(0xe7);
                        if(TVOverflow&0x20) TVVTotal|=512;
                        if(TVOverflow&0x01) TVVTotal|=256;
                        TVHTotal+=40; TVVTotal+=2;
+
                        TVHSyncStart=CRINB(0xe4)*8;
                        TVVSyncStart=CRINB(0xf0);
                        if(TVOverflow&0x80) TVVSyncStart|=512;
                        if(TVOverflow&0x04) TVVSyncStart|=256;
+
                        HWinStart=(TVHTotal-HDisp)&15;
                        HWinStart|=(HTotal-HDisp)&15;
                        HWinStart+=(TVHTotal-TVHSyncStart)-49;
@@ -470,7 +465,7 @@ static int cyberblade_config_playback(vidix_playback_t *info)
                }
                 VWinStart=(VTotal-VSync)-8;
 
-               printf("[cyberblade] HTotal: 0x%x, HSStart: 0x%x\n",HTotal,HSync); 
+               printf("[cyberblade] HTotal: 0x%x, HSStart: 0x%x\n",HTotal,HSync);
                printf("  VTotal: 0x%x, VStart: 0x%x\n",VTotal,VSync);
                tx1=HWinStart+info->dest.x;
                ty1=VWinStart+info->dest.y;
@@ -567,7 +562,7 @@ static int cyberblade_playback_on(void)
 
 static int cyberblade_playback_off(void)
 {
-        LOGWRITE("Disable overlay\n"); 
+        LOGWRITE("Disable overlay\n");
        CROUTB(0x8E, 0xc4); /* VDE Flags*/
 
        return 0;
@@ -577,7 +572,7 @@ static int cyberblade_playback_off(void)
 static int cyberblade_frame_sel(unsigned int frame)
 {
        int protect;
-        LOGWRITE("Frame select\n"); 
+        LOGWRITE("Frame select\n");
        protect=SRINB(0x11);
        SROUTB(0x11, 0x92);
        /* Set overlay address to that of selected frame */