Commit 0e3f1252 authored by Emma Anholt's avatar Emma Anholt
Browse files

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: Emma Anholt's avatarEric Anholt <eric@anholt.net>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
parent f47e3f53
...@@ -531,6 +531,15 @@ glamor_init(ScreenPtr screen, unsigned int flags) ...@@ -531,6 +531,15 @@ glamor_init(ScreenPtr screen, unsigned int flags)
epoxy_gl_version() >= 30 || epoxy_gl_version() >= 30 ||
epoxy_has_gl_extension("GL_NV_pack_subimage"); 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_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size);
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size); glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size);
......
...@@ -203,6 +203,7 @@ typedef struct glamor_screen_private { ...@@ -203,6 +203,7 @@ typedef struct glamor_screen_private {
Bool has_pack_subimage; Bool has_pack_subimage;
Bool has_unpack_subimage; Bool has_unpack_subimage;
Bool has_rw_pbo; Bool has_rw_pbo;
Bool use_quads;
int max_fbo_size; int max_fbo_size;
struct xorg_list struct xorg_list
......
...@@ -1400,7 +1400,7 @@ glamor_make_current(glamor_screen_private *glamor_priv) ...@@ -1400,7 +1400,7 @@ glamor_make_current(glamor_screen_private *glamor_priv)
static inline void static inline void
glamor_glDrawArrays_GL_QUADS(glamor_screen_private *glamor_priv, unsigned count) 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); glDrawArrays(GL_QUADS, 0, count * 4);
} else { } else {
glamor_gldrawarrays_quads_using_indices(glamor_priv, count); glamor_gldrawarrays_quads_using_indices(glamor_priv, count);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment