DirectFB - Home of the pragmatist Roadmap


[directfb-dev] [PATCH] G450 CRTC2 support
Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[directfb-dev] [PATCH] G450 CRTC2 support



This patch adds G450 support to the CRTC2 layer. I've basically rewritten
the entire maven code. I didn't like the look of it at all :) Thus the
patch is quite big and I've compressed it.

Dok: Do NOT apply this to cvs. It's hardcoded for G450 at the moment.

If you want to try this code on a G400 change the line
mav->g450 = 1;
to
mav->g450 = 0;
in crtc2InitLayer()

I've tested the code with G400 DH 32MB SGRAM and G450 DH 16 MB DDR SDRAM.
Hopefully it will work with a G550 too.

The following changes affect all cards:
* NTSC height is now 480.
* Make color adjustments persistent.
* Brightness and contrast should work better now. Before some combinations
could cause problems.
* Better error reporting when opening the i2c device. Before there was
none.
* Improved enabling/disabling output.
* FlipBuffers() w/ DSFLIP_WAITFORSYNC and WaitForSync() don't hang if
output is diabled.

The included spic patch has the NTSC height change, some whitespace
cleanups, and it removes the unused config member from the layer data
structure.


TODO:
Some way to recognize G450 vs. G400. AFAIK matroxfb can't help us so I
suppose we'll have to read the PCI config registers. /proc/bus/pci would
do the trick I think.

-- 
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/

Attachment: crtc2-g450.patch.bz2
Description: Binary data

diff -urN DirectFB/gfxdrivers/matrox/matrox_spic.c DirectFB-G450/gfxdrivers/matrox/matrox_spic.c
--- DirectFB/gfxdrivers/matrox/matrox_spic.c	Wed Dec 11 00:08:55 2002
+++ DirectFB-G450/gfxdrivers/matrox/matrox_spic.c	Wed Dec 18 14:29:17 2002
@@ -56,8 +56,6 @@
 #include "matrox_maven.h"
 
 typedef struct {
-     DFBDisplayLayerConfig config;
-
      /* Stored registers */
      struct {
           /* CRTC2 sub picture */
@@ -70,7 +68,7 @@
 } MatroxSpicLayerData;
 
 static void spic_set_buffer( MatroxDriverData *mdrv, MatroxSpicLayerData *mspic,
-                              DisplayLayer *layer );
+                             DisplayLayer *layer );
 
 #define SPIC_SUPPORTED_OPTIONS   (DLOP_DEINTERLACING)
 
@@ -83,13 +81,13 @@
 }
      
 static DFBResult
-spicInitLayer( GraphicsDevice             *device,
-                DisplayLayer               *layer,
-                DisplayLayerInfo           *layer_info,
-                DFBDisplayLayerConfig      *default_config,
-                DFBColorAdjustment         *default_adj,
-                void                       *driver_data,
-                void                       *layer_data )
+spicInitLayer( GraphicsDevice        *device,
+               DisplayLayer          *layer,
+               DisplayLayerInfo      *layer_info,
+               DFBDisplayLayerConfig *default_config,
+               DFBColorAdjustment    *default_adj,
+               void                  *driver_data,
+               void                  *layer_data )
 {
      /* set capabilities and type */
      layer_info->desc.caps = DLCAPS_SURFACE | DLCAPS_DEINTERLACING;
@@ -105,7 +103,7 @@
                                    DLCONF_OPTIONS;
 
      default_config->width       = 720;
-     default_config->height      = dfb_config->matrox_ntsc ? 486 : 576;
+     default_config->height      = dfb_config->matrox_ntsc ? 480 : 576;
      default_config->pixelformat = DSPF_LUT8;
      default_config->buffermode  = DLBM_FRONTONLY;
      default_config->options     = DLOP_NONE;
@@ -113,11 +111,10 @@
      return DFB_OK;
 }
 
-
 static void
-spicOnOff( MatroxDriverData     *mdrv,
-            MatroxSpicLayerData *mspic,
-            int                   on )
+spicOnOff( MatroxDriverData    *mdrv,
+           MatroxSpicLayerData *mspic,
+           int                  on )
 {
      volatile __u8 *mmio = mdrv->mmio_base;
 
@@ -166,7 +163,7 @@
                        DFBDisplayLayerConfig      *config,
                        DFBDisplayLayerConfigFlags *failed )
 {
-     DFBDisplayLayerConfigFlags  fail = 0;
+     DFBDisplayLayerConfigFlags fail = 0;
 
      if (config->options & ~SPIC_SUPPORTED_OPTIONS)
           fail |= DLCONF_OPTIONS;
@@ -181,7 +178,7 @@
      if (config->width != 720)
           fail |= DLCONF_WIDTH;
 
-     if (config->height != (dfb_config->matrox_ntsc ? 486 : 576))
+     if (config->height != (dfb_config->matrox_ntsc ? 480 : 576))
           fail |= DLCONF_HEIGHT;
 
      if (failed)
@@ -199,11 +196,8 @@
                       void                  *layer_data,
                       DFBDisplayLayerConfig *config )
 {
-     MatroxDriverData    *mdrv   = (MatroxDriverData*) driver_data;
-     MatroxSpicLayerData *mspic   = (MatroxSpicLayerData*) layer_data;
-
-     /* remember configuration */
-     mspic->config = *config;
+     MatroxDriverData    *mdrv  = (MatroxDriverData*) driver_data;
+     MatroxSpicLayerData *mspic = (MatroxSpicLayerData*) layer_data;
 
      spic_set_buffer( mdrv, mspic, layer );
 
@@ -241,7 +235,6 @@
 
      return DFB_OK;
 }
-
 
 static DFBResult
 spicSetOpacity( DisplayLayer *layer,

Home | Main Index | Thread Index


directfb.org / Development / Old Archives