summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vdpau
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-07-08 12:47:52 +0200
committerChristian König <[email protected]>2011-07-08 12:47:52 +0200
commit10fd45114d4a7bbac4093755305ea5e4ba3ab6a5 (patch)
tree2806b80bd167257804f4cdfba0e839d248463838 /src/gallium/state_trackers/vdpau
parent06ddbc3b8e58a6cf22708263a8b7d16cf1db5dbc (diff)
[g3dvl] remove sampler view handling from video context
Diffstat (limited to 'src/gallium/state_trackers/vdpau')
-rw-r--r--src/gallium/state_trackers/vdpau/surface.c24
1 files changed, 22 insertions, 2 deletions
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 <util/u_memory.h>
#include <util/u_debug.h>
+#include <util/u_rect.h>
#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;