diff options
Diffstat (limited to 'dri3/dri3_screen.c')
-rw-r--r-- | dri3/dri3_screen.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c index bbf1d05a9..6c0c60cbf 100644 --- a/dri3/dri3_screen.c +++ b/dri3/dri3_screen.c @@ -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; |