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

Submitted by Emmanuel Gil Peyrot on Nov. 14, 2017, 3:05 p.m.

Details

Message ID 20171114150600.1763-10-linkmauve@linkmauve.fr
State New
Headers show
Series "Add stereoscopy support" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Emmanuel Gil Peyrot Nov. 14, 2017, 3:05 p.m.
From: Emmanuel Gil Peyrot <emmanuel.peyrot@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@linkmauve.fr>
---
 libweston/compositor-drm.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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);