kms: Fix GLES2 support
There were two problems stopping the KMS winsys from working with a GLES2 driver: • When creating the EGL context, it was missing the attribute to select the client version so it would end up with the GLES1 API. • When creating the depth buffer for the framebuffer it was using GL_DEPTH_COMPONENT but only GL_DEPTH_COMPONENT16 is supported on GLES. cogl-framebuffer already unconditionally uses this so it probably makes sense to do the same here. Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
1e7f536c40
commit
7adf7c5e38
@ -578,8 +578,8 @@ try_create_context (CoglDisplay *display,
|
|||||||
CoglXlibDisplay *xlib_display = display->winsys;
|
CoglXlibDisplay *xlib_display = display->winsys;
|
||||||
CoglXlibRenderer *xlib_renderer = display->renderer->winsys;
|
CoglXlibRenderer *xlib_renderer = display->renderer->winsys;
|
||||||
#endif
|
#endif
|
||||||
CoglRendererEGL *egl_renderer = display->renderer->winsys;
|
|
||||||
#ifndef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT
|
#ifndef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT
|
||||||
|
CoglRendererEGL *egl_renderer = display->renderer->winsys;
|
||||||
EGLDisplay edpy;
|
EGLDisplay edpy;
|
||||||
EGLConfig config;
|
EGLConfig config;
|
||||||
EGLint config_count = 0;
|
EGLint config_count = 0;
|
||||||
@ -849,8 +849,8 @@ try_create_context (CoglDisplay *display,
|
|||||||
&egl_display->egl_surface_height);
|
&egl_display->egl_surface_height);
|
||||||
|
|
||||||
#elif defined (COGL_HAS_EGL_PLATFORM_KMS_SUPPORT)
|
#elif defined (COGL_HAS_EGL_PLATFORM_KMS_SUPPORT)
|
||||||
if (!_cogl_winsys_kms_create_context (&egl_renderer->kms_renderer,
|
if (!_cogl_winsys_kms_create_context (display->renderer,
|
||||||
&egl_display->kms_display,
|
display,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -185,11 +185,29 @@ _cogl_winsys_kms_display_setup (CoglDisplay *display, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_winsys_kms_create_context (CoglRendererKMS *kms_renderer,
|
_cogl_winsys_kms_create_context (CoglRenderer *renderer,
|
||||||
CoglDisplayKMS *kms_display,
|
CoglDisplay *display,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
kms_display->egl_context = eglCreateContext (kms_renderer->dpy, NULL, EGL_NO_CONTEXT, NULL);
|
CoglRendererEGL *egl_renderer = renderer->winsys;
|
||||||
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
|
CoglRendererKMS *kms_renderer = &egl_renderer->kms_renderer;
|
||||||
|
CoglDisplayKMS *kms_display = &egl_display->kms_display;
|
||||||
|
EGLint attribs[3];
|
||||||
|
|
||||||
|
if (renderer->driver == COGL_DRIVER_GLES2)
|
||||||
|
{
|
||||||
|
attribs[0] = EGL_CONTEXT_CLIENT_VERSION;
|
||||||
|
attribs[1] = 2;
|
||||||
|
attribs[2] = EGL_NONE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
attribs[0] = EGL_NONE;
|
||||||
|
|
||||||
|
kms_display->egl_context = eglCreateContext (kms_renderer->dpy,
|
||||||
|
NULL,
|
||||||
|
EGL_NO_CONTEXT,
|
||||||
|
attribs);
|
||||||
|
|
||||||
if (kms_display->egl_context == NULL)
|
if (kms_display->egl_context == NULL)
|
||||||
{
|
{
|
||||||
@ -277,11 +295,12 @@ _cogl_winsys_kms_onscreen_init (CoglContext *context,
|
|||||||
context->glGenFramebuffers (1, &kms_onscreen->fb);
|
context->glGenFramebuffers (1, &kms_onscreen->fb);
|
||||||
context->glBindFramebuffer (GL_FRAMEBUFFER_EXT, kms_onscreen->fb);
|
context->glBindFramebuffer (GL_FRAMEBUFFER_EXT, kms_onscreen->fb);
|
||||||
|
|
||||||
context->glGenRenderbuffers(1, &kms_onscreen->depth_rb);
|
context->glGenRenderbuffers (1, &kms_onscreen->depth_rb);
|
||||||
context->glBindRenderbuffer(GL_RENDERBUFFER_EXT, kms_onscreen->depth_rb);
|
context->glBindRenderbuffer (GL_RENDERBUFFER_EXT, kms_onscreen->depth_rb);
|
||||||
context->glRenderbufferStorage(GL_RENDERBUFFER_EXT,
|
context->glRenderbufferStorage (GL_RENDERBUFFER_EXT,
|
||||||
GL_DEPTH_COMPONENT,
|
GL_DEPTH_COMPONENT16,
|
||||||
kms_display->mode.hdisplay, kms_display->mode.vdisplay);
|
kms_display->mode.hdisplay,
|
||||||
|
kms_display->mode.vdisplay);
|
||||||
context->glBindRenderbuffer (GL_RENDERBUFFER_EXT, 0);
|
context->glBindRenderbuffer (GL_RENDERBUFFER_EXT, 0);
|
||||||
|
|
||||||
context->glFramebufferRenderbuffer (GL_FRAMEBUFFER_EXT,
|
context->glFramebufferRenderbuffer (GL_FRAMEBUFFER_EXT,
|
||||||
|
@ -91,9 +91,9 @@ _cogl_winsys_kms_bind (CoglRendererKMS *kms_renderer,
|
|||||||
CoglDisplayKMS *kms_display);
|
CoglDisplayKMS *kms_display);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_winsys_kms_create_context (CoglRendererKMS *kms_renderer,
|
_cogl_winsys_kms_create_context (CoglRenderer *renderer,
|
||||||
CoglDisplayKMS *kms_display,
|
CoglDisplay *display,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_winsys_kms_destroy_context (CoglRendererKMS *kms_renderer,
|
_cogl_winsys_kms_destroy_context (CoglRendererKMS *kms_renderer,
|
||||||
|
Loading…
Reference in New Issue
Block a user