summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-07-02 12:55:27 -0700
committerEric Anholt <eric@anholt.net>2015-07-10 09:42:58 -0700
commit0dbdb83b0d0254ac67fb33da8bf9ebc0ef4e8081 (patch)
tree5d72e3dc94049da5ee1fa96af71096f1efd380f1
parent1fd11c46aa086e4b80cb1bafa87c6b19a8014fd1 (diff)
glamor: Use the actual picture's format when uploading memory pixmaps.
The pixmap->picture is just the *last* picture attached to the pixmap, so you'd potentially be looking at the wrong one when trying to temporarily upload to avoid a composite fallback. There's some trickiness in glamor_render.c when we're dealing with the upload of a GLAMOR_MEMORY pixmap as both the source and mask using different formats, where we smash the source's format to a new value so that the mask can use the same uploaded bits. Dropping most of that should be safe, since it will be uploaded as the source first, so the smashed format will still be used. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--glamor/glamor_picture.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index 3b0b7c945..c36d9d6c9 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -307,22 +307,15 @@ glamor_get_tex_format_type_from_pictformat_gles2(PictFormatShort format,
static int
glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap,
+ PictFormatShort pict_format,
GLenum *format,
GLenum *type,
int *no_alpha,
int *revert, int *swap_rb, int is_upload)
{
- glamor_pixmap_private *pixmap_priv;
- PictFormatShort pict_format;
glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen);
- pixmap_priv = glamor_get_pixmap_private(pixmap);
- if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
- pict_format = pixmap_priv->picture->format;
- else
- pict_format = format_for_depth(pixmap->drawable.depth);
-
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
return glamor_get_tex_format_type_from_pictformat_gl(pict_format,
format, type,
@@ -774,7 +767,8 @@ glamor_put_bits(char *dst_bits, int dst_stride, char *src_bits,
static Bool
glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
- int h, int stride, void *bits, int pbo)
+ int h, int stride, void *bits, int pbo,
+ PictFormatShort pict_format)
{
ScreenPtr screen = pixmap->drawable.pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
@@ -784,6 +778,7 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
Bool force_clip;
if (glamor_get_tex_format_type_from_pixmap(pixmap,
+ pict_format,
&format,
&type,
&no_alpha,
@@ -884,23 +879,6 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
pbo);
}
-static enum glamor_pixmap_status
-glamor_upload_pixmap_to_texture(PixmapPtr pixmap)
-{
- int ret;
-
- if (glamor_upload_sub_pixmap_to_texture(pixmap, 0, 0,
- pixmap->drawable.width,
- pixmap->drawable.height,
- pixmap->devKind,
- pixmap->devPrivate.ptr, 0))
- ret = GLAMOR_UPLOAD_DONE;
- else
- ret = GLAMOR_UPLOAD_FAILED;
-
- return ret;
-}
-
/* Upload picture to texture. We may need to flip the y axis or
* wire alpha to 1. So we may conditional create fbo for the picture.
* */
@@ -912,7 +890,15 @@ glamor_upload_picture_to_texture(PicturePtr picture)
assert(picture->pDrawable);
pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
- return glamor_upload_pixmap_to_texture(pixmap);
+ if (glamor_upload_sub_pixmap_to_texture(pixmap, 0, 0,
+ pixmap->drawable.width,
+ pixmap->drawable.height,
+ pixmap->devKind,
+ pixmap->devPrivate.ptr, 0,
+ picture->format))
+ return GLAMOR_UPLOAD_DONE;
+ else
+ return GLAMOR_UPLOAD_FAILED;
}
/*