diff options
author | Louis-Francis Ratté-Boulianne <lfrb@collabora.com> | 2018-02-28 01:19:44 +0000 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-03-05 13:27:55 -0500 |
commit | cef12efc15ca1444d6d8cd839116b318a4668692 (patch) | |
tree | 29d81005b1360e9ab029f09822b222f51fca394b /present | |
parent | c8c276c9569b3ca1e695682a5443f1b615c606bd (diff) |
glamor: Implement GetSupportedModifiers
Implement function added in DRI3 v1.1.
A newest version of libepoxy (>= 1.4.4) is required as earlier
versions use a problematic version of Khronos
EXT_image_dma_buf_import_modifiers spec.
v4: Only send scanout-supported modifiers if flipping is possible
v5: Fix memory corruption in XWayland (uninitialized pointer)
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'present')
-rw-r--r-- | present/present.c | 38 | ||||
-rw-r--r-- | present/present.h | 3 |
2 files changed, 41 insertions, 0 deletions
diff --git a/present/present.c b/present/present.c index 42e5fb4fc..080cafcba 100644 --- a/present/present.c +++ b/present/present.c @@ -614,6 +614,44 @@ present_check_flip_window (WindowPtr window) } } +Bool +present_can_window_flip(WindowPtr window) +{ + ScreenPtr screen = window->drawable.pScreen; + PixmapPtr window_pixmap; + WindowPtr root = screen->root; + present_screen_priv_ptr screen_priv = present_screen_priv(screen); + + if (!screen_priv) + return FALSE; + + if (!screen_priv->info) + return FALSE; + + /* Check to see if the driver supports flips at all */ + if (!screen_priv->info->flip) + return FALSE; + + /* Make sure the window hasn't been redirected with Composite */ + window_pixmap = screen->GetWindowPixmap(window); + if (window_pixmap != screen->GetScreenPixmap(screen) && + window_pixmap != screen_priv->flip_pixmap && + window_pixmap != present_flip_pending_pixmap(screen)) + return FALSE; + + /* Check for full-screen window */ + if (!RegionEqual(&window->clipList, &root->winSize)) { + return FALSE; + } + + /* Does the window match the pixmap exactly? */ + if (window->drawable.x != 0 || window->drawable.y != 0) { + return FALSE; + } + + return TRUE; +} + /* * Called when the wait fence is triggered; just gets the current msc/ust and * calls present_execute again. That will re-check the fence and pend the diff --git a/present/present.h b/present/present.h index 6542dc385..ade838bda 100644 --- a/present/present.h +++ b/present/present.h @@ -135,4 +135,7 @@ typedef void (*present_complete_notify_proc)(WindowPtr window, extern _X_EXPORT void present_register_complete_notify(present_complete_notify_proc proc); +extern _X_EXPORT Bool +present_can_window_flip(WindowPtr window); + #endif /* _PRESENT_H_ */ |