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"
33 dri2_convert_glx_query_renderer_attribs(int attribute
)
36 case GLX_RENDERER_VENDOR_ID_MESA
:
37 return __DRI2_RENDERER_VENDOR_ID
;
38 case GLX_RENDERER_DEVICE_ID_MESA
:
39 return __DRI2_RENDERER_DEVICE_ID
;
40 case GLX_RENDERER_VERSION_MESA
:
41 return __DRI2_RENDERER_VERSION
;
42 case GLX_RENDERER_ACCELERATED_MESA
:
43 return __DRI2_RENDERER_ACCELERATED
;
44 case GLX_RENDERER_VIDEO_MEMORY_MESA
:
45 return __DRI2_RENDERER_VIDEO_MEMORY
;
46 case GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA
:
47 return __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE
;
48 case GLX_RENDERER_PREFERRED_PROFILE_MESA
:
49 return __DRI2_RENDERER_PREFERRED_PROFILE
;
50 case GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA
:
51 return __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION
;
52 case GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA
:
53 return __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION
;
54 case GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA
:
55 return __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION
;
56 case GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA
:
57 return __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION
;
64 dri2_query_renderer_integer(struct glx_screen
*base
, int attribute
,
67 struct dri2_screen
*const psc
= (struct dri2_screen
*) base
;
69 /* Even though there are invalid values (and
70 * dri2_convert_glx_query_renderer_attribs may return -1), the higher level
71 * GLX code is required to perform the filtering. Assume that we got a
74 const int dri_attribute
= dri2_convert_glx_query_renderer_attribs(attribute
);
76 if (psc
->rendererQuery
== NULL
)
79 return psc
->rendererQuery
->queryInteger(psc
->driScreen
, dri_attribute
,
84 dri2_query_renderer_string(struct glx_screen
*base
, int attribute
,
87 struct dri2_screen
*const psc
= (struct dri2_screen
*) base
;
89 /* Even though queryString only accepts a subset of the possible GLX
90 * queries, the higher level GLX code is required to perform the filtering.
91 * Assume that we got a good value.
93 const int dri_attribute
= dri2_convert_glx_query_renderer_attribs(attribute
);
95 if (psc
->rendererQuery
== NULL
)
98 return psc
->rendererQuery
->queryString(psc
->driScreen
, dri_attribute
, value
);
101 #endif /* GLX_DIRECT_RENDERING */