diff options
author | Axel Davy <axel.davy@ens.fr> | 2013-12-05 08:49:15 +0100 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2013-12-18 11:23:54 -0800 |
commit | 7cfd9cc23270c0246d584e167fe14bf5af4571df (patch) | |
tree | eeae7a689072d22eb08253cdae3d0dfe08667b18 /glamor/glamor_fbo.c | |
parent | 06ba3fdfd6162a64c149ea6fda85f9f56d7f3c31 (diff) |
Add DRI3 support to glamor
This implements some DRI3 helpers to help the DDXs using
glamor to support DRI3.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'glamor/glamor_fbo.c')
-rw-r--r-- | glamor/glamor_fbo.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c index 4838a277f..d1b087ebe 100644 --- a/glamor/glamor_fbo.c +++ b/glamor/glamor_fbo.c @@ -328,18 +328,30 @@ _glamor_create_tex(glamor_screen_private *glamor_priv, int w, int h, GLenum format) { glamor_gl_dispatch *dispatch; - unsigned int tex; - - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glGenTextures(1, &tex); - dispatch->glBindTexture(GL_TEXTURE_2D, tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, - GL_NEAREST); - dispatch->glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, format, - GL_UNSIGNED_BYTE, NULL); - glamor_put_dispatch(glamor_priv); + unsigned int tex = 0; + + /* With dri3, we want to allocate ARGB8888 pixmaps only. + * Depending on the implementation, GL_RGBA might not + * give us ARGB8888. We ask glamor_egl to use get + * an ARGB8888 based texture for us. */ + if (glamor_priv->dri3_enabled && format == GL_RGBA) + { + tex = glamor_egl_create_argb8888_based_texture(glamor_priv->screen, + w, h); + } + if (!tex) + { + dispatch = glamor_get_dispatch(glamor_priv); + dispatch->glGenTextures(1, &tex); + dispatch->glBindTexture(GL_TEXTURE_2D, tex); + dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_NEAREST); + dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + GL_NEAREST); + dispatch->glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, + format, GL_UNSIGNED_BYTE, NULL); + glamor_put_dispatch(glamor_priv); + } return tex; } |