mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
dri3: Fix dri3_open API change by adding new dri3_open_client
Xwayland will eventually need the current client in dri3_open. Simply changing that API is not an option though as other drivers that implement DRI3 will not have a matching function signature and will crash when called. Add a new dri3_open_client function pointer and bump DRI3_SCREEN_INFO_VERSION so that drivers can be aware of the new function which will be used in preference to the old function when available. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anhole <eric@anholt.net>
This commit is contained in:
@@ -30,6 +30,14 @@
|
||||
#include <misyncshm.h>
|
||||
#include <randrstr.h>
|
||||
|
||||
static inline Bool has_open(dri3_screen_info_ptr info) {
|
||||
if (info == NULL)
|
||||
return FALSE;
|
||||
|
||||
return info->open != NULL ||
|
||||
(info->version >= 1 && info->open_client != NULL);
|
||||
}
|
||||
|
||||
int
|
||||
dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd)
|
||||
{
|
||||
@@ -37,10 +45,14 @@ dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd)
|
||||
dri3_screen_info_ptr info = ds->info;
|
||||
int rc;
|
||||
|
||||
if (!info || !info->open)
|
||||
if (!has_open(info))
|
||||
return BadMatch;
|
||||
|
||||
rc = (*info->open) (client, screen, provider, fd);
|
||||
if (info->version >= 1 && info->open_client != NULL)
|
||||
rc = (*info->open_client) (client, screen, provider, fd);
|
||||
else
|
||||
rc = (*info->open) (screen, provider, fd);
|
||||
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user