diff options
author | Marek Olšák <[email protected]> | 2012-10-08 04:06:42 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-10-11 21:12:16 +0200 |
commit | 369e46888904c6d379b8b477d9242cff1608e30e (patch) | |
tree | 528b10f900f23af3acd22a0edcf50fde0eeee86e /src/gallium/state_trackers | |
parent | ec4c74a9dc10039d97ad24c4f16bd2400517991d (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')
-rw-r--r-- | src/gallium/state_trackers/clover/core/resource.cpp | 11 | ||||
-rw-r--r-- | src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h | 8 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/sw/drisw.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/xm_api.c | 23 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/output.c | 12 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/surface.c | 13 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_filters.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_images.c | 12 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/image.c | 23 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/paint.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/xa/xa_context.c | 30 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_crtc.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_exa.c | 43 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_xv.c | 31 | ||||
-rw-r--r-- | src/gallium/state_trackers/xvmc/subpicture.c | 35 |
15 files changed, 111 insertions, 170 deletions
diff --git a/src/gallium/state_trackers/clover/core/resource.cpp b/src/gallium/state_trackers/clover/core/resource.cpp index 0c671f47388..80bcd2a851a 100644 --- a/src/gallium/state_trackers/clover/core/resource.cpp +++ b/src/gallium/state_trackers/clover/core/resource.cpp @@ -177,14 +177,10 @@ mapping::mapping(command_queue &q, resource &r, (flags & CL_MAP_READ ? PIPE_TRANSFER_READ : 0 ) | (blocking ? PIPE_TRANSFER_UNSYNCHRONIZED : 0)); - pxfer = pctx->get_transfer(pctx, r.pipe, 0, usage, - box(origin + r.offset, region)); - if (!pxfer) - throw error(CL_OUT_OF_RESOURCES); - - p = pctx->transfer_map(pctx, pxfer); + p = pctx->transfer_map(pctx, r.pipe, 0, usage, + box(origin + r.offset, region), &pxfer); if (!p) { - pctx->transfer_destroy(pctx, pxfer); + pxfer = NULL; throw error(CL_OUT_OF_RESOURCES); } } @@ -198,6 +194,5 @@ mapping::mapping(mapping &&m) : mapping::~mapping() { if (pxfer) { pctx->transfer_unmap(pctx, pxfer); - pctx->transfer_destroy(pctx, pxfer); } } diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 07612bd5f9a..8c387e3a2bc 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -1506,15 +1506,16 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe> return E_INVALIDARG; if(map_type & D3D10_MAP_FLAG_DO_NOT_WAIT) usage |= PIPE_TRANSFER_DONTBLOCK; - struct pipe_transfer* transfer = pipe->get_transfer(pipe, resource->resource, level, usage, &box); - if(!transfer) { + struct pipe_transfer* transfer; + void *map = pipe->transfer_map(pipe, resource->resource, level, usage, &box, &transfer); + if(!map) { if(map_type & D3D10_MAP_FLAG_DO_NOT_WAIT) return DXGI_ERROR_WAS_STILL_DRAWING; else return E_FAIL; } resource->transfers[subresource] = transfer; - mapped_resource->pData = pipe->transfer_map(pipe, transfer); + mapped_resource->pData = map; mapped_resource->RowPitch = transfer->stride; mapped_resource->DepthPitch = transfer->layer_stride; return S_OK; @@ -1530,7 +1531,6 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe> if(i != resource->transfers.end()) { pipe->transfer_unmap(pipe, i->second); - pipe->transfer_destroy(pipe, i->second); resource->transfers.erase(i); } } diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index c4c4264d351..5247126527d 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -257,11 +257,10 @@ drisw_update_tex_buffer(struct dri_drawable *drawable, get_drawable_info(dPriv, &x, &y, &w, &h); - transfer = pipe_get_transfer(pipe, res, - 0, 0, // level, layer, - PIPE_TRANSFER_WRITE, - x, y, w, h); - map = pipe_transfer_map(pipe, transfer); + map = pipe_transfer_map(pipe, res, + 0, 0, // level, layer, + PIPE_TRANSFER_WRITE, + x, y, w, h, &transfer); /* Copy the Drawable content to the mapped texture buffer */ get_image(dPriv, x, y, w, h, map); @@ -275,7 +274,6 @@ drisw_update_tex_buffer(struct dri_drawable *drawable, } pipe_transfer_unmap(pipe, transfer); - pipe_transfer_destroy(pipe, transfer); } /* diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 7e915567a43..607584f0195 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -1368,12 +1368,12 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, internal_format = choose_pixel_format(drawable->xm_visual); - tex_xfer = pipe_get_transfer(pipe, res, - 0, 0, /* level, layer */ - PIPE_TRANSFER_WRITE, - x, y, - w, h); - if (!tex_xfer) + map = pipe_transfer_map(pipe, res, + 0, 0, /* level, layer */ + PIPE_TRANSFER_WRITE, + x, y, + w, h, &tex_xfer); + if (!map) return; /* Grab the XImage that we want to turn into a texture. */ @@ -1385,14 +1385,7 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, ZPixmap); if (!img) { - pipe_transfer_destroy(pipe, tex_xfer); - return; - } - - map = pipe_transfer_map(pipe, tex_xfer); - - if (!map) { - pipe_transfer_destroy(pipe, tex_xfer); + pipe_transfer_unmap(pipe, tex_xfer); return; } @@ -1407,8 +1400,6 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, pipe_transfer_unmap(pipe, tex_xfer); - pipe_transfer_destroy(pipe, tex_xfer); - st->teximage(st, ST_TEXTURE_2D, 0, /* level */ diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index 5b25e63d28e..dd3c1a834bb 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -207,15 +207,8 @@ vlVdpOutputSurfaceGetBitsNative(VdpOutputSurface surface, res = vlsurface->sampler_view->texture; box = RectToPipeBox(source_rect, res); - transfer = pipe->get_transfer(pipe, res, 0, PIPE_TRANSFER_READ, &box); - if (transfer == NULL) { - pipe_mutex_unlock(vlsurface->device->mutex); - return VDP_STATUS_RESOURCES; - } - - map = pipe_transfer_map(pipe, transfer); - if (map == NULL) { - pipe_transfer_destroy(pipe, transfer); + map = pipe->transfer_map(pipe, res, 0, PIPE_TRANSFER_READ, &box, &transfer); + if (!map) { pipe_mutex_unlock(vlsurface->device->mutex); return VDP_STATUS_RESOURCES; } @@ -224,7 +217,6 @@ vlVdpOutputSurfaceGetBitsNative(VdpOutputSurface surface, box.width, box.height, map, transfer->stride, 0, 0); pipe_transfer_unmap(pipe, transfer); - pipe_transfer_destroy(pipe, transfer); pipe_mutex_unlock(vlsurface->device->mutex); return VDP_STATUS_OK; diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index cc866a6ca0d..bcc33c0f9b0 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -236,15 +236,9 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface, struct pipe_transfer *transfer; uint8_t *map; - transfer = pipe->get_transfer(pipe, sv->texture, 0, PIPE_TRANSFER_READ, &box); - if (transfer == NULL) { - pipe_mutex_unlock(vlsurface->device->mutex); - return VDP_STATUS_RESOURCES; - } - - map = pipe_transfer_map(pipe, transfer); - if (map == NULL) { - pipe_transfer_destroy(pipe, transfer); + map = pipe->transfer_map(pipe, sv->texture, 0, + PIPE_TRANSFER_READ, &box, &transfer); + if (!map) { pipe_mutex_unlock(vlsurface->device->mutex); return VDP_STATUS_RESOURCES; } @@ -254,7 +248,6 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface, box.width, box.height, map, transfer->stride, 0, 0); pipe_transfer_unmap(pipe, transfer); - pipe_transfer_destroy(pipe, transfer); } } pipe_mutex_unlock(vlsurface->device->mutex); diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c index afa5213d9a8..f5856db4405 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -78,15 +78,15 @@ static INLINE struct pipe_resource *create_texture_1d(struct vg_context *ctx, tex = screen->resource_create(screen, &templ); { /* upload color_data */ - struct pipe_transfer *transfer = - pipe_get_transfer(pipe, tex, + struct pipe_transfer *transfer; + void *map = + pipe_transfer_map(pipe, tex, 0, 0, PIPE_TRANSFER_READ_WRITE , - 0, 0, tex->width0, tex->height0); - void *map = pipe->transfer_map(pipe, transfer); + 0, 0, tex->width0, tex->height0, + &transfer); memcpy(map, color_data, sizeof(VGint)*color_data_len); pipe->transfer_unmap(pipe, transfer); - pipe->transfer_destroy(pipe, transfer); } return tex; diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c index 2cb5622f817..300868c252c 100644 --- a/src/gallium/state_trackers/vega/api_images.c +++ b/src/gallium/state_trackers/vega/api_images.c @@ -442,24 +442,26 @@ void vegaReadPixels(void * data, VGint dataStride, { VGint y = (stfb->height - sy) - 1, yStep = -1; struct pipe_transfer *transfer; + void *map; - transfer = pipe_get_transfer(pipe, strb->texture, 0, 0, - PIPE_TRANSFER_READ, - 0, 0, sx + width, stfb->height - sy); + map = pipe_transfer_map(pipe, strb->texture, 0, 0, + PIPE_TRANSFER_READ, + 0, 0, sx + width, stfb->height - sy, + &transfer); /* Do a row at a time to flip image data vertically */ for (i = 0; i < height; i++) { #if 0 debug_printf("%d-%d == %d\n", sy, height, y); #endif - pipe_get_tile_rgba(pipe, transfer, sx, y, width, 1, df); + pipe_get_tile_rgba(transfer, map, sx, y, width, 1, df); y += yStep; _vega_pack_rgba_span_float(ctx, width, temp, dataFormat, dst + yoffset + xoffset); dst += dataStride; } - pipe->transfer_destroy(pipe, transfer); + pipe->transfer_unmap(pipe, transfer); } } diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index c42315e4bba..74a84e0a81d 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -418,17 +418,19 @@ void image_sub_data(struct vg_image *image, } { /* upload color_data */ - struct pipe_transfer *transfer = pipe_get_transfer( - pipe, texture, 0, 0, - PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0); + struct pipe_transfer *transfer; + void *map = pipe_transfer_map(pipe, texture, 0, 0, + PIPE_TRANSFER_WRITE, 0, 0, + texture->width0, texture->height0, + &transfer); src += (dataStride * yoffset); for (i = 0; i < height; i++) { _vega_unpack_float_span_rgba(ctx, width, xoffset, src, dataFormat, temp); - pipe_put_tile_rgba(pipe, transfer, x+image->x, y+image->y, width, 1, df); + pipe_put_tile_rgba(transfer, map, x+image->x, y+image->y, width, 1, df); y += yStep; src += dataStride; } - pipe->transfer_destroy(pipe, transfer); + pipe->transfer_unmap(pipe, transfer); } } @@ -448,25 +450,26 @@ void image_get_sub_data(struct vg_image * image, VGubyte *dst = (VGubyte *)data; { - struct pipe_transfer *transfer = - pipe_get_transfer(pipe, + struct pipe_transfer *transfer; + void *map = + pipe_transfer_map(pipe, image->sampler_view->texture, 0, 0, PIPE_TRANSFER_READ, 0, 0, image->x + image->width, - image->y + image->height); + image->y + image->height, &transfer); /* Do a row at a time to flip image data vertically */ for (i = 0; i < height; i++) { #if 0 debug_printf("%d-%d == %d\n", sy, height, y); #endif - pipe_get_tile_rgba(pipe, transfer, sx+image->x, y, width, 1, df); + pipe_get_tile_rgba(transfer, map, sx+image->x, y, width, 1, df); y += yStep; _vega_pack_rgba_span_float(ctx, width, temp, dataFormat, dst); dst += dataStride; } - pipe->transfer_destroy(pipe, transfer); + pipe->transfer_unmap(pipe, transfer); } } diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c index 40b4b2502f1..f73e60c9e6d 100644 --- a/src/gallium/state_trackers/vega/paint.c +++ b/src/gallium/state_trackers/vega/paint.c @@ -160,13 +160,13 @@ static INLINE struct pipe_resource *create_gradient_texture(struct vg_paint *p) tex = screen->resource_create(screen, &templ); { /* upload color_data */ - struct pipe_transfer *transfer = - pipe_get_transfer(p->base.ctx->pipe, tex, 0, 0, - PIPE_TRANSFER_WRITE, 0, 0, 1024, 1); - void *map = pipe->transfer_map(pipe, transfer); + struct pipe_transfer *transfer; + void *map = + pipe_transfer_map(p->base.ctx->pipe, tex, 0, 0, + PIPE_TRANSFER_WRITE, 0, 0, 1024, 1, + &transfer); memcpy(map, p->gradient.color_data, sizeof(VGint)*1024); pipe->transfer_unmap(pipe, transfer); - pipe->transfer_destroy(pipe, transfer); } return tex; diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c index 2e9806bb0a9..93dae137ba1 100644 --- a/src/gallium/state_trackers/xa/xa_context.c +++ b/src/gallium/state_trackers/xa/xa_context.c @@ -103,15 +103,11 @@ xa_surface_dma(struct xa_context *ctx, w = boxes->x2 - boxes->x1; h = boxes->y2 - boxes->y1; - transfer = pipe_get_transfer(pipe, srf->tex, 0, 0, - transfer_direction, boxes->x1, boxes->y1, - w, h); - if (!transfer) - return -XA_ERR_NORES; - - map = pipe_transfer_map(ctx->pipe, transfer); + map = pipe_transfer_map(pipe, srf->tex, 0, 0, + transfer_direction, boxes->x1, boxes->y1, + w, h, &transfer); if (!map) - goto out_no_map; + return -XA_ERR_NORES; if (to_surface) { util_copy_rect(map, srf->tex->format, transfer->stride, @@ -122,14 +118,10 @@ xa_surface_dma(struct xa_context *ctx, 0); } pipe->transfer_unmap(pipe, transfer); - pipe->transfer_destroy(pipe, transfer); if (to_surface) pipe->flush(pipe, &ctx->last_fence); } return XA_ERR_NONE; - out_no_map: - pipe->transfer_destroy(pipe, transfer); - return -XA_ERR_NORES; } XA_EXPORT void * @@ -154,15 +146,12 @@ xa_surface_map(struct xa_context *ctx, if (!transfer_direction) return NULL; - srf->transfer = pipe_get_transfer(pipe, srf->tex, 0, 0, - transfer_direction, 0, 0, - srf->tex->width0, srf->tex->height0); - if (!srf->transfer) - return NULL; - - map = pipe_transfer_map(pipe, srf->transfer); + map = pipe_transfer_map(pipe, srf->tex, 0, 0, + transfer_direction, 0, 0, + srf->tex->width0, srf->tex->height0, + &srf->transfer); if (!map) - pipe->transfer_destroy(pipe, srf->transfer); + return NULL; srf->mapping_pipe = pipe; return map; @@ -175,7 +164,6 @@ xa_surface_unmap(struct xa_surface *srf) struct pipe_context *pipe = srf->mapping_pipe; pipe->transfer_unmap(pipe, srf->transfer); - pipe->transfer_destroy(pipe, srf->transfer); srf->transfer = NULL; } } 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); } diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c index 8e96ce66dc0..3e13aa60a8f 100644 --- a/src/gallium/state_trackers/xvmc/subpicture.c +++ b/src/gallium/state_trackers/xvmc/subpicture.c @@ -173,20 +173,16 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst, struct pipe_transfer *transfer; void *map; - transfer = pipe->get_transfer(pipe, dst->texture, 0, PIPE_TRANSFER_WRITE, dst_box); - if (!transfer) + map = pipe->transfer_map(pipe, dst->texture, 0, PIPE_TRANSFER_WRITE, + dst_box, &transfer); + if (!map) return; - map = pipe->transfer_map(pipe, transfer); - if (map) { - util_copy_rect(map, dst->texture->format, transfer->stride, 0, 0, - dst_box->width, dst_box->height, - src, src_stride, src_x, src_y); + util_copy_rect(map, dst->texture->format, transfer->stride, 0, 0, + dst_box->width, dst_box->height, + src, src_stride, src_x, src_y); - pipe->transfer_unmap(pipe, transfer); - } - - pipe->transfer_destroy(pipe, transfer); + pipe->transfer_unmap(pipe, transfer); } PUBLIC @@ -323,20 +319,15 @@ Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, sh dst = subpicture_priv->sampler; /* TODO: Assert clear rect is within bounds? Or clip? */ - transfer = pipe->get_transfer(pipe, dst->texture, 0, PIPE_TRANSFER_WRITE, &dst_box); - if (!transfer) + map = pipe->transfer_map(pipe, dst->texture, 0, PIPE_TRANSFER_WRITE, + &dst_box, &transfer); + if (!map) return XvMCBadSubpicture; - map = pipe->transfer_map(pipe, transfer); - if (map) { - util_fill_rect(map, dst->texture->format, transfer->stride, 0, 0, - dst_box.width, dst_box.height, &uc); - - pipe->transfer_unmap(pipe, transfer); - } - - pipe->transfer_destroy(pipe, transfer); + util_fill_rect(map, dst->texture->format, transfer->stride, 0, 0, + dst_box.width, dst_box.height, &uc); + pipe->transfer_unmap(pipe, transfer); return Success; } |