Remove drmmode_crtc->scanout_destroy[] array
PATCH 1/10 Remove drmmode_crtc->scanout_destroy[] array
From: Michel Dänzer <[email protected]>
No longer necessary since we're reference counting framebuffers.
(Ported from radeon commit 3f120fa1d5d921656a367751bc079e020e9ab105)
--- src/drmmode_display.c | 22 ++++------------------ src/drmmode_display.h | 1 - 2 files changed, 4 insertions(+), 19 deletions(-)
src/drmmode_display.c +4 -18
@@ -457,19 +457,10 @@ drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,static void drmmode_crtc_scanout_free (drmmode_crtc_private_ptr drmmode_crtc) { -if (drmmode_crtc->flip_pending) { - drmmode_crtc->scanout_destroy[0 ] = drmmode_crtc->scanout[0 ]; - drmmode_crtc->scanout[0 ].pixmap =NULL ; - drmmode_crtc->scanout[0 ].bo =NULL ; - drmmode_crtc->scanout_destroy[1 ] = drmmode_crtc->scanout[1 ]; - drmmode_crtc->scanout[1 ].pixmap =NULL ; - drmmode_crtc->scanout[1 ].bo =NULL ; - }else { -drmmode_crtc_scanout_destroy (drmmode_crtc->drmmode, - &drmmode_crtc->scanout[0 ]); -drmmode_crtc_scanout_destroy (drmmode_crtc->drmmode, - &drmmode_crtc->scanout[1 ]); - } +drmmode_crtc_scanout_destroy (drmmode_crtc->drmmode, + &drmmode_crtc->scanout[0 ]); +drmmode_crtc_scanout_destroy (drmmode_crtc->drmmode, + &drmmode_crtc->scanout[1 ]);if (drmmode_crtc->scanout_damage)DamageDestroy (drmmode_crtc->scanout_damage);
@@ -2238,11 +2229,6 @@ drmmode_clear_pending_flip(xf86CrtcPtr crtc)drmmode_crtc_dpms (crtc, drmmode_crtc->pending_dpms_mode); } - -drmmode_crtc_scanout_destroy (drmmode_crtc->drmmode, - &drmmode_crtc->scanout_destroy[0 ]); -drmmode_crtc_scanout_destroy (drmmode_crtc->drmmode, - &drmmode_crtc->scanout_destroy[1 ]); } static void
src/drmmode_display.h +0 -1
@@ -79,7 +79,6 @@ typedef struct {struct amdgpu_buffer *cursor_buffer;struct drmmode_scanout rotate;struct drmmode_scanout scanout[2 ]; -struct drmmode_scanout scanout_destroy[2 ];DamagePtr scanout_damage;RegionRec scanout_last_region;unsigned scanout_id;
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170818085322.3040-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH 2/10 Pass reference CRTC to amdgpu_do_pageflip directly
From: Michel Dänzer <[email protected]>
Simplifies the code slightly.
(Ported from radeon commit 49cc61ab970ee28d4509b4e2dd0a57165136889f)
--- src/amdgpu_dri2.c | 4 +--- src/amdgpu_present.c | 6 ++---- src/drmmode_display.c | 11 +++-------- src/drmmode_display.h | 2 +- 4 files changed, 7 insertions(+), 16 deletions(-)
src/amdgpu_dri2.c +1 -3
@@ -541,7 +541,6 @@ amdgpu_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,AMDGPUInfoPtr info =AMDGPUPTR (scrn);struct dri2_buffer_priv *back_priv;DRI2FrameEventPtr flip_info; -int ref_crtc_hw_id =drmmode_get_crtc_id (crtc); flip_info =calloc (1 ,sizeof (DRI2FrameEventRec));if (!flip_info)
@@ -561,8 +560,7 @@ amdgpu_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,/* Page flip the full screen buffer */ back_priv = back->driverPrivate;if (amdgpu_do_pageflip (scrn, client, back_priv->pixmap, -AMDGPU_DRM_QUEUE_ID_DEFAULT , flip_info, - ref_crtc_hw_id, +AMDGPU_DRM_QUEUE_ID_DEFAULT , flip_info, crtc, amdgpu_dri2_flip_event_handler, amdgpu_dri2_flip_event_abort,FLIP_VSYNC , target_msc -amdgpu_get_msc_delta (draw, crtc))) {
src/amdgpu_present.c +2 -4
@@ -308,8 +308,6 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,ScrnInfoPtr scrn =xf86ScreenToScrn (screen);AMDGPUInfoPtr info =AMDGPUPTR (scrn);struct amdgpu_present_vblank_event *event; -xf86CrtcPtr xf86_crtc = crtc->devPrivate; -int crtc_id = xf86_crtc ?drmmode_get_crtc_id (xf86_crtc) :-1 ;Bool ret;if (!amdgpu_present_check_flip (crtc, screen->root, pixmap, sync_flip))
@@ -324,7 +322,7 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,amdgpu_glamor_flush (scrn); ret = amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT, - pixmap, event_id, event, crtc_id, + pixmap, event_id, event, crtc->devPrivate, amdgpu_present_flip_event, amdgpu_present_flip_abort, sync_flip ? FLIP_VSYNC : FLIP_ASYNC,
@@ -367,7 +365,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)amdgpu_glamor_flush (scrn);if (amdgpu_do_pageflip (scrn,AMDGPU_DRM_QUEUE_CLIENT_DEFAULT , pixmap, - event_id, event,-1 , amdgpu_present_flip_event, + event_id, event,NULL , amdgpu_present_flip_event, amdgpu_present_flip_abort, flip_sync,0 ))return ;
src/drmmode_display.c +3 -8
@@ -2759,7 +2759,7 @@ void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode)Bool amdgpu_do_pageflip (ScrnInfoPtr scrn,ClientPtr client,PixmapPtr new_front,uint64_t id,void *data, -int ref_crtc_hw_id,amdgpu_drm_handler_proc handler, +xf86CrtcPtr ref_crtc,amdgpu_drm_handler_proc handler,amdgpu_drm_abort_proc abort,enum drmmode_flip_sync flip_sync,uint32_t target_msc)
@@ -2800,6 +2800,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, flipdata->event_data = data; flipdata->handler = handler; flipdata->abort = abort; + flipdata->fe_crtc = ref_crtc;for (i =0 ; i < config->num_crtc; i++) { crtc = config->crtc[i];
@@ -2810,12 +2811,6 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, flipdata->flip_count++; drmmode_crtc = crtc->driver_private; -/* Only the reference crtc will finally deliver its page flip -* completion event. All other crtc's events will be discarded. -*/ -if (drmmode_crtc->hw_id == ref_crtc_hw_id) - flipdata->fe_crtc = crtc; - drm_queue_seq = amdgpu_drm_queue_alloc(crtc, client, id, flipdata, drmmode_flip_handler,
@@ -2826,7 +2821,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, goto error; } -if (drmmode_crtc->hw_id == ref_crtc_hw_id) { +if (crtc == ref_crtc) { if (drmmode_page_flip_target_absolute(pAMDGPUEnt, drmmode_crtc, fb->handle,
src/drmmode_display.h +1 -1
@@ -209,7 +209,7 @@ extern int drmmode_get_pitch_align(ScrnInfoPtr scrn, int bpe);extern void drmmode_clear_pending_flip (xf86CrtcPtr crtc);Bool amdgpu_do_pageflip (ScrnInfoPtr scrn,ClientPtr client,PixmapPtr new_front,uint64_t id,void *data, -int ref_crtc_hw_id,amdgpu_drm_handler_proc handler, +xf86CrtcPtr ref_crtc,amdgpu_drm_handler_proc handler,amdgpu_drm_abort_proc abort,enum drmmode_flip_sync flip_sync,uint32_t target_msc);
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/10 Create drmmode_wait_vblank helper
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Allows cleaning up the code considerably.
(Ported from radeon commit 99f1d7a474af3683fe1a66f50c0bb8935478ff0a)
--- src/amdgpu_dri2.c | 97 +++++++++++++++------------------------------------ src/amdgpu_drv.h | 2 -- src/amdgpu_kms.c | 23 ++++-------- src/amdgpu_present.c | 23 ++---------- src/drmmode_display.c | 63 ++++++++++++++++++++++----------- src/drmmode_display.h | 5 +++ 6 files changed, 85 insertions(+), 128 deletions(-)
src/amdgpu_dri2.c +29 -68
@@ -778,20 +778,6 @@ cleanup:amdgpu_dri2_frame_event_abort (crtc, event_data); } -drmVBlankSeqType amdgpu_populate_vbl_request_type (xf86CrtcPtr crtc) -{ -drmVBlankSeqType type =0 ; -int crtc_id =drmmode_get_crtc_id (crtc); - -if (crtc_id ==1 ) - type |=DRM_VBLANK_SECONDARY ; -else if (crtc_id >1 ) - type |= (crtc_id <<DRM_VBLANK_HIGH_CRTC_SHIFT ) & -DRM_VBLANK_HIGH_CRTC_MASK ; - -return type; -} -/* * This function should be called on a disabled CRTC only (i.e., CRTC * in DPMS-off state). It will calculate the delay necessary to reach
@@ -971,13 +957,11 @@ static int amdgpu_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw, {ScreenPtr screen = draw->pScreen;ScrnInfoPtr scrn =xf86ScreenToScrn (screen); -AMDGPUEntPtr pAMDGPUEnt =AMDGPUEntPriv (scrn);DRI2FrameEventPtr wait_info =NULL ;uintptr_t drm_queue_seq =0 ;xf86CrtcPtr crtc =amdgpu_dri2_drawable_crtc (draw, TRUE);uint32_t msc_delta; -drmVBlank vbl; -int ret; +uint32_t seq;CARD64 current_msc;/* Truncate to match kernel interfaces; means occasional overflow
@@ -1016,17 +1000,13 @@ static int amdgpu_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw, }/* Get current count */ - vbl.request.type =DRM_VBLANK_RELATIVE ; - vbl.request.type |=amdgpu_populate_vbl_request_type (crtc); - vbl.request.sequence =0 ; - ret =drmWaitVBlank (pAMDGPUEnt->fd, &vbl); -if (ret) { +if (!drmmode_wait_vblank (crtc,DRM_VBLANK_RELATIVE ,0 ,0 ,NULL , &seq)) {xf86DrvMsg (scrn->scrnIndex,X_WARNING ,"get vblank counter failed: %s\n" ,strerror (errno)); goto out_complete; } - current_msc = vbl.reply.sequence + msc_delta; + current_msc = seq + msc_delta; current_msc &=0xffffffff ; drm_queue_seq = amdgpu_drm_queue_alloc(crtc, client, AMDGPU_DRM_QUEUE_ID_DEFAULT,
@@ -1053,12 +1033,9 @@ static int amdgpu_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,*/ if (current_msc >= target_msc) target_msc = current_msc; - vbl.request.type =DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT ; - vbl.request.type |=amdgpu_populate_vbl_request_type (crtc); - vbl.request.sequence = target_msc - msc_delta; - vbl.request.signal = drm_queue_seq; - ret =drmWaitVBlank (pAMDGPUEnt->fd, &vbl); -if (ret) { +if (!drmmode_wait_vblank (crtc,DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT , + target_msc - msc_delta, drm_queue_seq,NULL , +NULL )) {xf86DrvMsg (scrn->scrnIndex,X_WARNING ,"get vblank counter failed: %s\n" ,strerror (errno));
@@ -1073,11 +1050,7 @@ static int amdgpu_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,* If we get here, target_msc has already passed or we don't have one, * so we queue an event that will satisfy the divisor/remainder equation. */ - vbl.request.type =DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT ; - vbl.request.type |=amdgpu_populate_vbl_request_type (crtc); - - vbl.request.sequence = current_msc - (current_msc % divisor) + - remainder - msc_delta; + target_msc = current_msc - (current_msc % divisor) + remainder - msc_delta;/* * If calculated remainder is larger than requested remainder,
@@ -1086,11 +1059,10 @@ static int amdgpu_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,* that will happen. */ if ((current_msc % divisor) >= remainder) - vbl.request.sequence += divisor; + target_msc += divisor; - vbl.request.signal = drm_queue_seq; - ret =drmWaitVBlank (pAMDGPUEnt->fd, &vbl); -if (ret) { +if (!drmmode_wait_vblank (crtc,DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT , + target_msc, drm_queue_seq,NULL ,NULL )) {xf86DrvMsg (scrn->scrnIndex,X_WARNING ,"get vblank counter failed: %s\n" ,strerror (errno)); goto out_complete;
@@ -1134,14 +1106,14 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, {ScreenPtr screen = draw->pScreen;ScrnInfoPtr scrn =xf86ScreenToScrn (screen); -AMDGPUEntPtr pAMDGPUEnt =AMDGPUEntPriv (scrn);xf86CrtcPtr crtc =amdgpu_dri2_drawable_crtc (draw, TRUE);uint32_t msc_delta; -drmVBlank vbl; -int ret, flip =0 ; +drmVBlankSeqType type; +uint32_t seq; +int flip =0 ;DRI2FrameEventPtr swap_info =NULL ;uintptr_t drm_queue_seq; -CARD64 current_msc; +CARD64 current_msc, event_msc;BoxRec box;RegionRec region;
@@ -1204,18 +1176,14 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, }/* Get current count */ - vbl.request.type =DRM_VBLANK_RELATIVE ; - vbl.request.type |=amdgpu_populate_vbl_request_type (crtc); - vbl.request.sequence =0 ; - ret =drmWaitVBlank (pAMDGPUEnt->fd, &vbl); -if (ret) { +if (!drmmode_wait_vblank (crtc,DRM_VBLANK_RELATIVE ,0 ,0 ,NULL , &seq)) {xf86DrvMsg (scrn->scrnIndex,X_WARNING ,"first get vblank counter failed: %s\n" ,strerror (errno)); goto blit_fallback; } - current_msc = vbl.reply.sequence + msc_delta; + current_msc = seq + msc_delta; current_msc &=0xffffffff ;/* Flips need to be submitted one frame before */
@@ -1237,14 +1205,13 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,* the swap. */ if (divisor ==0 || current_msc < *target_msc) { - vbl.request.type =DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT ; + type =DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT ;/* If non-pageflipping, but blitting/exchanging, we need to use * DRM_VBLANK_NEXTONMISS to avoid unreliable timestamping later * on. */ if (flip ==0 ) - vbl.request.type |=DRM_VBLANK_NEXTONMISS ; - vbl.request.type |=amdgpu_populate_vbl_request_type (crtc); + type |=DRM_VBLANK_NEXTONMISS ;/* If target_msc already reached or passed, set it to * current_msc to ensure we return a reasonable value back
@@ -1253,17 +1220,15 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,if (current_msc >= *target_msc) *target_msc = current_msc; - vbl.request.sequence = *target_msc - msc_delta; - vbl.request.signal = drm_queue_seq; - ret =drmWaitVBlank (pAMDGPUEnt->fd, &vbl); -if (ret) { +if (!drmmode_wait_vblank (crtc, type, *target_msc - msc_delta, + drm_queue_seq,NULL , &seq)) {xf86DrvMsg (scrn->scrnIndex,X_WARNING ,"divisor 0 get vblank counter failed: %s\n" ,strerror (errno)); goto blit_fallback; } - *target_msc = vbl.reply.sequence + flip + msc_delta; + *target_msc = seq + flip + msc_delta; *target_msc &=0xffffffff ; swap_info->frame = *target_msc;
@@ -1275,13 +1240,11 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,* and we need to queue an event that will satisfy the divisor/remainder * equation. */ - vbl.request.type =DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT ; + type =DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT ;if (flip ==0 ) - vbl.request.type |=DRM_VBLANK_NEXTONMISS ; - vbl.request.type |=amdgpu_populate_vbl_request_type (crtc); + type |=DRM_VBLANK_NEXTONMISS ; - vbl.request.sequence = current_msc - (current_msc % divisor) + - remainder - msc_delta; + event_msc = current_msc - (current_msc % divisor) + remainder - msc_delta;/* * If the calculated deadline vbl.request.sequence is smaller than
@@ -1294,15 +1257,13 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,* into account, as well as a potential DRM_VBLANK_NEXTONMISS delay * if we are blitting/exchanging instead of flipping. */ -if (vbl.request.sequence <= current_msc) - vbl.request.sequence += divisor; +if (event_msc <= current_msc) + event_msc += divisor;/* Account for 1 frame extra pageflip delay if flip > 0 */ - vbl.request.sequence -= flip; + event_msc -= flip; - vbl.request.signal = drm_queue_seq; - ret =drmWaitVBlank (pAMDGPUEnt->fd, &vbl); -if (ret) { +if (!drmmode_wait_vblank (crtc, type, event_msc, drm_queue_seq,NULL , &seq)) {xf86DrvMsg (scrn->scrnIndex,X_WARNING ,"final get vblank counter failed: %s\n" ,strerror (errno));
@@ -1310,7 +1271,7 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, }/* Adjust returned value for 1 fame pageflip offset of flip > 0 */ - *target_msc = vbl.reply.sequence + flip + msc_delta; + *target_msc = seq + flip + msc_delta; *target_msc &=0xffffffff ; swap_info->frame = *target_msc;
src/amdgpu_drv.h +0 -2
@@ -363,6 +363,4 @@ extern xf86CrtcPtr amdgpu_pick_best_crtc(ScrnInfoPtr pScrn,extern AMDGPUEntPtr AMDGPUEntPriv (ScrnInfoPtr pScrn); -drmVBlankSeqType amdgpu_populate_vbl_request_type (xf86CrtcPtr crtc); -#endif /* _AMDGPU_DRV_H_ */
src/amdgpu_kms.c +6 -17
@@ -624,11 +624,9 @@ 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; -drmVBlank vbl;if (!xf86_crtc || !xf86_crtc->enabled)return ;
@@ -650,13 +648,10 @@ amdgpu_prime_scanout_update(PixmapDirtyUpdatePtr dirty)return ; } - vbl.request.type =DRM_VBLANK_RELATIVE |DRM_VBLANK_EVENT ; - vbl.request.type |=amdgpu_populate_vbl_request_type (xf86_crtc); - vbl.request.sequence =1 ; - vbl.request.signal = drm_queue_seq; -if (drmWaitVBlank (pAMDGPUEnt->fd, &vbl)) { +if (!drmmode_wait_vblank (xf86_crtc,DRM_VBLANK_RELATIVE |DRM_VBLANK_EVENT , +1 , drm_queue_seq,NULL ,NULL )) {xf86DrvMsg (scrn->scrnIndex,X_WARNING , -"drmWaitVBlank failed for PRIME update: %s\n" , +"drmmode_wait_vblank failed for PRIME update: %s\n" ,strerror (errno));amdgpu_drm_abort_entry (drm_queue_seq);return ;
@@ -915,8 +910,6 @@ amdgpu_scanout_update(xf86CrtcPtr xf86_crtc)drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;uintptr_t drm_queue_seq;ScrnInfoPtr scrn; -AMDGPUEntPtr pAMDGPUEnt; -drmVBlank vbl;DamagePtr pDamage;RegionPtr pRegion;BoxRec extents;
@@ -953,14 +946,10 @@ amdgpu_scanout_update(xf86CrtcPtr xf86_crtc)return ; } - pAMDGPUEnt =AMDGPUEntPriv (scrn); - vbl.request.type =DRM_VBLANK_RELATIVE |DRM_VBLANK_EVENT ; - vbl.request.type |=amdgpu_populate_vbl_request_type (xf86_crtc); - vbl.request.sequence =1 ; - vbl.request.signal = drm_queue_seq; -if (drmWaitVBlank (pAMDGPUEnt->fd, &vbl)) { +if (!drmmode_wait_vblank (xf86_crtc,DRM_VBLANK_RELATIVE |DRM_VBLANK_EVENT , +1 , drm_queue_seq,NULL ,NULL )) {xf86DrvMsg (scrn->scrnIndex,X_WARNING , -"drmWaitVBlank failed for scanout update: %s\n" , +"drmmode_wait_vblank failed for scanout update: %s\n" ,strerror (errno));amdgpu_drm_abort_entry (drm_queue_seq);return ;
src/amdgpu_present.c +3 -20
@@ -55,16 +55,6 @@ struct amdgpu_present_vblank_event {Bool unflip; }; -static uint32_t crtc_select (int crtc_id) -{ -if (crtc_id >1 ) -return crtc_id <<DRM_VBLANK_HIGH_CRTC_SHIFT ; -else if (crtc_id >0 ) -return DRM_VBLANK_SECONDARY ; -else -return 0 ; -} -static RRCrtcPtr amdgpu_present_get_crtc (WindowPtr window) {
@@ -155,13 +145,8 @@ amdgpu_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) {xf86CrtcPtr xf86_crtc = crtc->devPrivate;ScreenPtr screen = crtc->pScreen; -ScrnInfoPtr scrn =xf86ScreenToScrn (screen); -AMDGPUEntPtr pAMDGPUEnt =AMDGPUEntPriv (scrn); -int crtc_id =drmmode_get_crtc_id (xf86_crtc);struct amdgpu_present_vblank_event *event;uintptr_t drm_queue_seq; -drmVBlank vbl; -int ret; event =calloc (sizeof (struct amdgpu_present_vblank_event ),1 );if (!event)
@@ -177,12 +162,10 @@ amdgpu_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)return BadAlloc; } - vbl.request.type =DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT |crtc_select (crtc_id); - vbl.request.sequence = msc; - vbl.request.signal = drm_queue_seq;for (;;) { - ret =drmWaitVBlank (pAMDGPUEnt->fd, &vbl); -if (!ret) +if (drmmode_wait_vblank (xf86_crtc, +DRM_VBLANK_ABSOLUTE |DRM_VBLANK_EVENT , msc, + drm_queue_seq,NULL ,NULL ))break ;if (errno !=EBUSY || !amdgpu_present_flush_drm_events (screen)) {amdgpu_drm_abort_entry (drm_queue_seq);
src/drmmode_display.c +42 -21
98 lines not on this page · raw message
src/drmmode_display.h +5 -0
@@ -216,4 +216,9 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,int drmmode_crtc_get_ust_msc (xf86CrtcPtr crtc,CARD64 *ust,CARD64 *msc);int drmmode_get_current_ust (int drm_fd,CARD64 * ust); +Bool drmmode_wait_vblank (xf86CrtcPtr crtc,drmVBlankSeqType type, +uint32_t target_seq,unsigned long signal, +uint64_t *ust,uint32_t *result_seq); + +#endif
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/10 Create drmmode_crtc_wait_pending_event helper macro
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Preparation for following change, no functional change intended yet.
(Ported from radeon commit f87acdbfb1b0b6d2769764772a52ea8b81675e20)
--- src/drmmode_display.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
src/drmmode_display.c +10 -4
@@ -96,6 +96,14 @@ AMDGPUZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)return FALSE; } + +/* Wait for the boolean condition to be FALSE */ +#define drmmode_crtc_wait_pending_event (drmmode_crtc, fd, condition) \ + do {} while ((condition) && \ + drmHandleEvent(fd, &drmmode_crtc->drmmode->event_context) \ + > 0); + + static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn, int width, int height, int depth, int bpp,
@@ -891,10 +899,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, goto done; } -/* Wait for any pending flip to finish */ -do {}while (drmmode_crtc->flip_pending && -drmHandleEvent (pAMDGPUEnt->fd, - &drmmode->event_context) >0 ); +drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, + drmmode_crtc->flip_pending); if (drmModeSetCrtc(pAMDGPUEnt->fd, drmmode_crtc->mode_crtc->crtc_id,
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170818085322.3040-4-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Re: [PATCH xf86-video-amdgpu 04/10] Create drmmode_crtc_wait_pending_event helper macro
One comment inline
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Michel Dänzer <[email protected]>
Sent: Friday, August 18, 2017 4:53 AM
To: [email protected]
Subject: [PATCH xf86-video-amdgpu 04/10] Create drmmode_crtc_wait_pending_event helper macro
From: Michel Dänzer <[email protected]>
Preparation for following change, no functional change intended yet.
(Ported from radeon commit f87acdbfb1b0b6d2769764772a52ea8b81675e20)
--- src/drmmode_display.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
src/drmmode_display.c +8 -0
@@ -96,6 +96,14 @@ AMDGPUZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)return FALSE; } + +/* Wait for the boolean condition to be FALSE */ +#define drmmode_crtc_wait_pending_event (drmmode_crtc, fd, condition) \ + do {} while ((condition) && \ + drmHandleEvent(fd, &drmmode_crtc->drmmode->event_context) \ + > 0); + +
[slava] The comment seems a little misleading to me. The loop condition has actually two parts, and it's unclear what we're actually waiting for. A side question: is it expected that the variable 'condition' will change while we're waiting?
static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
int width, int height,
int depth, int bpp,
@@ -891,10 +899,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
goto done;
}- /* Wait for any pending flip to finish */
- do {} while (drmmode_crtc->flip_pending &&
- drmHandleEvent(pAMDGPUEnt->fd,
- &drmmode->event_context) > 0);
+ drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
+ drmmode_crtc->flip_pending);
if (drmModeSetCrtc(pAMDGPUEnt->fd,
drmmode_crtc->mode_crtc->crtc_id,--
2.14.1
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): MWHPR12MB1549229E1196C34EA406CCB4FE800-Gy0DoCVfaSXpH7u887dlEAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Re: [PATCH xf86-video-amdgpu 04/10] Create drmmode_crtc_wait_pending_event helper macro
Quoted 11 lines · Slava
*From:* amd-gfx <[email protected]> on behalf of
Quoted 9 lines
src/drmmode_display.c +0
-0@@ -96,6 +96,14 @@ AMDGPUZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name) return FALSE; }
Quoted 14 lines
src/drmmode_display.c AMDGPUZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name) · line 106
Quoted 9 lines
src/drmmode_display.c +8
-0+ +/* Wait for the boolean condition to be FALSE */ +#define drmmode_crtc_wait_pending_event (drmmode_crtc, fd, condition) \ + do {} while ((condition) && \ + drmHandleEvent(fd, &drmmode_crtc->drmmode->event_context) \ + > 0); + +[slava] The comment seems a little misleading to me. The loop condition has actually two parts, and it's unclear what we're actually waiting for. A side question: is it expected that the variable 'condition' will change while we're waiting?
Yes, that's the whole point. :) While (condition) evaluates to non-0, we call drmHandleEvent(), which blocks until at least one DRM event arrives, and triggers processing of arrived DRM events.
Maybe something like this would be better?
/* If condition evaluates to TRUE, process DRM events until condition
* evaluates to FALSE.
*/
Anyway, this patch just ports the same change from xf86-video-ati, so I'm not going to modify the comment in this patch. Do you want to send a patch modifying the comment in either driver?
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): f2d7b471-a7c1-fa13-1293-7a9b852074ca-otUistvHUpPR7s880joybQ@public.gmane.org
Re: [PATCH xf86-video-amdgpu 04/10] Create drmmode_crtc_wait_pending_event helper macro
From: Michel Dänzer <[email protected]>
Sent: Tuesday, August 22, 2017 1:52 AM
To: Abramov, Slava
Cc: [email protected]
Subject: Re: [PATCH xf86-video-amdgpu 04/10] Create drmmode_crtc_wait_pending_event helper macro
Quoted 11 lines · Slava
*From:* amd-gfx <[email protected]> on behalf of
Quoted 9 lines
src/drmmode_display.c +0
-0@@ -96,6 +96,14 @@ AMDGPUZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name) return FALSE; }
Quoted 14 lines
src/drmmode_display.c AMDGPUZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name) · line 106
Quoted 9 lines
src/drmmode_display.c +8
-0+ +/* Wait for the boolean condition to be FALSE */ +#define drmmode_crtc_wait_pending_event (drmmode_crtc, fd, condition) \ + do {} while ((condition) && \ + drmHandleEvent(fd, &drmmode_crtc->drmmode->event_context) \ + > 0); + +[slava] The comment seems a little misleading to me. The loop condition has actually two parts, and it's unclear what we're actually waiting for. A side question: is it expected that the variable 'condition' will change while we're waiting?
Yes, that's the whole point. :) While (condition) evaluates to non-0, we call drmHandleEvent(), which blocks until at least one DRM event arrives, and triggers processing of arrived DRM events.
Maybe something like this would be better?
/* If condition evaluates to TRUE, process DRM events until condition
* evaluates to FALSE.
*/
[slava] Yes, I like that :)
Anyway, this patch just ports the same change from xf86-video-ati, so I'm not going to modify the comment in this patch. Do you want to send a patch modifying the comment in either driver?
[slava] I will try to do this, as a military exercise, to get use to the process 😊
Slava
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/10 Wait for pending flips synchronously before turning off a CRTC
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Allows removing drmmode_clear_pending_flip and the pending_dpms_mode field and cleaning up the code considerably.
(Ported from radeon commit e6d7dc2070f4d21a6900916bb70a31839112882c)
--- src/amdgpu_kms.c | 12 ++++++----- src/amdgpu_present.c | 2 +- src/amdgpu_video.c | 2 +- src/drmmode_display.c | 60 ++++++++++----------------------------------------- src/drmmode_display.h | 5 +---- 5 files changed, 21 insertions(+), 60 deletions(-)
src/amdgpu_kms.c +7 -5
@@ -634,7 +634,7 @@ amdgpu_prime_scanout_update(PixmapDirtyUpdatePtr dirty) drmmode_crtc = xf86_crtc->driver_private;if (drmmode_crtc->scanout_update_pending || !drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap || - drmmode_crtc->pending_dpms_mode != DPMSModeOn) + drmmode_crtc->dpms_mode != DPMSModeOn)return ; drm_queue_seq = amdgpu_drm_queue_alloc(xf86_crtc,
@@ -663,10 +663,12 @@ amdgpu_prime_scanout_update(PixmapDirtyUpdatePtr dirty)static void amdgpu_prime_scanout_flip_abort (xf86CrtcPtr crtc,void *event_data) { +AMDGPUEntPtr pAMDGPUEnt =AMDGPUEntPriv (crtc->scrn);drmmode_crtc_private_ptr drmmode_crtc = event_data; drmmode_crtc->scanout_update_pending = FALSE; -drmmode_clear_pending_flip (crtc); +drmmode_fb_reference (pAMDGPUEnt->fd, &drmmode_crtc->flip_pending, +NULL ); } static void
@@ -698,7 +700,7 @@ amdgpu_prime_scanout_flip(PixmapDirtyUpdatePtr ent) drmmode_crtc = crtc->driver_private;if (drmmode_crtc->scanout_update_pending || !drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap || - drmmode_crtc->pending_dpms_mode != DPMSModeOn) + drmmode_crtc->dpms_mode != DPMSModeOn)return ; scanout_id = drmmode_crtc->scanout_id ^1 ;
@@ -916,7 +918,7 @@ amdgpu_scanout_update(xf86CrtcPtr xf86_crtc)if (!xf86_crtc->enabled || drmmode_crtc->scanout_update_pending || - drmmode_crtc->pending_dpms_mode != DPMSModeOn) + drmmode_crtc->dpms_mode != DPMSModeOn)return ; pDamage = drmmode_crtc->scanout_damage;
@@ -982,7 +984,7 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,unsigned scanout_id;if (drmmode_crtc->scanout_update_pending || - drmmode_crtc->pending_dpms_mode != DPMSModeOn) + drmmode_crtc->dpms_mode != DPMSModeOn)return ; scanout_id = drmmode_crtc->scanout_id ^1 ;
src/amdgpu_present.c +1 -1
@@ -361,7 +361,7 @@ modeset:if (!crtc->enabled)continue ; -if (drmmode_crtc->pending_dpms_mode == DPMSModeOn) +if (drmmode_crtc->dpms_mode == DPMSModeOn) crtc->funcs->set_mode_major (crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y);else
src/amdgpu_video.c +1 -1
@@ -67,7 +67,7 @@ static int amdgpu_box_area(BoxPtr box)Bool amdgpu_crtc_is_enabled (xf86CrtcPtr crtc) {drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; -return drmmode_crtc->pending_dpms_mode == DPMSModeOn; +return drmmode_crtc->dpms_mode == DPMSModeOn; } xf86CrtcPtr
src/drmmode_display.c +11 -49
110 lines not on this page · raw message
src/drmmode_display.h +1 -4
@@ -88,8 +88,6 @@ typedef struct {PixmapPtr prime_scanout_pixmap;int dpms_mode; -/* For when a flip is pending when DPMS off requested */ -int pending_dpms_mode;CARD64 dpms_last_ust;uint32_t dpms_last_seq;int dpms_last_fps;
@@ -138,7 +136,7 @@ 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->dpms_mode == DPMSModeOn && !drmmode_crtc->rotate.bo && !drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo; }
@@ -206,7 +204,6 @@ extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);extern int drmmode_get_crtc_id (xf86CrtcPtr crtc);extern int drmmode_get_pitch_align (ScrnInfoPtr scrn,int bpe); -extern void drmmode_clear_pending_flip (xf86CrtcPtr crtc); Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, PixmapPtr new_front, uint64_t id, void *data, xf86CrtcPtr ref_crtc, amdgpu_drm_handler_proc handler,
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/10 Handle multiple "pending" Present flips
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
The xserver Present code can submit a flip in response to notifying it that a vblank event arrived. This can happen before the completion event of the previous flip is processed. In that case, we were clearing the drmmode_crtc->flip_pending field prematurely.
Prevent this by only clearing drmmode_crtc->flip_pending when it matches the framebuffer being scanned out since the flip whose completion event we're processing.
(Ported from radeon commit 7c10ee9c88378d773c0bcf651fdc5d9f2c6dc5e5)
--- src/drmmode_display.c | 27 ++++++++++++++++----------- src/drmmode_display.h | 3 ++- 2 files changed, 18 insertions(+), 12 deletions(-)
src/drmmode_display.c +16 -11
@@ -2227,6 +2227,7 @@ drmmode_flip_abort(xf86CrtcPtr crtc, void *event_data)if (!flipdata->fe_crtc) flipdata->fe_crtc = crtc; flipdata->abort (flipdata->fe_crtc, flipdata->event_data); +drmmode_fb_reference (pAMDGPUEnt->fd, &flipdata->fb,NULL );free (flipdata); }
@@ -2248,6 +2249,13 @@ drmmode_flip_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, void *even flipdata->fe_usec = usec; } +drmmode_fb_reference (pAMDGPUEnt->fd, &drmmode_crtc->fb, + flipdata->fb); +if (drmmode_crtc->flip_pending == flipdata->fb) { +drmmode_fb_reference (pAMDGPUEnt->fd, + &drmmode_crtc->flip_pending,NULL ); + } +if (--flipdata->flip_count ==0 ) {/* Deliver MSC & UST from reference/current CRTC to flip event * handler
@@ -2258,13 +2266,9 @@ drmmode_flip_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, void *evenelse flipdata->handler (crtc, frame, usec, flipdata->event_data); +drmmode_fb_reference (pAMDGPUEnt->fd, &flipdata->fb,NULL );free (flipdata); } - -drmmode_fb_reference (pAMDGPUEnt->fd, &drmmode_crtc->fb, - drmmode_crtc->flip_pending); -drmmode_fb_reference (pAMDGPUEnt->fd, &drmmode_crtc->flip_pending, -NULL ); }#if HAVE_NOTIFY_FD
@@ -2761,7 +2765,6 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,uint32_t flip_flags = flip_sync ==FLIP_ASYNC ?DRM_MODE_PAGE_FLIP_ASYNC :0 ;drmmode_flipdata_ptr flipdata;uintptr_t drm_queue_seq =0 ; -struct drmmode_fb *fb; flipdata =calloc (1 ,sizeof (drmmode_flipdata_rec));if (!flipdata) {
@@ -2770,8 +2773,9 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, goto error; } - fb =amdgpu_pixmap_get_fb (new_front); -if (!fb) { +drmmode_fb_reference (pAMDGPUEnt->fd, &flipdata->fb, +amdgpu_pixmap_get_fb (new_front)); +if (!flipdata->fb) {ErrorF ("Failed to get FB for flip\n" ); goto error; }
@@ -2813,7 +2817,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,if (crtc == ref_crtc) {if (drmmode_page_flip_target_absolute (pAMDGPUEnt, drmmode_crtc, - fb->handle, + flipdata->fb->handle, flip_flags, drm_queue_seq, target_msc) !=0 )
@@ -2821,14 +2825,14 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, }else {if (drmmode_page_flip_target_relative (pAMDGPUEnt, drmmode_crtc, - fb->handle, + flipdata->fb->handle, flip_flags, drm_queue_seq,0 ) !=0 ) goto flip_error; }drmmode_fb_reference (pAMDGPUEnt->fd, &drmmode_crtc->flip_pending, - fb); + flipdata->fb); drm_queue_seq =0 ; }
@@ -2846,6 +2850,7 @@ error:drmmode_flip_abort (crtc, flipdata); else {abort (NULL , data); +drmmode_fb_reference (pAMDGPUEnt->fd, &flipdata->fb,NULL );free (flipdata); }
src/drmmode_display.h +2 -1
@@ -52,8 +52,9 @@ typedef struct { } drmmode_rec, *drmmode_ptr; typedef struct { - int flip_count; + struct drmmode_fb *fb; void *event_data; + int flip_count; unsigned int fe_frame; uint64_t fe_usec; xf86CrtcPtr fe_crtc;
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/10 Add source drawable parameter to amdgpu_scanout_do_update
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Preparation for following changes, no functional change intended yet.
(Ported from radeon commit 1443270e52e8562bd8dc3603f301963bd4027cef)
--- src/amdgpu_drv.h | 3 ++- src/amdgpu_kms.c | 18 +++++++++--------- src/drmmode_display.c | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-)
src/amdgpu_drv.h +2 -1
@@ -340,7 +340,8 @@ typedef struct {Bool amdgpu_dri3_screen_init (ScreenPtr screen);/* amdgpu_kms.c */ -Bool amdgpu_scanout_do_update (xf86CrtcPtr xf86_crtc,int scanout_id); +Bool amdgpu_scanout_do_update (xf86CrtcPtr xf86_crtc,int scanout_id, +DrawablePtr src_draw); void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion#if XORG_VERSION_CURRENT <XORG_VERSION_NUMERIC (1 ,16 ,99 ,901 ,0 ) , RegionPtr pBSRegion
src/amdgpu_kms.c +9 -9
@@ -792,7 +792,8 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)#endif Bool -amdgpu_scanout_do_update (xf86CrtcPtr xf86_crtc,int scanout_id) +amdgpu_scanout_do_update (xf86CrtcPtr xf86_crtc,int scanout_id, +DrawablePtr src_draw) {drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;RegionPtr pRegion =DamageRegion (drmmode_crtc->scanout_damage);
@@ -827,10 +828,7 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)PicturePtr src, dst;XID include_inferiors = IncludeInferiors; - src =CreatePicture (None, - &pScreen->root->drawable, - format, - CPSubwindowMode, + src =CreatePicture (None, src_draw, format, CPSubwindowMode, &include_inferiors, serverClient, &error);if (!src) { ErrorF("Failed to create source picture for transformed scanout "
@@ -874,8 +872,7 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)GCPtr gc =GetScratchGC (pDraw->depth, pScreen);ValidateGC (pDraw, gc); - (*gc->ops->CopyArea)(&pScreen->GetWindowPixmap (pScreen->root)->drawable, - pDraw, gc, + (*gc->ops->CopyArea)(src_draw, pDraw, gc, xf86_crtc->x + extents.x1, xf86_crtc->y + extents.y1, extents.x2 - extents.x1, extents.y2 - extents.y1, extents.x1, extents.y1);
@@ -900,8 +897,10 @@ amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, void *event_data) {drmmode_crtc_private_ptr drmmode_crtc = event_data; +ScreenPtr screen = crtc->scrn->pScreen; -amdgpu_scanout_do_update (crtc, drmmode_crtc->scanout_id); +amdgpu_scanout_do_update (crtc, drmmode_crtc->scanout_id, + &screen->GetWindowPixmap (screen->root)->drawable);amdgpu_scanout_update_abort (crtc, event_data); }
@@ -988,7 +987,8 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,return ; scanout_id = drmmode_crtc->scanout_id ^1 ; -if (!amdgpu_scanout_do_update (xf86_crtc, scanout_id)) +if (!amdgpu_scanout_do_update (xf86_crtc, scanout_id, + &pScreen->GetWindowPixmap (pScreen->root)->drawable))return ; drm_queue_seq = amdgpu_drm_queue_alloc(xf86_crtc,
src/drmmode_display.c +2 -1
@@ -770,7 +770,8 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode, *fb =amdgpu_pixmap_get_fb (drmmode_crtc->scanout[scanout_id].pixmap); *x = *y =0 ; -amdgpu_scanout_do_update (crtc, scanout_id); +amdgpu_scanout_do_update (crtc, scanout_id, + &screen->GetWindowPixmap (screen->root)->drawable);amdgpu_glamor_finish (scrn); } }
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/10 Pass extents to amdgpu_scanout_do_update
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Preparation for following change, no functional change intended yet.
(Ported from radeon commit 65e0c5ea1b4adff21d673dbf54af99704c429627)
--- src/amdgpu_drv.h | 2 +- src/amdgpu_kms.c | 41 +++++++++++++++++++++-------------------- src/drmmode_display.c | 3 ++- 3 files changed, 24 insertions(+), 22 deletions(-)
src/amdgpu_drv.h +1 -1
@@ -341,7 +341,7 @@ Bool amdgpu_dri3_screen_init(ScreenPtr screen);/* amdgpu_kms.c */ Bool amdgpu_scanout_do_update (xf86CrtcPtr xf86_crtc,int scanout_id, -DrawablePtr src_draw); +DrawablePtr src_draw,BoxPtr extents); void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion#if XORG_VERSION_CURRENT <XORG_VERSION_NUMERIC (1 ,16 ,99 ,901 ,0 ) , RegionPtr pBSRegion
src/amdgpu_kms.c +21 -20
94 lines not on this page · raw message
src/drmmode_display.c +2 -1
@@ -771,7 +771,8 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode, *x = *y =0 ;amdgpu_scanout_do_update (crtc, scanout_id, - &screen->GetWindowPixmap (screen->root)->drawable); + &screen->GetWindowPixmap (screen->root)->drawable, + box);amdgpu_glamor_finish (scrn); } }
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/10 Always allow Present page flipping with TearFree
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Even if TearFree is active for the the CRTC we're synchronizing to. In that case, for Present flips synchronized to vertical blank, the other scanout buffer is immediately synchronized and flipped to during the target vertical blank period. For Present flips not synchronized to vertical blank, we simply use the MSC and timestamp values of the last vertical blank period for timing purposes, and let the normal TearFree mechanism handle display updates.
(Ported from radeon commit 4445765af5b97d0cfd10889fe6d6f58f2ce85659)
--- src/amdgpu_kms.c | 27 ++++++++++++++++--- src/amdgpu_present.c | 75 +++++++++++++++++++++++++++++++++++++++++++-------- src/drmmode_display.c | 61 ++++++++++++++++++++++++++++++++++++----- src/drmmode_display.h | 12 ++++++++- 4 files changed, 152 insertions(+), 23 deletions(-)
src/amdgpu_kms.c +23 -4
@@ -41,6 +41,10 @@#include "shadow.h" #include <xf86Priv.h> +#if HAVE_PRESENT_H +#include <present.h> +#endif +/* DPMS */ #ifdef HAVE_XEXTPROTO_71 #include <X11/extensions/dpmsconst.h>
@@ -681,6 +685,15 @@ amdgpu_prime_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc, uint64_t usec,drmmode_fb_reference (pAMDGPUEnt->fd, &drmmode_crtc->fb, drmmode_crtc->flip_pending);amdgpu_prime_scanout_flip_abort (crtc, event_data); + +#ifdef HAVE_PRESENT_H +if (drmmode_crtc->present_vblank_event_id) { +present_event_notify (drmmode_crtc->present_vblank_event_id, + drmmode_crtc->present_vblank_usec, + drmmode_crtc->present_vblank_msc); + drmmode_crtc->present_vblank_event_id =0 ; + } +#endif } static void
@@ -895,10 +908,14 @@ amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,ScreenPtr screen = crtc->scrn->pScreen;RegionPtr region =DamageRegion (drmmode_crtc->scanout_damage); -amdgpu_scanout_do_update (crtc, drmmode_crtc->scanout_id, - &screen->GetWindowPixmap (screen->root)->drawable, - ®ion->extents); -RegionEmpty (region); +if (crtc->enabled && + !drmmode_crtc->flip_pending && + drmmode_crtc->dpms_mode == DPMSModeOn) { +if (amdgpu_scanout_do_update (crtc, drmmode_crtc->scanout_id, + &screen->GetWindowPixmap (screen->root)->drawable, + ®ion->extents)) +RegionEmpty (region); + }amdgpu_scanout_update_abort (crtc, event_data); }
@@ -915,6 +932,7 @@ amdgpu_scanout_update(xf86CrtcPtr xf86_crtc)if (!xf86_crtc->enabled || drmmode_crtc->scanout_update_pending || + drmmode_crtc->flip_pending || drmmode_crtc->dpms_mode != DPMSModeOn)return ;
@@ -982,6 +1000,7 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,unsigned scanout_id;if (drmmode_crtc->scanout_update_pending || + drmmode_crtc->flip_pending || drmmode_crtc->dpms_mode != DPMSModeOn)return ;
src/amdgpu_present.c +64 -11
149 lines not on this page · raw message
src/drmmode_display.c +54 -7
104 lines not on this page · raw message
src/drmmode_display.h +11 -1
@@ -81,6 +81,7 @@ typedef struct {struct drmmode_scanout rotate;struct drmmode_scanout scanout[2 ];DamagePtr scanout_damage; +Bool ignore_damage;RegionRec scanout_last_region;unsigned scanout_id;Bool scanout_update_pending;
@@ -100,6 +101,14 @@ typedef struct {struct drmmode_fb *flip_pending;/* The FB currently being scanned out by this CRTC, if any */ struct drmmode_fb *fb; + +#ifdef HAVE_PRESENT_H +/* Deferred processing of Present vblank event */ +uint64_t present_vblank_event_id; +uint64_t present_vblank_usec; +unsigned present_vblank_msc; +Bool present_flip_expected; +#endif } drmmode_crtc_private_rec, *drmmode_crtc_private_ptr; typedef struct {
@@ -139,7 +148,8 @@ drmmode_crtc_can_flip(xf86CrtcPtr crtc)return crtc->enabled && drmmode_crtc->dpms_mode == DPMSModeOn && !drmmode_crtc->rotate.bo && - !drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo; + (drmmode_crtc->tear_free || + !drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo); }
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/10 Always allow DRI2 page flipping with TearFree
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Even if TearFree is enabled for the CRTC we're synchronizing to.
(Ported from radeon commit d314cbfb228bb4b8762714f98d0c114a8ee3f061)
--- man/amdgpu.man | 6 ++---- src/amdgpu_dri2.c | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-)
man/amdgpu.man +2 -4
@@ -77,10 +77,8 @@ Set the default value of the per-output 'TearFree' property, which controls tearing prevention using the hardware page flipping mechanism. TearFree is on for any CRTC associated with one or more outputs with TearFree on. Two separate scanout buffers need to be allocated for each CRTC with TearFree -on. While TearFree is on for any CRTC, it may prevent clients from using -DRI page flipping. If this option is set, the default value of the property -is 'on' or 'off' accordingly. If this option isn't set, the default value of the -property is +on. If this option is set, the default value of the property is 'on' or 'off' +accordingly. If this option isn't set, the default value of the property is .B auto, which means that TearFree is on for outputs with rotation or other RandR transforms, and for RandR 1.4 slave outputs, otherwise off.
src/amdgpu_dri2.c +0 -2
@@ -641,8 +641,6 @@ can_flip(xf86CrtcPtr crtc, DrawablePtr draw,for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) {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);
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170818085322.3040-10-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Deucher, Alexander
Reviewed-by Alex DeucherRE: [PATCH xf86-video-amdgpu 10/10] Always allow DRI2 page flipping with TearFree
Quoted 8 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Friday, August 18, 2017 4:53 AM
To: [email protected]
Subject: [PATCH xf86-video-amdgpu 10/10] Always allow DRI2 page flipping with TearFree
Quoted 7 lines
From: Michel Dänzer <[email protected]>
Even if TearFree is enabled for the CRTC we're synchronizing to.
(Ported from radeon commit
d314cbfb228bb4b8762714f98d0c114a8ee3f061)Signed-off-by Michel Dänzer <[email protected]>
Series is:
Quoted 40 lines
--- man/amdgpu.man | 6 ++---- src/amdgpu_dri2.c | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-)man/amdgpu.man +0
-0@@ -77,10 +77,8 @@ Set the default value of the per-output 'TearFree'property, which controls
tearing prevention using the hardware page flipping mechanism. TearFree is on for any CRTC associated with one or more outputs with TearFree on. Two separate scanout buffers need to be allocated for each CRTC with TearFreeman/amdgpu.man +2
-4-on. While TearFree is on for any CRTC, it may prevent clients from using -DRI page flipping. If this option is set, the default value of the property -is 'on' or 'off' accordingly. If this option isn't set, the default value of the -property is +on. If this option is set, the default value of the property is 'on' or 'off' +accordingly. If this option isn't set, the default value of the property is .B auto, which means that TearFree is on for outputs with rotation or other RandR transforms, and for RandR 1.4 slave outputs, otherwise off.src/amdgpu_dri2.c +0
-2@@ -641,8 +641,6 @@ can_flip(xf86CrtcPtr crtc, DrawablePtr draw,for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) {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);
--
2.14.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx