mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
glx: inline DRI_CORE functions
Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30400>
This commit is contained in:
parent
87720ab42b
commit
66e0d12627
8 changed files with 40 additions and 61 deletions
|
|
@ -50,6 +50,7 @@
|
|||
#include "dri2_priv.h"
|
||||
#include "loader.h"
|
||||
#include "loader_dri_helper.h"
|
||||
#include "dri_util.h"
|
||||
|
||||
#undef DRI2_MINOR
|
||||
#define DRI2_MINOR 1
|
||||
|
|
@ -90,13 +91,11 @@ merge_counter(uint32_t hi, uint32_t lo)
|
|||
static void
|
||||
dri2_destroy_context(struct glx_context *context)
|
||||
{
|
||||
struct dri2_screen *psc = (struct dri2_screen *) context->psc;
|
||||
|
||||
driReleaseDrawables(context);
|
||||
|
||||
free((char *) context->extensions);
|
||||
|
||||
psc->core->destroyContext(context->driContext);
|
||||
driDestroyContext(context->driContext);
|
||||
|
||||
free(context);
|
||||
}
|
||||
|
|
@ -104,7 +103,6 @@ dri2_destroy_context(struct glx_context *context)
|
|||
static Bool
|
||||
dri2_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read)
|
||||
{
|
||||
struct dri2_screen *psc = (struct dri2_screen *) context->psc;
|
||||
struct dri2_drawable *pdraw, *pread;
|
||||
__DRIdrawable *dri_draw = NULL, *dri_read = NULL;
|
||||
|
||||
|
|
@ -123,7 +121,7 @@ dri2_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable rea
|
|||
else if (read != None)
|
||||
return GLXBadDrawable;
|
||||
|
||||
if (!psc->core->bindContext(context->driContext, dri_draw, dri_read))
|
||||
if (!driBindContext(context->driContext, dri_draw, dri_read))
|
||||
return GLXBadContext;
|
||||
|
||||
return Success;
|
||||
|
|
@ -132,9 +130,7 @@ dri2_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable rea
|
|||
static void
|
||||
dri2_unbind_context(struct glx_context *context)
|
||||
{
|
||||
struct dri2_screen *psc = (struct dri2_screen *) context->psc;
|
||||
|
||||
psc->core->unbindContext(context->driContext);
|
||||
driUnbindContext(context->driContext);
|
||||
}
|
||||
|
||||
static struct glx_context *
|
||||
|
|
@ -260,7 +256,7 @@ dri2DestroyDrawable(__GLXDRIdrawable *base)
|
|||
struct glx_display *dpyPriv = psc->base.display;
|
||||
|
||||
__glxHashDelete(dpyPriv->dri2Hash, pdraw->base.xDrawable);
|
||||
psc->core->destroyDrawable(pdraw->driDrawable);
|
||||
driDestroyDrawable(pdraw->driDrawable);
|
||||
|
||||
/* If it's a GLX 1.3 drawables, we can destroy the DRI2 drawable
|
||||
* now, as the application explicitly asked to destroy the GLX
|
||||
|
|
@ -314,7 +310,7 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable,
|
|||
}
|
||||
|
||||
if (__glxHashInsert(dpyPriv->dri2Hash, xDrawable, pdraw)) {
|
||||
psc->core->destroyDrawable(pdraw->driDrawable);
|
||||
driDestroyDrawable(pdraw->driDrawable);
|
||||
DRI2DestroyDrawable(psc->base.dpy, xDrawable);
|
||||
free(pdraw);
|
||||
return None;
|
||||
|
|
@ -596,7 +592,7 @@ dri2DestroyScreen(struct glx_screen *base)
|
|||
struct dri2_screen *psc = (struct dri2_screen *) base;
|
||||
|
||||
/* Free the direct rendering per screen data */
|
||||
psc->core->destroyScreen(psc->driScreen);
|
||||
driDestroyScreen(psc->driScreen);
|
||||
driDestroyConfigs(psc->driver_configs);
|
||||
free(psc->driverName);
|
||||
close(psc->fd);
|
||||
|
|
@ -876,7 +872,7 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv,
|
|||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
||||
extensions = psc->core->getExtensions(psc->driScreen);
|
||||
extensions = driGetExtensions(psc->driScreen);
|
||||
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_EXT_swap_control");
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_SGI_swap_control");
|
||||
|
|
@ -1027,7 +1023,6 @@ dri2CreateScreen(int screen, struct glx_display * priv, bool driver_name_is_infe
|
|||
goto handle_error;
|
||||
|
||||
static const struct dri_extension_match exts[] = {
|
||||
{ __DRI_CORE, 1, offsetof(struct dri2_screen, core), false },
|
||||
{ __DRI_DRI2, 5, offsetof(struct dri2_screen, dri2), false },
|
||||
{ __DRI_MESA, 2, offsetof(struct dri2_screen, mesa), false },
|
||||
};
|
||||
|
|
@ -1047,8 +1042,8 @@ dri2CreateScreen(int screen, struct glx_display * priv, bool driver_name_is_infe
|
|||
|
||||
dri2BindExtensions(psc, priv, driverName);
|
||||
|
||||
configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs);
|
||||
visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
|
||||
configs = driConvertConfigs(psc->base.configs, driver_configs);
|
||||
visuals = driConvertConfigs(psc->base.visuals, driver_configs);
|
||||
|
||||
if (!configs || !visuals) {
|
||||
ErrorMessageF("No matching fbConfigs or visuals found\n");
|
||||
|
|
@ -1140,7 +1135,7 @@ handle_error:
|
|||
if (visuals)
|
||||
glx_config_destroy_list(visuals);
|
||||
if (psc->driScreen)
|
||||
psc->core->destroyScreen(psc->driScreen);
|
||||
driDestroyScreen(psc->driScreen);
|
||||
psc->driScreen = NULL;
|
||||
if (psc->fd >= 0)
|
||||
close(psc->fd);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ struct dri2_screen {
|
|||
__DRIscreen *driScreen;
|
||||
__GLXDRIscreen vtable;
|
||||
const __DRIdri2Extension *dri2;
|
||||
const __DRIcoreExtension *core;
|
||||
const __DRImesaCoreExtension *mesa;
|
||||
|
||||
const __DRI2flushExtension *f;
|
||||
|
|
|
|||
|
|
@ -148,13 +148,11 @@ static const struct glx_context_vtable dri3_context_vtable;
|
|||
static void
|
||||
dri3_destroy_context(struct glx_context *context)
|
||||
{
|
||||
struct dri3_screen *psc = (struct dri3_screen *) context->psc;
|
||||
|
||||
driReleaseDrawables(context);
|
||||
|
||||
free((char *) context->extensions);
|
||||
|
||||
psc->core->destroyContext(context->driContext);
|
||||
driDestroyContext(context->driContext);
|
||||
|
||||
free(context);
|
||||
}
|
||||
|
|
@ -181,7 +179,7 @@ dri3_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable rea
|
|||
else if (read != None)
|
||||
return GLXBadDrawable;
|
||||
|
||||
if (!psc->core->bindContext(context->driContext, dri_draw, dri_read))
|
||||
if (!driBindContext(context->driContext, dri_draw, dri_read))
|
||||
return GLXBadContext;
|
||||
|
||||
if (dri_draw)
|
||||
|
|
@ -195,9 +193,7 @@ dri3_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable rea
|
|||
static void
|
||||
dri3_unbind_context(struct glx_context *context)
|
||||
{
|
||||
struct dri3_screen *psc = (struct dri3_screen *) context->psc;
|
||||
|
||||
psc->core->unbindContext(context->driContext);
|
||||
driUnbindContext(context->driContext);
|
||||
}
|
||||
|
||||
static struct glx_context *
|
||||
|
|
@ -590,12 +586,12 @@ dri3_destroy_screen(struct glx_screen *base)
|
|||
/* Free the direct rendering per screen data */
|
||||
if (psc->fd_render_gpu != psc->fd_display_gpu && psc->driScreenDisplayGPU) {
|
||||
loader_dri3_close_screen(psc->driScreenDisplayGPU);
|
||||
psc->core->destroyScreen(psc->driScreenDisplayGPU);
|
||||
driDestroyScreen(psc->driScreenDisplayGPU);
|
||||
}
|
||||
if (psc->fd_render_gpu != psc->fd_display_gpu)
|
||||
close(psc->fd_display_gpu);
|
||||
loader_dri3_close_screen(psc->driScreenRenderGPU);
|
||||
psc->core->destroyScreen(psc->driScreenRenderGPU);
|
||||
driDestroyScreen(psc->driScreenRenderGPU);
|
||||
driDestroyConfigs(psc->driver_configs);
|
||||
close(psc->fd_render_gpu);
|
||||
free(psc);
|
||||
|
|
@ -698,7 +694,7 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
|
|||
unsigned mask;
|
||||
int i;
|
||||
|
||||
extensions = psc->core->getExtensions(psc->driScreenRenderGPU);
|
||||
extensions = driGetExtensions(psc->driScreenRenderGPU);
|
||||
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_EXT_swap_control");
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_EXT_swap_control_tear");
|
||||
|
|
@ -843,7 +839,6 @@ dri3_create_screen(int screen, struct glx_display * priv, bool driver_name_is_in
|
|||
goto handle_error;
|
||||
|
||||
static const struct dri_extension_match exts[] = {
|
||||
{ __DRI_CORE, 1, offsetof(struct dri3_screen, core), false },
|
||||
{ __DRI_MESA, 2, offsetof(struct dri3_screen, mesa), false },
|
||||
};
|
||||
if (!loader_bind_extensions(psc, exts, ARRAY_SIZE(exts), extensions))
|
||||
|
|
@ -917,8 +912,8 @@ dri3_create_screen(int screen, struct glx_display * priv, bool driver_name_is_in
|
|||
psc->loader_dri3_ext.image = psc->image;
|
||||
psc->loader_dri3_ext.config = psc->config;
|
||||
|
||||
configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs);
|
||||
visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
|
||||
configs = driConvertConfigs(psc->base.configs, driver_configs);
|
||||
visuals = driConvertConfigs(psc->base.visuals, driver_configs);
|
||||
|
||||
if (!configs || !visuals) {
|
||||
ErrorMessageF("No matching fbConfigs or visuals found\n");
|
||||
|
|
@ -1017,10 +1012,10 @@ handle_error:
|
|||
if (visuals)
|
||||
glx_config_destroy_list(visuals);
|
||||
if (psc->driScreenRenderGPU)
|
||||
psc->core->destroyScreen(psc->driScreenRenderGPU);
|
||||
driDestroyScreen(psc->driScreenRenderGPU);
|
||||
psc->driScreenRenderGPU = NULL;
|
||||
if (psc->fd_render_gpu != psc->fd_display_gpu && psc->driScreenDisplayGPU)
|
||||
psc->core->destroyScreen(psc->driScreenDisplayGPU);
|
||||
driDestroyScreen(psc->driScreenDisplayGPU);
|
||||
psc->driScreenDisplayGPU = NULL;
|
||||
if (psc->fd_display_gpu >= 0 && psc->fd_render_gpu != psc->fd_display_gpu)
|
||||
close(psc->fd_display_gpu);
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ struct dri3_screen {
|
|||
__DRIscreen *driScreenRenderGPU;
|
||||
|
||||
const __DRIimageExtension *image;
|
||||
const __DRIcoreExtension *core;
|
||||
const __DRImesaCoreExtension *mesa;
|
||||
const __DRI2flushExtension *f;
|
||||
const __DRI2configQueryExtension *config;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "loader.h"
|
||||
#include <X11/Xlib-xcb.h>
|
||||
#include <xcb/xproto.h>
|
||||
#include "dri_util.h"
|
||||
|
||||
#ifndef RTLD_NOW
|
||||
#define RTLD_NOW 0
|
||||
|
|
@ -135,14 +136,13 @@ scalarEqual(struct glx_config *mode, unsigned int attrib, unsigned int value)
|
|||
}
|
||||
|
||||
static int
|
||||
driConfigEqual(const __DRIcoreExtension *core,
|
||||
struct glx_config *config, const __DRIconfig *driConfig)
|
||||
driConfigEqual(struct glx_config *config, const __DRIconfig *driConfig)
|
||||
{
|
||||
unsigned int attrib, value, glxValue;
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
|
||||
while (driIndexConfigAttrib(driConfig, i++, &attrib, &value)) {
|
||||
switch (attrib) {
|
||||
case __DRI_ATTRIB_RENDER_TYPE:
|
||||
glxValue = 0;
|
||||
|
|
@ -230,14 +230,13 @@ driConfigEqual(const __DRIcoreExtension *core,
|
|||
}
|
||||
|
||||
static struct glx_config *
|
||||
createDriMode(const __DRIcoreExtension * core,
|
||||
struct glx_config *config, const __DRIconfig **driConfigs)
|
||||
createDriMode(struct glx_config *config, const __DRIconfig **driConfigs)
|
||||
{
|
||||
__GLXDRIconfigPrivate *driConfig;
|
||||
int i;
|
||||
|
||||
for (i = 0; driConfigs[i]; i++) {
|
||||
if (driConfigEqual(core, config, driConfigs[i]))
|
||||
if (driConfigEqual(config, driConfigs[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -255,15 +254,14 @@ createDriMode(const __DRIcoreExtension * core,
|
|||
}
|
||||
|
||||
_X_HIDDEN struct glx_config *
|
||||
driConvertConfigs(const __DRIcoreExtension * core,
|
||||
struct glx_config *configs, const __DRIconfig **driConfigs)
|
||||
driConvertConfigs(struct glx_config *configs, const __DRIconfig **driConfigs)
|
||||
{
|
||||
struct glx_config head, *tail, *m;
|
||||
|
||||
tail = &head;
|
||||
head.next = NULL;
|
||||
for (m = configs; m; m = m->next) {
|
||||
tail->next = createDriMode(core, m, driConfigs);
|
||||
tail->next = createDriMode(m, driConfigs);
|
||||
if (tail->next == NULL) {
|
||||
/* no matching dri config for m */
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -51,8 +51,7 @@ struct __GLXDRIconfigPrivateRec
|
|||
const __DRIconfig *driConfig;
|
||||
};
|
||||
|
||||
extern struct glx_config *driConvertConfigs(const __DRIcoreExtension * core,
|
||||
struct glx_config * modes,
|
||||
extern struct glx_config *driConvertConfigs(struct glx_config * modes,
|
||||
const __DRIconfig ** configs);
|
||||
|
||||
extern void driDestroyConfigs(const __DRIconfig **configs);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "util/u_debug.h"
|
||||
#include "kopper_interface.h"
|
||||
#include "loader_dri_helper.h"
|
||||
#include "dri_util.h"
|
||||
|
||||
static int xshm_error = 0;
|
||||
static int xshm_opcode = -1;
|
||||
|
|
@ -421,13 +422,11 @@ static const __DRIextension *kopper_extensions_noshm[] = {
|
|||
static void
|
||||
drisw_destroy_context(struct glx_context *context)
|
||||
{
|
||||
struct drisw_screen *psc = (struct drisw_screen *) context->psc;
|
||||
|
||||
driReleaseDrawables(context);
|
||||
|
||||
free((char *) context->extensions);
|
||||
|
||||
psc->core->destroyContext(context->driContext);
|
||||
driDestroyContext(context->driContext);
|
||||
|
||||
free(context);
|
||||
}
|
||||
|
|
@ -443,7 +442,7 @@ drisw_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable re
|
|||
|
||||
driReleaseDrawables(context);
|
||||
|
||||
if (!psc->core->bindContext(context->driContext,
|
||||
if (!driBindContext(context->driContext,
|
||||
pdraw ? pdraw->driDrawable : NULL,
|
||||
pread ? pread->driDrawable : NULL))
|
||||
return GLXBadContext;
|
||||
|
|
@ -460,9 +459,7 @@ drisw_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable re
|
|||
static void
|
||||
drisw_unbind_context(struct glx_context *context)
|
||||
{
|
||||
struct drisw_screen *psc = (struct drisw_screen *) context->psc;
|
||||
|
||||
psc->core->unbindContext(context->driContext);
|
||||
driUnbindContext(context->driContext);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -660,9 +657,8 @@ static void
|
|||
driswDestroyDrawable(__GLXDRIdrawable * pdraw)
|
||||
{
|
||||
struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw;
|
||||
struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc;
|
||||
|
||||
psc->core->destroyDrawable(pdp->driDrawable);
|
||||
driDestroyDrawable(pdp->driDrawable);
|
||||
|
||||
XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable);
|
||||
free(pdp);
|
||||
|
|
@ -769,7 +765,7 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw,
|
|||
if (psc->kopper)
|
||||
return psc->kopper->swapBuffers (pdp->driDrawable, 0);
|
||||
|
||||
psc->core->swapBuffers(pdp->driDrawable);
|
||||
driSwapBuffers(pdp->driDrawable);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -794,7 +790,7 @@ driswDestroyScreen(struct glx_screen *base)
|
|||
struct drisw_screen *psc = (struct drisw_screen *) base;
|
||||
|
||||
/* Free the direct rendering per screen data */
|
||||
psc->core->destroyScreen(psc->driScreen);
|
||||
driDestroyScreen(psc->driScreen);
|
||||
driDestroyConfigs(psc->driver_configs);
|
||||
psc->driScreen = NULL;
|
||||
free(psc->name);
|
||||
|
|
@ -966,7 +962,6 @@ driswCreateScreen(int screen, struct glx_display *priv, enum glx_driver glx_driv
|
|||
loader_extensions_local = loader_extensions_shm;
|
||||
|
||||
static const struct dri_extension_match exts[] = {
|
||||
{ __DRI_CORE, 1, offsetof(struct drisw_screen, core), false },
|
||||
{ __DRI_SWRAST, 5, offsetof(struct drisw_screen, swrast), false },
|
||||
{ __DRI_KOPPER, 1, offsetof(struct drisw_screen, kopper), true },
|
||||
{ __DRI_COPY_SUB_BUFFER, 1, offsetof(struct drisw_screen, copySubBuffer), true },
|
||||
|
|
@ -985,11 +980,11 @@ driswCreateScreen(int screen, struct glx_display *priv, enum glx_driver glx_driv
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
extensions = psc->core->getExtensions(psc->driScreen);
|
||||
extensions = driGetExtensions(psc->driScreen);
|
||||
driswBindExtensions(psc, extensions);
|
||||
|
||||
configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs);
|
||||
visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
|
||||
configs = driConvertConfigs(psc->base.configs, driver_configs);
|
||||
visuals = driConvertConfigs(psc->base.visuals, driver_configs);
|
||||
|
||||
if (!configs || !visuals) {
|
||||
ErrorMessageF("No matching fbConfigs or visuals found\n");
|
||||
|
|
@ -1033,7 +1028,7 @@ driswCreateScreen(int screen, struct glx_display *priv, enum glx_driver glx_driv
|
|||
if (visuals)
|
||||
glx_config_destroy_list(visuals);
|
||||
if (psc->driScreen)
|
||||
psc->core->destroyScreen(psc->driScreen);
|
||||
driDestroyScreen(psc->driScreen);
|
||||
psc->driScreen = NULL;
|
||||
|
||||
glx_screen_cleanup(&psc->base);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ struct drisw_screen
|
|||
|
||||
__DRIscreen *driScreen;
|
||||
__GLXDRIscreen vtable;
|
||||
const __DRIcoreExtension *core;
|
||||
const __DRImesaCoreExtension *mesa;
|
||||
const __DRIswrastExtension *swrast;
|
||||
const __DRIkopperExtension *kopper;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue