gbm: gbm_bo_get_handle_for_plane fallback to nonplanar handle
[mesa.git] / src / gbm / backends / dri / gbm_dri.c
index 99396f658f2f037420a9abd34c1a54bc0f9e690a..8d7e4babc3a596b8d3ade8ceefb1b103f9c38eaa 100644 (file)
@@ -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;
    }