present: Add flip mode API hook for present_pixmap

Make present_pixmap a common function callable by any
flip mode.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Roman Gilg 2018-03-13 16:00:39 +01:00 committed by Adam Jackson
parent 679ffbf5f3
commit 1db7cf0429
3 changed files with 119 additions and 60 deletions

View File

@ -108,3 +108,60 @@ present_set_tree_pixmap(WindowPtr window,
return;
TraverseTree(window, present_set_tree_pixmap_visit, &visit);
}
int
present_pixmap(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,
uint64_t window_msc,
uint64_t divisor,
uint64_t remainder,
present_notify_ptr notifies,
int num_notifies)
{
ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
return screen_priv->present_pixmap(window,
pixmap,
serial,
valid,
update,
x_off,
y_off,
target_crtc,
wait_fence,
idle_fence,
options,
window_msc,
divisor,
remainder,
notifies,
num_notifies);
}
int
present_notify_msc(WindowPtr window,
CARD32 serial,
uint64_t target_msc,
uint64_t divisor,
uint64_t remainder)
{
return present_pixmap(window,
NULL,
serial,
NULL, NULL,
0, 0,
NULL,
NULL, NULL,
divisor == 0 ? PresentOptionAsync : 0,
target_msc, divisor, remainder, NULL, 0);
}

View File

@ -98,6 +98,23 @@ typedef Bool (*present_priv_check_flip_ptr)(RRCrtcPtr crtc,
PresentFlipReason *reason);
typedef void (*present_priv_check_flip_window_ptr)(WindowPtr window);
typedef int (*present_priv_pixmap_ptr)(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,
uint64_t window_msc,
uint64_t divisor,
uint64_t remainder,
present_notify_ptr notifies,
int num_notifies);
typedef void (*present_priv_create_event_id_ptr)(present_vblank_ptr vblank);
typedef int (*present_priv_queue_vblank_ptr)(ScreenPtr screen,
@ -132,6 +149,7 @@ typedef struct present_screen_priv {
present_priv_check_flip_ptr check_flip;
present_priv_check_flip_window_ptr check_flip_window;
present_priv_pixmap_ptr present_pixmap;
present_priv_create_event_id_ptr create_event_id;
present_priv_queue_vblank_ptr queue_vblank;
@ -219,6 +237,31 @@ present_set_tree_pixmap(WindowPtr window,
PixmapPtr expected,
PixmapPtr pixmap);
int
present_pixmap(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,
uint64_t target_msc,
uint64_t divisor,
uint64_t remainder,
present_notify_ptr notifies,
int num_notifies);
int
present_notify_msc(WindowPtr window,
CARD32 serial,
uint64_t target_msc,
uint64_t divisor,
uint64_t remainder);
/*
* present_event.c
*/
@ -334,31 +377,6 @@ sproc_present_dispatch(ClientPtr client);
/*
* present_scmd.c
*/
int
present_pixmap(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,
uint64_t target_msc,
uint64_t divisor,
uint64_t remainder,
present_notify_ptr notifies,
int num_notifies);
int
present_notify_msc(WindowPtr window,
CARD32 serial,
uint64_t target_msc,
uint64_t divisor,
uint64_t remainder);
void
present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc);

View File

@ -662,23 +662,23 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
present_execute_post(vblank, ust, crtc_msc);
}
int
present_pixmap(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,
uint64_t window_msc,
uint64_t divisor,
uint64_t remainder,
present_notify_ptr notifies,
int num_notifies)
static int
present_scmd_pixmap(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,
uint64_t window_msc,
uint64_t divisor,
uint64_t remainder,
present_notify_ptr notifies,
int num_notifies)
{
uint64_t ust = 0;
uint64_t target_msc;
@ -834,24 +834,6 @@ present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64
}
}
int
present_notify_msc(WindowPtr window,
CARD32 serial,
uint64_t target_msc,
uint64_t divisor,
uint64_t remainder)
{
return present_pixmap(window,
NULL,
serial,
NULL, NULL,
0, 0,
NULL,
NULL, NULL,
divisor == 0 ? PresentOptionAsync : 0,
target_msc, divisor, remainder, NULL, 0);
}
void
present_flip_destroy(ScreenPtr screen)
{
@ -871,7 +853,9 @@ present_scmd_init_mode_hooks(present_screen_priv_ptr screen_priv)
screen_priv->check_flip = &present_check_flip;
screen_priv->check_flip_window = &present_check_flip_window;
screen_priv->present_pixmap = &present_scmd_pixmap;
screen_priv->create_event_id = &present_scmd_create_event_id;
screen_priv->queue_vblank = &present_queue_vblank;
screen_priv->flush = &present_flush;
screen_priv->re_execute = &present_re_execute;