[PATCH weston v12 23/40] compositor-drm: Extract overlay FB import to helper
Pekka Paalanen
ppaalanen at gmail.com
Thu Sep 28 11:12:14 UTC 2017
On Tue, 26 Sep 2017 18:15:56 +0100
Daniel Stone <daniels at collabora.com> wrote:
> ... in order to be able to use it from scanout as well.
>
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
> libweston/compositor-drm.c | 221 ++++++++++++++++++++++++---------------------
> 1 file changed, 119 insertions(+), 102 deletions(-)
>
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 5413ff3f..de80506a 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> +static struct drm_fb *
> +drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev)
> +{
> + struct drm_output *output = state->output;
> + struct drm_backend *b = to_drm_backend(output->base.compositor);
> + struct weston_buffer *buffer = ev->surface->buffer_ref.buffer;
> + struct linux_dmabuf_buffer *dmabuf;
> + struct drm_fb *fb;
> + struct gbm_bo *bo;
> +
> + /* Don't import buffers which span multiple outputs. */
> + if (ev->output_mask != (1u << output->base.id))
> + return NULL;
> +
> + if (ev->alpha != 1.0f)
> + return NULL;
> +
> + if (!buffer)
> + return NULL;
> +
> + if (wl_shm_buffer_get(buffer->resource))
> + return NULL;
> +
> + if (!b->gbm)
> + return NULL;
> +
> + dmabuf = linux_dmabuf_buffer_get(buffer->resource);
> + if (dmabuf) {
> +#ifdef HAVE_GBM_FD_IMPORT
> + /* XXX: TODO:
> + *
> + * Use AddFB2 directly, do not go via GBM.
> + * Add support for multiplanar formats.
> + * Both require refactoring in the DRM-backend to
> + * support a mix of gbm_bos and drmfbs.
> + */
> + struct gbm_import_fd_data gbm_dmabuf = {
> + .fd = dmabuf->attributes.fd[0],
> + .width = dmabuf->attributes.width,
> + .height = dmabuf->attributes.height,
> + .stride = dmabuf->attributes.stride[0],
> + .format = dmabuf->attributes.format
> + };
> +
> + /* XXX: TODO:
> + *
> + * Currently the buffer is rejected if any dmabuf attribute
> + * flag is set. This keeps us from passing an inverted /
> + * interlaced / bottom-first buffer (or any other type that may
> + * be added in the future) through to an overlay. Ultimately,
> + * these types of buffers should be handled through buffer
> + * transforms and not as spot-checks requiring specific
> + * knowledge. */
> + if (dmabuf->attributes.n_planes != 1 ||
> + dmabuf->attributes.offset[0] != 0 ||
> + dmabuf->attributes.flags)
> + goto err;
Hi,
this breaks the build, as 'err' is no longer defined.
> +
> + bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_FD, &gbm_dmabuf,
> + GBM_BO_USE_SCANOUT);
> +#else
> + return NULL;
> +#endif
> + } else {
> + bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_WL_BUFFER,
> + buffer->resource, GBM_BO_USE_SCANOUT);
> + }
> +
> + if (!bo)
> + return NULL;
> +
> + fb = drm_fb_get_from_bo(bo, b, drm_view_is_opaque(ev), BUFFER_CLIENT);
> + if (!fb) {
> + gbm_bo_destroy(bo);
> + return NULL;
> + }
> +
> + drm_fb_set_buffer(fb, buffer);
> + return fb;
> +}
> +
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170928/777df563/attachment.sig>
More information about the wayland-devel
mailing list