From 2bf34fe8d9b7628d164392c2d11ace78f7cf17b9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 13 Oct 2014 12:32:27 -0700 Subject: [PATCH] glamor: Pass depth to glamor_pm_is_solid and glamor_set_planemask Instead of passing the destination drawable, just pass the depth, as the underlying functions need only that to check whether the planemask is going to work. This API change will allow higher level functions to not need the destination pixmap. Signed-off-by: Keith Packard Reviewed-by: Eric Anholt --- glamor/glamor_copy.c | 9 ++++----- glamor/glamor_image.c | 4 ++-- glamor/glamor_pixmap.c | 4 ++-- glamor/glamor_priv.h | 8 ++++---- glamor/glamor_spans.c | 2 +- glamor/glamor_text.c | 2 +- glamor/glamor_transform.c | 4 ++-- 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c index 75fe8a700d..921e80e3d6 100644 --- a/glamor/glamor_copy.c +++ b/glamor/glamor_copy.c @@ -212,7 +212,7 @@ glamor_copy_cpu_fbo(DrawablePtr src, if (gc && gc->alu != GXcopy) goto bail; - if (gc && !glamor_pm_is_solid(dst, gc->planemask)) + if (gc && !glamor_pm_is_solid(gc->depth, gc->planemask)) goto bail; glamor_make_current(glamor_priv); @@ -262,7 +262,7 @@ glamor_copy_fbo_cpu(DrawablePtr src, if (gc && gc->alu != GXcopy) goto bail; - if (gc && !glamor_pm_is_solid(dst, gc->planemask)) + if (gc && !glamor_pm_is_solid(gc->depth, gc->planemask)) goto bail; glamor_make_current(glamor_priv); @@ -319,7 +319,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src, glamor_make_current(glamor_priv); - if (gc && !glamor_set_planemask(dst_pixmap, gc->planemask)) + if (gc && !glamor_set_planemask(gc->depth, gc->planemask)) goto bail_ctx; if (!glamor_set_alu(screen, gc ? gc->alu : GXcopy)) @@ -419,7 +419,6 @@ glamor_copy_fbo_fbo_temp(DrawablePtr src, { ScreenPtr screen = dst->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst); PixmapPtr tmp_pixmap; BoxRec bounds; int n; @@ -434,7 +433,7 @@ glamor_copy_fbo_fbo_temp(DrawablePtr src, */ glamor_make_current(glamor_priv); - if (gc && !glamor_set_planemask(dst_pixmap, gc->planemask)) + if (gc && !glamor_set_planemask(gc->depth, gc->planemask)) goto bail_ctx; if (!glamor_set_alu(screen, gc ? gc->alu : GXcopy)) diff --git a/glamor/glamor_image.c b/glamor/glamor_image.c index 5633da6478..a272d5eafe 100644 --- a/glamor/glamor_image.c +++ b/glamor/glamor_image.c @@ -49,7 +49,7 @@ glamor_put_image_gl(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, if (gc->alu != GXcopy) goto bail; - if (!glamor_pm_is_solid(&pixmap->drawable, gc->planemask)) + if (!glamor_pm_is_solid(gc->depth, gc->planemask)) goto bail; if (format == XYPixmap && drawable->depth == 1 && leftPad == 0) @@ -116,7 +116,7 @@ glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h, if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; - if (format != ZPixmap || !glamor_pm_is_solid(drawable, plane_mask)) + if (format != ZPixmap || !glamor_pm_is_solid(drawable->depth, plane_mask)) goto bail; glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c index 6235747163..4e87371723 100644 --- a/glamor/glamor_pixmap.c +++ b/glamor/glamor_pixmap.c @@ -109,9 +109,9 @@ glamor_set_destination_pixmap(PixmapPtr pixmap) } Bool -glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask) +glamor_set_planemask(int depth, unsigned long planemask) { - if (glamor_pm_is_solid(&pixmap->drawable, planemask)) { + if (glamor_pm_is_solid(depth, planemask)) { return GL_TRUE; } diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index 4b9ba4d55a..e586fcc516 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -638,10 +638,10 @@ glamor_get_gc_private(GCPtr gc) * pixel values for pDrawable. */ static inline Bool -glamor_pm_is_solid(DrawablePtr drawable, unsigned long planemask) +glamor_pm_is_solid(int depth, unsigned long planemask) { - return (planemask & FbFullMask(drawable->depth)) == - FbFullMask(drawable->depth); + return (planemask & FbFullMask(depth)) == + FbFullMask(depth); } extern int glamor_debug_level; @@ -701,7 +701,7 @@ glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int swap_rb); Bool glamor_set_alu(ScreenPtr screen, unsigned char alu); -Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask); +Bool glamor_set_planemask(int depth, unsigned long planemask); RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap); void diff --git a/glamor/glamor_spans.c b/glamor/glamor_spans.c index b358c60bdd..58da3edf7a 100644 --- a/glamor/glamor_spans.c +++ b/glamor/glamor_spans.c @@ -279,7 +279,7 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src, if (gc->alu != GXcopy) goto bail; - if (!glamor_pm_is_solid(&pixmap->drawable, gc->planemask)) + if (!glamor_pm_is_solid(gc->depth, gc->planemask)) goto bail; glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); diff --git a/glamor/glamor_text.c b/glamor/glamor_text.c index c7c1ab7383..8d8c970728 100644 --- a/glamor/glamor_text.c +++ b/glamor/glamor_text.c @@ -431,7 +431,7 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc, /* Check planemask before drawing background to * bail early if it's not OK */ - if (!glamor_set_planemask(pixmap, gc->planemask)) + if (!glamor_set_planemask(gc->depth, gc->planemask)) goto bail; for (c = 0; c < count; c++) if (charinfo[c]) diff --git a/glamor/glamor_transform.c b/glamor/glamor_transform.c index 6d29e9eb6b..3036a06d06 100644 --- a/glamor/glamor_transform.c +++ b/glamor/glamor_transform.c @@ -129,7 +129,7 @@ glamor_set_solid(PixmapPtr pixmap, CARD32 pixel; int alu = use_alu ? gc->alu : GXcopy; - if (!glamor_set_planemask(pixmap, gc->planemask)) + if (!glamor_set_planemask(gc->depth, gc->planemask)) return FALSE; pixel = gc->fgPixel; @@ -189,7 +189,7 @@ glamor_set_tiled(PixmapPtr pixmap, if (!glamor_set_alu(pixmap->drawable.pScreen, gc->alu)) return FALSE; - if (!glamor_set_planemask(pixmap, gc->planemask)) + if (!glamor_set_planemask(gc->depth, gc->planemask)) return FALSE; return glamor_set_texture(pixmap,