[PATCH 5/8] glamor: add core profile support. (v2)

Dave Airlie airlied at gmail.com
Mon Jan 18 23:02:31 PST 2016


From: Dave Airlie <airlied at redhat.com>

Glamor works out from the profile if it is
core.

This flag is used to disable quads for rendering.

v1.1: split long line + make whitespace conform (Michel)
v1.2: add GL 3.1 version defines
v2: move to having glamor work out the profile.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 glamor/glamor.c      | 8 +++++++-
 glamor/glamor.h      | 4 ++++
 glamor/glamor_priv.h | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 7fa3a46..e751a09 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -576,9 +576,15 @@ glamor_init(ScreenPtr screen, unsigned int flags)
     glamor_priv->has_vertex_array_object =
         epoxy_has_gl_extension("GL_ARB_vertex_array_object");
 
+    /* assume a core profile if we are GL 3.1 and don't have ARB_compatibility */
+    glamor_priv->is_core_profile =
+        gl_version >= 31 && !epoxy_has_gl_extension("GL_ARB_compatibility");
+
     glamor_setup_debug_output(screen);
 
-    glamor_priv->use_quads = (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
+    glamor_priv->use_quads = (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) &&
+                             !glamor_priv->is_core_profile;
+
     /* Driver-specific hack: Avoid using GL_QUADS on VC4, where
      * they'll be emulated more expensively than we can with our
      * cached IB.
diff --git a/glamor/glamor.h b/glamor/glamor.h
index a4e0655..a73e9ef 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -66,6 +66,10 @@ typedef enum glamor_pixmap_type {
 #define GLAMOR_VALID_FLAGS      (GLAMOR_USE_EGL_SCREEN                \
                                  | GLAMOR_NO_DRI3)
 
+/* until we need geometry shaders GL3.1 should suffice. */
+#define GLAMOR_GL_CORE_VER_MAJOR 3
+#define GLAMOR_GL_CORE_VER_MINOR 1
+
 /* @glamor_init: Initialize glamor internal data structure.
  *
  * @screen: Current screen pointer.
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index d58c40f..a90c3ac 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -210,6 +210,7 @@ typedef struct glamor_screen_private {
     Bool use_quads;
     Bool has_dual_blend;
     Bool has_vertex_array_object;
+    Bool is_core_profile;
     int max_fbo_size;
 
     GLuint one_channel_format;
-- 
2.4.3



More information about the xorg-devel mailing list