sna: Pass the pixmap to sna_replace()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
4e38d22105
commit
8657128fa7
|
|
@ -626,8 +626,8 @@ void sna_write_boxes(struct sna *sna,
|
|||
const BoxRec *box, int n);
|
||||
|
||||
struct kgem_bo *sna_replace(struct sna *sna,
|
||||
PixmapPtr pixmap,
|
||||
struct kgem_bo *bo,
|
||||
int width, int height, int bpp,
|
||||
const void *src, int stride);
|
||||
|
||||
Bool
|
||||
|
|
|
|||
|
|
@ -796,10 +796,8 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, BoxPtr box)
|
|||
box->y2 >= pixmap->drawable.height) {
|
||||
priv->gpu_bo =
|
||||
sna_replace(sna,
|
||||
pixmap,
|
||||
priv->gpu_bo,
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height,
|
||||
pixmap->drawable.bitsPerPixel,
|
||||
pixmap->devPrivate.ptr,
|
||||
pixmap->devKind);
|
||||
} else {
|
||||
|
|
@ -1106,10 +1104,8 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap)
|
|||
box->y2 >= pixmap->drawable.height) {
|
||||
priv->gpu_bo =
|
||||
sna_replace(sna,
|
||||
pixmap,
|
||||
priv->gpu_bo,
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height,
|
||||
pixmap->drawable.bitsPerPixel,
|
||||
pixmap->devPrivate.ptr,
|
||||
pixmap->devKind);
|
||||
} else {
|
||||
|
|
@ -1343,11 +1339,7 @@ sna_put_image_upload_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
|
|||
box->x2 >= pixmap->drawable.width &&
|
||||
box->y2 >= pixmap->drawable.height) {
|
||||
priv->gpu_bo =
|
||||
sna_replace(sna, priv->gpu_bo,
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height,
|
||||
pixmap->drawable.bitsPerPixel,
|
||||
bits, stride);
|
||||
sna_replace(sna, pixmap, priv->gpu_bo, bits, stride);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2149,10 +2141,9 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
|
|||
|
||||
dst_priv->gpu_bo =
|
||||
sna_replace(sna,
|
||||
dst_pixmap,
|
||||
dst_priv->gpu_bo,
|
||||
dst_pixmap->drawable.width,
|
||||
dst_pixmap->drawable.height,
|
||||
bpp, bits, stride);
|
||||
bits, stride);
|
||||
|
||||
sna_damage_destroy(&dst_priv->cpu_damage);
|
||||
sna_damage_all(&dst_priv->gpu_damage,
|
||||
|
|
|
|||
|
|
@ -1011,8 +1011,7 @@ blt_put_composite(struct sna *sna,
|
|||
data += (src_y - dst_y) * pitch;
|
||||
|
||||
dst_priv->gpu_bo =
|
||||
sna_replace(sna, dst_priv->gpu_bo,
|
||||
r->width, r->height, bpp,
|
||||
sna_replace(sna, op->dst.pixmap, dst_priv->gpu_bo,
|
||||
data, pitch);
|
||||
} else {
|
||||
BoxRec box;
|
||||
|
|
@ -1051,11 +1050,7 @@ fastcall static void blt_put_composite_box(struct sna *sna,
|
|||
data += (box->x1 + op->u.blt.sx) * bpp;
|
||||
|
||||
dst_priv->gpu_bo =
|
||||
sna_replace(sna,
|
||||
op->dst.bo,
|
||||
op->dst.width,
|
||||
op->dst.height,
|
||||
src->drawable.bitsPerPixel,
|
||||
sna_replace(sna, op->dst.pixmap, op->dst.bo,
|
||||
data, pitch);
|
||||
} else {
|
||||
sna_write_boxes(sna,
|
||||
|
|
@ -1091,11 +1086,7 @@ static void blt_put_composite_boxes(struct sna *sna,
|
|||
data += (box->x1 + op->u.blt.sx) * bpp;
|
||||
|
||||
dst_priv->gpu_bo =
|
||||
sna_replace(sna,
|
||||
op->dst.bo,
|
||||
op->dst.width,
|
||||
op->dst.height,
|
||||
src->drawable.bitsPerPixel,
|
||||
sna_replace(sna, op->dst.pixmap, op->dst.bo,
|
||||
data, pitch);
|
||||
} else {
|
||||
sna_write_boxes(sna,
|
||||
|
|
|
|||
|
|
@ -424,22 +424,28 @@ void sna_write_boxes(struct sna *sna,
|
|||
}
|
||||
|
||||
struct kgem_bo *sna_replace(struct sna *sna,
|
||||
PixmapPtr pixmap,
|
||||
struct kgem_bo *bo,
|
||||
int width, int height, int bpp,
|
||||
const void *src, int stride)
|
||||
{
|
||||
struct kgem *kgem = &sna->kgem;
|
||||
void *dst;
|
||||
|
||||
DBG(("%s(handle=%d, %dx%d, bpp=%d, tiling=%d)\n",
|
||||
__FUNCTION__, bo->handle, width, height, bpp, bo->tiling));
|
||||
__FUNCTION__, bo->handle,
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height,
|
||||
pixmap->drawable.bitsPerPixel,
|
||||
bo->tiling));
|
||||
|
||||
if (kgem_bo_is_busy(bo)) {
|
||||
struct kgem_bo *new_bo;
|
||||
|
||||
new_bo = kgem_create_2d(kgem,
|
||||
width, height, bpp, bo->tiling,
|
||||
CREATE_INACTIVE);
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height,
|
||||
pixmap->drawable.bitsPerPixel,
|
||||
bo->tiling, CREATE_INACTIVE);
|
||||
if (new_bo) {
|
||||
kgem_bo_destroy(kgem, bo);
|
||||
bo = new_bo;
|
||||
|
|
@ -447,18 +453,19 @@ struct kgem_bo *sna_replace(struct sna *sna,
|
|||
}
|
||||
|
||||
if (bo->tiling == I915_TILING_NONE && bo->pitch == stride) {
|
||||
kgem_bo_write(kgem, bo, src, (height-1)*stride + width*bpp/8);
|
||||
return bo;
|
||||
}
|
||||
|
||||
dst = kgem_bo_map(kgem, bo, PROT_READ | PROT_WRITE);
|
||||
if (dst) {
|
||||
memcpy_blt(src, dst, bpp,
|
||||
stride, bo->pitch,
|
||||
0, 0,
|
||||
0, 0,
|
||||
width, height);
|
||||
munmap(dst, bo->size);
|
||||
kgem_bo_write(kgem, bo, src,
|
||||
(pixmap->drawable.height-1)*stride + pixmap->drawable.width*pixmap->drawable.bitsPerPixel/8);
|
||||
} else {
|
||||
dst = kgem_bo_map(kgem, bo, PROT_READ | PROT_WRITE);
|
||||
if (dst) {
|
||||
memcpy_blt(src, dst, pixmap->drawable.bitsPerPixel,
|
||||
stride, bo->pitch,
|
||||
0, 0,
|
||||
0, 0,
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height);
|
||||
munmap(dst, bo->size);
|
||||
}
|
||||
}
|
||||
|
||||
return bo;
|
||||
|
|
|
|||
Loading…
Reference in New Issue