mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-04-26 10:10:48 +02:00
glamor: add glvnd_vendor private
This commit adds an ability to store a glvnd vendor in Glamor
structures, which can be used for initialize some vendor-based values
without hooking into DDX internals. Also this adds setting this value
into Xorg and Xwayland
Signed-off-by: Konstantin Pugin <ria.freelander@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Emma Anholt <emma@anholt.net>
(cherry picked from commit 3caf7aa88d)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1636>
This commit is contained in:
parent
93abc39fcd
commit
a6145198bc
4 changed files with 38 additions and 0 deletions
|
|
@ -964,6 +964,7 @@ glamor_close_screen(ScreenPtr screen)
|
|||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_sync_close(screen);
|
||||
glamor_composite_glyphs_fini(screen);
|
||||
glamor_set_glvnd_vendor(screen, NULL);
|
||||
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
|
||||
|
||||
screen->CreateGC = glamor_priv->saved_procs.create_gc;
|
||||
|
|
@ -996,6 +997,31 @@ glamor_fini(ScreenPtr screen)
|
|||
/* Do nothing currently. */
|
||||
}
|
||||
|
||||
void
|
||||
glamor_set_glvnd_vendor(ScreenPtr screen, const char *vendor_name)
|
||||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
if (!glamor_priv)
|
||||
return;
|
||||
|
||||
if (glamor_priv->glvnd_vendor)
|
||||
free(glamor_priv->glvnd_vendor);
|
||||
|
||||
glamor_priv->glvnd_vendor = xnfstrdup(vendor_name);
|
||||
}
|
||||
|
||||
const char *
|
||||
glamor_get_glvnd_vendor(ScreenPtr screen)
|
||||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
if (!glamor_priv)
|
||||
return NULL;
|
||||
|
||||
return glamor_priv->glvnd_vendor;
|
||||
}
|
||||
|
||||
void
|
||||
glamor_enable_dri3(ScreenPtr screen)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -120,6 +120,12 @@ extern _X_EXPORT void glamor_clear_pixmap(PixmapPtr pixmap);
|
|||
|
||||
extern _X_EXPORT void glamor_block_handler(ScreenPtr screen);
|
||||
|
||||
/* This function should be called after glamor_init,
|
||||
* but before adding a glamor GLX provider */
|
||||
extern _X_EXPORT void glamor_set_glvnd_vendor(ScreenPtr screen,
|
||||
const char *vendor);
|
||||
extern _X_EXPORT const char *glamor_get_glvnd_vendor(ScreenPtr screen);
|
||||
|
||||
extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h,
|
||||
int depth, unsigned int usage);
|
||||
extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap);
|
||||
|
|
|
|||
|
|
@ -887,6 +887,7 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
|
|||
#ifdef DRI3
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
#endif
|
||||
const char *gbm_backend_name;
|
||||
|
||||
glamor_egl->saved_close_screen = screen->CloseScreen;
|
||||
screen->CloseScreen = glamor_egl_close_screen;
|
||||
|
|
@ -899,6 +900,10 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
|
|||
|
||||
glamor_ctx->make_current = glamor_egl_make_current;
|
||||
|
||||
gbm_backend_name = gbm_device_get_backend_name(glamor_egl->gbm);
|
||||
/* Mesa uses "drm" as backend name, in that case, just do nothing */
|
||||
if (gbm_backend_name && strcmp(gbm_backend_name, "drm") != 0)
|
||||
glamor_set_glvnd_vendor(screen, gbm_backend_name);
|
||||
#ifdef DRI3
|
||||
/* Tell the core that we have the interfaces for import/export
|
||||
* of pixmaps.
|
||||
|
|
|
|||
|
|
@ -335,6 +335,7 @@ typedef struct glamor_screen_private {
|
|||
int flags;
|
||||
ScreenPtr screen;
|
||||
int dri3_enabled;
|
||||
char *glvnd_vendor;
|
||||
|
||||
Bool suppress_gl_out_of_memory_logging;
|
||||
Bool logged_any_fbo_allocation_failure;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue