present: Preliminary internal flip mode API

Add some basic function hooks to our future present-internal flip mode API,
that will allow us to share functionality in between modes and move more code
in separate files.

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:35 +01:00 committed by Adam Jackson
parent dda7efec36
commit c5c50c6db1
3 changed files with 45 additions and 6 deletions

View File

@ -85,6 +85,21 @@ struct present_vblank {
Bool has_suboptimal; /* whether client can support SuboptimalCopy mode */
};
/*
* Mode hooks
*/
typedef Bool (*present_priv_check_flip_ptr)(RRCrtcPtr crtc,
WindowPtr window,
PixmapPtr pixmap,
Bool sync_flip,
RegionPtr valid,
int16_t x_off,
int16_t y_off,
PresentFlipReason *reason);
typedef void (*present_priv_check_flip_window_ptr)(WindowPtr window);
typedef void (*present_priv_create_event_id_ptr)(present_vblank_ptr vblank);
typedef struct present_screen_priv {
CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify;
@ -105,6 +120,12 @@ typedef struct present_screen_priv {
Bool flip_sync;
present_screen_info_ptr info;
/* Mode hooks */
present_priv_check_flip_ptr check_flip;
present_priv_check_flip_window_ptr check_flip_window;
present_priv_create_event_id_ptr create_event_id;
} present_screen_priv_rec, *present_screen_priv_ptr;
#define wrap(priv,real,mem,func) {\
@ -318,9 +339,6 @@ present_restore_screen_pixmap(ScreenPtr screen);
void
present_set_abort_flip(ScreenPtr screen);
void
present_check_flip_window(WindowPtr window);
RRCrtcPtr
present_get_crtc(WindowPtr window);
@ -330,6 +348,9 @@ present_query_capabilities(RRCrtcPtr crtc);
Bool
present_init(void);
void
present_scmd_init_mode_hooks(present_screen_priv_ptr screen_priv);
/*
* present_screen.c
*/

View File

@ -68,6 +68,12 @@ msc_is_equal_or_after(uint64_t test, uint64_t reference)
return (int64_t)(test - reference) >= 0;
}
static void
present_scmd_create_event_id(present_vblank_ptr vblank)
{
vblank->event_id = ++present_event_id;
}
static inline PixmapPtr
present_flip_pending_pixmap(ScreenPtr screen)
{
@ -484,7 +490,7 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
* 'window' is being reconfigured. Check to see if it is involved
* in flipping and clean up as necessary
*/
void
static void
present_check_flip_window (WindowPtr window)
{
ScreenPtr screen = window->drawable.pScreen;
@ -858,7 +864,8 @@ present_pixmap(WindowPtr window,
vblank->screen = screen;
vblank->window = window;
vblank->pixmap = pixmap;
vblank->event_id = ++present_event_id;
present_scmd_create_event_id(vblank);
if (pixmap) {
vblank->kind = PresentCompleteKindPixmap;
pixmap->refcnt++;
@ -1038,6 +1045,15 @@ present_vblank_destroy(present_vblank_ptr vblank)
free(vblank);
}
void
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->create_event_id = &present_scmd_create_event_id;
}
Bool
present_init(void)
{

View File

@ -161,7 +161,7 @@ present_clip_notify(WindowPtr window, int dx, int dy)
ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_check_flip_window(window);
screen_priv->check_flip_window(window);
unwrap(screen_priv, screen, ClipNotify)
if (screen->ClipNotify)
screen->ClipNotify (window, dx, dy);
@ -194,6 +194,8 @@ present_screen_init(ScreenPtr screen, present_screen_info_ptr info)
dixSetPrivate(&screen->devPrivates, &present_screen_private_key, screen_priv);
present_scmd_init_mode_hooks(screen_priv);
present_fake_screen_init(screen);
}