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.
This commit is contained in:
parent
c190323c90
commit
2763a2e94e
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user