mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
renderer/native: Use modifier-aware GBM API
Newer versions of GBM support buffer modifiers, including multi-plane buffers. Use this new API to explicitly pull the information from GBM, and feed it to drmModeAddFB2WithModifiers. https://bugzilla.gnome.org/show_bug.cgi?id=785779
This commit is contained in:
parent
d99cd279d2
commit
c0d9b08ef9
@ -266,7 +266,7 @@ AC_SUBST(XWAYLAND_PATH)
|
||||
|
||||
PKG_CHECK_MODULES(MUTTER, $MUTTER_PC_MODULES)
|
||||
|
||||
MUTTER_NATIVE_BACKEND_MODULES="libdrm >= 2.4.83 libsystemd libinput >= 1.4 gudev-1.0 gbm >= 10.3"
|
||||
MUTTER_NATIVE_BACKEND_MODULES="libdrm >= 2.4.83 libsystemd libinput >= 1.4 gudev-1.0 gbm >= 17.1"
|
||||
|
||||
AC_ARG_ENABLE(native-backend,
|
||||
AS_HELP_STRING([--disable-native-backend], [disable mutter native (KMS) backend]),,
|
||||
|
@ -1283,24 +1283,49 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms,
|
||||
uint32_t handles[4] = { 0, };
|
||||
uint32_t strides[4] = { 0, };
|
||||
uint32_t offsets[4] = { 0, };
|
||||
uint64_t modifiers[4] = { 0, };
|
||||
int i;
|
||||
|
||||
/* Now we need to set the CRTC to whatever is the front buffer */
|
||||
next_bo = gbm_surface_lock_front_buffer (gbm_surface);
|
||||
|
||||
strides[0] = gbm_bo_get_stride (next_bo);
|
||||
handles[0] = gbm_bo_get_handle (next_bo).u32;
|
||||
for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++)
|
||||
{
|
||||
strides[i] = gbm_bo_get_stride_for_plane (next_bo, i);
|
||||
handles[i] = gbm_bo_get_handle_for_plane (next_bo, i).u32;
|
||||
offsets[i] = gbm_bo_get_offset (next_bo, i);
|
||||
modifiers[i] = gbm_bo_get_modifier (next_bo);
|
||||
}
|
||||
|
||||
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
|
||||
|
||||
if (drmModeAddFB2 (kms_fd,
|
||||
gbm_bo_get_width (next_bo),
|
||||
gbm_bo_get_height (next_bo),
|
||||
gbm_bo_get_format (next_bo),
|
||||
handles,
|
||||
strides,
|
||||
offsets,
|
||||
&next_fb_id,
|
||||
0))
|
||||
if (modifiers[0] != DRM_FORMAT_MOD_INVALID)
|
||||
{
|
||||
if (drmModeAddFB2WithModifiers (kms_fd,
|
||||
gbm_bo_get_width (next_bo),
|
||||
gbm_bo_get_height (next_bo),
|
||||
gbm_bo_get_format (next_bo),
|
||||
handles,
|
||||
strides,
|
||||
offsets,
|
||||
modifiers,
|
||||
&next_fb_id,
|
||||
DRM_MODE_FB_MODIFIERS))
|
||||
{
|
||||
g_warning ("Failed to create new back buffer handle: %m");
|
||||
gbm_surface_release_buffer (gbm_surface, next_bo);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (drmModeAddFB2 (kms_fd,
|
||||
gbm_bo_get_width (next_bo),
|
||||
gbm_bo_get_height (next_bo),
|
||||
gbm_bo_get_format (next_bo),
|
||||
handles,
|
||||
strides,
|
||||
offsets,
|
||||
&next_fb_id,
|
||||
0))
|
||||
{
|
||||
if (drmModeAddFB (kms_fd,
|
||||
gbm_bo_get_width (next_bo),
|
||||
|
Loading…
Reference in New Issue
Block a user