mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-24 01:24:31 +00:00
present: Check that we can get a KMS FB for flipping
This can legitimately fail if the pixmap's storage is shared from another device, e.g. when using PRIME render offloading.
This commit is contained in:
committed by
Michel Dänzer
parent
ea19a52070
commit
7d3fef72e0
@@ -36,6 +36,7 @@ struct amdgpu_pixmap {
|
||||
|
||||
struct amdgpu_buffer *bo;
|
||||
struct drmmode_fb *fb;
|
||||
Bool fb_failed;
|
||||
|
||||
/* GEM handle for pixmaps shared via DRI2/3 */
|
||||
Bool handle_valid;
|
||||
|
||||
@@ -255,6 +255,7 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
|
||||
xf86CrtcPtr xf86_crtc = crtc->devPrivate;
|
||||
ScreenPtr screen = window->drawable.pScreen;
|
||||
ScrnInfoPtr scrn = xf86_crtc->scrn;
|
||||
struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap);
|
||||
PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
AMDGPUInfoPtr info = AMDGPUPTR(scrn);
|
||||
@@ -278,6 +279,23 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
if (priv && priv->fb_failed)
|
||||
return FALSE;
|
||||
|
||||
if (!amdgpu_pixmap_get_fb(pixmap)) {
|
||||
if (!priv)
|
||||
priv = amdgpu_get_pixmap_private(pixmap);
|
||||
|
||||
if (priv && !priv->fb_failed) {
|
||||
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
|
||||
"Cannot get FB for Present flip (may be "
|
||||
"normal if using PRIME render offloading)\n");
|
||||
priv->fb_failed = TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Only DC supports advanced color management features, so we can use
|
||||
* drmmode_cm_enabled as a proxy for "Is DC enabled?"
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user