summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2019-06-25 17:46:23 +0200
committerMichel Dänzer <michel.daenzer@amd.com>2019-06-25 17:46:23 +0200
commit33803c85f761d343aa7300311b8e9489b1a89495 (patch)
tree189f4e8892cc3bbbf2db0c9f6110d09273428bd3
parentfee737e82837dc8282a832fc9391ed959c4c3737 (diff)
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. (Ported from amdgpu commit 7d3fef72e0c871e1677e9e544f4cae5e238b5c52)
-rw-r--r--src/radeon.h1
-rw-r--r--src/radeon_present.c18
2 files changed, 19 insertions, 0 deletions
diff --git a/src/radeon.h b/src/radeon.h
index 008a59f3..2c913466 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -309,6 +309,7 @@ struct radeon_pixmap {
struct radeon_buffer *bo;
struct drmmode_fb *fb;
+ Bool fb_failed;
uint32_t tiling_flags;
diff --git a/src/radeon_present.c b/src/radeon_present.c
index 38a9a6b7..494655c9 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -254,6 +254,7 @@ radeon_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 radeon_pixmap *priv = radeon_get_pixmap_private(pixmap);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
RADEONInfoPtr info = RADEONPTR(scrn);
PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
@@ -277,6 +278,23 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
return FALSE;
#endif
+ if (priv && priv->fb_failed)
+ return FALSE;
+
+ if (!radeon_pixmap_get_fb(pixmap)) {
+ if (!priv)
+ priv = radeon_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;
+ }
+
/* The kernel driver doesn't handle flipping between BOs with different
* tiling parameters correctly yet
*/