On Tue, 26 Sep 2017 18:15:56 +0100
Daniel Stone <dani...@collabora.com> wrote:

> ... in order to be able to use it from scanout as well.
> 
> Signed-off-by: Daniel Stone <dani...@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

Attachment: pgppqfQygrmPz.pgp
Description: OpenPGP digital signature

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to