summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/xorg
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-10-08 04:06:42 +0200
committerMarek Olšák <[email protected]>2012-10-11 21:12:16 +0200
commit369e46888904c6d379b8b477d9242cff1608e30e (patch)
tree528b10f900f23af3acd22a0edcf50fde0eeee86e /src/gallium/state_trackers/xorg
parentec4c74a9dc10039d97ad24c4f16bd2400517991d (diff)
gallium: unify transfer functions
"get_transfer + transfer_map" becomes "transfer_map". "transfer_unmap + transfer_destroy" becomes "transfer_unmap". transfer_map must create and return the transfer object and transfer_unmap must destroy it. transfer_map is successful if the returned buffer pointer is not NULL. If transfer_map fails, the pointer to the transfer object remains unchanged (i.e. doesn't have to be NULL). Acked-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c10
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c43
-rw-r--r--src/gallium/state_trackers/xorg/xorg_xv.c31
3 files changed, 36 insertions, 48 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 6a78abebcb1..11888096e66 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -240,16 +240,14 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
crtcp->cursor_handle = whandle.handle;
}
- transfer = pipe_get_transfer(ctx, crtcp->cursor_tex,
- 0, 0,
- PIPE_TRANSFER_WRITE,
- 0, 0, 64, 64);
- ptr = ctx->transfer_map(ctx, transfer);
+ ptr = pipe_transfer_map(ctx, crtcp->cursor_tex,
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ 0, 0, 64, 64, &transfer);
util_copy_rect(ptr, crtcp->cursor_tex->format,
transfer->stride, 0, 0,
64, 64, (void*)image, 64 * 4, 0, 0);
ctx->transfer_unmap(ctx, transfer);
- ctx->transfer_destroy(ctx, transfer);
ctx->flush(ctx, &fence);
if (fence) {
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 11985c547fd..c8f20acdec7 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -201,24 +201,23 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst,
struct exa_context *exa = ms->exa;
struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPix);
struct pipe_transfer *transfer;
+ void *map;
if (!priv || !priv->tex)
return FALSE;
- transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0,
- PIPE_TRANSFER_READ, x, y, w, h);
- if (!transfer)
+ map = pipe_transfer_map(exa->pipe, priv->tex, 0, 0,
+ PIPE_TRANSFER_READ, x, y, w, h, &transfer);
+ if (!map)
return FALSE;
exa_debug_printf("------ ExaDownloadFromScreen(%d, %d, %d, %d, %d)\n",
x, y, w, h, dst_pitch);
util_copy_rect((unsigned char*)dst, priv->tex->format, dst_pitch, 0, 0,
- w, h, exa->pipe->transfer_map(exa->pipe, transfer),
- transfer->stride, 0, 0);
+ w, h, map, transfer->stride, 0, 0);
exa->pipe->transfer_unmap(exa->pipe, transfer);
- exa->pipe->transfer_destroy(exa->pipe, transfer);
return TRUE;
}
@@ -233,24 +232,24 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src,
struct exa_context *exa = ms->exa;
struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPix);
struct pipe_transfer *transfer;
+ void *map;
if (!priv || !priv->tex)
return FALSE;
- transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0,
- PIPE_TRANSFER_WRITE, x, y, w, h);
- if (!transfer)
+ map = pipe_transfer_map(exa->pipe, priv->tex, 0, 0,
+ PIPE_TRANSFER_WRITE, x, y, w, h, &transfer);
+ if (!map)
return FALSE;
exa_debug_printf("++++++ ExaUploadToScreen(%d, %d, %d, %d, %d)\n",
x, y, w, h, src_pitch);
- util_copy_rect(exa->pipe->transfer_map(exa->pipe, transfer),
+ util_copy_rect(map,
priv->tex->format, transfer->stride, 0, 0, w, h,
(unsigned char*)src, src_pitch, 0, 0);
exa->pipe->transfer_unmap(exa->pipe, transfer);
- exa->pipe->transfer_destroy(exa->pipe, transfer);
return TRUE;
}
@@ -279,24 +278,23 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
assert(pPix->drawable.width <= priv->tex->width0);
assert(pPix->drawable.height <= priv->tex->height0);
- priv->map_transfer =
- pipe_get_transfer(exa->pipe, priv->tex, 0, 0,
+ pPix->devPrivate.ptr =
+ pipe_transfer_map(exa->pipe, priv->tex, 0, 0,
#ifdef EXA_MIXED_PIXMAPS
- PIPE_TRANSFER_MAP_DIRECTLY |
+ PIPE_TRANSFER_MAP_DIRECTLY |
#endif
- PIPE_TRANSFER_READ_WRITE,
- 0, 0,
- pPix->drawable.width,
- pPix->drawable.height );
- if (!priv->map_transfer)
+ PIPE_TRANSFER_READ_WRITE,
+ 0, 0,
+ pPix->drawable.width,
+ pPix->drawable.height,
+ &priv->map_transfer);
+ if (!pPix->devPrivate.ptr)
#ifdef EXA_MIXED_PIXMAPS
return FALSE;
#else
FatalError("failed to create transfer\n");
#endif
- pPix->devPrivate.ptr =
- exa->pipe->transfer_map(exa->pipe, priv->map_transfer);
pPix->devKind = priv->map_transfer->stride;
}
@@ -320,7 +318,7 @@ ExaFinishAccess(PixmapPtr pPix, int index)
if (!priv)
return;
- if (!priv->map_transfer)
+ if (!priv->map_transfer || pPix->devPrivate.ptr == NULL)
return;
exa_debug_printf("ExaFinishAccess %d\n", index);
@@ -328,7 +326,6 @@ ExaFinishAccess(PixmapPtr pPix, int index)
if (--priv->map_count == 0) {
assert(priv->map_transfer);
exa->pipe->transfer_unmap(exa->pipe, priv->map_transfer);
- exa->pipe->transfer_destroy(exa->pipe, priv->map_transfer);
priv->map_transfer = NULL;
pPix->devPrivate.ptr = NULL;
}
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index 7cbad702bf4..3097d000e19 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -312,22 +312,18 @@ copy_packed_data(ScrnInfoPtr pScrn,
int yidx, uidx, vidx;
int y_array_size = w * h;
- ytrans = pipe_get_transfer(pipe, dst[0],
- 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
- utrans = pipe_get_transfer(pipe, dst[1],
- 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
- vtrans = pipe_get_transfer(pipe, dst[2],
- 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
-
- ymap = (char*)pipe->transfer_map(pipe, ytrans);
- umap = (char*)pipe->transfer_map(pipe, utrans);
- vmap = (char*)pipe->transfer_map(pipe, vtrans);
+ ymap = pipe_transfer_map(pipe, dst[0],
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h, &ytrans);
+ umap = pipe_transfer_map(pipe, dst[1],
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h, &utrans);
+ vmap = pipe_transfer_map(pipe, dst[2],
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h, &vtrans);
yidx = uidx = vidx = 0;
@@ -396,9 +392,6 @@ copy_packed_data(ScrnInfoPtr pScrn,
pipe->transfer_unmap(pipe, ytrans);
pipe->transfer_unmap(pipe, utrans);
pipe->transfer_unmap(pipe, vtrans);
- pipe->transfer_destroy(pipe, ytrans);
- pipe->transfer_destroy(pipe, utrans);
- pipe->transfer_destroy(pipe, vtrans);
}