Move DRM event queue related initialization to radeon_drm_queue_init
PATCH 1/5 Move DRM event queue related initialization to radeon_drm_queue_init
From: Michel Dänzer <[email protected]>
And make radeon_drm_queue_handler not directly accessible outside of radeon_drm_queue.c.
(Ported from amdgpu commit 0148283984c77f7a6e97026edc3093497547e0a4)
--- src/drmmode_display.c | 4 ---- src/radeon_dri2.c | 14 ++++++++------ src/radeon_drm_queue.c | 11 +++++++++-- src/radeon_drm_queue.h | 5 +---- src/radeon_kms.c | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-)
src/drmmode_display.c +0 -4
@@ -2742,10 +2742,6 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)xf86InitialConfiguration (pScrn, TRUE); - drmmode->event_context.version =2 ; - drmmode->event_context.vblank_handler = radeon_drm_queue_handler; - drmmode->event_context.page_flip_handler = radeon_drm_queue_handler; - pRADEONEnt->has_page_flip_target =drmmode_probe_page_flip_target (pRADEONEnt);drmModeFreeResources (mode_res);
src/radeon_dri2.c +8 -6
@@ -968,13 +968,15 @@ CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data) scrn = crtc->scrn; pRADEONEnt =RADEONEntPriv (scrn); + drmmode_crtc = event_info->crtc->driver_private; ret =drmmode_get_current_ust (pRADEONEnt->fd, &drm_now);if (ret) {xf86DrvMsg (scrn->scrnIndex,X_ERROR ,"%s cannot get current time\n" , __func__);if (event_info->drm_queue_seq) -radeon_drm_queue_handler (pRADEONEnt->fd,0 ,0 ,0 , - (void *)event_info->drm_queue_seq); + drmmode_crtc->drmmode->event_context. +vblank_handler (pRADEONEnt->fd,0 ,0 ,0 , + (void *)event_info->drm_queue_seq);else radeon_dri2_frame_event_handler (crtc,0 ,0 , data);return 0 ;
@@ -983,15 +985,15 @@ CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)* calculate the frame number from current time * that would come from CRTC if it were running */ - drmmode_crtc = event_info->crtc->driver_private; delta_t = drm_now - (CARD64 )drmmode_crtc->dpms_last_ust; delta_seq = delta_t * drmmode_crtc->dpms_last_fps; delta_seq /=1000000 ; frame = (CARD64 )drmmode_crtc->dpms_last_seq + delta_seq;if (event_info->drm_queue_seq) -radeon_drm_queue_handler (pRADEONEnt->fd, frame, drm_now /1000000 , - drm_now %1000000 , - (void *)event_info->drm_queue_seq); + drmmode_crtc->drmmode->event_context. +vblank_handler (pRADEONEnt->fd, frame, drm_now /1000000 , + drm_now %1000000 , + (void *)event_info->drm_queue_seq);else radeon_dri2_frame_event_handler (crtc, frame, drm_now, data);return 0 ;
src/radeon_drm_queue.c +9 -2
@@ -57,7 +57,7 @@ static uintptr_t radeon_drm_queue_seq;/* * Handle a DRM event */ -void +static void radeon_drm_queue_handler (int fd,unsigned int frame,unsigned int sec,unsigned int usec,void *user_ptr) {
@@ -181,8 +181,15 @@ radeon_drm_abort_id(uint64_t id)* Initialize the DRM event queue */ void -radeon_drm_queue_init () +radeon_drm_queue_init (ScrnInfoPtr scrn) { +RADEONInfoPtr info =RADEONPTR (scrn); +drmmode_ptr drmmode = &info->drmmode; + + drmmode->event_context.version =2 ; + drmmode->event_context.vblank_handler = radeon_drm_queue_handler; + drmmode->event_context.page_flip_handler = radeon_drm_queue_handler; +if (radeon_drm_queue_refcnt++)return ;
src/radeon_drm_queue.h +1 -4
@@ -40,9 +40,6 @@ typedef void (*radeon_drm_handler_proc)(xf86CrtcPtr crtc, uint32_t seq, uint64_t usec, void *data);typedef void (*radeon_drm_abort_proc )(xf86CrtcPtr crtc,void *data); -void radeon_drm_queue_handler (int fd,unsigned int frame, -unsigned int tv_sec,unsigned int tv_usec, -void *user_ptr); uintptr_t radeon_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client, uint64_t id, void *data, radeon_drm_handler_proc handler,
@@ -50,7 +47,7 @@ uintptr_t radeon_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client,void radeon_drm_abort_client (ClientPtr client);void radeon_drm_abort_entry (uintptr_t seq);void radeon_drm_abort_id (uint64_t id); -void radeon_drm_queue_init (); +void radeon_drm_queue_init (ScrnInfoPtr scrn);void radeon_drm_queue_close (ScrnInfoPtr scrn);#endif /* _RADEON_DRM_QUEUE_H_ */
src/radeon_kms.c +1 -1
@@ -1789,7 +1789,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)return FALSE; } -radeon_drm_queue_init (); +radeon_drm_queue_init (pScrn); info->allowColorTiling2D = FALSE;
Signature · 6 lines
2.18.0 _______________________________________________ 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): 20180816161942.2538-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH 2/5 Add radeon_drm_wait_pending_flip function
From: Michel Dänzer <[email protected]>
Replacing the drmmode_crtc_wait_pending_event macro.
(Ported from amdgpu commit 6029794e8a35417faf825491a89b85f713c77fc1)
--- src/drmmode_display.c | 21 ++++----------------- src/radeon_drm_queue.c | 13 +++++++++++++ src/radeon_drm_queue.h | 1 + 3 files changed, 18 insertions(+), 17 deletions(-)
src/drmmode_display.c +4 -17
@@ -100,13 +100,6 @@ RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name) } -/* 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,
@@ -306,8 +299,7 @@ drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode)if (drmmode_crtc->dpms_mode == DPMSModeOn && mode != DPMSModeOn) {uint32_t seq; -drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, - drmmode_crtc->flip_pending); +radeon_drm_wait_pending_flip (crtc);/* * On->Off transition: record the last vblank time,
@@ -918,8 +910,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, goto done; } -drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, - drmmode_crtc->flip_pending); +radeon_drm_wait_pending_flip (crtc);if (!drmmode_set_mode (crtc, fb, mode, x, y)) goto done;
@@ -1772,14 +1763,11 @@ drmmode_output_set_tear_free(RADEONEntPtr pRADEONEnt, drmmode_output->tear_free = tear_free;if (crtc) { -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; -/* Wait for pending flips before drmmode_set_mode_major calls * drmmode_crtc_update_tear_free, to prevent a nested * drmHandleEvent call, which would hang */ -drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, - drmmode_crtc->flip_pending); +radeon_drm_wait_pending_flip (crtc);drmmode_set_mode_major (crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y); }
@@ -3370,8 +3358,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,radeon_cs_flush_indirect (crtc->scrn);if (drmmode_crtc->scanout_update_pending) { -drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, - drmmode_crtc->flip_pending); +radeon_drm_wait_pending_flip (crtc);radeon_drm_abort_entry (drmmode_crtc->scanout_update_pending); drmmode_crtc->scanout_update_pending =0 ; }
src/radeon_drm_queue.c +13 -0
@@ -177,6 +177,19 @@ radeon_drm_abort_id(uint64_t id) } } +/* +* Wait for pending page flip on given CRTC to complete +*/ +void radeon_drm_wait_pending_flip (xf86CrtcPtr crtc) +{ +drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; +RADEONEntPtr pRADEONEnt =RADEONEntPriv (crtc->scrn); +drmmode_ptr drmmode = drmmode_crtc->drmmode; + +while (drmmode_crtc->flip_pending && +drmHandleEvent (pRADEONEnt->fd, &drmmode->event_context) >0 ); +} +/* * Initialize the DRM event queue */
src/radeon_drm_queue.h +1 -0
@@ -47,6 +47,7 @@ uintptr_t radeon_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client,void radeon_drm_abort_client (ClientPtr client);void radeon_drm_abort_entry (uintptr_t seq);void radeon_drm_abort_id (uint64_t id); +void radeon_drm_wait_pending_flip (xf86CrtcPtr crtc);void radeon_drm_queue_init (ScrnInfoPtr scrn);void radeon_drm_queue_close (ScrnInfoPtr scrn);
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/5 Add radeon_drm_handle_event wrapper for drmHandleEvent
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Instead of processing DRM events directly from drmHandleEvent's callbacks, there are three phases:
1. drmHandleEvent is called, and signalled events are re-queued to _signalled lists from its callbacks.
2. Signalled page flip completion events are processed.
3. Signalled vblank events are processed.
This should make sure that we never call drmHandleEvent from one of its callbacks, which would usually result in blocking forever.
(Ported from amdgpu commit 739181c8d3334ff14b5a607895dfdeb29b0d9020)
--- src/drmmode_display.c | 13 ++--- src/radeon_drm_queue.c | 110 ++++++++++++++++++++++++++++++++--------- src/radeon_drm_queue.h | 1 + src/radeon_present.c | 2 +- 4 files changed, 96 insertions(+), 30 deletions(-)
src/drmmode_display.c +7 -6
@@ -2587,9 +2587,8 @@ static void drm_wakeup_handler(pointer data, int err, pointer p) #endif { - ScrnInfoPtr scrn = data; - RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn); - RADEONInfoPtr info = RADEONPTR(scrn); + drmmode_ptr drmmode = data; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(drmmode->scrn); #if !HAVE_NOTIFY_FD fd_set *read_mask = p;
@@ -2597,7 +2596,7 @@ drm_wakeup_handler(pointer data, int err, pointer p) if (err >= 0 && FD_ISSET(pRADEONEnt->fd, read_mask))#endif { -drmHandleEvent (pRADEONEnt->fd, &info->drmmode.event_context); +radeon_drm_handle_event (pRADEONEnt->fd, &drmmode->event_context); } }
@@ -2747,11 +2746,13 @@ void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode) info->drmmode_inited = TRUE;if (pRADEONEnt->fd_wakeup_registered != serverGeneration) {#if HAVE_NOTIFY_FD -SetNotifyFd (pRADEONEnt->fd, drm_notify_fd,X_NOTIFY_READ , pScrn); +SetNotifyFd (pRADEONEnt->fd, drm_notify_fd,X_NOTIFY_READ , + &info->drmmode);#else AddGeneralSocket (pRADEONEnt->fd);RegisterBlockAndWakeupHandlers ((BlockHandlerProcPtr )NoopDDA, - drm_wakeup_handler, pScrn); + drm_wakeup_handler, + &info->drmmode);#endif pRADEONEnt->fd_wakeup_registered = serverGeneration; pRADEONEnt->fd_wakeup_ref =1 ;
src/radeon_drm_queue.c +87 -23
158 lines not on this page · raw message
src/radeon_drm_queue.h +1 -0
@@ -47,6 +47,7 @@ uintptr_t radeon_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client,void radeon_drm_abort_client (ClientPtr client);void radeon_drm_abort_entry (uintptr_t seq);void radeon_drm_abort_id (uint64_t id); +int radeon_drm_handle_event (int fd,drmEventContext *event_context);void radeon_drm_wait_pending_flip (xf86CrtcPtr crtc);void radeon_drm_queue_init (ScrnInfoPtr scrn);void radeon_drm_queue_close (ScrnInfoPtr scrn);
src/radeon_present.c +1 -1
@@ -110,7 +110,7 @@ radeon_present_flush_drm_events(ScreenPtr screen)if (r <=0 )return 0 ; -return drmHandleEvent (pRADEONEnt->fd, &drmmode->event_context) >=0 ; +return radeon_drm_handle_event (pRADEONEnt->fd, &drmmode->event_context) >=0 ; }/*
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/5 Add radeon_drm_wait_pending_flip function
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Replacing the drmmode_crtc_wait_pending_event macro.
(Ported from amdgpu commit 6029794e8a35417faf825491a89b85f713c77fc1)
--- src/drmmode_display.c | 18 ++++++++++++------ src/drmmode_display.h | 4 ++++ src/radeon_drm_queue.c | 41 +++++++++++++++++++++++++++++++++++++++-- src/radeon_drm_queue.h | 1 + 4 files changed, 56 insertions(+), 8 deletions(-)
src/drmmode_display.c +12 -6
@@ -324,6 +324,9 @@ drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode) nominal_frame_rate /= pix_in_frame; drmmode_crtc->dpms_last_fps = nominal_frame_rate; } + + drmmode_crtc->dpms_mode = mode; +radeon_drm_queue_handle_deferred (crtc); }else if (drmmode_crtc->dpms_mode != DPMSModeOn && mode == DPMSModeOn) {/* * Off->On transition: calculate and accumulate the
@@ -341,8 +344,9 @@ drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode) drmmode_crtc->interpolated_vblanks += delta_seq; } + + drmmode_crtc->dpms_mode = DPMSModeOn; } - drmmode_crtc->dpms_mode = mode; } static void
@@ -972,6 +976,7 @@ done: } } +radeon_drm_queue_handle_deferred (crtc);return ret; }
@@ -1763,11 +1768,6 @@ drmmode_output_set_tear_free(RADEONEntPtr pRADEONEnt, drmmode_output->tear_free = tear_free;if (crtc) { -/* Wait for pending flips before drmmode_set_mode_major calls -* drmmode_crtc_update_tear_free, to prevent a nested -* drmHandleEvent call, which would hang -*/ -radeon_drm_wait_pending_flip (crtc);drmmode_set_mode_major (crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y); }
@@ -3278,6 +3278,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,drmmode_crtc_private_ptr drmmode_crtc = config->crtc[0 ]->driver_private;uint32_t flip_flags = flip_sync ==FLIP_ASYNC ?DRM_MODE_PAGE_FLIP_ASYNC :0 ;drmmode_flipdata_ptr flipdata; +Bool handle_deferred = FALSE;uintptr_t drm_queue_seq =0 ;struct drmmode_fb *fb;int i =0 ;
@@ -3360,6 +3361,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,if (drmmode_crtc->scanout_update_pending) {radeon_drm_wait_pending_flip (crtc); + handle_deferred = TRUE;radeon_drm_abort_entry (drmmode_crtc->scanout_update_pending); drmmode_crtc->scanout_update_pending =0 ; }
@@ -3395,6 +3397,8 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, drm_queue_seq =0 ; } +if (handle_deferred) +radeon_drm_queue_handle_deferred (ref_crtc);if (flipdata->flip_count >0 )return TRUE;
@@ -3414,5 +3418,7 @@ error:xf86DrvMsg (scrn->scrnIndex,X_WARNING ,"Page flip failed: %s\n" ,strerror (errno)); +if (handle_deferred) +radeon_drm_queue_handle_deferred (ref_crtc);return FALSE; }
src/drmmode_display.h +4 -0
@@ -103,6 +103,10 @@ typedef struct {* modeset) */ Bool need_modeset; +/* For keeping track of nested calls to drm_wait_pending_flip / +* drm_queue_handle_deferred +*/ +int wait_flip_nesting_level;/* A flip to this FB is pending for this CRTC */ struct drmmode_fb *flip_pending;/* The FB currently being scanned out by this CRTC, if any */
src/radeon_drm_queue.c +39 -2
65 lines not on this page · raw message
src/radeon_drm_queue.h +1 -0
@@ -40,6 +40,7 @@ typedef void (*radeon_drm_handler_proc)(xf86CrtcPtr crtc, uint32_t seq, uint64_t usec, void *data);typedef void (*radeon_drm_abort_proc )(xf86CrtcPtr crtc,void *data); +void radeon_drm_queue_handle_deferred (xf86CrtcPtr crtc); uintptr_t radeon_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client, uint64_t id, void *data, radeon_drm_handler_proc handler,
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/5 Remove drmmode_crtc_private_rec::present_vblank_* related code
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Not needed anymore with the more robust mechanisms for preventing nested drmHandleEvent calls introduced in the previous changes.
(Ported from amdgpu commit 85cd8eef0cbed7b409b07f58d76dacd34aa3ddea)
--- src/drmmode_display.h | 8 -------- src/radeon_kms.c | 9 --------- src/radeon_present.c | 34 +++------------------------------- 3 files changed, 3 insertions(+), 48 deletions(-)
src/drmmode_display.h +0 -8
@@ -111,14 +111,6 @@ 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 {
src/radeon_kms.c +0 -9
@@ -541,15 +541,6 @@ radeon_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc, uint64_t usec,drmmode_fb_reference (pRADEONEnt->fd, &drmmode_crtc->fb, drmmode_crtc->flip_pending);radeon_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 }
src/radeon_present.c +3 -31
@@ -52,7 +52,6 @@ static present_screen_info_rec radeon_present_screen_info;struct radeon_present_vblank_event {uint64_t event_id; -Bool vblank_for_flip;Bool unflip; };
@@ -120,26 +119,9 @@ static void radeon_present_vblank_handler(xf86CrtcPtr crtc, unsigned int msc, uint64_t usec, void *data) { - drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; struct radeon_present_vblank_event *event = data; -if (event->vblank_for_flip && - drmmode_crtc->tear_free && - drmmode_crtc->scanout_update_pending) { -if (drmmode_crtc->present_vblank_event_id !=0 ) { -xf86DrvMsg (crtc->scrn->scrnIndex,X_WARNING , -"Need to handle previously deferred vblank event\n" ); -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 = event->event_id; - drmmode_crtc->present_vblank_msc = msc; - drmmode_crtc->present_vblank_usec = usec; - }else -present_event_notify (event->event_id, usec, msc); - +present_event_notify (event->event_id, usec, msc);free (event); }
@@ -162,7 +144,6 @@ static int radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) { xf86CrtcPtr xf86_crtc = crtc->devPrivate; -drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;ScreenPtr screen = crtc->pScreen;struct radeon_present_vblank_event *event;uintptr_t drm_queue_seq;
@@ -171,8 +152,6 @@ radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)if (!event)return BadAlloc; event->event_id = event_id; - event->vblank_for_flip = drmmode_crtc->present_flip_expected; - drmmode_crtc->present_flip_expected = FALSE; drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc, RADEON_DRM_QUEUE_CLIENT_DEFAULT,
@@ -272,7 +251,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, Bool sync_flip) {xf86CrtcPtr xf86_crtc = crtc->devPrivate; -drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;ScreenPtr screen = window->drawable.pScreen;ScrnInfoPtr scrn = xf86_crtc->scrn;xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (scrn);
@@ -281,8 +259,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,int num_crtcs_on;int i; - drmmode_crtc->present_flip_expected = FALSE; -if (!scrn->vtSema)return FALSE;
@@ -313,7 +289,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,if (num_crtcs_on ==0 )return FALSE; - drmmode_crtc->present_flip_expected = TRUE;return TRUE; }
@@ -354,7 +329,6 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc, PixmapPtr pixmap, Bool sync_flip) {xf86CrtcPtr xf86_crtc = crtc->devPrivate; -drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;ScreenPtr screen = crtc->pScreen;ScrnInfoPtr scrn = xf86_crtc->scrn;RADEONInfoPtr info =RADEONPTR (scrn);
@@ -362,11 +336,11 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,Bool ret = FALSE;if (!radeon_present_check_flip (crtc, screen->root, pixmap, sync_flip)) - goto out; +return ret; event =calloc (1 ,sizeof (struct radeon_present_vblank_event ));if (!event) - goto out; +return ret; event->event_id = event_id;
@@ -383,8 +357,6 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,else info->drmmode.present_flipping = TRUE; - out: - drmmode_crtc->present_flip_expected = FALSE;return ret; }
Signature · 6 lines
2.18.0 _______________________________________________ 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): 20180816161942.2538-5-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Alex Deucher
Acked-byRe: [PATCH xf86-video-ati 5/5] Remove drmmode_crtc_private_rec::present_vblank_* related code
Quoted 9 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
Not needed anymore with the more robust mechanisms for preventing nested drmHandleEvent calls introduced in the previous changes.
(Ported from amdgpu commit
85cd8eef0cbed7b409b07f58d76dacd34aa3ddea)Signed-off-by Michel Dänzer <[email protected]>
Series is:
Quoted 161 lines
--- src/drmmode_display.h | 8 -------- src/radeon_kms.c | 9 --------- src/radeon_present.c | 34 +++------------------------------- 3 files changed, 3 insertions(+), 48 deletions(-)src/drmmode_display.h +0
-8@@ -111,14 +111,6 @@ 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 {src/radeon_kms.c +0
-9@@ -541,15 +541,6 @@ radeon_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc, uint64_t usec,drmmode_fb_reference (pRADEONEnt->fd, &drmmode_crtc->fb, drmmode_crtc->flip_pending);radeon_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 }src/radeon_present.c +3
-32@@ -52,7 +52,6 @@ static present_screen_info_rec radeon_present_screen_info;struct radeon_present_vblank_event {uint64_t event_id; -Bool vblank_for_flip;Bool unflip; };@@ -120,26 +119,9 @@ static void radeon_present_vblank_handler(xf86CrtcPtr crtc, unsigned int msc, uint64_t usec, void *data) { - drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; struct radeon_present_vblank_event *event = data; -if (event->vblank_for_flip && - drmmode_crtc->tear_free && - drmmode_crtc->scanout_update_pending) { -if (drmmode_crtc->present_vblank_event_id !=0 ) { -xf86DrvMsg (crtc->scrn->scrnIndex,X_WARNING , -"Need to handle previously deferred vblank event\n" ); -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 = event->event_id; - drmmode_crtc->present_vblank_msc = msc; - drmmode_crtc->present_vblank_usec = usec; - }else -present_event_notify (event->event_id, usec, msc); - +present_event_notify (event->event_id, usec, msc);free (event); }@@ -162,7 +144,6 @@ static int radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) { xf86CrtcPtr xf86_crtc = crtc->devPrivate; -drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;ScreenPtr screen = crtc->pScreen;struct radeon_present_vblank_event *event;uintptr_t drm_queue_seq;@@ -171,8 +152,6 @@ radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)if (!event)return BadAlloc; event->event_id = event_id; - event->vblank_for_flip = drmmode_crtc->present_flip_expected; - drmmode_crtc->present_flip_expected = FALSE; drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc, RADEON_DRM_QUEUE_CLIENT_DEFAULT,@@ -272,7 +251,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, Bool sync_flip) {xf86CrtcPtr xf86_crtc = crtc->devPrivate; -drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;ScreenPtr screen = window->drawable.pScreen;ScrnInfoPtr scrn = xf86_crtc->scrn;xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (scrn);@@ -281,8 +259,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,int num_crtcs_on;int i; - drmmode_crtc->present_flip_expected = FALSE; -if (!scrn->vtSema)return FALSE;@@ -313,7 +289,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,if (num_crtcs_on ==0 )return FALSE; - drmmode_crtc->present_flip_expected = TRUE;return TRUE; }@@ -354,7 +329,6 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc, PixmapPtr pixmap, Bool sync_flip) {xf86CrtcPtr xf86_crtc = crtc->devPrivate; -drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;ScreenPtr screen = crtc->pScreen;ScrnInfoPtr scrn = xf86_crtc->scrn;RADEONInfoPtr info =RADEONPTR (scrn);@@ -362,11 +336,11 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,Bool ret = FALSE;if (!radeon_present_check_flip (crtc, screen->root, pixmap, sync_flip)) - goto out; +return ret; event =calloc (1 ,sizeof (struct radeon_present_vblank_event ));if (!event) - goto out; +return ret; event->event_id = event_id;@@ -383,8 +357,6 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,else info->drmmode.present_flipping = TRUE; - out: - drmmode_crtc->present_flip_expected = FALSE;return ret; } --2.18.0
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