mirror of
https://github.com/X11Libre/xf86-video-ati.git
synced 2026-03-24 01:24:43 +00:00
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>
This commit is contained in:
committed by
Michel Dänzer
parent
824189b3da
commit
ecdf0b7ec9
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user