mirror of
https://github.com/brl/mutter.git
synced 2024-11-30 20:01:00 -05:00
renderer/native: Fallback to non-planar API if gbm_bo_get_handle_for_plane fails
Commitc0d9b08ef9
replaced the old GBM API calls with the multi-plane GBM API. However, the call to gbm_bo_get_handle_for_plane fails for some DRI drivers (in particular i915). Due to missing error checks, the subsequent call to drmModeAddFB[2] fails and the screen output locks up. This commit adds the missing error checks and falls back to the old GBM API (non-planar) if necessary. v5: test success of gbm_bo_get_handle_for_plane instead of errno This commit adopts solution proposed by Daniel van Vugt to check the return value of gbm_bo_get_handle_for_plane on plane 0 and fall back to old non-planar method if the call fails. This removes the errno check (for ENOSYS) that could abort if mesa ever sets a different value. Related to: https://gitlab.gnome.org/GNOME/mutter/issues/127 (cherry picked from commitf7af32a3ea
)
This commit is contained in:
parent
b2cc2b1064
commit
c3590cea72
@ -1607,6 +1607,16 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gbm_bo_get_handle_for_plane (next_bo, 0).s32 == -1)
|
||||||
|
{
|
||||||
|
/* Failed to fetch handle to plane, falling back to old method */
|
||||||
|
strides[0] = gbm_bo_get_stride (next_bo);
|
||||||
|
handles[0] = gbm_bo_get_handle (next_bo).u32;
|
||||||
|
offsets[0] = 0;
|
||||||
|
modifiers[0] = DRM_FORMAT_MOD_INVALID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++)
|
for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++)
|
||||||
{
|
{
|
||||||
strides[i] = gbm_bo_get_stride_for_plane (next_bo, i);
|
strides[i] = gbm_bo_get_stride_for_plane (next_bo, i);
|
||||||
@ -1614,6 +1624,7 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms,
|
|||||||
offsets[i] = gbm_bo_get_offset (next_bo, i);
|
offsets[i] = gbm_bo_get_offset (next_bo, i);
|
||||||
modifiers[i] = gbm_bo_get_modifier (next_bo);
|
modifiers[i] = gbm_bo_get_modifier (next_bo);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
|
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user