[Mesa-dev] [PATCH 1/3] egl/android: use the image_driver alongside the image_loader
Tapani Pälli
tapani.palli at intel.com
Mon May 15 07:19:12 UTC 2017
On 05/12/2017 01:22 AM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> They are meant to be used together. Otherwise we'll need workarounds
> like egl/wayland. Namely register an image_loader_extension even thought
> we should be using only DRI2.
>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> src/egl/drivers/dri2/platform_android.c | 29 +++++++++++++++++++----------
> 1 file changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
> index 49cbeb4698e..8e5bc457e00 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -315,6 +315,7 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
> _EGLConfig *conf, void *native_window,
> const EGLint *attrib_list)
> {
> + __DRIcreateNewDrawableFunc createNewDrawable;
> struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
> struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
> struct dri2_egl_surface *dri2_surf;
> @@ -356,11 +357,15 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
> if (!config)
> goto cleanup_surface;
>
> - dri2_surf->dri_drawable =
> - dri2_dpy->dri2->createNewDrawable(dri2_dpy->dri_screen, config,
> - dri2_surf);
> + if (dri2_dpy->image_driver)
> + createNewDrawable = dri2_dpy->image_driver->createNewDrawable;
> + else
> + createNewDrawable = dri2_dpy->dri2->createNewDrawable;
> +
> + dri2_surf->dri_drawable = (*createNewDrawable)(dri2_dpy->dri_screen, config,
> + dri2_surf);
> if (dri2_surf->dri_drawable == NULL) {
> - _eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable");
> + _eglError(EGL_BAD_ALLOC, "createNewDrawable");
> goto cleanup_surface;
> }
>
> @@ -1128,19 +1133,23 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
> goto cleanup_device;
> }
>
> - if (!dri2_load_driver(dpy)) {
> - err = "DRI2: failed to load driver";
> - goto cleanup_driver_name;
> - }
> -
> dri2_dpy->is_render_node = drmGetNodeTypeFromFd(dri2_dpy->fd) == DRM_NODE_RENDER;
>
> /* render nodes cannot use Gem names, and thus do not support
> * the __DRI_DRI2_LOADER extension */
> if (!dri2_dpy->is_render_node)
> dri2_dpy->loader_extensions = droid_dri2_loader_extensions;
> - else
> + if (!dri2_load_driver(dpy)) {
> + err = "DRI2: failed to load driver";
> + goto cleanup_driver_name;
> + }
> + } else {
there is no '{' for the '}' here, you probably expect one in
if(!dri2_dpy->is_render_node)?
This is OK change for me with that one fixed. There was some small
amount of pain to get it to blend with Tomasz's changes that are
required for dma-buf support (which we really should integrate, need to
visit why those got rejected and what would be solution there).
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
> dri2_dpy->loader_extensions = droid_image_loader_extensions;
> + if (!dri2_load_driver_dri3(dpy)) {
> + err = "DRI3: failed to load driver";
> + goto cleanup_driver_name;
> + }
> + }
>
> if (!dri2_create_screen(dpy)) {
> err = "DRI2: failed to create screen";
>
More information about the mesa-dev
mailing list