summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-08-02 19:07:40 +0900
committerMichel Dänzer <michel@daenzer.net>2017-08-03 17:11:39 +0900
commit9caa9dd9cc5eb9882c4bb85275bc318948dab71f (patch)
tree45b414c02900e157b7d1732274cf2186656a0f0c /src
parent4441c7c6dde2d71bd44c3031c5679ee3186ea8f9 (diff)
Allow DRI page flipping when some CRTCs use separate scanout buffers
As long as the CRTC we're synchronizing to doesn't. (Ported from radeon commit 5309bde0c4e28adf2b167191c6d7011a19e31eed) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/amdgpu_dri2.c30
-rw-r--r--src/amdgpu_present.c12
-rw-r--r--src/drmmode_display.c2
-rw-r--r--src/drmmode_display.h4
4 files changed, 15 insertions, 33 deletions
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index b4cb1ec..dfbc999 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -600,18 +600,6 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw,
struct dri2_buffer_priv *back_priv = back->driverPrivate;
PixmapPtr front_pixmap;
PixmapPtr back_pixmap = back_priv->pixmap;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int i;
-
- for (i = 0; i < xf86_config->num_crtc; i++) {
- xf86CrtcPtr crtc = xf86_config->crtc[i];
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-
- if (crtc->enabled &&
- (crtc->rotatedData ||
- drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo))
- return FALSE;
- }
if (!update_front(draw, front))
return FALSE;
@@ -635,9 +623,10 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw,
}
static Bool
-can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,
+can_flip(xf86CrtcPtr crtc, DrawablePtr draw,
DRI2BufferPtr front, DRI2BufferPtr back)
{
+ ScrnInfoPtr pScrn = crtc->scrn;
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int num_crtcs_on;
@@ -652,15 +641,10 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,
return FALSE;
for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) {
- xf86CrtcPtr crtc = config->crtc[i];
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-
- if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
- drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)
- return FALSE;
-
- if (drmmode_crtc_can_flip(crtc))
+ if (drmmode_crtc_can_flip(config->crtc[i]))
num_crtcs_on++;
+ else if (config->crtc[i] == crtc)
+ return FALSE;
}
return num_crtcs_on > 0 && can_exchange(pScrn, draw, front, back);
@@ -745,7 +729,7 @@ static void amdgpu_dri2_frame_event_handler(xf86CrtcPtr crtc, uint32_t seq,
switch (event->type) {
case DRI2_FLIP:
- if (can_flip(scrn, drawable, event->front, event->back) &&
+ if (can_flip(crtc, drawable, event->front, event->back) &&
amdgpu_dri2_schedule_flip(crtc,
event->client,
drawable,
@@ -1237,7 +1221,7 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
current_msc &= 0xffffffff;
/* Flips need to be submitted one frame before */
- if (can_flip(scrn, draw, front, back)) {
+ if (can_flip(crtc, draw, front, back)) {
swap_info->type = DRI2_FLIP;
flip = 1;
}
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 3754569..550b702 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -228,14 +228,7 @@ amdgpu_present_check_unflip(ScrnInfoPtr scrn)
return FALSE;
for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) {
- xf86CrtcPtr crtc = config->crtc[i];
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-
- if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
- drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)
- return FALSE;
-
- if (drmmode_crtc_can_flip(crtc))
+ if (drmmode_crtc_can_flip(config->crtc[i]))
num_crtcs_on++;
}
@@ -269,6 +262,9 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
amdgpu_pixmap_get_tiling_info(screen->GetScreenPixmap(screen)))
return FALSE;
+ if (!drmmode_crtc_can_flip(crtc->devPrivate))
+ return FALSE;
+
return amdgpu_present_check_unflip(scrn);
}
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 8ddb2ac..75cf784 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2814,7 +2814,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
for (i = 0; i < config->num_crtc; i++) {
crtc = config->crtc[i];
- if (!crtc->enabled)
+ if (!drmmode_crtc_can_flip(crtc))
continue;
flipdata->flip_count++;
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 677f796..ca556f2 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -139,7 +139,9 @@ drmmode_crtc_can_flip(xf86CrtcPtr crtc)
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
return crtc->enabled &&
- drmmode_crtc->pending_dpms_mode == DPMSModeOn;
+ drmmode_crtc->pending_dpms_mode == DPMSModeOn &&
+ !drmmode_crtc->rotate.bo &&
+ !drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo;
}