mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
dri: unify DRI2_CONFIG_QUERY interfaces
these should always be the same to check both option caches Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30450>
This commit is contained in:
parent
b7c17a4f3b
commit
e8d4b0a253
5 changed files with 88 additions and 94 deletions
|
|
@ -2068,86 +2068,6 @@ static const __DRI2bufferDamageExtension dri2BufferDamageExtensionTempl = {
|
|||
.base = { __DRI2_BUFFER_DAMAGE, 1 },
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension configQueryb method
|
||||
*/
|
||||
static int
|
||||
dri2GalliumConfigQueryb(__DRIscreen *sPriv, const char *var,
|
||||
unsigned char *val)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(sPriv);
|
||||
|
||||
if (!driCheckOption(&screen->dev->option_cache, var, DRI_BOOL))
|
||||
return dri2ConfigQueryExtension.configQueryb(sPriv, var, val);
|
||||
|
||||
*val = driQueryOptionb(&screen->dev->option_cache, var);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension configQueryi method
|
||||
*/
|
||||
static int
|
||||
dri2GalliumConfigQueryi(__DRIscreen *sPriv, const char *var, int *val)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(sPriv);
|
||||
|
||||
if (!driCheckOption(&screen->dev->option_cache, var, DRI_INT) &&
|
||||
!driCheckOption(&screen->dev->option_cache, var, DRI_ENUM))
|
||||
return dri2ConfigQueryExtension.configQueryi(sPriv, var, val);
|
||||
|
||||
*val = driQueryOptioni(&screen->dev->option_cache, var);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension configQueryf method
|
||||
*/
|
||||
static int
|
||||
dri2GalliumConfigQueryf(__DRIscreen *sPriv, const char *var, float *val)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(sPriv);
|
||||
|
||||
if (!driCheckOption(&screen->dev->option_cache, var, DRI_FLOAT))
|
||||
return dri2ConfigQueryExtension.configQueryf(sPriv, var, val);
|
||||
|
||||
*val = driQueryOptionf(&screen->dev->option_cache, var);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension configQuerys method
|
||||
*/
|
||||
static int
|
||||
dri2GalliumConfigQuerys(__DRIscreen *sPriv, const char *var, char **val)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(sPriv);
|
||||
|
||||
if (!driCheckOption(&screen->dev->option_cache, var, DRI_STRING))
|
||||
return dri2ConfigQueryExtension.configQuerys(sPriv, var, val);
|
||||
|
||||
*val = driQueryOptionstr(&screen->dev->option_cache, var);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension struct.
|
||||
*
|
||||
* We first query the driver option cache. Then the dri2 option cache.
|
||||
*/
|
||||
static const __DRI2configQueryExtension dri2GalliumConfigQueryExtension = {
|
||||
.base = { __DRI2_CONFIG_QUERY, 2 },
|
||||
|
||||
.configQueryb = dri2GalliumConfigQueryb,
|
||||
.configQueryi = dri2GalliumConfigQueryi,
|
||||
.configQueryf = dri2GalliumConfigQueryf,
|
||||
.configQuerys = dri2GalliumConfigQuerys,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief the DRI2blobExtension set_cache_funcs method
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
#include "loader/loader.h"
|
||||
#include "mesa_interface.h"
|
||||
#include "loader_dri_helper.h"
|
||||
#include "pipe-loader/pipe_loader.h"
|
||||
|
||||
driOptionDescription __dri2ConfigOptions[] = {
|
||||
DRI_CONF_SECTION_DEBUG
|
||||
|
|
@ -844,6 +845,88 @@ dri2ConfigQuerys(__DRIscreen *psp, const char *var, char **val)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension configQueryb method
|
||||
*/
|
||||
static int
|
||||
dri2GalliumConfigQueryb(__DRIscreen *sPriv, const char *var,
|
||||
unsigned char *val)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(sPriv);
|
||||
|
||||
if (!driCheckOption(&screen->dev->option_cache, var, DRI_BOOL))
|
||||
return dri2ConfigQueryb(sPriv, var, val);
|
||||
|
||||
*val = driQueryOptionb(&screen->dev->option_cache, var);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension configQueryi method
|
||||
*/
|
||||
static int
|
||||
dri2GalliumConfigQueryi(__DRIscreen *sPriv, const char *var, int *val)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(sPriv);
|
||||
|
||||
if (!driCheckOption(&screen->dev->option_cache, var, DRI_INT) &&
|
||||
!driCheckOption(&screen->dev->option_cache, var, DRI_ENUM))
|
||||
return dri2ConfigQueryi(sPriv, var, val);
|
||||
|
||||
*val = driQueryOptioni(&screen->dev->option_cache, var);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension configQueryf method
|
||||
*/
|
||||
static int
|
||||
dri2GalliumConfigQueryf(__DRIscreen *sPriv, const char *var, float *val)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(sPriv);
|
||||
|
||||
if (!driCheckOption(&screen->dev->option_cache, var, DRI_FLOAT))
|
||||
return dri2ConfigQueryf(sPriv, var, val);
|
||||
|
||||
*val = driQueryOptionf(&screen->dev->option_cache, var);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension configQuerys method
|
||||
*/
|
||||
static int
|
||||
dri2GalliumConfigQuerys(__DRIscreen *sPriv, const char *var, char **val)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(sPriv);
|
||||
|
||||
if (!driCheckOption(&screen->dev->option_cache, var, DRI_STRING))
|
||||
return dri2ConfigQuerys(sPriv, var, val);
|
||||
|
||||
*val = driQueryOptionstr(&screen->dev->option_cache, var);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief the DRI2ConfigQueryExtension struct.
|
||||
*
|
||||
* We first query the driver option cache. Then the dri2 option cache.
|
||||
*/
|
||||
const __DRI2configQueryExtension dri2GalliumConfigQueryExtension = {
|
||||
.base = { __DRI2_CONFIG_QUERY, 2 },
|
||||
|
||||
.configQueryb = dri2GalliumConfigQueryb,
|
||||
.configQueryi = dri2GalliumConfigQueryi,
|
||||
.configQueryf = dri2GalliumConfigQueryf,
|
||||
.configQuerys = dri2GalliumConfigQuerys,
|
||||
};
|
||||
|
||||
|
||||
unsigned int
|
||||
driGetAPIMask(__DRIscreen *screen)
|
||||
{
|
||||
|
|
@ -948,15 +1031,6 @@ const __DRIswrastExtension driSWRastExtension = {
|
|||
.createNewScreen3 = driSWRastCreateNewScreen3,
|
||||
};
|
||||
|
||||
const __DRI2configQueryExtension dri2ConfigQueryExtension = {
|
||||
.base = { __DRI2_CONFIG_QUERY, 2 },
|
||||
|
||||
.configQueryb = dri2ConfigQueryb,
|
||||
.configQueryi = dri2ConfigQueryi,
|
||||
.configQueryf = dri2ConfigQueryf,
|
||||
.configQuerys = dri2ConfigQuerys,
|
||||
};
|
||||
|
||||
const __DRI2flushControlExtension dri2FlushControlExtension = {
|
||||
.base = { __DRI2_FLUSH_CONTROL, 1 }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ extern const __DRIcoreExtension driCoreExtension;
|
|||
extern const __DRIswrastExtension driSWRastExtension;
|
||||
extern const __DRIdri2Extension driDRI2Extension;
|
||||
extern const __DRIdri2Extension swkmsDRI2Extension;
|
||||
extern const __DRI2configQueryExtension dri2ConfigQueryExtension;
|
||||
extern const __DRI2flushControlExtension dri2FlushControlExtension;
|
||||
extern const __DRI2configQueryExtension dri2GalliumConfigQueryExtension;
|
||||
|
||||
/**
|
||||
* Description of the attributes used to create a config.
|
||||
|
|
|
|||
|
|
@ -524,7 +524,7 @@ static const __DRIrobustnessExtension dri2Robustness = {
|
|||
static const __DRIextension *drisw_screen_extensions[] = {
|
||||
&driSWImageExtension.base,
|
||||
&driTexBufferExtension.base,
|
||||
&dri2ConfigQueryExtension.base,
|
||||
&dri2GalliumConfigQueryExtension.base,
|
||||
&dri2FenceExtension.base,
|
||||
&dri2FlushControlExtension.base,
|
||||
NULL
|
||||
|
|
@ -533,7 +533,7 @@ static const __DRIextension *drisw_screen_extensions[] = {
|
|||
static const __DRIextension *drisw_robust_screen_extensions[] = {
|
||||
&driSWImageExtension.base,
|
||||
&driTexBufferExtension.base,
|
||||
&dri2ConfigQueryExtension.base,
|
||||
&dri2GalliumConfigQueryExtension.base,
|
||||
&dri2FenceExtension.base,
|
||||
&dri2Robustness.base,
|
||||
&dri2FlushControlExtension.base,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ const __DRIkopperExtension driKopperExtension;
|
|||
|
||||
static const __DRIextension *drivk_screen_extensions[] = {
|
||||
&driTexBufferExtension.base,
|
||||
&dri2ConfigQueryExtension.base,
|
||||
&dri2GalliumConfigQueryExtension.base,
|
||||
&dri2FenceExtension.base,
|
||||
&dri2Robustness.base,
|
||||
&driVkImageExtension.base,
|
||||
|
|
@ -90,7 +90,7 @@ static const __DRIextension *drivk_screen_extensions[] = {
|
|||
|
||||
static const __DRIextension *drivk_sw_screen_extensions[] = {
|
||||
&driTexBufferExtension.base,
|
||||
&dri2ConfigQueryExtension.base,
|
||||
&dri2GalliumConfigQueryExtension.base,
|
||||
&dri2FenceExtension.base,
|
||||
&dri2Robustness.base,
|
||||
&driVkImageExtensionSw.base,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue