gl-renderer: Move get_platform_display to EGL client setup

This is to put more of the EGL client extension handling in the same
place. This also adds a boolean to check if EGL_EXT_platform_base is
supported, similar to other extensions we check.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
This commit is contained in:
Scott Anderson 2019-12-20 14:39:38 +13:00
parent dddb592cfb
commit 7725415478
3 changed files with 14 additions and 21 deletions

View file

@ -466,11 +466,15 @@ gl_renderer_setup_egl_client_extensions(struct gl_renderer *gr)
return;
}
if (weston_check_egl_extension(extensions, "EGL_EXT_platform_base"))
if (weston_check_egl_extension(extensions, "EGL_EXT_platform_base")) {
gr->get_platform_display =
(void *) eglGetProcAddress("eglGetPlatformDisplayEXT");
gr->create_platform_window =
(void *) eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
else
gr->has_platform_base = true;
} else {
weston_log("warning: EGL_EXT_platform_base not supported.\n");
}
}
int

View file

@ -63,7 +63,10 @@ struct gl_renderer {
PFNEGLCREATEIMAGEKHRPROC create_image;
PFNEGLDESTROYIMAGEKHRPROC destroy_image;
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display;
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window;
bool has_platform_base;
bool has_unpack_subimage;

View file

@ -209,8 +209,6 @@ struct timeline_render_point {
struct wl_event_source *event_source;
};
static PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL;
static inline const char *
dump_format(uint32_t format, char out[4])
{
@ -3495,22 +3493,10 @@ gl_renderer_display_create(struct weston_compositor *ec,
gr->egl_display = NULL;
/* extension_suffix is supported */
if (supports) {
if (!get_platform_display) {
get_platform_display = (void *) eglGetProcAddress(
"eglGetPlatformDisplayEXT");
}
/* also wrap this in the supports check because
* eglGetProcAddress can return non-NULL and still not
* support the feature at runtime, so ensure the
* appropriate extension checks have been done. */
if (get_platform_display && platform) {
gr->egl_display = get_platform_display(platform,
native_display,
NULL);
}
}
if (gr->has_platform_base && supports)
gr->egl_display = gr->get_platform_display(platform,
native_display,
NULL);
if (!gr->egl_display) {
weston_log("warning: either no EGL_EXT_platform_base "
@ -3519,7 +3505,7 @@ gl_renderer_display_create(struct weston_compositor *ec,
gr->egl_display = eglGetDisplay(native_display);
}
if (gr->egl_display == EGL_NO_DISPLAY) {
if (!gr->egl_display) {
weston_log("failed to create display\n");
goto fail;
}