summaryrefslogtreecommitdiff
path: root/src/sna/gen2_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-30 21:01:11 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-30 21:18:43 +0100
commit43176b9bfafe389c4b9ed676f4e50e3b06f858c4 (patch)
tree17ee682cf1c0ebc886c29d7c390b50e34b45d3bd /src/sna/gen2_render.c
parent6c3399715e316be970c696b8949e3c14e83ea5df (diff)
sna/dri2: Pass around the correct DrawableRec for sampling from the foriegn bo
One day, we will move the width/height/bpp to the bo itself... Reported-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen2_render.c')
-rw-r--r--src/sna/gen2_render.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index fc0406e2..4cc8dcd5 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -2734,7 +2734,7 @@ static bool
gen2_render_fill_boxes_try_blt(struct sna *sna,
CARD8 op, PictFormat format,
const xRenderColor *color,
- PixmapPtr dst, struct kgem_bo *dst_bo,
+ const DrawableRec *dst, struct kgem_bo *dst_bo,
const BoxRec *box, int n)
{
uint8_t alu;
@@ -2757,7 +2757,7 @@ gen2_render_fill_boxes_try_blt(struct sna *sna,
alu = GXcopy;
return sna_blt_fill_boxes(sna, alu,
- dst_bo, dst->drawable.bitsPerPixel,
+ dst_bo, dst->bitsPerPixel,
pixel, box, n);
}
@@ -2766,7 +2766,7 @@ gen2_render_fill_boxes(struct sna *sna,
CARD8 op,
PictFormat format,
const xRenderColor *color,
- PixmapPtr dst, struct kgem_bo *dst_bo,
+ const DrawableRec *dst, struct kgem_bo *dst_bo,
const BoxRec *box, int n)
{
struct sna_composite_op tmp;
@@ -2793,7 +2793,7 @@ gen2_render_fill_boxes(struct sna *sna,
__FUNCTION__, op, (int)format,
color->red, color->green, color->blue, color->alpha));
- if (too_large(dst->drawable.width, dst->drawable.height) ||
+ if (too_large(dst->width, dst->height) ||
dst_bo->pitch < 8 || dst_bo->pitch > MAX_3D_PITCH ||
!gen2_check_dst_format(format)) {
DBG(("%s: try blt, too large or incompatible destination\n",
@@ -2821,9 +2821,10 @@ gen2_render_fill_boxes(struct sna *sna,
memset(&tmp, 0, sizeof(tmp));
tmp.op = op;
- tmp.dst.pixmap = dst;
- tmp.dst.width = dst->drawable.width;
- tmp.dst.height = dst->drawable.height;
+ assert(dst->type == DRAWABLE_PIXMAP);
+ tmp.dst.pixmap = (PixmapPtr)dst;
+ tmp.dst.width = dst->width;
+ tmp.dst.height = dst->height;
tmp.dst.format = format;
tmp.dst.bo = dst_bo;
tmp.floats_per_vertex = 2;
@@ -3103,20 +3104,20 @@ gen2_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
static void
gen2_render_copy_setup_source(struct sna_composite_channel *channel,
- PixmapPtr pixmap,
+ const DrawableRec *draw,
struct kgem_bo *bo)
{
- assert(pixmap->drawable.width && pixmap->drawable.height);
+ assert(draw->width && draw->height);
channel->filter = PictFilterNearest;
channel->repeat = RepeatNone;
- channel->width = pixmap->drawable.width;
- channel->height = pixmap->drawable.height;
- channel->scale[0] = 1.f/pixmap->drawable.width;
- channel->scale[1] = 1.f/pixmap->drawable.height;
+ channel->width = draw->width;
+ channel->height = draw->height;
+ channel->scale[0] = 1.f/draw->width;
+ channel->scale[1] = 1.f/draw->height;
channel->offset[0] = 0;
channel->offset[1] = 0;
- channel->pict_format = sna_format_for_depth(pixmap->drawable.depth);
+ channel->pict_format = sna_format_for_depth(draw->depth);
channel->bo = bo;
channel->is_affine = 1;
@@ -3205,8 +3206,8 @@ static void gen2_emit_copy_state(struct sna *sna, const struct sna_composite_op
static bool
gen2_render_copy_boxes(struct sna *sna, uint8_t alu,
- PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
- PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
+ const DrawableRec *src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
+ const DrawableRec *dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
const BoxRec *box, int n, unsigned flags)
{
struct sna_composite_op tmp;
@@ -3225,16 +3226,16 @@ gen2_render_copy_boxes(struct sna *sna, uint8_t alu,
DBG(("%s (%d, %d)->(%d, %d) x %d\n",
__FUNCTION__, src_dx, src_dy, dst_dx, dst_dy, n));
- if (sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
+ if (sna_blt_compare_depth(src, dst) &&
sna_blt_copy_boxes(sna, alu,
src_bo, src_dx, src_dy,
dst_bo, dst_dx, dst_dy,
- dst->drawable.bitsPerPixel,
+ dst->bitsPerPixel,
box, n))
return true;
if (src_bo == dst_bo || /* XXX handle overlap using 3D ? */
- too_large(src->drawable.width, src->drawable.height) ||
+ too_large(src->width, src->height) ||
src_bo->pitch > MAX_3D_PITCH || dst_bo->pitch < 8) {
fallback:
return sna_blt_copy_boxes_fallback(sna, alu,
@@ -3254,10 +3255,10 @@ fallback:
memset(&tmp, 0, sizeof(tmp));
tmp.op = alu;
- tmp.dst.pixmap = dst;
- tmp.dst.width = dst->drawable.width;
- tmp.dst.height = dst->drawable.height;
- tmp.dst.format = sna_format_for_depth(dst->drawable.depth);
+ tmp.dst.pixmap = (PixmapPtr)dst;
+ tmp.dst.width = dst->width;
+ tmp.dst.height = dst->height;
+ tmp.dst.format = sna_format_for_depth(dst->depth);
tmp.dst.bo = dst_bo;
tmp.dst.x = tmp.dst.y = 0;
tmp.damage = NULL;
@@ -3428,7 +3429,7 @@ fallback:
tmp->base.dst.format = sna_format_for_depth(dst->drawable.depth);
tmp->base.dst.bo = dst_bo;
- gen2_render_copy_setup_source(&tmp->base.src, src, src_bo);
+ gen2_render_copy_setup_source(&tmp->base.src, &src->drawable, src_bo);
tmp->base.mask.bo = NULL;
tmp->base.floats_per_vertex = 4;