summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-06-19 18:40:47 -0700
committerEric Anholt <eric@anholt.net>2015-06-29 21:43:36 -0700
commit0e3f1252dacdc3194a99a2d090b5c13f070f8799 (patch)
treee5851467be55dc83d5be9a3f2380d18f61378212
parentf47e3f539568d19e22d10d7dd4ec09c7d570e716 (diff)
glamor: Avoid using GL_QUADS on VC4.
Improves text rendering from about 284k glyphs per second to 320k glyphs per second. There's no GL extension for probing this, because of the philosophy of "Don't expose whether things are really in hardware or not." Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--glamor/glamor.c9
-rw-r--r--glamor/glamor_priv.h1
-rw-r--r--glamor/glamor_utils.h2
3 files changed, 11 insertions, 1 deletions
diff --git a/glamor/glamor.c b/glamor/glamor.c
index fbb1d851a..525249c9e 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -531,6 +531,15 @@ glamor_init(ScreenPtr screen, unsigned int flags)
epoxy_gl_version() >= 30 ||
epoxy_has_gl_extension("GL_NV_pack_subimage");
+ glamor_priv->use_quads = (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
+ /* Driver-specific hack: Avoid using GL_QUADS on VC4, where
+ * they'll be emulated more expensively than we can with our
+ * cached IB.
+ */
+ if (strstr((char *)glGetString(GL_VENDOR), "Broadcom") &&
+ strstr((char *)glGetString(GL_RENDERER), "VC4"))
+ glamor_priv->use_quads = FALSE;
+
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size);
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size);
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 681895ff3..3e666b482 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -203,6 +203,7 @@ typedef struct glamor_screen_private {
Bool has_pack_subimage;
Bool has_unpack_subimage;
Bool has_rw_pbo;
+ Bool use_quads;
int max_fbo_size;
struct xorg_list
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index 73cda9c2b..66c3492b6 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -1400,7 +1400,7 @@ glamor_make_current(glamor_screen_private *glamor_priv)
static inline void
glamor_glDrawArrays_GL_QUADS(glamor_screen_private *glamor_priv, unsigned count)
{
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+ if (glamor_priv->use_quads) {
glDrawArrays(GL_QUADS, 0, count * 4);
} else {
glamor_gldrawarrays_quads_using_indices(glamor_priv, count);