diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2018-07-20 16:37:05 +0200 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2018-08-16 17:11:23 +0200 |
commit | 0148283984c77f7a6e97026edc3093497547e0a4 (patch) | |
tree | 3f33bebb627b6704921ad5103f2e2bcb5be1a84b /src | |
parent | 7f65a8c9e03bddf2378aaa928460632ed6b1a688 (diff) |
Move DRM event queue related initialization to amdgpu_drm_queue_init
And make amdgpu_drm_queue_handler not directly accessible outside of
amdgpu_drm_queue.c.
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/amdgpu_dri2.c | 14 | ||||
-rw-r--r-- | src/amdgpu_drm_queue.c | 11 | ||||
-rw-r--r-- | src/amdgpu_drm_queue.h | 5 | ||||
-rw-r--r-- | src/amdgpu_kms.c | 2 | ||||
-rw-r--r-- | src/drmmode_display.c | 4 |
5 files changed, 19 insertions, 17 deletions
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c index a9238e5..96b2d17 100644 --- a/src/amdgpu_dri2.c +++ b/src/amdgpu_dri2.c @@ -873,13 +873,15 @@ CARD32 amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data) scrn = crtc->scrn; pAMDGPUEnt = AMDGPUEntPriv(scrn); + drmmode_crtc = event_info->crtc->driver_private; ret = drmmode_get_current_ust(pAMDGPUEnt->fd, &drm_now); if (ret) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "%s cannot get current time\n", __func__); if (event_info->drm_queue_seq) - amdgpu_drm_queue_handler(pAMDGPUEnt->fd, 0, 0, 0, - (void*)event_info->drm_queue_seq); + drmmode_crtc->drmmode->event_context. + vblank_handler(pAMDGPUEnt->fd, 0, 0, 0, + (void*)event_info->drm_queue_seq); else amdgpu_dri2_frame_event_handler(crtc, 0, 0, data); return 0; @@ -888,15 +890,15 @@ CARD32 amdgpu_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) - amdgpu_drm_queue_handler(pAMDGPUEnt->fd, frame, drm_now / 1000000, - drm_now % 1000000, - (void*)event_info->drm_queue_seq); + drmmode_crtc->drmmode->event_context. + vblank_handler(pAMDGPUEnt->fd, frame, drm_now / 1000000, + drm_now % 1000000, + (void*)event_info->drm_queue_seq); else amdgpu_dri2_frame_event_handler(crtc, frame, drm_now, data); return 0; diff --git a/src/amdgpu_drm_queue.c b/src/amdgpu_drm_queue.c index d1456ca..dfe0148 100644 --- a/src/amdgpu_drm_queue.c +++ b/src/amdgpu_drm_queue.c @@ -57,7 +57,7 @@ static uintptr_t amdgpu_drm_queue_seq; /* * Handle a DRM event */ -void +static void amdgpu_drm_queue_handler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *user_ptr) { @@ -181,8 +181,15 @@ amdgpu_drm_abort_id(uint64_t id) * Initialize the DRM event queue */ void -amdgpu_drm_queue_init() +amdgpu_drm_queue_init(ScrnInfoPtr scrn) { + AMDGPUInfoPtr info = AMDGPUPTR(scrn); + drmmode_ptr drmmode = &info->drmmode; + + drmmode->event_context.version = 2; + drmmode->event_context.vblank_handler = amdgpu_drm_queue_handler; + drmmode->event_context.page_flip_handler = amdgpu_drm_queue_handler; + if (amdgpu_drm_queue_refcnt++) return; diff --git a/src/amdgpu_drm_queue.h b/src/amdgpu_drm_queue.h index 36ee900..328b5e6 100644 --- a/src/amdgpu_drm_queue.h +++ b/src/amdgpu_drm_queue.h @@ -42,9 +42,6 @@ typedef void (*amdgpu_drm_handler_proc)(xf86CrtcPtr crtc, uint32_t seq, uint64_t usec, void *data); typedef void (*amdgpu_drm_abort_proc)(xf86CrtcPtr crtc, void *data); -void amdgpu_drm_queue_handler(int fd, unsigned int frame, - unsigned int tv_sec, unsigned int tv_usec, - void *user_ptr); uintptr_t amdgpu_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client, uint64_t id, void *data, amdgpu_drm_handler_proc handler, @@ -52,7 +49,7 @@ uintptr_t amdgpu_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client, void amdgpu_drm_abort_client(ClientPtr client); void amdgpu_drm_abort_entry(uintptr_t seq); void amdgpu_drm_abort_id(uint64_t id); -void amdgpu_drm_queue_init(); +void amdgpu_drm_queue_init(ScrnInfoPtr scrn); void amdgpu_drm_queue_close(ScrnInfoPtr scrn); #endif /* _AMDGPU_DRM_QUEUE_H_ */ diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c index 9807e08..82d1dfa 100644 --- a/src/amdgpu_kms.c +++ b/src/amdgpu_kms.c @@ -1403,7 +1403,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags) if (!AMDGPUPreInitAccel_KMS(pScrn)) return FALSE; - amdgpu_drm_queue_init(); + amdgpu_drm_queue_init(pScrn); /* don't enable tiling if accel is not enabled */ if (info->use_glamor) { diff --git a/src/drmmode_display.c b/src/drmmode_display.c index e58e15d..e1b6b72 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -3319,10 +3319,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 = amdgpu_drm_queue_handler; - drmmode->event_context.page_flip_handler = amdgpu_drm_queue_handler; - pAMDGPUEnt->has_page_flip_target = drmmode_probe_page_flip_target(pAMDGPUEnt); drmModeFreeResources(mode_res); |