Re: [AD] fbcon driver color depth

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


On 2007-01-07, Evert Glebbeek <eglebbk@xxxxxxxxxx> wrote:
> On Sunday 07 January 2007 04:03, Milan Mimica wrote:
> > It works. Using vesafb driver in 800x600x16 mode, with fbcon as a module.
> 
> Good.
> Could you also test with modules disabled?
> 
> > Just that there should be a "fb_mode_read = FALSE;" in fbexit() because 
> > some drivers are able to change resolution and color depth I think.
> 
> Ok, revised patch attached.
> 
> Evert

> Index: src/linux/lsystem.c
> ===================================================================
> --- src/linux/lsystem.c	(revision 7693)
> +++ src/linux/lsystem.c	(working copy)
> @@ -42,6 +42,13 @@
>  #endif
>  
>  
> +#if (defined ALLEGRO_LINUX_FBCON) && (!defined ALLEGRO_WITH_MODULES)
> +/* Functions for querying the framebuffer, for the fbcon driver */
> +extern int __al_linux_get_fb_color_depth(void);
> +extern int __al_linux_get_fb_resolution(int *width, int *height);
> +#endif

Please move this into one of the internal headers, and make sure it's
included by fbcon.c

> +
> +
>  static int  sys_linux_init(void);
>  static void sys_linux_exit(void);
>  static void sys_linux_message (AL_CONST char *msg);
> @@ -86,8 +93,13 @@
>     NULL, /* get_vtable */
>     __al_linux_set_display_switch_mode,
>     __al_linux_display_switch_lock,
> +#if (defined ALLEGRO_LINUX_FBCON) && (!defined ALLEGRO_WITH_MODULES)
> +   __al_linux_get_fb_color_depth,
> +   __al_linux_get_fb_resolution,
> +#else
>     NULL, /* desktop_color_depth */
>     NULL, /* get_desktop_resolution */
> +#endif
>     NULL, /* get_gfx_safe_mode */
>     _unix_yield_timeslice,
>  #ifdef HAVE_LIBPTHREAD
> Index: src/linux/fbcon.c
> ===================================================================
> --- src/linux/fbcon.c	(revision 7693)
> +++ src/linux/fbcon.c	(working copy)
> @@ -97,6 +97,8 @@
>  
>  static char fb_desc[256] = EMPTY_STRING;     /* description string */
>  
> +static int fb_mode_read = FALSE;             /* has orig_mode been read? */
> +

Is it necessary to avoid reading the mode twice?  (I didn't check the code.)

>  /* fb_init:
>   *  Sets a graphics mode.
>   */
> @@ -199,7 +228,7 @@
>     char tmp[16];
>  
>     /* open framebuffer and store info in global variables */
> -   if (fb_open_device() != 0)
> +   if ( (!fb_mode_read) && (fb_open_device() != 0) )
>        return NULL;

Please stick to the formatting of the file you're editing.  Thanks.

Peter





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