backend-drm: Add dmabuf scan-out check for DRM-backend

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 5 years ago
parent 5a701547a4
commit 81bada58db
  1. 9
      libweston/backend-drm/drm-internal.h
  2. 1
      libweston/backend-drm/drm.c
  3. 18
      libweston/backend-drm/fb.c

@ -682,12 +682,21 @@ drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_backend *backend,
#ifdef BUILD_DRM_GBM #ifdef BUILD_DRM_GBM
extern struct drm_fb * extern struct drm_fb *
drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev); drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev);
extern bool
drm_can_scanout_dmabuf(struct weston_compositor *ec,
struct linux_dmabuf_buffer *dmabuf);
#else #else
static inline struct drm_fb * static inline struct drm_fb *
drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev) drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev)
{ {
return NULL; return NULL;
} }
static inline bool
drm_can_scanout_dmabuf(struct weston_compositor *ec,
struct linux_dmabuf_buffer *dmabuf)
{
return false;
}
#endif #endif
struct drm_pending_state * struct drm_pending_state *

@ -2893,6 +2893,7 @@ drm_backend_create(struct weston_compositor *compositor,
b->base.repaint_cancel = drm_repaint_cancel; b->base.repaint_cancel = drm_repaint_cancel;
b->base.create_output = drm_output_create; b->base.create_output = drm_output_create;
b->base.device_changed = drm_device_changed; b->base.device_changed = drm_device_changed;
b->base.can_scanout_dmabuf = drm_can_scanout_dmabuf;
weston_setup_vt_switch_bindings(compositor); weston_setup_vt_switch_bindings(compositor);

@ -509,6 +509,24 @@ drm_fb_unref(struct drm_fb *fb)
} }
#ifdef BUILD_DRM_GBM #ifdef BUILD_DRM_GBM
bool
drm_can_scanout_dmabuf(struct weston_compositor *ec,
struct linux_dmabuf_buffer *dmabuf)
{
struct drm_fb *fb;
struct drm_backend *b = to_drm_backend(ec);
bool ret = false;
fb = drm_fb_get_from_dmabuf(dmabuf, b, true);
if (fb)
ret = true;
drm_fb_unref(fb);
drm_debug(b, "[dmabuf] dmabuf %p, import test %s\n", dmabuf,
ret ? "succeeded" : "failed");
return ret;
}
struct drm_fb * struct drm_fb *
drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev) drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev)
{ {

Loading…
Cancel
Save