Re: [AD] GGI patch for 3.9.21 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Shawn Hargreaves <shawn@xxxxxxxxxx> writes:
> This raises a more general question: does GFX_SAFE always have to be 8 bit,
> or not? The same problem arises with fbcon, which currently just won't run
> if it can't set an 8 bit mode.
There is an idea for GFX_SAFE mode which is explained with
pseudo-code:
int
set_gfx_mode (int mode, int w, int h, inw vw, int vh)
{
...
if (mode == GFX_SAFE) {
/* autodetect resolution if one of dimensions was not specified */
if ((w <= 0) || (h <= 0)) {
w = 0;
h = 0;
}
/* set safe graphics mode */
depth = _color_depth;
if (system_driver->set_safe_gfx_mode (depth, w, h, vw, vh) != 0)
abort ();
/* screen and gfx_driver are set now */
if ((w == 0) && (h == 0)) {
/* we were autodetecting, user will accept any resolution */
w = SCREEN_W;
h = SCREEN_H;
}
if (depth == 0) {
/* user will accept any color depth */
depth = _color_depth;
}
if ((w != SCREEN_W) || (h != SCREEN_H) || (depth != _color_depth)) {
/* resolution is different, use autoconversion */
real_screen = screen;
real_gfx_driver = gfx_driver;
/* create double buffer and prepare VTABLE with autoconversion */
...
screen = ...;
gfx_driver = ...;
}
else {
/* do nothing */
}
return 0;
}
...
}
Perhaps, it can just ignore user specified size and only use automatic
conversion when requested color depth and actual color depth don't
match.
system_driver->set_safe_gfx_mode can just call set_gfx_mode and try
different resolutions and color depths. It can choose any resolution
and color depth, but it would be better to try resolution specified in
parameters first, then it will not require autoconversion.
--
Michael Bukin