present: Refactor present_vblank_init helper ouf of _vblank_create
Allows embedding into another struct. Acked-by: Olivier Fourdan <ofourdan@redhat.com>
This commit is contained in:
parent
35f173ddb6
commit
61cc5d96ed
|
@ -448,6 +448,25 @@ present_screen_priv_init(ScreenPtr screen);
|
||||||
void
|
void
|
||||||
present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_t ust, uint64_t crtc_msc);
|
present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_t ust, uint64_t crtc_msc);
|
||||||
|
|
||||||
|
Bool
|
||||||
|
present_vblank_init(present_vblank_ptr vblank,
|
||||||
|
WindowPtr window,
|
||||||
|
PixmapPtr pixmap,
|
||||||
|
CARD32 serial,
|
||||||
|
RegionPtr valid,
|
||||||
|
RegionPtr update,
|
||||||
|
int16_t x_off,
|
||||||
|
int16_t y_off,
|
||||||
|
RRCrtcPtr target_crtc,
|
||||||
|
SyncFence *wait_fence,
|
||||||
|
SyncFence *idle_fence,
|
||||||
|
uint32_t options,
|
||||||
|
const uint32_t capabilities,
|
||||||
|
present_notify_ptr notifies,
|
||||||
|
int num_notifies,
|
||||||
|
uint64_t target_msc,
|
||||||
|
uint64_t crtc_msc);
|
||||||
|
|
||||||
present_vblank_ptr
|
present_vblank_ptr
|
||||||
present_vblank_create(WindowPtr window,
|
present_vblank_create(WindowPtr window,
|
||||||
PixmapPtr pixmap,
|
PixmapPtr pixmap,
|
||||||
|
|
|
@ -38,38 +38,39 @@ present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
present_vblank_ptr
|
/* The memory vblank points to must be 0-initialized before calling this function.
|
||||||
present_vblank_create(WindowPtr window,
|
*
|
||||||
PixmapPtr pixmap,
|
* If this function returns FALSE, present_vblank_destroy must be called to clean
|
||||||
CARD32 serial,
|
* up.
|
||||||
RegionPtr valid,
|
*/
|
||||||
RegionPtr update,
|
Bool
|
||||||
int16_t x_off,
|
present_vblank_init(present_vblank_ptr vblank,
|
||||||
int16_t y_off,
|
WindowPtr window,
|
||||||
RRCrtcPtr target_crtc,
|
PixmapPtr pixmap,
|
||||||
SyncFence *wait_fence,
|
CARD32 serial,
|
||||||
SyncFence *idle_fence,
|
RegionPtr valid,
|
||||||
uint32_t options,
|
RegionPtr update,
|
||||||
const uint32_t capabilities,
|
int16_t x_off,
|
||||||
present_notify_ptr notifies,
|
int16_t y_off,
|
||||||
int num_notifies,
|
RRCrtcPtr target_crtc,
|
||||||
uint64_t target_msc,
|
SyncFence *wait_fence,
|
||||||
uint64_t crtc_msc)
|
SyncFence *idle_fence,
|
||||||
|
uint32_t options,
|
||||||
|
const uint32_t capabilities,
|
||||||
|
present_notify_ptr notifies,
|
||||||
|
int num_notifies,
|
||||||
|
uint64_t target_msc,
|
||||||
|
uint64_t crtc_msc)
|
||||||
{
|
{
|
||||||
ScreenPtr screen = window->drawable.pScreen;
|
ScreenPtr screen = window->drawable.pScreen;
|
||||||
present_window_priv_ptr window_priv = present_get_window_priv(window, TRUE);
|
present_window_priv_ptr window_priv = present_get_window_priv(window, TRUE);
|
||||||
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
|
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
|
||||||
present_vblank_ptr vblank;
|
|
||||||
PresentFlipReason reason = PRESENT_FLIP_REASON_UNKNOWN;
|
PresentFlipReason reason = PRESENT_FLIP_REASON_UNKNOWN;
|
||||||
|
|
||||||
if (target_crtc) {
|
if (target_crtc) {
|
||||||
screen_priv = present_screen_priv(target_crtc->pScreen);
|
screen_priv = present_screen_priv(target_crtc->pScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
vblank = calloc (1, sizeof (present_vblank_rec));
|
|
||||||
if (!vblank)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
xorg_list_append(&vblank->window_list, &window_priv->vblank);
|
xorg_list_append(&vblank->window_list, &window_priv->vblank);
|
||||||
xorg_list_init(&vblank->event_queue);
|
xorg_list_init(&vblank->event_queue);
|
||||||
|
|
||||||
|
@ -140,10 +141,42 @@ present_vblank_create(WindowPtr window,
|
||||||
vblank->event_id, vblank, target_msc,
|
vblank->event_id, vblank, target_msc,
|
||||||
vblank->pixmap->drawable.id, vblank->window->drawable.id,
|
vblank->pixmap->drawable.id, vblank->window->drawable.id,
|
||||||
target_crtc, vblank->flip, vblank->sync_flip, vblank->serial));
|
target_crtc, vblank->flip, vblank->sync_flip, vblank->serial));
|
||||||
return vblank;
|
return TRUE;
|
||||||
|
|
||||||
no_mem:
|
no_mem:
|
||||||
vblank->notifies = NULL;
|
vblank->notifies = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
present_vblank_ptr
|
||||||
|
present_vblank_create(WindowPtr window,
|
||||||
|
PixmapPtr pixmap,
|
||||||
|
CARD32 serial,
|
||||||
|
RegionPtr valid,
|
||||||
|
RegionPtr update,
|
||||||
|
int16_t x_off,
|
||||||
|
int16_t y_off,
|
||||||
|
RRCrtcPtr target_crtc,
|
||||||
|
SyncFence *wait_fence,
|
||||||
|
SyncFence *idle_fence,
|
||||||
|
uint32_t options,
|
||||||
|
const uint32_t capabilities,
|
||||||
|
present_notify_ptr notifies,
|
||||||
|
int num_notifies,
|
||||||
|
uint64_t target_msc,
|
||||||
|
uint64_t crtc_msc)
|
||||||
|
{
|
||||||
|
present_vblank_ptr vblank = calloc(1, sizeof(present_vblank_rec));
|
||||||
|
|
||||||
|
if (!vblank)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (present_vblank_init(vblank, window, pixmap, serial, valid, update,
|
||||||
|
x_off, y_off, target_crtc, wait_fence, idle_fence,
|
||||||
|
options, capabilities, notifies, num_notifies,
|
||||||
|
target_msc, crtc_msc))
|
||||||
|
return vblank;
|
||||||
|
|
||||||
present_vblank_destroy(vblank);
|
present_vblank_destroy(vblank);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user