[PATCH xserver] glamor: Clarify variable names in glamor_copy_cpu_fbo
Keith Packard
keithp at keithp.com
Tue Jun 13 00:50:11 UTC 2017
This function creates a temporary pixmap to hold data being moved from
the source to the destination. However, it labeled all of the
variables associated with this as src_, which makes it confusing to
read the code. Rename them tmp_ instead. Also fix the comment
describing the function to note that it copies from CPU to GPU, not
GPU to GPU.
Signed-off-by: Keith Packard <keithp at keithp.com>
---
glamor/glamor_copy.c | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index ff8f44ef1..b13f11d42 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -180,7 +180,7 @@ glamor_copy_bail(DrawablePtr src,
}
/**
- * Implements CopyPlane and CopyArea from the GPU to the GPU by using
+ * Implements CopyPlane and CopyArea from the CPU to the GPU by using
* the source as a texture and painting that into the destination.
*
* This requires that source and dest are different textures, or that
@@ -203,10 +203,6 @@ glamor_copy_cpu_fbo(DrawablePtr src,
ScreenPtr screen = dst->pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst);
- FbBits *src_bits;
- FbStride src_stride;
- int src_bpp;
- int src_xoff, src_yoff;
int dst_xoff, dst_yoff;
if (gc && gc->alu != GXcopy)
@@ -221,33 +217,43 @@ glamor_copy_cpu_fbo(DrawablePtr src,
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_xoff, &dst_yoff);
if (bitplane) {
- PixmapPtr src_pix = fbCreatePixmap(screen, dst_pixmap->drawable.width,
+ FbBits *tmp_bits;
+ FbStride tmp_stride;
+ int tmp_bpp;
+ int tmp_xoff, tmp_yoff;
+
+ PixmapPtr tmp_pix = fbCreatePixmap(screen, dst_pixmap->drawable.width,
dst_pixmap->drawable.height,
dst->depth, 0);
- if (!src_pix) {
+ if (!tmp_pix) {
glamor_finish_access(src);
goto bail;
}
- src_pix->drawable.x = -dst->x;
- src_pix->drawable.y = -dst->y;
+ tmp_pix->drawable.x = -dst->x;
+ tmp_pix->drawable.y = -dst->y;
- fbGetDrawable(&src_pix->drawable, src_bits, src_stride, src_bpp, src_xoff,
- src_yoff);
+ fbGetDrawable(&tmp_pix->drawable, tmp_bits, tmp_stride, tmp_bpp, tmp_xoff,
+ tmp_yoff);
if (src->bitsPerPixel > 1)
- fbCopyNto1(src, &src_pix->drawable, gc, box, nbox, dx, dy,
+ fbCopyNto1(src, &tmp_pix->drawable, gc, box, nbox, dx, dy,
reverse, upsidedown, bitplane, closure);
else
- fbCopy1toN(src, &src_pix->drawable, gc, box, nbox, dx, dy,
+ fbCopy1toN(src, &tmp_pix->drawable, gc, box, nbox, dx, dy,
reverse, upsidedown, bitplane, closure);
- glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff, src_yoff,
- dst_xoff, dst_yoff, (uint8_t *) src_bits,
- src_stride * sizeof(FbBits));
- fbDestroyPixmap(src_pix);
+ glamor_upload_boxes(dst_pixmap, box, nbox, tmp_xoff, tmp_yoff,
+ dst_xoff, dst_yoff, (uint8_t *) tmp_bits,
+ tmp_stride * sizeof(FbBits));
+ fbDestroyPixmap(tmp_pix);
} else {
+ FbBits *src_bits;
+ FbStride src_stride;
+ int src_bpp;
+ int src_xoff, src_yoff;
+
fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff + dx, src_yoff + dy,
dst_xoff, dst_yoff,
--
2.11.0
More information about the xorg-devel
mailing list