[PATCH weston 09/13] compositor-drm: Create a correctly-sized gbm buffer.

Emmanuel Gil Peyrot linkmauve at linkmauve.fr
Tue Nov 14 15:05:56 UTC 2017


From: Emmanuel Gil Peyrot <emmanuel.peyrot at collabora.com>

Makes frame packing modes work, the normal-sized buffer was way too
small to contain both images.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
---
 libweston/compositor-drm.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index c0f1ebee..1d28d09d 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -62,6 +62,7 @@
 #include "presentation-time-server-protocol.h"
 #include "linux-dmabuf.h"
 #include "linux-dmabuf-unstable-v1-server-protocol.h"
+#include "stereoscopy-unstable-v1-server-protocol.h"
 
 #ifndef DRM_CAP_TIMESTAMP_MONOTONIC
 #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
@@ -2642,9 +2643,17 @@ drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
 	};
 	int n_formats = 1;
 
+	int32_t width = output->base.current_mode->width;
+	int32_t height = output->base.current_mode->height;
+
+	/* This layout has two full-size buffers, with a hole of 1/24th of
+	 * their height at the middle. */
+	if (output->base.stereoscopy_layout == ZWP_STEREOSCOPY_V1_LAYOUT_FRAME_PACKING)
+		height = height * 2 + height / 24;
+
 	output->gbm_surface = gbm_surface_create(b->gbm,
-					     output->base.current_mode->width,
-					     output->base.current_mode->height,
+					     width,
+					     height,
 					     format[0],
 					     GBM_BO_USE_SCANOUT |
 					     GBM_BO_USE_RENDERING);
-- 
2.15.0



More information about the wayland-devel mailing list