From 2763a2e94ee4278c72fc328c4f0c8044716cf05e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 13 Jul 2012 22:54:43 -0400 Subject: [PATCH] compositor-drm: Use gbm_bo_import instead of gbm_bo_create_from_egl_surface This lets us create the gbm bo from the wl_buffer instead of the EGLImage. With planar buffer, the EGLImage corresponds to a plane and not the entire planar buffer. More importantly, with some YUV formats (packed YUYV and similar) we use several EGLImages to sample the different components, but KMS only want one plane in that case. --- src/compositor-drm.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index f943ef3..db84557 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -257,15 +257,11 @@ drm_output_prepare_scanout_surface(struct drm_output *output) es->geometry.width != output->base.current->width || es->geometry.height != output->base.current->height || es->transform.enabled || - es->images[0] == EGL_NO_IMAGE_KHR) + es->buffer == NULL) return -1; - bo = gbm_bo_create_from_egl_image(c->gbm, - c->base.egl_display, - es->images[0], - es->geometry.width, - es->geometry.height, - GBM_BO_USE_SCANOUT); + bo = gbm_bo_import(c->gbm, GBM_BO_IMPORT_WL_BUFFER, + es->buffer, GBM_BO_USE_SCANOUT); /* Need to verify output->region contained in surface opaque * region. Or maybe just that format doesn't have alpha. @@ -567,7 +563,7 @@ drm_output_prepare_overlay_surface(struct weston_output *output_base, if (surface_is_primary(ec, es)) return -1; - if (es->num_images != 1 || es->images[0] == EGL_NO_IMAGE_KHR) + if (es->buffer == NULL) return -1; if (!drm_surface_transform_supported(es)) @@ -590,10 +586,11 @@ drm_output_prepare_overlay_surface(struct weston_output *output_base, if (!found) return -1; - bo = gbm_bo_create_from_egl_image(c->gbm, c->base.egl_display, - es->images[0], es->geometry.width, - es->geometry.height, - GBM_BO_USE_SCANOUT); + bo = gbm_bo_import(c->gbm, GBM_BO_IMPORT_WL_BUFFER, + es->buffer, GBM_BO_USE_SCANOUT); + if (!bo) + return -1; + format = gbm_bo_get_format(bo); handle = gbm_bo_get_handle(bo).s32; stride = gbm_bo_get_pitch(bo); -- 2.7.4