[Mesa-dev] [PATCH 05/25] glx/dri3: add support for DRI2rendererQueryExtension
Ian Romanick
idr at freedesktop.org
Fri Feb 28 09:18:20 PST 2014
On 02/21/2014 07:03 PM, Emil Velikov wrote:
> The extension is used to implement GLX_MESA_query_renderer.
> Currently untested, due to lack of dri3 enabled drivers.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Tested-by: Keith Packard <keithp at keithp.com>
I had to make Keith test it because I don't have a working DRI3 setup. :)
Could you also mark this for 10.1?
> ---
> src/glx/dri3_glx.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++-----
> src/glx/dri3_priv.h | 1 +
> 2 files changed, 51 insertions(+), 5 deletions(-)
>
> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
> index 70ec057..78f956d 100644
> --- a/src/glx/dri3_glx.c
> +++ b/src/glx/dri3_glx.c
> @@ -266,6 +266,51 @@ dri3_create_context(struct glx_screen *base,
> 0, NULL, &error);
> }
>
> +static int
> +dri3_query_renderer_integer(struct glx_screen *base, int attribute,
> + unsigned int *value)
> +{
> + struct dri3_screen *const psc = (struct dri3_screen *) base;
> +
> + /* Even though there are invalid values (and
> + * dri2_convert_glx_query_renderer_attribs may return -1), the higher level
> + * GLX code is required to perform the filtering. Assume that we got a
> + * good value.
> + */
> + const int dri_attribute = dri2_convert_glx_query_renderer_attribs(attribute);
> +
> + if (psc->rendererQuery == NULL)
> + return -1;
> +
> + return psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
> + value);
> +}
> +
> +static int
> +dri3_query_renderer_string(struct glx_screen *base, int attribute,
> + const char **value)
> +{
> + struct dri3_screen *const psc = (struct dri3_screen *) base;
> +
> + /* Even though queryString only accepts a subset of the possible GLX
> + * queries, the higher level GLX code is required to perform the filtering.
> + * Assume that we got a good value.
> + */
> + const int dri_attribute = dri2_convert_glx_query_renderer_attribs(attribute);
> +
> + if (psc->rendererQuery == NULL)
> + return -1;
> +
> + return psc->rendererQuery->queryString(psc->driScreen, dri_attribute, value);
> +}
> +
> +static const struct glx_screen_vtable dri3_screen_vtable = {
> + dri3_create_context,
> + dri3_create_context_attribs,
> + dri3_query_renderer_integer,
> + dri3_query_renderer_string,
> +};
> +
> static void
> dri3_free_render_buffer(struct dri3_drawable *pdraw, struct dri3_buffer *buffer);
>
> @@ -1580,14 +1625,14 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
> if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0)
> __glXEnableDirectExtension(&psc->base,
> "GLX_ARB_create_context_robustness");
> +
> + if (strcmp(extensions[i]->name, __DRI2_RENDERER_QUERY) == 0) {
> + psc->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i];
> + __glXEnableDirectExtension(&psc->base, "GLX_MESA_query_renderer");
> + }
> }
> }
>
> -static const struct glx_screen_vtable dri3_screen_vtable = {
> - dri3_create_context,
> - dri3_create_context_attribs
> -};
> -
> /** dri3_create_screen
> *
> * Initialize DRI3 on the specified screen.
> diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
> index 1d124f8..3346a17 100644
> --- a/src/glx/dri3_priv.h
> +++ b/src/glx/dri3_priv.h
> @@ -129,6 +129,7 @@ struct dri3_screen {
> const __DRI2flushExtension *f;
> const __DRI2configQueryExtension *config;
> const __DRItexBufferExtension *texBuffer;
> + const __DRI2rendererQueryExtension *rendererQuery;
> const __DRIconfig **driver_configs;
>
> void *driver;
>
More information about the mesa-dev
mailing list