(FBDev) Cleanups
This commit is contained in:
parent
e1a5379886
commit
c66ada4e90
|
@ -33,6 +33,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
egl_ctx_data_t egl;
|
egl_ctx_data_t egl;
|
||||||
|
EGLNativeWindowType native_window;
|
||||||
#endif
|
#endif
|
||||||
bool resize;
|
bool resize;
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
|
@ -42,15 +43,15 @@ static void gfx_ctx_opendingux_destroy(void *data)
|
||||||
{
|
{
|
||||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||||
|
|
||||||
if (!viv)
|
if (viv)
|
||||||
return;
|
{
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
egl_destroy(&viv->egl);
|
egl_destroy(&viv->egl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
viv->resize = false;
|
viv->resize = false;
|
||||||
free(viv);
|
free(viv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_opendingux_init(void *video_driver)
|
static void *gfx_ctx_opendingux_init(void *video_driver)
|
||||||
|
@ -78,8 +79,6 @@ static void *gfx_ctx_opendingux_init(void *video_driver)
|
||||||
if (!viv)
|
if (!viv)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
(void)video_driver;
|
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
frontend_driver_install_signal_handler();
|
frontend_driver_install_signal_handler();
|
||||||
|
|
||||||
|
@ -146,8 +145,6 @@ static void gfx_ctx_opendingux_update_window_title(void *data)
|
||||||
char buf_fps[128] = {0};
|
char buf_fps[128] = {0};
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
(void)data;
|
|
||||||
|
|
||||||
video_monitor_get_fps(buf, sizeof(buf),
|
video_monitor_get_fps(buf, sizeof(buf),
|
||||||
buf_fps, sizeof(buf_fps));
|
buf_fps, sizeof(buf_fps));
|
||||||
if (settings->fps_show)
|
if (settings->fps_show)
|
||||||
|
@ -159,7 +156,6 @@ static bool gfx_ctx_opendingux_set_video_mode(void *data,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
EGLNativeWindowType window;
|
|
||||||
static const EGLint attribs[] = {
|
static const EGLint attribs[] = {
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 2, /* Use version 2, even for GLES3. */
|
EGL_CONTEXT_CLIENT_VERSION, 2, /* Use version 2, even for GLES3. */
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
|
@ -183,8 +179,8 @@ static bool gfx_ctx_opendingux_set_video_mode(void *data,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = 0;
|
viv->native_window = 0;
|
||||||
if (!egl_create_surface(&viv->egl, window))
|
if (!egl_create_surface(&viv->egl, viv->native_window))
|
||||||
goto error;
|
goto error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,8 @@ typedef struct
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
egl_ctx_data_t egl;
|
egl_ctx_data_t egl;
|
||||||
#endif
|
#endif
|
||||||
|
EGL_DISPMANX_WINDOW_T native_window;
|
||||||
|
|
||||||
bool resize;
|
bool resize;
|
||||||
unsigned fb_width, fb_height;
|
unsigned fb_width, fb_height;
|
||||||
|
|
||||||
|
@ -129,10 +131,12 @@ static void gfx_ctx_vc_get_video_size(void *data,
|
||||||
|
|
||||||
/* Calculate source and destination aspect ratios. */
|
/* Calculate source and destination aspect ratios. */
|
||||||
|
|
||||||
float srcAspect = (float)settings->video.fullscreen_x / (float)settings->video.fullscreen_y;
|
float srcAspect = (float)settings->video.fullscreen_x
|
||||||
|
/ (float)settings->video.fullscreen_y;
|
||||||
float dstAspect = (float)vc->fb_width / (float)vc->fb_height;
|
float dstAspect = (float)vc->fb_width / (float)vc->fb_height;
|
||||||
|
|
||||||
/* If source and destination aspect ratios are not equal correct source width. */
|
/* If source and destination aspect ratios
|
||||||
|
* are not equal correct source width. */
|
||||||
if (srcAspect != dstAspect)
|
if (srcAspect != dstAspect)
|
||||||
*width = (unsigned)(settings->video.fullscreen_y * dstAspect);
|
*width = (unsigned)(settings->video.fullscreen_y * dstAspect);
|
||||||
else
|
else
|
||||||
|
@ -152,7 +156,6 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
||||||
{
|
{
|
||||||
VC_DISPMANX_ALPHA_T alpha;
|
VC_DISPMANX_ALPHA_T alpha;
|
||||||
EGLint n, major, minor;
|
EGLint n, major, minor;
|
||||||
static EGL_DISPMANX_WINDOW_T nativewindow;
|
|
||||||
|
|
||||||
DISPMANX_ELEMENT_HANDLE_T dispman_element;
|
DISPMANX_ELEMENT_HANDLE_T dispman_element;
|
||||||
DISPMANX_DISPLAY_HANDLE_T dispman_display;
|
DISPMANX_DISPLAY_HANDLE_T dispman_display;
|
||||||
|
@ -202,7 +205,8 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!egl_create_context(&vc->egl, (vc_api == GFX_CTX_OPENGL_ES_API) ? context_attributes : NULL))
|
if (!egl_create_context(&vc->egl, (vc_api == GFX_CTX_OPENGL_ES_API)
|
||||||
|
? context_attributes : NULL))
|
||||||
{
|
{
|
||||||
egl_report_error();
|
egl_report_error();
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -257,7 +261,7 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
||||||
0 /*layer*/, &dst_rect, 0 /*src*/,
|
0 /*layer*/, &dst_rect, 0 /*src*/,
|
||||||
&src_rect, DISPMANX_PROTECTION_NONE, &alpha, 0 /*clamp*/, DISPMANX_NO_ROTATE);
|
&src_rect, DISPMANX_PROTECTION_NONE, &alpha, 0 /*clamp*/, DISPMANX_NO_ROTATE);
|
||||||
|
|
||||||
nativewindow.element = dispman_element;
|
vc->native_window.element = dispman_element;
|
||||||
|
|
||||||
/* Use dispmanx upscaling if fullscreen_x and fullscreen_y are set. */
|
/* Use dispmanx upscaling if fullscreen_x and fullscreen_y are set. */
|
||||||
|
|
||||||
|
@ -269,25 +273,26 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
||||||
* can be used to stretch video output. */
|
* can be used to stretch video output. */
|
||||||
|
|
||||||
/* Calculate source and destination aspect ratios. */
|
/* Calculate source and destination aspect ratios. */
|
||||||
float srcAspect = (float)settings->video.fullscreen_x / (float)settings->video.fullscreen_y;
|
float srcAspect = (float)settings->video.fullscreen_x
|
||||||
|
/ (float)settings->video.fullscreen_y;
|
||||||
float dstAspect = (float)vc->fb_width / (float)vc->fb_height;
|
float dstAspect = (float)vc->fb_width / (float)vc->fb_height;
|
||||||
|
|
||||||
/* If source and destination aspect ratios are not equal correct source width. */
|
/* If source and destination aspect ratios are not equal correct source width. */
|
||||||
if (srcAspect != dstAspect)
|
if (srcAspect != dstAspect)
|
||||||
nativewindow.width = (unsigned)(settings->video.fullscreen_y * dstAspect);
|
vc->native_window.width = (unsigned)(settings->video.fullscreen_y * dstAspect);
|
||||||
else
|
else
|
||||||
nativewindow.width = settings->video.fullscreen_x;
|
vc->native_window.width = settings->video.fullscreen_x;
|
||||||
nativewindow.height = settings->video.fullscreen_y;
|
vc->native_window.height = settings->video.fullscreen_y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nativewindow.width = vc->fb_width;
|
vc->native_window.width = vc->fb_width;
|
||||||
nativewindow.height = vc->fb_height;
|
vc->native_window.height = vc->fb_height;
|
||||||
}
|
}
|
||||||
vc_dispmanx_update_submit_sync(dispman_update);
|
vc_dispmanx_update_submit_sync(dispman_update);
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
if (!egl_create_surface(&vc->egl, &nativewindow))
|
if (!egl_create_surface(&vc->egl, &vc->native_window))
|
||||||
goto error;
|
goto error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue