[Mesa-dev] [PATCH 19/19] st/dri: Add __DRI2rendererQueryExtension support

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 14 17:24:21 PDT 2014


On 15/08/14 00:44, Marek Olšák wrote:
> On Fri, Aug 15, 2014 at 12:18 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> The final step to get GLX_MESA_query_renderer working with gallium
>> drivers.
>>
>> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
>> ---
>>  src/gallium/state_trackers/dri/Makefile.sources    |  2 +
>>  src/gallium/state_trackers/dri/dri2.c              |  2 +
>>  .../state_trackers/dri/dri_query_renderer.c        | 78 ++++++++++++++++++++++
>>  .../state_trackers/dri/dri_query_renderer.h        |  9 +++
>>  src/gallium/state_trackers/dri/drisw.c             |  2 +
>>  5 files changed, 93 insertions(+)
>>  create mode 100644 src/gallium/state_trackers/dri/dri_query_renderer.c
>>  create mode 100644 src/gallium/state_trackers/dri/dri_query_renderer.h
>>
>> diff --git a/src/gallium/state_trackers/dri/Makefile.sources b/src/gallium/state_trackers/dri/Makefile.sources
>> index 5967796..52d60ac 100644
>> --- a/src/gallium/state_trackers/dri/Makefile.sources
>> +++ b/src/gallium/state_trackers/dri/Makefile.sources
>> @@ -3,6 +3,8 @@ common_SOURCES := \
>>         dri_context.h \
>>         dri_drawable.c \
>>         dri_drawable.h \
>> +       dri_query_renderer.c \
>> +       dri_query_renderer.h \
>>         dri_screen.c \
>>         dri_screen.h
>>
>> diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
>> index 4bca238..1d79dfc 100644
>> --- a/src/gallium/state_trackers/dri/dri2.c
>> +++ b/src/gallium/state_trackers/dri/dri2.c
>> @@ -42,6 +42,7 @@
>>  #include "dri_screen.h"
>>  #include "dri_context.h"
>>  #include "dri_drawable.h"
>> +#include "dri_query_renderer.h"
>>  #include "dri2_buffer.h"
>>
>>  static int convert_fourcc(int format, int *dri_components_p)
>> @@ -1228,6 +1229,7 @@ static const __DRIextension *dri_screen_extensions[] = {
>>     &driTexBufferExtension.base,
>>     &dri2FlushExtension.base,
>>     &dri2ImageExtension.base,
>> +   &dri2RendererQueryExtension.base,
>>     &dri2ConfigQueryExtension.base,
>>     &dri2ThrottleExtension.base,
>>     NULL
>> diff --git a/src/gallium/state_trackers/dri/dri_query_renderer.c b/src/gallium/state_trackers/dri/dri_query_renderer.c
>> new file mode 100644
>> index 0000000..2c19aa0
>> --- /dev/null
>> +++ b/src/gallium/state_trackers/dri/dri_query_renderer.c
>> @@ -0,0 +1,78 @@
>> +#include "dri_query_renderer.h"
>> +
>> +#include "util/u_inlines.h"
>> +#include "state_tracker/drm_driver.h"
>> +
>> +#include "utils.h"
>> +#include "dri_screen.h"
>> +#include "dri_query_renderer.h"
>> +
>> +static int
>> +dri2_query_renderer_integer(__DRIscreen *_screen, int param,
>> +                            unsigned int *value)
>> +{
>> +   struct dri_screen *screen = dri_screen(_screen);
>> +
>> +   switch (param) {
>> +   case __DRI2_RENDERER_VENDOR_ID:
>> +      value[0] =
>> +         (unsigned int)screen->base.screen->get_param(screen->base.screen,
>> +                                                      PIPE_CAP_VENDOR_ID);
>> +      return 0;
>> +   case __DRI2_RENDERER_DEVICE_ID:
>> +      value[0] =
>> +         (unsigned int)screen->base.screen->get_param(screen->base.screen,
>> +                                                      PIPE_CAP_DEVICE_ID);
>> +      return 0;
>> +   case __DRI2_RENDERER_ACCELERATED:
>> +      value[0] =
>> +         (unsigned int)screen->base.screen->get_param(screen->base.screen,
>> +                                                      PIPE_CAP_ACCELERATED);
>> +      return 0;
>> +
>> +   case __DRI2_RENDERER_VIDEO_MEMORY:
>> +      value[0] =
>> +         (unsigned int)screen->base.screen->get_param(screen->base.screen,
>> +                                                      PIPE_CAP_VIDEO_MEMORY);
>> +      return 0;
>> +
>> +   case __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE:
>> +      value[0] =
>> +         (unsigned int)screen->base.screen->get_param(screen->base.screen,
>> +                                                      PIPE_CAP_UMA);
>> +      return 0;
>> +
>> +   case __DRI2_RENDERER_PREFERRED_PROFILE:
>> +      value[0] = (_screen->max_gl_core_version != 0)
>> +         ? (1U << __DRI_API_OPENGL_CORE) : (1U << __DRI_API_OPENGL);
> 
> I think you can remove this case statement because of patch 4?
> 
It seems that I've updated the classic drivers, but missed out gallium :)

Thanks
Emil

> Other than that, patches 9, 14, 19 are:
> 
> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
> 
> Marek
> 



More information about the mesa-dev mailing list