sna/io: Propagate failure to XOR uploads
Similar to the handling required for the normal upload paths. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
51590e55c0
commit
51c87f9aca
|
|
@ -884,7 +884,7 @@ bool sna_write_boxes(struct sna *sna, PixmapPtr dst,
|
|||
struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
|
||||
const void *src, int stride, int16_t src_dx, int16_t src_dy,
|
||||
const BoxRec *box, int n);
|
||||
void sna_write_boxes__xor(struct sna *sna, PixmapPtr dst,
|
||||
bool sna_write_boxes__xor(struct sna *sna, PixmapPtr dst,
|
||||
struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
|
||||
const void *src, int stride, int16_t src_dx, int16_t src_dy,
|
||||
const BoxRec *box, int nbox,
|
||||
|
|
@ -894,11 +894,11 @@ bool sna_replace(struct sna *sna,
|
|||
PixmapPtr pixmap,
|
||||
struct kgem_bo **bo,
|
||||
const void *src, int stride);
|
||||
struct kgem_bo *sna_replace__xor(struct sna *sna,
|
||||
PixmapPtr pixmap,
|
||||
struct kgem_bo *bo,
|
||||
const void *src, int stride,
|
||||
uint32_t and, uint32_t or);
|
||||
bool sna_replace__xor(struct sna *sna,
|
||||
PixmapPtr pixmap,
|
||||
struct kgem_bo **bo,
|
||||
const void *src, int stride,
|
||||
uint32_t and, uint32_t or);
|
||||
|
||||
bool
|
||||
sna_compute_composite_extents(BoxPtr extents,
|
||||
|
|
|
|||
|
|
@ -1709,6 +1709,7 @@ blt_put_composite(struct sna *sna,
|
|||
data += (src_x - dst_x) * bpp / 8;
|
||||
data += (src_y - dst_y) * pitch;
|
||||
|
||||
assert(op->dst.bo == dst_priv->gpu_bo);
|
||||
sna_replace(sna, op->dst.pixmap, &dst_priv->gpu_bo,
|
||||
data, pitch);
|
||||
} else {
|
||||
|
|
@ -1750,6 +1751,7 @@ fastcall static void blt_put_composite_box(struct sna *sna,
|
|||
data += (box->y1 + op->u.blt.sy) * pitch;
|
||||
data += (box->x1 + op->u.blt.sx) * bpp;
|
||||
|
||||
assert(op->dst.bo == dst_priv->gpu_bo);
|
||||
sna_replace(sna, op->dst.pixmap, &dst_priv->gpu_bo,
|
||||
data, pitch);
|
||||
} else {
|
||||
|
|
@ -1788,6 +1790,7 @@ static void blt_put_composite_boxes(struct sna *sna,
|
|||
data += (box->y1 + op->u.blt.sy) * pitch;
|
||||
data += (box->x1 + op->u.blt.sx) * bpp;
|
||||
|
||||
assert(op->dst.bo == dst_priv->gpu_bo);
|
||||
sna_replace(sna, op->dst.pixmap, &dst_priv->gpu_bo,
|
||||
data, pitch);
|
||||
} else {
|
||||
|
|
@ -1829,10 +1832,9 @@ blt_put_composite_with_alpha(struct sna *sna,
|
|||
data += (src_x - dst_x) * bpp;
|
||||
data += (src_y - dst_y) * pitch;
|
||||
|
||||
dst_priv->gpu_bo =
|
||||
sna_replace__xor(sna, op->dst.pixmap, dst_priv->gpu_bo,
|
||||
data, pitch,
|
||||
0xffffffff, op->u.blt.pixel);
|
||||
assert(op->dst.bo == dst_priv->gpu_bo);
|
||||
sna_replace__xor(sna, op->dst.pixmap, &dst_priv->gpu_bo,
|
||||
data, pitch, 0xffffffff, op->u.blt.pixel);
|
||||
} else {
|
||||
BoxRec box;
|
||||
|
||||
|
|
@ -1871,10 +1873,9 @@ blt_put_composite_box_with_alpha(struct sna *sna,
|
|||
data += (box->y1 + op->u.blt.sy) * pitch;
|
||||
data += (box->x1 + op->u.blt.sx) * bpp;
|
||||
|
||||
dst_priv->gpu_bo =
|
||||
sna_replace__xor(sna, op->dst.pixmap, op->dst.bo,
|
||||
data, pitch,
|
||||
0xffffffff, op->u.blt.pixel);
|
||||
assert(op->dst.bo == dst_priv->gpu_bo);
|
||||
sna_replace__xor(sna, op->dst.pixmap, &dst_priv->gpu_bo,
|
||||
data, pitch, 0xffffffff, op->u.blt.pixel);
|
||||
} else {
|
||||
sna_write_boxes__xor(sna, op->dst.pixmap,
|
||||
op->dst.bo, op->dst.x, op->dst.y,
|
||||
|
|
@ -1909,10 +1910,9 @@ blt_put_composite_boxes_with_alpha(struct sna *sna,
|
|||
data += (box->y1 + op->u.blt.sy) * pitch;
|
||||
data += (box->x1 + op->u.blt.sx) * bpp;
|
||||
|
||||
dst_priv->gpu_bo =
|
||||
sna_replace__xor(sna, op->dst.pixmap, op->dst.bo,
|
||||
data, pitch,
|
||||
0xffffffff, op->u.blt.pixel);
|
||||
assert(dst_priv->gpu_bo == op->dst.bo);
|
||||
sna_replace__xor(sna, op->dst.pixmap, &dst_priv->gpu_bo,
|
||||
data, pitch, 0xffffffff, op->u.blt.pixel);
|
||||
} else {
|
||||
sna_write_boxes__xor(sna, op->dst.pixmap,
|
||||
op->dst.bo, op->dst.x, op->dst.y,
|
||||
|
|
|
|||
|
|
@ -1032,7 +1032,7 @@ fallback:
|
|||
box, nbox);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
write_boxes_inplace__xor(struct kgem *kgem,
|
||||
const void *src, int stride, int bpp, int16_t src_dx, int16_t src_dy,
|
||||
struct kgem_bo *bo, int16_t dst_dx, int16_t dst_dy,
|
||||
|
|
@ -1047,11 +1047,11 @@ write_boxes_inplace__xor(struct kgem *kgem,
|
|||
|
||||
dst = kgem_bo_map(kgem, bo);
|
||||
if (dst == NULL)
|
||||
return;
|
||||
return false;
|
||||
|
||||
sigtrap_assert();
|
||||
if (sigtrap_get())
|
||||
return;
|
||||
return false;
|
||||
|
||||
do {
|
||||
DBG(("%s: (%d, %d) -> (%d, %d) x (%d, %d) [bpp=%d, src_pitch=%d, dst_pitch=%d]\n", __FUNCTION__,
|
||||
|
|
@ -1082,6 +1082,7 @@ write_boxes_inplace__xor(struct kgem *kgem,
|
|||
} while (--n);
|
||||
|
||||
sigtrap_put();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool upload_inplace__xor(struct kgem *kgem,
|
||||
|
|
@ -1098,7 +1099,7 @@ static bool upload_inplace__xor(struct kgem *kgem,
|
|||
return __upload_inplace(kgem, bo, box, n, bpp);
|
||||
}
|
||||
|
||||
void sna_write_boxes__xor(struct sna *sna, PixmapPtr dst,
|
||||
bool sna_write_boxes__xor(struct sna *sna, PixmapPtr dst,
|
||||
struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
|
||||
const void *src, int stride, int16_t src_dx, int16_t src_dy,
|
||||
const BoxRec *box, int nbox,
|
||||
|
|
@ -1116,12 +1117,11 @@ void sna_write_boxes__xor(struct sna *sna, PixmapPtr dst,
|
|||
|
||||
if (upload_inplace__xor(kgem, dst_bo, box, nbox, dst->drawable.bitsPerPixel)) {
|
||||
fallback:
|
||||
write_boxes_inplace__xor(kgem,
|
||||
src, stride, dst->drawable.bitsPerPixel, src_dx, src_dy,
|
||||
dst_bo, dst_dx, dst_dy,
|
||||
box, nbox,
|
||||
and, or);
|
||||
return;
|
||||
return write_boxes_inplace__xor(kgem,
|
||||
src, stride, dst->drawable.bitsPerPixel, src_dx, src_dy,
|
||||
dst_bo, dst_dx, dst_dy,
|
||||
box, nbox,
|
||||
and, or);
|
||||
}
|
||||
|
||||
can_blt = kgem_bo_can_blt(kgem, dst_bo) &&
|
||||
|
|
@ -1294,7 +1294,7 @@ tile:
|
|||
goto tile;
|
||||
}
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
cmd = XY_SRC_COPY_BLT_CMD;
|
||||
|
|
@ -1410,6 +1410,7 @@ tile:
|
|||
} while (nbox);
|
||||
|
||||
sna->blt_state.fill_bo = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -1564,12 +1565,14 @@ err:
|
|||
return false;
|
||||
}
|
||||
|
||||
struct kgem_bo *sna_replace__xor(struct sna *sna,
|
||||
PixmapPtr pixmap,
|
||||
struct kgem_bo *bo,
|
||||
const void *src, int stride,
|
||||
uint32_t and, uint32_t or)
|
||||
bool
|
||||
sna_replace__xor(struct sna *sna,
|
||||
PixmapPtr pixmap,
|
||||
struct kgem_bo **_bo,
|
||||
const void *src, int stride,
|
||||
uint32_t and, uint32_t or)
|
||||
{
|
||||
struct kgem_bo *bo = *_bo;
|
||||
struct kgem *kgem = &sna->kgem;
|
||||
void *dst;
|
||||
|
||||
|
|
@ -1615,12 +1618,21 @@ struct kgem_bo *sna_replace__xor(struct sna *sna,
|
|||
box.x2 = pixmap->drawable.width;
|
||||
box.y2 = pixmap->drawable.height;
|
||||
|
||||
sna_write_boxes__xor(sna, pixmap,
|
||||
bo, 0, 0,
|
||||
src, stride, 0, 0,
|
||||
&box, 1,
|
||||
and, or);
|
||||
if (!sna_write_boxes__xor(sna, pixmap,
|
||||
bo, 0, 0,
|
||||
src, stride, 0, 0,
|
||||
&box, 1,
|
||||
and, or))
|
||||
goto err;
|
||||
}
|
||||
|
||||
return bo;
|
||||
if (bo != *_bo)
|
||||
kgem_bo_destroy(kgem, *_bo);
|
||||
*_bo = bo;
|
||||
return true;
|
||||
|
||||
err:
|
||||
if (bo != *_bo)
|
||||
kgem_bo_destroy(kgem, bo);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue