summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2019-05-09 17:39:49 +0200
committerMichel Dänzer <michel@daenzer.net>2019-06-25 15:28:36 +0000
commit7d3fef72e0c871e1677e9e544f4cae5e238b5c52 (patch)
tree494f4ca59fe0c27954da3c7116290694c6eb49de
parentea19a5207054bb159fc7fb6d88e0ceb10c3da010 (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.
-rw-r--r--src/amdgpu_pixmap.h1
-rw-r--r--src/amdgpu_present.c18
2 files changed, 19 insertions, 0 deletions
diff --git a/src/amdgpu_pixmap.h b/src/amdgpu_pixmap.h
index 6720458..94ec210 100644
--- a/src/amdgpu_pixmap.h
+++ b/src/amdgpu_pixmap.h
@@ -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;
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index fdedd32..83a0517 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -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?"
*/