From 10fd45114d4a7bbac4093755305ea5e4ba3ab6a5 Mon Sep 17 00:00:00 2001 From: Christian König Date: Fri, 8 Jul 2011 12:47:52 +0200 Subject: [g3dvl] remove sampler view handling from video context --- src/gallium/state_trackers/vdpau/surface.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/gallium/state_trackers/vdpau/surface.c') diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index c2945c787da..f20087f3fca 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -33,6 +33,7 @@ #include #include +#include #include "vdpau_private.h" @@ -159,6 +160,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, uint32_t const *source_pitches) { enum pipe_format pformat = FormatToPipe(source_ycbcr_format); + struct pipe_context *pipe; struct pipe_video_context *context; struct pipe_sampler_view **sampler_views; unsigned i; @@ -170,8 +172,9 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, if (!p_surf) return VDP_STATUS_INVALID_HANDLE; + pipe = p_surf->device->context->pipe; context = p_surf->device->context->vpipe; - if (!context) + if (!pipe && !context) return VDP_STATUS_INVALID_HANDLE; if (p_surf->video_buffer == NULL || pformat != p_surf->video_buffer->buffer_format) { @@ -186,7 +189,24 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, for (i = 0; i < 3; ++i) { //TODO put nr of planes into util format struct pipe_sampler_view *sv = sampler_views[i ? i ^ 3 : 0]; struct pipe_box dst_box = { 0, 0, 0, sv->texture->width0, sv->texture->height0, 1 }; - context->upload_sampler(context, sv, &dst_box, source_data[i], source_pitches[i], 0, 0); + + struct pipe_transfer *transfer; + void *map; + + transfer = pipe->get_transfer(pipe, sv->texture, 0, PIPE_TRANSFER_WRITE, &dst_box); + if (!transfer) + return VDP_STATUS_RESOURCES; + + map = pipe->transfer_map(pipe, transfer); + if (map) { + util_copy_rect(map, sv->texture->format, transfer->stride, 0, 0, + dst_box.width, dst_box.height, + source_data[i], source_pitches[i], 0, 0); + + pipe->transfer_unmap(pipe, transfer); + } + + pipe->transfer_destroy(pipe, transfer); } return VDP_STATUS_OK; -- cgit v1.2.3