Track all picture's drawable pict format.

Even if a picture's pixmap is a pure in memory pixmap, we still need
to track its format. The reason is we may need to upload this drawable
to texture thus we need to know its real picture format.

As to the MACRO to check whether a pixmap is a picture, we should
check whether the priv is non-NULL before we touch its field.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2012-01-04 14:34:39 +08:00 committed by Eric Anholt
parent 8a4758a358
commit 057f52a04d
2 changed files with 9 additions and 1 deletions

View File

@ -58,6 +58,14 @@ glamor_create_picture(PicturePtr picture)
glamor_get_screen_private(picture->pDrawable->pScreen);
pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
pixmap_priv = glamor_get_pixmap_private(pixmap);
if (!pixmap_priv) {
/* We must create a pixmap priv to track the picture format even
* if the pixmap is a pure in memory pixmap. The reason is that
* we may need to upload this pixmap to a texture on the fly. During
* the uploading, we need to know the picture format. */
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
pixmap_priv = glamor_get_pixmap_private(pixmap);
}
if (pixmap_priv) {
pixmap_priv->is_picture = 1;

View File

@ -175,7 +175,7 @@ glamor_transform_boxes(BoxPtr boxes, int nbox, int dx, int dy)
|| _depth_ == 32)
#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv->is_picture == 1)
#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->is_picture == 1)
#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->gl_fbo == 1)
#define GLAMOR_PIXMAP_PRIV_NEED_VALIDATE(pixmap_priv) \