mirror of
https://github.com/X11Libre/xserver.git
synced 2026-01-26 14:03:17 +00:00
glamor: handle if GBM_BO_USE_SCANOUT is not supported
Backport from Xwayland:
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/433
111d318fc2
See also:
https://forums.developer.nvidia.com/t/gbm-surface-create-fails-if-flags-0/279951
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304#note_1983279
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1535
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
parent
e6885d7e8b
commit
73e56fd076
@ -393,9 +393,23 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok)
|
||||
|
||||
if (num_modifiers > 0) {
|
||||
#ifdef GBM_BO_WITH_MODIFIERS2
|
||||
/* TODO: Is scanout ever used? If so, where? */
|
||||
bo = gbm_bo_create_with_modifiers2(glamor_egl->gbm, width, height,
|
||||
format, modifiers, num_modifiers,
|
||||
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
|
||||
if (!bo) {
|
||||
/* something failed, try again without GBM_BO_USE_SCANOUT */
|
||||
/* maybe scanout does work, but modifiers aren't supported */
|
||||
/* we handle this case on the fallback path */
|
||||
bo = gbm_bo_create_with_modifiers2(glamor_egl->gbm, width, height,
|
||||
format, modifiers, num_modifiers,
|
||||
GBM_BO_USE_RENDERING);
|
||||
#if 0
|
||||
if (bo) {
|
||||
/* TODO: scanout failed, but regular buffer succeeded, maybe log something? */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
bo = gbm_bo_create_with_modifiers(glamor_egl->gbm, width, height,
|
||||
format, modifiers, num_modifiers);
|
||||
@ -409,12 +423,27 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok)
|
||||
|
||||
if (!bo)
|
||||
{
|
||||
/* TODO: Is scanout ever used? If so, where? */
|
||||
bo = gbm_bo_create(glamor_egl->gbm, width, height, format,
|
||||
#ifdef GLAMOR_HAS_GBM_LINEAR
|
||||
(pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ?
|
||||
GBM_BO_USE_LINEAR : 0) |
|
||||
#endif
|
||||
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
|
||||
if (!bo) {
|
||||
/* something failed, try again without GBM_BO_USE_SCANOUT */
|
||||
bo = gbm_bo_create(glamor_egl->gbm, width, height, format,
|
||||
#ifdef GLAMOR_HAS_GBM_LINEAR
|
||||
(pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ?
|
||||
GBM_BO_USE_LINEAR : 0) |
|
||||
GBM_BO_USE_RENDERING);
|
||||
#endif
|
||||
#if 0
|
||||
if (bo) {
|
||||
/* TODO: scanout failed, but regular buffer succeeded, maybe log something? */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (!bo) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user