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.
24 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
26 #include "glxclient.h"
27 #include "glx_error.h"
29 #include "dri_interface.h"
30 #include "dri2_priv.h"
31 #include "dri3_priv.h"
34 dri2_convert_glx_query_renderer_attribs(int attribute
)
37 case GLX_RENDERER_VENDOR_ID_MESA
:
38 return __DRI2_RENDERER_VENDOR_ID
;
39 case GLX_RENDERER_DEVICE_ID_MESA
:
40 return __DRI2_RENDERER_DEVICE_ID
;
41 case GLX_RENDERER_VERSION_MESA
:
42 return __DRI2_RENDERER_VERSION
;
43 case GLX_RENDERER_ACCELERATED_MESA
:
44 return __DRI2_RENDERER_ACCELERATED
;
45 case GLX_RENDERER_VIDEO_MEMORY_MESA
:
46 return __DRI2_RENDERER_VIDEO_MEMORY
;
47 case GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA
:
48 return __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE
;
49 case GLX_RENDERER_PREFERRED_PROFILE_MESA
:
50 return __DRI2_RENDERER_PREFERRED_PROFILE
;
51 case GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA
:
52 return __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION
;
53 case GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA
:
54 return __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION
;
55 case GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA
:
56 return __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION
;
57 case GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA
:
58 return __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION
;
65 dri2_query_renderer_integer(struct glx_screen
*base
, int attribute
,
68 struct dri2_screen
*const psc
= (struct dri2_screen
*) base
;
70 /* Even though there are invalid values (and
71 * dri2_convert_glx_query_renderer_attribs may return -1), the higher level
72 * GLX code is required to perform the filtering. Assume that we got a
75 const int dri_attribute
= dri2_convert_glx_query_renderer_attribs(attribute
);
77 if (psc
->rendererQuery
== NULL
)
80 return psc
->rendererQuery
->queryInteger(psc
->driScreen
, dri_attribute
,
85 dri2_query_renderer_string(struct glx_screen
*base
, int attribute
,
88 struct dri2_screen
*const psc
= (struct dri2_screen
*) base
;
90 /* Even though queryString only accepts a subset of the possible GLX
91 * queries, the higher level GLX code is required to perform the filtering.
92 * Assume that we got a good value.
94 const int dri_attribute
= dri2_convert_glx_query_renderer_attribs(attribute
);
96 if (psc
->rendererQuery
== NULL
)
99 return psc
->rendererQuery
->queryString(psc
->driScreen
, dri_attribute
, value
);
103 dri3_query_renderer_integer(struct glx_screen
*base
, int attribute
,
106 struct dri3_screen
*const psc
= (struct dri3_screen
*) base
;
108 /* Even though there are invalid values (and
109 * dri2_convert_glx_query_renderer_attribs may return -1), the higher level
110 * GLX code is required to perform the filtering. Assume that we got a
113 const int dri_attribute
= dri2_convert_glx_query_renderer_attribs(attribute
);
115 if (psc
->rendererQuery
== NULL
)
118 return psc
->rendererQuery
->queryInteger(psc
->driScreen
, dri_attribute
,
123 dri3_query_renderer_string(struct glx_screen
*base
, int attribute
,
126 struct dri3_screen
*const psc
= (struct dri3_screen
*) base
;
128 /* Even though queryString only accepts a subset of the possible GLX
129 * queries, the higher level GLX code is required to perform the filtering.
130 * Assume that we got a good value.
132 const int dri_attribute
= dri2_convert_glx_query_renderer_attribs(attribute
);
134 if (psc
->rendererQuery
== NULL
)
137 return psc
->rendererQuery
->queryString(psc
->driScreen
, dri_attribute
, value
);
140 #endif /* GLX_DIRECT_RENDERING */