From b2200514af1ce22da9b0dcc0ca5e24731badd192 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alex=20Villac=C3=ADs=20Lasso?= Date: Sun, 12 May 2019 20:34:28 -0500 Subject: [PATCH] gbm: gbm_bo_get_handle_for_plane fallback to nonplanar handle MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Commit f9567ab435217a72cbae628336ead84dc0b2a803 (gbm: Export a getter for per plane handles) contains an API version check that fails on i915 (API version 7 vs. check for minimum API version 13). Any client that migrates to the planar API will start failing on i915 (see https://gitlab.gnome.org/GNOME/mutter/issues/127 for mutter, and https://bugs.freedesktop.org/show_bug.cgi?id=108487 for weston). This commit adds a fallback for plane 0 when the API check fails and returns the non-planar handle in this scenario, making the call equivalent to gbm_bo_get_handle(). This is enough for weston 6.0.0 to start working again on an i915 system. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=108487 Signed-off-by: Alex Villacís Lasso Reviewed-by: Daniel Stone --- src/gbm/backends/dri/gbm_dri.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 99396f658f2..8d7e4babc3a 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -681,6 +681,12 @@ gbm_dri_bo_get_handle_for_plane(struct gbm_bo *_bo, int plane) ret.s32 = -1; if (!dri->image || dri->image->base.version < 13 || !dri->image->fromPlanar) { + /* Preserve legacy behavior if plane is 0 */ + if (plane == 0) { + /* NOTE: return _bo->handle, *NOT* bo->handle which is invalid at this point */ + return _bo->handle; + } + errno = ENOSYS; return ret; } -- 2.30.2