diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2018-08-16 17:14:42 +0200 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2018-08-17 09:57:33 +0200 |
commit | ecdf0b7ec9378bc386ce8276f16fb16d09f72812 (patch) | |
tree | 3f16b9671334c3ad2e44fb1b789895cc6764230a | |
parent | 824189b3da9edc33e1a4f5c6130a043da73c1a4c (diff) |
Move DRM event queue related initialization to radeon_drm_queue_init
And make radeon_drm_queue_handler not directly accessible outside of
radeon_drm_queue.c.
(Ported from amdgpu commit 0148283984c77f7a6e97026edc3093497547e0a4)
Acked-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 4 | ||||
-rw-r--r-- | src/radeon_dri2.c | 14 | ||||
-rw-r--r-- | src/radeon_drm_queue.c | 11 | ||||
-rw-r--r-- | src/radeon_drm_queue.h | 5 | ||||
-rw-r--r-- | src/radeon_kms.c | 2 |
5 files changed, 19 insertions, 17 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 68d6254d..385c5b3e 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -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); diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c index c36e06f2..4d12fc09 100644 --- a/src/radeon_dri2.c +++ b/src/radeon_dri2.c @@ -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; diff --git a/src/radeon_drm_queue.c b/src/radeon_drm_queue.c index ac775f86..bff010fa 100644 --- a/src/radeon_drm_queue.c +++ b/src/radeon_drm_queue.c @@ -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; diff --git a/src/radeon_drm_queue.h b/src/radeon_drm_queue.h index c3e2076d..b6aab37c 100644 --- a/src/radeon_drm_queue.h +++ b/src/radeon_drm_queue.h @@ -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_ */ diff --git a/src/radeon_kms.c b/src/radeon_kms.c index 36840ad3..809d2446 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -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; |