summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-07-27 15:46:41 +0900
committerMichel Dänzer <michel@daenzer.net>2017-08-02 18:54:54 +0900
commit9bc3eef74452d924f9101c024f66ad9b14c404c8 (patch)
treecf41b11503e79f72c38aba09bffb93f0eae7c203 /src
parentc2d26890691ec105858f086b63170ad94c6f7f05 (diff)
Add drmmode_crtc_can_flip helper
To reduce code duplication between DRI2 and Present. No functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.h11
-rw-r--r--src/radeon_dri2.c5
-rw-r--r--src/radeon_present.c8
3 files changed, 15 insertions, 9 deletions
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index b9bc8fd8..4378be86 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -139,6 +139,17 @@ enum drmmode_flip_sync {
};
+/* Can the page flip ioctl be used for this CRTC? */
+static inline Bool
+drmmode_crtc_can_flip(xf86CrtcPtr crtc)
+{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+ return crtc->enabled &&
+ drmmode_crtc->pending_dpms_mode == DPMSModeOn;
+}
+
+
static inline void
drmmode_fb_reference_loc(int drm_fd, struct drmmode_fb **old, struct drmmode_fb *new,
const char *caller, unsigned line)
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 35fb60d9..70751b0b 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -774,14 +774,11 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,
xf86CrtcPtr crtc = config->crtc[i];
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- if (!crtc->enabled)
- continue;
-
if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)
return FALSE;
- if (drmmode_crtc->pending_dpms_mode == DPMSModeOn)
+ if (drmmode_crtc_can_flip(crtc))
num_crtcs_on++;
}
diff --git a/src/radeon_present.c b/src/radeon_present.c
index e3a8f7e2..85da655d 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -243,16 +243,14 @@ radeon_present_check_unflip(ScrnInfoPtr scrn)
return FALSE;
for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) {
- drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private;
-
- if (!config->crtc[i]->enabled)
- continue;
+ 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->pending_dpms_mode == DPMSModeOn)
+ if (drmmode_crtc_can_flip(crtc))
num_crtcs_on++;
}