[Mesa-dev] [PATCH 15/25] st/dri: set max_gl*version based on the value supported by the driver

Emil Velikov emil.l.velikov at gmail.com
Fri Feb 21 19:04:05 PST 2014


Avoid setting generic gallium max_gl*version values, but use driver
provided ones instead.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---

Marek stated that drivers may abuse this and report version that
are not supported/handled by core mesa. The following patch adds
a way of capping the driver values, thus resolving this.

Might want to squash this with the following patch, depending on
how devs feel on the subject.

-Emil

 src/gallium/state_trackers/dri/common/dri_screen.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 7a6dcb2..a14ce3c 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -448,18 +448,21 @@ dri_init_screen_helper(struct dri_screen *screen,
 
    dri_postprocessing_init(screen);
 
-   /* gallium drivers don't declare what version of GL they support, so we
-    * check the computed Mesa context version after context creation and fail
-    * out then.
-    */
    if (screen->st_api->profile_mask & ST_PROFILE_DEFAULT_MASK)
-      screen->sPriv->max_gl_compat_version = 30;
+      screen->sPriv->max_gl_compat_version =
+            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_COMPAT_VERSION);
+
    if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_CORE_MASK)
-      screen->sPriv->max_gl_core_version = 33;
+      screen->sPriv->max_gl_core_version =
+            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_CORE_VERSION);
+
    if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES1_MASK)
-      screen->sPriv->max_gl_es1_version = 11;
+      screen->sPriv->max_gl_es1_version =
+            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_ES1_VERSION);
+
    if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES2_MASK)
-      screen->sPriv->max_gl_es2_version = 30;
+      screen->sPriv->max_gl_es2_version =
+            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_ES2_VERSION);
 
    return dri_fill_in_modes(screen);
 }
-- 
1.9.0



More information about the mesa-dev mailing list