summaryrefslogtreecommitdiff
path: root/glamor/glamor_picture.c
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@linux.intel.com>2012-01-18 17:07:25 +0800
committerEric Anholt <eric@anholt.net>2013-12-18 11:23:47 -0800
commit994a9ff7f58161bf5651f83d810eb77b7718ab00 (patch)
tree094ee52af7ae7ec19cb25338280e83ae49ed04d3 /glamor/glamor_picture.c
parent28fcd7cd01edfdf68c370e6c6ad0238d45477b3f (diff)
glamor_create_picture: Fix the format matching method.
We should not simply set a TEXTURE_DRM pixmap to a separated texture pixmap. If the format is compatible with current fbo then it is just fine to keep it as TEXTURE_DRM type and we can safely fallback to DDX layer on it. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'glamor/glamor_picture.c')
-rw-r--r--glamor/glamor_picture.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index a9e3c267d..6904dab20 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -65,15 +65,21 @@ glamor_create_picture(PicturePtr picture)
* the uploading, we need to know the picture format. */
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
pixmap_priv = glamor_get_pixmap_private(pixmap);
+ } else {
+ if (GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
+ /* If the picture format is not compatible with glamor fbo format,
+ * we have to mark this pixmap as a separated texture, and don't
+ * fallback to DDX layer. */
+ if (pixmap_priv->type == GLAMOR_TEXTURE_DRM
+ && !glamor_pict_format_is_compatible(picture->format,
+ pixmap->drawable.depth))
+ glamor_set_pixmap_type(pixmap, GLAMOR_SEPARATE_TEXTURE);
+ }
}
-
- if (pixmap_priv) {
- pixmap_priv->is_picture = 1;
- pixmap_priv->pict_format = picture->format;
- /* XXX Some formats are compatible between glamor and ddx driver*/
- if (pixmap_priv->type == GLAMOR_TEXTURE_DRM)
- glamor_set_pixmap_type(pixmap, GLAMOR_SEPARATE_TEXTURE);
- }
+
+ pixmap_priv->is_picture = 1;
+ pixmap_priv->pict_format = picture->format;
+
return miCreatePicture(picture);
}