diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2019-11-11 00:27:17 +0200 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2019-11-21 14:07:54 +0200 |
commit | 81bada58db87eb5b726f4e1f4b41b2fce063e650 (patch) | |
tree | 7cdf81f04bedd623cfe41fbd55c1ef8adc3f0770 | |
parent | 5a701547a45df414b25addac0709f68087117e32 (diff) | |
download | weston-81bada58db87eb5b726f4e1f4b41b2fce063e650.tar.gz weston-81bada58db87eb5b726f4e1f4b41b2fce063e650.tar.bz2 weston-81bada58db87eb5b726f4e1f4b41b2fce063e650.zip |
backend-drm: Add dmabuf scan-out check for DRM-backend
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r-- | libweston/backend-drm/drm-internal.h | 9 | ||||
-rw-r--r-- | libweston/backend-drm/drm.c | 1 | ||||
-rw-r--r-- | libweston/backend-drm/fb.c | 18 |
3 files changed, 28 insertions, 0 deletions
diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index cf588674..21bece8d 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -682,12 +682,21 @@ drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_backend *backend, #ifdef BUILD_DRM_GBM extern struct drm_fb * 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 static inline struct drm_fb * drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev) { return NULL; } +static inline bool +drm_can_scanout_dmabuf(struct weston_compositor *ec, + struct linux_dmabuf_buffer *dmabuf) +{ + return false; +} #endif struct drm_pending_state * diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index 6e1169c6..89508a8d 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -2893,6 +2893,7 @@ drm_backend_create(struct weston_compositor *compositor, b->base.repaint_cancel = drm_repaint_cancel; b->base.create_output = drm_output_create; b->base.device_changed = drm_device_changed; + b->base.can_scanout_dmabuf = drm_can_scanout_dmabuf; weston_setup_vt_switch_bindings(compositor); diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c index e978b088..fcbabbea 100644 --- a/libweston/backend-drm/fb.c +++ b/libweston/backend-drm/fb.c @@ -509,6 +509,24 @@ drm_fb_unref(struct drm_fb *fb) } #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 * drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev) { |