summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-11-21 12:42:22 +0100
committerMichel Dänzer <michel@daenzer.net>2018-12-13 12:16:27 +0100
commit500fadb16285146e91f62fce3a0ce1360ca684ba (patch)
tree7175bd768f7cf4c3941223fe8da32128883694b3
parentbe862ed459b06ab7dfc80b5c3d1e2ac7e9327a6e (diff)
Perform scanout buffer update immediately if drmmode_wait_vblank fails
Otherwise the damaged screen contents may never be displayed in that case. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/amdgpu_kms.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 92782de..44a3c8a 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -717,6 +717,7 @@ amdgpu_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
{
ScreenPtr screen = dirty->slave_dst->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
xf86CrtcPtr xf86_crtc = amdgpu_prime_dirty_to_crtc(dirty);
drmmode_crtc_private_ptr drmmode_crtc;
uintptr_t drm_queue_seq;
@@ -739,19 +740,23 @@ amdgpu_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
if (drm_queue_seq == AMDGPU_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"amdgpu_drm_queue_alloc failed for PRIME update\n");
+ amdgpu_prime_scanout_update_handler(xf86_crtc, 0, 0, NULL);
return;
}
+ drmmode_crtc->scanout_update_pending = drm_queue_seq;
+
if (!drmmode_wait_vblank(xf86_crtc, DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,
1, drm_queue_seq, NULL, NULL)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"drmmode_wait_vblank failed for PRIME update: %s\n",
strerror(errno));
- amdgpu_drm_abort_entry(drm_queue_seq);
- return;
+ drmmode_crtc->drmmode->event_context.vblank_handler(pAMDGPUEnt->fd,
+ 0, 0, 0,
+ (void*)drm_queue_seq);
+ drmmode_crtc->wait_flip_nesting_level++;
+ amdgpu_drm_queue_handle_deferred(xf86_crtc);
}
-
- drmmode_crtc->scanout_update_pending = drm_queue_seq;
}
static void
@@ -979,8 +984,9 @@ static void
amdgpu_scanout_update(xf86CrtcPtr xf86_crtc)
{
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
+ ScrnInfoPtr scrn = xf86_crtc->scrn;
+ AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
uintptr_t drm_queue_seq;
- ScrnInfoPtr scrn;
DamagePtr pDamage;
RegionPtr pRegion;
BoxRec extents;
@@ -1005,7 +1011,6 @@ amdgpu_scanout_update(xf86CrtcPtr xf86_crtc)
return;
}
- scrn = xf86_crtc->scrn;
drm_queue_seq = amdgpu_drm_queue_alloc(xf86_crtc,
AMDGPU_DRM_QUEUE_CLIENT_DEFAULT,
AMDGPU_DRM_QUEUE_ID_DEFAULT,
@@ -1016,19 +1021,23 @@ amdgpu_scanout_update(xf86CrtcPtr xf86_crtc)
if (drm_queue_seq == AMDGPU_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"amdgpu_drm_queue_alloc failed for scanout update\n");
+ amdgpu_scanout_update_handler(xf86_crtc, 0, 0, drmmode_crtc);
return;
}
+ drmmode_crtc->scanout_update_pending = drm_queue_seq;
+
if (!drmmode_wait_vblank(xf86_crtc, DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,
1, drm_queue_seq, NULL, NULL)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"drmmode_wait_vblank failed for scanout update: %s\n",
strerror(errno));
- amdgpu_drm_abort_entry(drm_queue_seq);
- return;
+ drmmode_crtc->drmmode->event_context.vblank_handler(pAMDGPUEnt->fd,
+ 0, 0, 0,
+ (void*)drm_queue_seq);
+ drmmode_crtc->wait_flip_nesting_level++;
+ amdgpu_drm_queue_handle_deferred(xf86_crtc);
}
-
- drmmode_crtc->scanout_update_pending = drm_queue_seq;
}
static void