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>
This commit is contained in:
parent
141e7dd8a3
commit
3caf7aa88d
|
@ -933,6 +933,7 @@ glamor_close_screen(ScreenPtr screen)
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
glamor_sync_close(screen);
|
glamor_sync_close(screen);
|
||||||
glamor_composite_glyphs_fini(screen);
|
glamor_composite_glyphs_fini(screen);
|
||||||
|
glamor_set_glvnd_vendor(screen, NULL);
|
||||||
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
|
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
|
||||||
|
|
||||||
screen->CreateGC = glamor_priv->saved_procs.create_gc;
|
screen->CreateGC = glamor_priv->saved_procs.create_gc;
|
||||||
|
@ -965,6 +966,31 @@ glamor_fini(ScreenPtr screen)
|
||||||
/* Do nothing currently. */
|
/* 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
|
void
|
||||||
glamor_enable_dri3(ScreenPtr screen)
|
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);
|
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,
|
extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h,
|
||||||
int depth, unsigned int usage);
|
int depth, unsigned int usage);
|
||||||
extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap);
|
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
|
#ifdef DRI3
|
||||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
#endif
|
#endif
|
||||||
|
const char *gbm_backend_name;
|
||||||
|
|
||||||
glamor_egl->saved_close_screen = screen->CloseScreen;
|
glamor_egl->saved_close_screen = screen->CloseScreen;
|
||||||
screen->CloseScreen = glamor_egl_close_screen;
|
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;
|
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
|
#ifdef DRI3
|
||||||
/* Tell the core that we have the interfaces for import/export
|
/* Tell the core that we have the interfaces for import/export
|
||||||
* of pixmaps.
|
* of pixmaps.
|
||||||
|
|
|
@ -336,6 +336,7 @@ typedef struct glamor_screen_private {
|
||||||
int flags;
|
int flags;
|
||||||
ScreenPtr screen;
|
ScreenPtr screen;
|
||||||
int dri3_enabled;
|
int dri3_enabled;
|
||||||
|
char *glvnd_vendor;
|
||||||
|
|
||||||
Bool suppress_gl_out_of_memory_logging;
|
Bool suppress_gl_out_of_memory_logging;
|
||||||
Bool logged_any_fbo_allocation_failure;
|
Bool logged_any_fbo_allocation_failure;
|
||||||
|
|
|
@ -77,6 +77,7 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
|
||||||
{
|
{
|
||||||
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
||||||
|
|
||||||
|
glamor_set_glvnd_vendor(screen, xwl_screen->glvnd_vendor);
|
||||||
glamor_enable_dri3(screen);
|
glamor_enable_dri3(screen);
|
||||||
glamor_ctx->ctx = xwl_screen->egl_context;
|
glamor_ctx->ctx = xwl_screen->egl_context;
|
||||||
glamor_ctx->display = xwl_screen->egl_display;
|
glamor_ctx->display = xwl_screen->egl_display;
|
||||||
|
|
Loading…
Reference in New Issue