Fixed 24bpp videomode

This commit is contained in:
Sergii Pylypenko
2020-02-26 23:05:57 +02:00
parent 4878f5a50c
commit 62db8acad2
3 changed files with 14 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ ln -sf /usr .
mkdir -p tmp
if [ -z "$1" ]; then
hw/kdrive/sdl/Xsdl :1 -audit 3 -listen inet -listen inet6 -nolisten unix -nopn -exec "x-window-manager & xlogo & xev & xclock -update 1 & xloadimage -onroot -fullscreen background.bmp"
hw/kdrive/sdl/Xsdl :1 -audit 3 -screen 640x480x32 -listen inet -listen inet6 -nolisten unix -nopn -exec "x-window-manager & xlogo & xev & xclock -update 1 & xloadimage -onroot -fullscreen background.bmp"
else
gdb --args hw/kdrive/sdl/Xsdl :1 -exec xlogo
fi

View File

@@ -200,7 +200,9 @@ static Bool sdlScreenInit(KdScreenInfo *screen)
screen->height = 480;
}
if (!screen->fb.depth)
screen->fb.depth = 16;
{
screen->fb.depth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
}
printf("Attempting for %dx%d/%dbpp mode\n", screen->width, screen->height, screen->fb.depth);
driver->screen = SDL_SetVideoMode(screen->width, screen->height, screen->fb.depth, 0);
if(driver->screen == NULL)
@@ -210,15 +212,15 @@ static Bool sdlScreenInit(KdScreenInfo *screen)
}
driver->randr = screen->randr;
screen->driver = driver;
printf("Set %dx%d/%dbpp mode\n", driver->screen->w, driver->screen->h, driver->screen->format->BitsPerPixel);
screen->width = driver->screen->w;
screen->height = driver->screen->h;
screen->fb.depth = driver->screen->format->BitsPerPixel;
screen->fb.depth = driver->screen->format->BitsPerPixel == 24 ? 32 : driver->screen->format->BitsPerPixel;
screen->fb.bitsPerPixel = driver->screen->format->BitsPerPixel;
printf("Set %dx%d/%dbpp mode\n", driver->screen->w, driver->screen->h, driver->screen->format->BitsPerPixel);
screen->fb.visuals = (1<<TrueColor);
screen->fb.redMask = driver->screen->format->Rmask;
screen->fb.greenMask = driver->screen->format->Gmask;
screen->fb.blueMask = driver->screen->format->Bmask;
screen->fb.bitsPerPixel = driver->screen->format->BitsPerPixel;
//screen->fb.shadow = FALSE;
screen->rate=30; // 60 is too intense for CPU
@@ -526,6 +528,8 @@ static Bool sdlFinishInitScreen(ScreenPtr pScreen)
KdScreenInfo *screen = pScreenPriv->screen;
SdlDriver *scrpriv = screen->driver;
printf("%s", __func__);
if (!shadowSetup (pScreen))
return FALSE;

View File

@@ -89,7 +89,7 @@ void sdlPollInput(void)
while ( SDL_PollEvent(&event) ) {
switch (event.type) {
case SDL_MOUSEMOTION:
//printf("SDL_MOUSEMOTION pressure %d\n", pressure);
//printf("SDL_MOUSEMOTION x:y %d:%d buttons %d\n", event.motion.x, event.motion.y, mouseState);
KdEnqueuePointerEvent(sdlPointer, mouseState, event.motion.x, event.motion.y, pressure);
setScreenButtons();
break;
@@ -120,7 +120,7 @@ void sdlPollInput(void)
break;
*/
default:
buttonState = 1 << (event.button.button - 1);
//buttonState = 1 << (event.button.button - 1);
break;
}
mouseState |= buttonState;
@@ -154,7 +154,7 @@ void sdlPollInput(void)
break;
*/
default:
buttonState = 1 << (event.button.button - 1);
//buttonState = 1 << (event.button.button - 1);
break;
}
mouseState &= ~buttonState;
@@ -282,8 +282,10 @@ void sdlPollInput(void)
}
}
//send_unicode (event.key.keysym.unicode);
#ifdef __ANDROID__
KdEnqueueKeyboardEvent (sdlKeyboard, SDL_android_keysym_to_scancode[event.key.keysym.unicode], 0);
KdEnqueueKeyboardEvent (sdlKeyboard, SDL_android_keysym_to_scancode[event.key.keysym.unicode], 1);
#endif
if (unshifted == event.key.keysym.unicode)
{
if (shiftState & 0x1)