return matrix;
}
-static void
-xfer_buffers_map(struct vl_idct *idct)
-{
- struct pipe_box rect =
- {
- 0, 0, 0,
- idct->textures.individual.source->width0,
- idct->textures.individual.source->height0,
- 1
- };
-
- idct->tex_transfer = idct->pipe->get_transfer
- (
- idct->pipe, idct->textures.individual.source,
- u_subresource(0, 0),
- PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD,
- &rect
- );
-
- idct->texels = idct->pipe->transfer_map(idct->pipe, idct->tex_transfer);
-}
-
-static void
-xfer_buffers_unmap(struct vl_idct *idct)
-{
- idct->pipe->transfer_unmap(idct->pipe, idct->tex_transfer);
- idct->pipe->transfer_destroy(idct->pipe, idct->tex_transfer);
-}
-
bool
vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe, struct pipe_resource *dst, struct pipe_resource *matrix)
{
init_state(idct);
- xfer_buffers_map(idct);
+ vl_idct_map_buffers(idct);
return true;
}
void
vl_idct_cleanup(struct vl_idct *idct)
{
+ vl_idct_unmap_buffers(idct);
+
vl_vb_cleanup(&idct->blocks);
cleanup_shaders(idct);
cleanup_buffers(idct);
pipe_resource_reference(&idct->destination, NULL);
}
+void
+vl_idct_map_buffers(struct vl_idct *idct)
+{
+ assert(idct);
+
+ struct pipe_box rect =
+ {
+ 0, 0, 0,
+ idct->textures.individual.source->width0,
+ idct->textures.individual.source->height0,
+ 1
+ };
+
+ idct->tex_transfer = idct->pipe->get_transfer
+ (
+ idct->pipe, idct->textures.individual.source,
+ u_subresource(0, 0),
+ PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD,
+ &rect
+ );
+
+ idct->texels = idct->pipe->transfer_map(idct->pipe, idct->tex_transfer);
+}
+
void
vl_idct_add_block(struct vl_idct *idct, unsigned x, unsigned y, short *block)
{
vl_vb_add_block(&idct->blocks, (float*)&v);
}
+void
+vl_idct_unmap_buffers(struct vl_idct *idct)
+{
+ assert(idct);
+
+ idct->pipe->transfer_unmap(idct->pipe, idct->tex_transfer);
+ idct->pipe->transfer_destroy(idct->pipe, idct->tex_transfer);
+}
+
void
vl_idct_flush(struct vl_idct *idct)
{
pipe_buffer_unmap(idct->pipe, idct->vertex_bufs.individual.pos.buffer, vec_transfer);
- xfer_buffers_unmap(idct);
-
if(num_verts > 0) {
idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
idct->pipe->bind_fs_state(idct->pipe, idct->transpose_fs);
util_draw_arrays(idct->pipe, PIPE_PRIM_QUADS, 0, num_verts);
}
-
- xfer_buffers_map(idct);
}
assert(r);
assert(r->num_macroblocks == r->macroblocks_per_batch);
+ vl_idct_unmap_buffers(&r->idct_y);
+ vl_idct_unmap_buffers(&r->idct_cr);
+ vl_idct_unmap_buffers(&r->idct_cb);
+
vl_idct_flush(&r->idct_y);
vl_idct_flush(&r->idct_cr);
vl_idct_flush(&r->idct_cb);
vb_start += flush_mbtype_handler(r, i, vb_start, num_verts[i]);
}
+
r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence);
+ vl_idct_map_buffers(&r->idct_y);
+ vl_idct_map_buffers(&r->idct_cr);
+ vl_idct_map_buffers(&r->idct_cb);
+
r->num_macroblocks = 0;
}