2 * Copyright © 2013 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
23 #include "glxclient.h"
24 #include "glx_error.h"
27 #include "dri_interface.h"
28 #include "dri2_priv.h"
31 dri2_convert_glx_query_renderer_attribs(int attribute
)
34 case GLX_RENDERER_VENDOR_ID_MESA
:
35 return __DRI2_RENDERER_VENDOR_ID
;
36 case GLX_RENDERER_DEVICE_ID_MESA
:
37 return __DRI2_RENDERER_DEVICE_ID
;
38 case GLX_RENDERER_VERSION_MESA
:
39 return __DRI2_RENDERER_VERSION
;
40 case GLX_RENDERER_ACCELERATED_MESA
:
41 return __DRI2_RENDERER_ACCELERATED
;
42 case GLX_RENDERER_VIDEO_MEMORY_MESA
:
43 return __DRI2_RENDERER_VIDEO_MEMORY
;
44 case GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA
:
45 return __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE
;
46 case GLX_RENDERER_PREFERRED_PROFILE_MESA
:
47 return __DRI2_RENDERER_PREFERRED_PROFILE
;
48 case GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA
:
49 return __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION
;
50 case GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA
:
51 return __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION
;
52 case GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA
:
53 return __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION
;
54 case GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA
:
55 return __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION
;
62 dri2_query_renderer_integer(struct glx_screen
*base
, int attribute
,
65 struct dri2_screen
*const psc
= (struct dri2_screen
*) base
;
67 /* Even though there are invalid values (and
68 * dri2_convert_glx_query_renderer_attribs may return -1), the higher level
69 * GLX code is required to perform the filtering. Assume that we got a
72 const int dri_attribute
= dri2_convert_glx_query_renderer_attribs(attribute
);
74 if (psc
->rendererQuery
== NULL
)
77 return psc
->rendererQuery
->queryInteger(psc
->driScreen
, dri_attribute
,
82 dri2_query_renderer_string(struct glx_screen
*base
, int attribute
,
85 struct dri2_screen
*const psc
= (struct dri2_screen
*) base
;
87 /* Even though queryString only accepts a subset of the possible GLX
88 * queries, the higher level GLX code is required to perform the filtering.
89 * Assume that we got a good value.
91 const int dri_attribute
= dri2_convert_glx_query_renderer_attribs(attribute
);
93 if (psc
->rendererQuery
== NULL
)
96 return psc
->rendererQuery
->queryString(psc
->driScreen
, dri_attribute
, value
);