summaryrefslogtreecommitdiffstats
path: root/bsp/meta-synopsys/recipes-graphics/wayland/weston/1046-compositor-drm-Read-FB2_MODIFIERS-capability.patch
diff options
context:
space:
mode:
authorToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:24:26 +0900
committerToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:24:26 +0900
commit5b80bfd7bffd4c20d80b7c70a7130529e9a755dd (patch)
treeb4bb18dcd1487dbf1ea8127e5671b7bb2eded033 /bsp/meta-synopsys/recipes-graphics/wayland/weston/1046-compositor-drm-Read-FB2_MODIFIERS-capability.patch
parent706ad73eb02caf8532deaf5d38995bd258725cb8 (diff)
agl-basesystem
Diffstat (limited to 'bsp/meta-synopsys/recipes-graphics/wayland/weston/1046-compositor-drm-Read-FB2_MODIFIERS-capability.patch')
-rw-r--r--bsp/meta-synopsys/recipes-graphics/wayland/weston/1046-compositor-drm-Read-FB2_MODIFIERS-capability.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/bsp/meta-synopsys/recipes-graphics/wayland/weston/1046-compositor-drm-Read-FB2_MODIFIERS-capability.patch b/bsp/meta-synopsys/recipes-graphics/wayland/weston/1046-compositor-drm-Read-FB2_MODIFIERS-capability.patch
new file mode 100644
index 00000000..f3a46b1a
--- /dev/null
+++ b/bsp/meta-synopsys/recipes-graphics/wayland/weston/1046-compositor-drm-Read-FB2_MODIFIERS-capability.patch
@@ -0,0 +1,89 @@
+From a864f58f44d701164dbb32bfcdde8c6d761f28ee Mon Sep 17 00:00:00 2001
+From: Deepak Rawat <drawat@vmware.com>
+Date: Fri, 24 Aug 2018 13:16:03 -0700
+Subject: [PATCH 46/46] compositor-drm: Read FB2_MODIFIERS capability
+
+Not all drivers support fb2 modifiers so read the capability before
+using drmModeAddFB2WithModifiers.
+
+Signed-off-by: Deepak Rawat <drawat@vmware.com>
+---
+ libweston/compositor-drm.c | 20 +++++++++++++++-----
+ 1 file changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
+index e024e66f..4cf0d31f 100644
+--- a/libweston/compositor-drm.c
++++ b/libweston/compositor-drm.c
+@@ -346,6 +346,8 @@ struct drm_backend {
+
+ bool aspect_ratio_supported;
+
++ bool fb_modifiers;
++
+ struct weston_debug_scope *debug;
+ };
+
+@@ -961,7 +963,7 @@ drm_fb_destroy_gbm(struct gbm_bo *bo, void *data)
+ }
+
+ static int
+-drm_fb_addfb(struct drm_fb *fb)
++drm_fb_addfb(struct drm_backend *b, struct drm_fb *fb)
+ {
+ int ret = -EINVAL;
+ #ifdef HAVE_DRM_ADDFB2_MODIFIERS
+@@ -971,7 +973,7 @@ drm_fb_addfb(struct drm_fb *fb)
+
+ /* If we have a modifier set, we must only use the WithModifiers
+ * entrypoint; we cannot import it through legacy ioctls. */
+- if (fb->modifier != DRM_FORMAT_MOD_INVALID) {
++ if (b->fb_modifiers && fb->modifier != DRM_FORMAT_MOD_INVALID) {
+ /* KMS demands that if a modifier is set, it must be the same
+ * for all planes. */
+ #ifdef HAVE_DRM_ADDFB2_MODIFIERS
+@@ -1055,7 +1057,7 @@ drm_fb_create_dumb(struct drm_backend *b, int width, int height,
+ fb->height = height;
+ fb->fd = b->drm.fd;
+
+- if (drm_fb_addfb(fb) != 0) {
++ if (drm_fb_addfb(b, fb) != 0) {
+ weston_log("failed to create kms fb: %m\n");
+ goto err_bo;
+ }
+@@ -1228,7 +1230,7 @@ drm_fb_get_from_dmabuf(struct linux_dmabuf_buffer *dmabuf,
+ goto err_free;
+ }
+
+- if (drm_fb_addfb(fb) != 0)
++ if (drm_fb_addfb(backend, fb) != 0)
+ goto err_free;
+
+ return fb;
+@@ -1301,7 +1303,7 @@ drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_backend *backend,
+ goto err_free;
+ }
+
+- if (drm_fb_addfb(fb) != 0) {
++ if (drm_fb_addfb(backend, fb) != 0) {
+ if (type == BUFFER_GBM_SURFACE)
+ weston_log("failed to create kms fb: %m\n");
+ goto err_free;
+@@ -4062,6 +4064,14 @@ init_kms_caps(struct drm_backend *b)
+ weston_log("DRM: %s atomic modesetting\n",
+ b->atomic_modeset ? "supports" : "does not support");
+
++#ifdef HAVE_DRM_ADDFB2_MODIFIERS
++ ret = drmGetCap(b->drm.fd, DRM_CAP_ADDFB2_MODIFIERS, &cap);
++ if (ret == 0)
++ b->fb_modifiers = cap;
++ else
++#endif
++ b->fb_modifiers = 0;
++
+ /*
+ * KMS support for hardware planes cannot properly synchronize
+ * without nuclear page flip. Without nuclear/atomic, hw plane
+--
+2.16.2
+