<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Two really small comments inline</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Michel Dänzer <michel@daenzer.net><br>
<b>Sent:</b> Wednesday, August 16, 2017 3:57 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> [PATCH xf86-video-ati 03/10] Create drmmode_wait_vblank helper</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">From: Michel Dänzer <michel.daenzer@amd.com><br>
<br>
Allows cleaning up the code considerably.<br>
<br>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com><br>
---<br>
src/drmmode_display.c | 61 ++++++++++++++++++++----------<br>
src/drmmode_display.h | 4 ++<br>
src/radeon.h | 2 -<br>
src/radeon_dri2.c | 103 ++++++++++++++------------------------------------<br>
src/radeon_kms.c | 22 +++--------<br>
src/radeon_present.c | 23 ++---------<br>
6 files changed, 82 insertions(+), 133 deletions(-)<br>
<br>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c<br>
index 46a579ff3..96c108a85 100644<br>
--- a/src/drmmode_display.c<br>
+++ b/src/drmmode_display.c<br>
@@ -242,6 +242,39 @@ drmmode_ConvertToKMode(ScrnInfoPtr scrn,<br>
<br>
}<br>
<br>
+/*<br>
+ * Utility helper for drmWaiVBlank</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">[slava a] drmWaitVBlank</div>
<div class="PlainText"><br>
+ */<br>
+Bool<br>
+drmmode_wait_vblank(xf86CrtcPtr crtc, drmVBlankSeqType type, unsigned seq,<br>
+ unsigned long signal, uint64_t *ust, uint32_t *msc)<br>
+{<br>
+ int crtc_id = drmmode_get_crtc_id(crtc);<br>
+ ScrnInfoPtr scrn = crtc->scrn;<br>
+ RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);<br>
+ drmVBlank vbl;<br>
+<br>
+ if (crtc_id == 1)<br>
+ type |= DRM_VBLANK_SECONDARY;<br>
+ else if (crtc_id > 1)<br>
+ type |= (crtc_id << DRM_VBLANK_HIGH_CRTC_SHIFT) &<br>
+ DRM_VBLANK_HIGH_CRTC_MASK;<br>
+<br>
+ vbl.request.type = type;<br>
+ vbl.request.sequence = seq;<br>
+ vbl.request.signal = signal;<br>
+<br>
+ if (drmWaitVBlank(pRADEONEnt->fd, &vbl) != 0)<br>
+ return FALSE;<br>
+<br>
+ if (ust)<br>
+ *ust = (uint64_t)vbl.reply.tval_sec * 1000000 +<br>
+ vbl.reply.tval_usec;<br>
+ if (msc)<br>
+ *msc = vbl.reply.sequence;</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">[slava a] Blank line here for better readability</div>
<div class="PlainText"><br>
+ return TRUE;<br>
+}<br>
+<br>
/*<br>
* Retrieves present time in microseconds that is compatible<br>
* with units used by vblank timestamps. Depending on the kernel<br>
@@ -272,23 +305,15 @@ int drmmode_get_current_ust(int drm_fd, CARD64 *ust)<br>
int drmmode_crtc_get_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc)<br>
{<br>
ScrnInfoPtr scrn = crtc->scrn;<br>
- RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);<br>
- drmVBlank vbl;<br>
- int ret;<br>
-<br>
- vbl.request.type = DRM_VBLANK_RELATIVE;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(crtc);<br>
- vbl.request.sequence = 0;<br>
+ uint32_t seq;<br>
<br>
- ret = drmWaitVBlank(pRADEONEnt->fd, &vbl);<br>
- if (ret) {<br>
+ if (!drmmode_wait_vblank(crtc, DRM_VBLANK_RELATIVE, 0, 0, ust, &seq)) {<br>
xf86DrvMsg(scrn->scrnIndex, X_WARNING,<br>
"get vblank counter failed: %s\n", strerror(errno));<br>
- return ret;<br>
+ return -1;<br>
}<br>
<br>
- *ust = ((CARD64)vbl.reply.tval_sec * 1000000) + vbl.reply.tval_usec;<br>
- *msc = vbl.reply.sequence;<br>
+ *msc = seq;<br>
<br>
return Success;<br>
}<br>
@@ -305,7 +330,7 @@ drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode)<br>
drmmode_crtc->pending_dpms_mode = mode;<br>
<br>
if (drmmode_crtc->dpms_mode == DPMSModeOn && mode != DPMSModeOn) {<br>
- drmVBlank vbl;<br>
+ uint32_t seq;<br>
<br>
/* Wait for any pending flip to finish */<br>
if (drmmode_crtc->flip_pending)<br>
@@ -315,20 +340,14 @@ drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode)<br>
* On->Off transition: record the last vblank time,<br>
* sequence number and frame period.<br>
*/<br>
- vbl.request.type = DRM_VBLANK_RELATIVE;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(crtc);<br>
- vbl.request.sequence = 0;<br>
- ret = drmWaitVBlank(pRADEONEnt->fd, &vbl);<br>
- if (ret)<br>
+ if (!drmmode_wait_vblank(crtc, DRM_VBLANK_RELATIVE, 0, 0, &ust,<br>
+ &seq))<br>
xf86DrvMsg(scrn->scrnIndex, X_ERROR,<br>
"%s cannot get last vblank counter\n",<br>
__func__);<br>
else {<br>
- CARD64 seq = (CARD64)vbl.reply.sequence;<br>
CARD64 nominal_frame_rate, pix_in_frame;<br>
<br>
- ust = ((CARD64)vbl.reply.tval_sec * 1000000) +<br>
- vbl.reply.tval_usec;<br>
drmmode_crtc->dpms_last_ust = ust;<br>
drmmode_crtc->dpms_last_seq = seq;<br>
nominal_frame_rate = crtc->mode.Clock;<br>
diff --git a/src/drmmode_display.h b/src/drmmode_display.h<br>
index f21047890..4262051d7 100644<br>
--- a/src/drmmode_display.h<br>
+++ b/src/drmmode_display.h<br>
@@ -226,5 +226,9 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,<br>
int drmmode_crtc_get_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc);<br>
int drmmode_get_current_ust(int drm_fd, CARD64 *ust);<br>
<br>
+Bool drmmode_wait_vblank(xf86CrtcPtr crtc, drmVBlankSeqType type, unsigned seq,<br>
+ unsigned long signal, uint64_t *ust, uint32_t *msc);<br>
+<br>
+<br>
#endif<br>
<br>
diff --git a/src/radeon.h b/src/radeon.h<br>
index d815d3f00..b93e28163 100644<br>
--- a/src/radeon.h<br>
+++ b/src/radeon.h<br>
@@ -693,8 +693,6 @@ extern void radeon_ddx_cs_start(ScrnInfoPtr pScrn,<br>
void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, uint32_t new_fb_size);<br>
extern RADEONEntPtr RADEONEntPriv(ScrnInfoPtr pScrn);<br>
<br>
-drmVBlankSeqType radeon_populate_vbl_request_type(xf86CrtcPtr crtc);<br>
-<br>
static inline struct radeon_surface *radeon_get_pixmap_surface(PixmapPtr pPix)<br>
{<br>
#ifdef USE_GLAMOR<br>
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c<br>
index 80b17f1f9..a0deb6bae 100644<br>
--- a/src/radeon_dri2.c<br>
+++ b/src/radeon_dri2.c<br>
@@ -889,26 +889,6 @@ cleanup:<br>
radeon_dri2_frame_event_abort(crtc, event_data);<br>
}<br>
<br>
-drmVBlankSeqType radeon_populate_vbl_request_type(xf86CrtcPtr crtc)<br>
-{<br>
- drmVBlankSeqType type = 0;<br>
- int crtc_id = drmmode_get_crtc_id(crtc);<br>
-<br>
- if (crtc_id == 1)<br>
- type |= DRM_VBLANK_SECONDARY;<br>
- else if (crtc_id > 1)<br>
-#ifdef DRM_VBLANK_HIGH_CRTC_SHIFT<br>
- type |= (crtc_id << DRM_VBLANK_HIGH_CRTC_SHIFT) &<br>
- DRM_VBLANK_HIGH_CRTC_MASK;<br>
-#else<br>
- ErrorF("radeon driver bug: %s called for CRTC %d > 1, but "<br>
- "DRM_VBLANK_HIGH_CRTC_MASK not defined at build time\n",<br>
- __func__, crtc_id);<br>
-#endif<br>
-<br>
- return type; <br>
-}<br>
-<br>
/*<br>
* This function should be called on a disabled CRTC only (i.e., CRTC<br>
* in DPMS-off state). It will calculate the delay necessary to reach<br>
@@ -1087,13 +1067,11 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,<br>
{<br>
ScreenPtr screen = draw->pScreen;<br>
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);<br>
- RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);<br>
DRI2FrameEventPtr wait_info = NULL;<br>
uintptr_t drm_queue_seq = 0;<br>
xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw, TRUE);<br>
uint32_t msc_delta;<br>
- drmVBlank vbl;<br>
- int ret;<br>
+ uint32_t seq;<br>
CARD64 current_msc;<br>
<br>
/* Truncate to match kernel interfaces; means occasional overflow<br>
@@ -1132,17 +1110,13 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,<br>
}<br>
<br>
/* Get current count */<br>
- vbl.request.type = DRM_VBLANK_RELATIVE;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(crtc);<br>
- vbl.request.sequence = 0;<br>
- ret = drmWaitVBlank(pRADEONEnt->fd, &vbl);<br>
- if (ret) {<br>
+ if (!drmmode_wait_vblank(crtc, DRM_VBLANK_RELATIVE, 0, 0, NULL, &seq)) {<br>
xf86DrvMsg(scrn->scrnIndex, X_WARNING,<br>
"get vblank counter failed: %s\n", strerror(errno));<br>
goto out_complete;<br>
}<br>
<br>
- current_msc = vbl.reply.sequence + msc_delta;<br>
+ current_msc = seq + msc_delta;<br>
current_msc &= 0xffffffff;<br>
<br>
drm_queue_seq = radeon_drm_queue_alloc(crtc, client, RADEON_DRM_QUEUE_ID_DEFAULT,<br>
@@ -1169,12 +1143,9 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,<br>
*/<br>
if (current_msc >= target_msc)<br>
target_msc = current_msc;<br>
- vbl.request.type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(crtc);<br>
- vbl.request.sequence = target_msc - msc_delta;<br>
- vbl.request.signal = drm_queue_seq;<br>
- ret = drmWaitVBlank(pRADEONEnt->fd, &vbl);<br>
- if (ret) {<br>
+ if (!drmmode_wait_vblank(crtc, DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT,<br>
+ target_msc - msc_delta, drm_queue_seq, NULL,<br>
+ NULL)) {<br>
xf86DrvMsg(scrn->scrnIndex, X_WARNING,<br>
"get vblank counter failed: %s\n", strerror(errno));<br>
goto out_complete;<br>
@@ -1188,11 +1159,7 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,<br>
* If we get here, target_msc has already passed or we don't have one,<br>
* so we queue an event that will satisfy the divisor/remainder equation.<br>
*/<br>
- vbl.request.type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(crtc);<br>
-<br>
- vbl.request.sequence = current_msc - (current_msc % divisor) +<br>
- remainder - msc_delta;<br>
+ target_msc = current_msc - (current_msc % divisor) + remainder - msc_delta;<br>
<br>
/*<br>
* If calculated remainder is larger than requested remainder,<br>
@@ -1201,11 +1168,10 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,<br>
* that will happen.<br>
*/<br>
if ((current_msc % divisor) >= remainder)<br>
- vbl.request.sequence += divisor;<br>
+ target_msc += divisor;<br>
<br>
- vbl.request.signal = drm_queue_seq;<br>
- ret = drmWaitVBlank(pRADEONEnt->fd, &vbl);<br>
- if (ret) {<br>
+ if (!drmmode_wait_vblank(crtc, DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT,<br>
+ target_msc, drm_queue_seq, NULL, NULL)) {<br>
xf86DrvMsg(scrn->scrnIndex, X_WARNING,<br>
"get vblank counter failed: %s\n", strerror(errno));<br>
goto out_complete;<br>
@@ -1249,14 +1215,14 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,<br>
{<br>
ScreenPtr screen = draw->pScreen;<br>
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);<br>
- RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);<br>
xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw, TRUE);<br>
uint32_t msc_delta;<br>
- drmVBlank vbl;<br>
- int ret, flip = 0;<br>
+ drmVBlankSeqType type;<br>
+ uint32_t seq;<br>
+ int flip = 0;<br>
DRI2FrameEventPtr swap_info = NULL;<br>
uintptr_t drm_queue_seq;<br>
- CARD64 current_msc;<br>
+ CARD64 current_msc, event_msc;<br>
BoxRec box;<br>
RegionRec region;<br>
<br>
@@ -1319,18 +1285,14 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,<br>
}<br>
<br>
/* Get current count */<br>
- vbl.request.type = DRM_VBLANK_RELATIVE;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(crtc);<br>
- vbl.request.sequence = 0;<br>
- ret = drmWaitVBlank(pRADEONEnt->fd, &vbl);<br>
- if (ret) {<br>
+ if (!drmmode_wait_vblank(crtc, DRM_VBLANK_RELATIVE, 0, 0, NULL, &seq)) {<br>
xf86DrvMsg(scrn->scrnIndex, X_WARNING,<br>
"first get vblank counter failed: %s\n",<br>
strerror(errno));<br>
goto blit_fallback;<br>
}<br>
<br>
- current_msc = vbl.reply.sequence + msc_delta;<br>
+ current_msc = seq + msc_delta;<br>
current_msc &= 0xffffffff;<br>
<br>
/* Flips need to be submitted one frame before */<br>
@@ -1352,14 +1314,13 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,<br>
* the swap.<br>
*/<br>
if (divisor == 0 || current_msc < *target_msc) {<br>
- vbl.request.type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;<br>
+ type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;<br>
/* If non-pageflipping, but blitting/exchanging, we need to use<br>
* DRM_VBLANK_NEXTONMISS to avoid unreliable timestamping later<br>
* on.<br>
*/<br>
if (flip == 0)<br>
- vbl.request.type |= DRM_VBLANK_NEXTONMISS;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(crtc);<br>
+ type |= DRM_VBLANK_NEXTONMISS;<br>
<br>
/* If target_msc already reached or passed, set it to<br>
* current_msc to ensure we return a reasonable value back<br>
@@ -1368,17 +1329,15 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,<br>
if (current_msc >= *target_msc)<br>
*target_msc = current_msc;<br>
<br>
- vbl.request.sequence = *target_msc - msc_delta;<br>
- vbl.request.signal = drm_queue_seq;<br>
- ret = drmWaitVBlank(pRADEONEnt->fd, &vbl);<br>
- if (ret) {<br>
+ if (!drmmode_wait_vblank(crtc, type, *target_msc - msc_delta,<br>
+ drm_queue_seq, NULL, &seq)) {<br>
xf86DrvMsg(scrn->scrnIndex, X_WARNING,<br>
"divisor 0 get vblank counter failed: %s\n",<br>
strerror(errno));<br>
goto blit_fallback;<br>
}<br>
<br>
- *target_msc = vbl.reply.sequence + flip + msc_delta;<br>
+ *target_msc = seq + flip + msc_delta;<br>
swap_info->frame = *target_msc;<br>
<br>
return TRUE;<br>
@@ -1389,13 +1348,11 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,<br>
* and we need to queue an event that will satisfy the divisor/remainder<br>
* equation.<br>
*/<br>
- vbl.request.type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;<br>
+ type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;<br>
if (flip == 0)<br>
- vbl.request.type |= DRM_VBLANK_NEXTONMISS;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(crtc);<br>
+ type |= DRM_VBLANK_NEXTONMISS;<br>
<br>
- vbl.request.sequence = current_msc - (current_msc % divisor) +<br>
- remainder - msc_delta;<br>
+ event_msc = current_msc - (current_msc % divisor) + remainder - msc_delta;<br>
<br>
/*<br>
* If the calculated deadline vbl.request.sequence is smaller than<br>
@@ -1408,15 +1365,13 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,<br>
* into account, as well as a potential DRM_VBLANK_NEXTONMISS delay<br>
* if we are blitting/exchanging instead of flipping.<br>
*/<br>
- if (vbl.request.sequence <= current_msc)<br>
- vbl.request.sequence += divisor;<br>
+ if (event_msc <= current_msc)<br>
+ event_msc += divisor;<br>
<br>
/* Account for 1 frame extra pageflip delay if flip > 0 */<br>
- vbl.request.sequence -= flip;<br>
+ event_msc -= flip;<br>
<br>
- vbl.request.signal = drm_queue_seq;<br>
- ret = drmWaitVBlank(pRADEONEnt->fd, &vbl);<br>
- if (ret) {<br>
+ if (!drmmode_wait_vblank(crtc, type, event_msc, drm_queue_seq, NULL, &seq)) {<br>
xf86DrvMsg(scrn->scrnIndex, X_WARNING,<br>
"final get vblank counter failed: %s\n",<br>
strerror(errno));<br>
@@ -1424,7 +1379,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,<br>
}<br>
<br>
/* Adjust returned value for 1 fame pageflip offset of flip > 0 */<br>
- *target_msc = vbl.reply.sequence + flip + msc_delta;<br>
+ *target_msc = seq + flip + msc_delta;<br>
*target_msc &= 0xffffffff;<br>
swap_info->frame = *target_msc;<br>
<br>
diff --git a/src/radeon_kms.c b/src/radeon_kms.c<br>
index 5ae94f5c8..423d36cbb 100644<br>
--- a/src/radeon_kms.c<br>
+++ b/src/radeon_kms.c<br>
@@ -722,11 +722,9 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)<br>
{<br>
ScreenPtr screen = dirty->slave_dst->drawable.pScreen;<br>
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);<br>
- RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);<br>
xf86CrtcPtr xf86_crtc = radeon_prime_dirty_to_crtc(dirty);<br>
drmmode_crtc_private_ptr drmmode_crtc;<br>
uintptr_t drm_queue_seq;<br>
- drmVBlank vbl;<br>
<br>
if (!xf86_crtc || !xf86_crtc->enabled)<br>
return;<br>
@@ -748,13 +746,10 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)<br>
return;<br>
}<br>
<br>
- vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(xf86_crtc);<br>
- vbl.request.sequence = 1;<br>
- vbl.request.signal = drm_queue_seq;<br>
- if (drmWaitVBlank(pRADEONEnt->fd, &vbl)) {<br>
+ if (!drmmode_wait_vblank(xf86_crtc, DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,<br>
+ 1, drm_queue_seq, NULL, NULL)) {<br>
xf86DrvMsg(scrn->scrnIndex, X_WARNING,<br>
- "drmWaitVBlank failed for PRIME update: %s\n",<br>
+ "drmmode_wait_vblank failed for PRIME update: %s\n",<br>
strerror(errno));<br>
radeon_drm_abort_entry(drm_queue_seq);<br>
return;<br>
@@ -1019,10 +1014,8 @@ static void<br>
radeon_scanout_update(xf86CrtcPtr xf86_crtc)<br>
{<br>
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;<br>
- RADEONEntPtr pRADEONEnt = RADEONEntPriv(xf86_crtc->scrn);<br>
uintptr_t drm_queue_seq;<br>
ScrnInfoPtr scrn;<br>
- drmVBlank vbl;<br>
DamagePtr pDamage;<br>
RegionPtr pRegion;<br>
BoxRec extents;<br>
@@ -1059,13 +1052,10 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)<br>
return;<br>
}<br>
<br>
- vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;<br>
- vbl.request.type |= radeon_populate_vbl_request_type(xf86_crtc);<br>
- vbl.request.sequence = 1;<br>
- vbl.request.signal = drm_queue_seq;<br>
- if (drmWaitVBlank(pRADEONEnt->fd, &vbl)) {<br>
+ if (!drmmode_wait_vblank(xf86_crtc, DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,<br>
+ 1, drm_queue_seq, NULL, NULL)) {<br>
xf86DrvMsg(scrn->scrnIndex, X_WARNING,<br>
- "drmWaitVBlank failed for scanout update: %s\n",<br>
+ "drmmode_wait_vblank failed for scanout update: %s\n",<br>
strerror(errno));<br>
radeon_drm_abort_entry(drm_queue_seq);<br>
return;<br>
diff --git a/src/radeon_present.c b/src/radeon_present.c<br>
index c01ba95f9..135a0a97c 100644<br>
--- a/src/radeon_present.c<br>
+++ b/src/radeon_present.c<br>
@@ -55,16 +55,6 @@ struct radeon_present_vblank_event {<br>
Bool unflip;<br>
};<br>
<br>
-static uint32_t crtc_select(int crtc_id)<br>
-{<br>
- if (crtc_id > 1)<br>
- return crtc_id << DRM_VBLANK_HIGH_CRTC_SHIFT;<br>
- else if (crtc_id > 0)<br>
- return DRM_VBLANK_SECONDARY;<br>
- else<br>
- return 0;<br>
-}<br>
-<br>
static RRCrtcPtr<br>
radeon_present_get_crtc(WindowPtr window)<br>
{<br>
@@ -155,13 +145,8 @@ radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)<br>
{<br>
xf86CrtcPtr xf86_crtc = crtc->devPrivate;<br>
ScreenPtr screen = crtc->pScreen;<br>
- ScrnInfoPtr scrn = xf86ScreenToScrn(screen);<br>
- RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);<br>
- int crtc_id = drmmode_get_crtc_id(xf86_crtc);<br>
struct radeon_present_vblank_event *event;<br>
uintptr_t drm_queue_seq;<br>
- drmVBlank vbl;<br>
- int ret;<br>
<br>
event = calloc(sizeof(struct radeon_present_vblank_event), 1);<br>
if (!event)<br>
@@ -177,12 +162,10 @@ radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)<br>
return BadAlloc;<br>
}<br>
<br>
- vbl.request.type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT | crtc_select(crtc_id);<br>
- vbl.request.sequence = msc;<br>
- vbl.request.signal = drm_queue_seq;<br>
for (;;) {<br>
- ret = drmWaitVBlank(pRADEONEnt->fd, &vbl);<br>
- if (!ret)<br>
+ if (drmmode_wait_vblank(xf86_crtc,<br>
+ DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT, msc,<br>
+ drm_queue_seq, NULL, NULL))<br>
break;<br>
if (errno != EBUSY || !radeon_present_flush_drm_events(screen)) {<br>
radeon_drm_abort_entry(drm_queue_seq);<br>
-- <br>
2.14.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="LPlnk679799" previewremoved="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
<div id="LPBorder_GT_15029013964060.38499156816480995" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15029013964040.6571836435305722" role="presentation" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_15029013964050.5827731624270094" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_15029013964050.06646265142104446"></div>
<div id="LPTitle_15029013964050.8577571959803711" style="top: 0px; color: rgb(0, 120, 215); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_15029013964060.5288276377801104" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" target="_blank" style="text-decoration: none;">amd-gfx Info Page - freedesktop.org</a></div>
<div id="LPMetadata_15029013964060.5154021037906125" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
lists.freedesktop.org</div>
<div id="LPDescription_15029013964060.7455276551082373" style="display: block; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all freedesktop.org lists is subject to our Code of ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>