DirectFB - Home of the pragmatist Roadmap


[directfb-dev] Re: how to CreateSurface on CRTC2 layer for G400
Mailing List archive

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

[directfb-dev] Re: how to CreateSurface on CRTC2 layer for G400



On Wed, Dec 18, 2002 at 08:32:51PM +0100, Denis Oliver Kropp wrote:
> 
> matrox-crtc2 only enables the availability of the additional layers.

Of course.  I should have realized this, having had to hack two back
ends to use the CRTC2 layer even though I had that specified in my
directfbrc file.

> It doesn't have any impact on applications that don't explicitly use
> these layers.

Right.  As I have found out.  :-)

> Yes, that's right. :)

OK.  Here is the hackery I had to implement to get SDL working on
CRTC2:

Index: src/video/directfb/SDL_DirectFB_video.c
===================================================================
RCS file: /home/sdlweb/libsdl.org/cvs/SDL12/src/video/directfb/SDL_DirectFB_video.c,v
retrieving revision 1.10
diff -u -r1.10 SDL_DirectFB_video.c
--- src/video/directfb/SDL_DirectFB_video.c	2002/11/17 19:36:49	1.10
+++ src/video/directfb/SDL_DirectFB_video.c	2002/12/18 21:17:07
@@ -387,7 +387,23 @@
       goto error;
     }
 
+#if 0
   ret = dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
+#else
+  ret = dfb->GetDisplayLayer (dfb, 2, &layer);
+  if (ret == DFB_OK) {
+
+  	DFBDisplayLayerConfig dlc;
+    DFBResult ret2;
+
+    dlc.flags = DLCONF_PIXELFORMAT;
+    dlc.pixelformat = DSPF_RGB32;
+	fprintf(stderr, "setting pixelformat to %x\n", dlc.pixelformat);
+    ret2 = layer->SetConfiguration(layer, &dlc);
+    if (ret2 != DFB_OK)
+      DirectFBError ("gdk_windowing_init_check: SetConfiguration", ret2);
+  }
+#endif
   if (ret)
     {
       SetDirectFBerror ("dfb->GetDisplayLayer", ret);
@@ -511,6 +527,7 @@
 	}
     }
 
+#if 0
   /* Set cooperative level depending on flag SDL_FULLSCREEN */
   if (flags & SDL_FULLSCREEN)
     {
@@ -557,11 +574,24 @@
   if (ret)
     {
       SetDirectFBerror ("dfb->CreateSurface", ret);
+#else
+  HIDDEN->layer->SetCooperativeLevel(HIDDEN->layer, DLSCL_SHARED);
+  ret = HIDDEN->layer->GetSurface (HIDDEN->layer, &surface);
+  if (ret)
+    {
+      SetDirectFBerror ("dfb->GetSurface", ret);
+#endif
       return NULL;
     }
 
+#if 0
   current->w     = width;
   current->h     = height;
+#else
+  HIDDEN->layer->SetOpacity(HIDDEN->layer, 0xff);
+
+  surface->GetSize(surface, &current->w, &current->h);
+#endif
   current->flags = SDL_HWSURFACE | SDL_PREALLOC;
 
   if (flags & SDL_FULLSCREEN)
@@ -808,7 +838,9 @@
     }
 
   if (region_valid)
+{
     surface->Flip (surface, &region, DSFLIP_WAITFORSYNC);
+}
 }
 
 int DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)

It basically amounts to 
- getting display layer 2 rather than DLID_PRIMARY
- setting a pixelformat that was compatible
- getting a surface on the layer rather than trying to create one
- asking DirectFB for the size of the surface rather than having created
  it to the dimensions passed to DirectFB_SetVideoMode()

> What about using the second head for SDL overlay surfaces only?

I dunno.  I don't really know anything about SDL.  Perhaps, given the
patch above, you can comment.

b.

-- 
Brian J. Murrell

Attachment: pgp00016.pgp
Description: PGP signature


Home | Main Index | Thread Index


directfb.org / Development / Old Archives