Skip to content

Commit

Permalink
Report the correct desktop video mode on the iMX6
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Sep 10, 2014
1 parent 50cc4ef commit 0e65e62
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/video/mx6/SDL_mx6opengles.c
Expand Up @@ -150,8 +150,6 @@ MX6_GLES_LoadLibrary(_THIS, const char *egl_path) {
LOAD_VIV_FUNC(fbDestroyPixmap);

displaydata = SDL_GetDisplayDriverData(0);
displaydata->native_display = egl_viv_data->fbGetDisplayByIndex(0);
egl_viv_data->fbGetDisplayGeometry(displaydata->native_display, &displaydata->width, &displaydata->height);

_this->egl_data->egl_display = _this->egl_data->eglGetDisplay(displaydata->native_display);
if (!_this->egl_data->egl_display) {
Expand Down
40 changes: 32 additions & 8 deletions src/video/mx6/SDL_mx6video.c
Expand Up @@ -124,6 +124,36 @@ VideoBootStrap MX6_bootstrap = {
MX6_Create
};

static void
MX6_UpdateDisplay(_THIS)
{
SDL_VideoDisplay *display = &_this->displays[0];
SDL_DisplayData *data = (SDL_DisplayData*)display->driverdata;
EGLNativeDisplayType native_display = egl_viv_data->fbGetDisplayByIndex(0);
SDL_DisplayMode current_mode;
int pitch, bpp;
unsigned long pixels;

/* Store the native EGL display */
data->native_display = native_display;

SDL_zero(current_mode);
egl_viv_data->fbGetDisplayInfo(native_display, &current_mode.w, &current_mode.h, &pixels, &pitch, &bpp);
/* FIXME: How do we query refresh rate? */
current_mode.refresh_rate = 60;

switch (bpp)
{
default: /* Is another format used? */
case 16:
current_mode.format = SDL_PIXELFORMAT_RGB565;
break;
}

display->desktop_mode = current_mode;
display->current_mode = current_mode;
}

/*****************************************************************************/
/* SDL Video and Display initialization/handling functions */
/*****************************************************************************/
Expand All @@ -138,16 +168,9 @@ MX6_VideoInit(_THIS)
if (data == NULL) {
return SDL_OutOfMemory();
}

/* Actual data will be set in SDL_GL_LoadLibrary call below */
SDL_zero(current_mode);
current_mode.w = 0;
current_mode.h = 0;
current_mode.refresh_rate = 60;
current_mode.format = SDL_PIXELFORMAT_RGB565;
current_mode.driverdata = NULL;

SDL_zero(display);
SDL_zero(current_mode);
display.desktop_mode = current_mode;
display.current_mode = current_mode;
display.driverdata = data;
Expand All @@ -156,6 +179,7 @@ MX6_VideoInit(_THIS)
if (SDL_GL_LoadLibrary(NULL) < 0) {
return -1;
}
MX6_UpdateDisplay(_this);

#ifdef SDL_INPUT_LINUXEV
SDL_EVDEV_Init();
Expand Down
2 changes: 0 additions & 2 deletions src/video/mx6/SDL_mx6video.h
Expand Up @@ -35,8 +35,6 @@ typedef struct SDL_DisplayData
{
EGLNativeDisplayType native_display;
EGLDisplay egl_display;
int width;
int height;
} SDL_DisplayData;

typedef struct SDL_WindowData
Expand Down

0 comments on commit 0e65e62

Please sign in to comment.