Re: [AD] GFX_SAFE mode patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sat, Sep 28, 2002 at 12:47:00PM +0200, Eric Botcazou wrote:
> I finally changed my mind and reverted my change to the GFX_MODE structure.
> New patch attached.

The patch breaks the GFX_SAFE 'maintain-screen-resolution' feature of the
framebuffer under linux console, desperately needed by users depending
on vesafb or with lcd screens.  The attached file fixes this. AFAIK it's
safe (pun intented) to apply the patch, since _safe_gfx_mode_change is
only used by fbcon.c.

The problem with the previous patch is that it relies on SYSTEM_DRIVER
to know what's the safe resolution. This is bad for the linux drivers,
because only fbcon.c would know this information, and that is only half
through the initialization process, hence the _safe_gfx_mode_change hack
which let's fbcon.c know it's being initialized with GFX_SAFE.

One possible solution for this would be to move the get_gfx_safe function
to each driver and let SYSTEM_DRIVER query all it's drivers.  But even
then, the new behaviour of set_gfx_mode tries to set the requested
resolution before trying the safe mode. This would still inconvenience
framebuffer users (me), because altough the framebuffer driver accepts
the 320x200 resolution, this is out of range for my lcd screen which
goes blank.

Finally, I see no sense on exposing get_safe_gfx_mode to the user,
since he/she will use GFX_SAFE anyway.
Index: src/graphics.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/graphics.c,v
retrieving revision 1.41
diff -u -r1.41 graphics.c
--- src/graphics.c	1 Oct 2002 17:05:12 -0000	1.41
+++ src/graphics.c	1 Oct 2002 20:06:33 -0000
@@ -592,9 +592,12 @@
 	 ASSERT(FALSE);  /* the safe graphics mode must always work */
       }
       else {
+	 _safe_gfx_mode_change = 1;
 	 /* no safe graphics mode, try normal autodetected modes */
-	 if (set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0) == 0)
+	 if (set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0) == 0) {
+	    _safe_gfx_mode_change = 0;
 	    return 0;
+	 }
 
 	 ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, buf);
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/