}
void vl_compositor_set_background(struct vl_compositor *compositor,
- struct pipe_texture *bg, struct pipe_video_rect *bg_src_rect)
+ struct pipe_surface *bg, struct pipe_video_rect *bg_src_rect)
{
assert(compositor);
assert((bg && bg_src_rect) || (!bg && !bg_src_rect));
if (compositor->bg != bg ||
!u_video_rects_equal(&compositor->bg_src_rect, bg_src_rect)) {
- pipe_texture_reference(&compositor->bg, bg);
+ pipe_surface_reference(&compositor->bg, bg);
/*if (!u_video_rects_equal(&compositor->bg_src_rect, bg_src_rect))*/
compositor->bg_src_rect = *bg_src_rect;
compositor->dirty_bg = true;
}
void vl_compositor_set_layers(struct vl_compositor *compositor,
- struct pipe_texture *layers[],
+ struct pipe_surface *layers[],
struct pipe_video_rect *src_rects[],
struct pipe_video_rect *dst_rects[],
unsigned num_layers)
!u_video_rects_equal(&compositor->layer_src_rects[i], src_rects[i]) ||
!u_video_rects_equal(&compositor->layer_dst_rects[i], dst_rects[i]))
{
- pipe_texture_reference(&compositor->layers[i], layers[i]);
+ pipe_surface_reference(&compositor->layers[i], layers[i]);
/*if (!u_video_rects_equal(&compositor->layer_src_rects[i], src_rects[i]))*/
compositor->layer_src_rects[i] = *src_rects[i];
/*if (!u_video_rects_equal(&compositor->layer_dst_rects[i], dst_rects[i]))*/
}
for (; i < VL_COMPOSITOR_MAX_LAYERS; ++i)
- pipe_texture_reference(&compositor->layers[i], NULL);
+ pipe_surface_reference(&compositor->layers[i], NULL);
}
static void gen_rect_verts(unsigned pos,
}
static unsigned gen_data(struct vl_compositor *c,
- struct pipe_texture *src_surface,
+ struct pipe_surface *src_surface,
struct pipe_video_rect *src_rect,
struct pipe_video_rect *dst_rect,
- struct pipe_texture **textures)
+ struct pipe_surface **textures)
{
void *vb;
unsigned num_rects = 0;
return 0;
if (c->dirty_bg) {
- struct vertex2f bg_inv_size = {1.0f / c->bg->width0, 1.0f / c->bg->height0};
+ struct vertex2f bg_inv_size = {1.0f / c->bg->width, 1.0f / c->bg->height};
gen_rect_verts(num_rects, &c->bg_src_rect, &bg_inv_size, NULL, NULL, vb);
textures[num_rects] = c->bg;
++num_rects;
}
{
- struct vertex2f src_inv_size = { 1.0f / src_surface->width0, 1.0f / src_surface->height0};
+ struct vertex2f src_inv_size = { 1.0f / src_surface->width, 1.0f / src_surface->height};
gen_rect_verts(num_rects, src_rect, &src_inv_size, dst_rect, &c->fb_inv_size, vb);
textures[num_rects] = src_surface;
++num_rects;
assert(i < VL_COMPOSITOR_MAX_LAYERS);
if (c->dirty_layers & (1 << i)) {
- struct vertex2f layer_inv_size = {1.0f / c->layers[i]->width0, 1.0f / c->layers[i]->height0};
+ struct vertex2f layer_inv_size = {1.0f / c->layers[i]->width, 1.0f / c->layers[i]->height};
gen_rect_verts(num_rects, &c->layer_src_rects[i], &layer_inv_size,
&c->layer_dst_rects[i], &c->fb_inv_size, vb);
textures[num_rects] = c->layers[i];
}
static void draw_layers(struct vl_compositor *c,
- struct pipe_texture *src_surface,
+ struct pipe_surface *src_surface,
struct pipe_video_rect *src_rect,
struct pipe_video_rect *dst_rect)
{
unsigned num_rects;
- struct pipe_texture *textures[VL_COMPOSITOR_MAX_LAYERS + 2];
+ struct pipe_surface *src_surfaces[VL_COMPOSITOR_MAX_LAYERS + 2];
unsigned i;
assert(c);
assert(src_rect);
assert(dst_rect);
- num_rects = gen_data(c, src_surface, src_rect, dst_rect, textures);
+ num_rects = gen_data(c, src_surface, src_rect, dst_rect, src_surfaces);
for (i = 0; i < num_rects; ++i) {
- c->pipe->set_fragment_sampler_textures(c->pipe, 1, &textures[i]);
+ c->pipe->set_fragment_sampler_textures(c->pipe, 1, &src_surfaces[i]->texture);
c->pipe->draw_arrays(c->pipe, PIPE_PRIM_TRIANGLES, i * 6, 6);
}
}
void vl_compositor_render(struct vl_compositor *compositor,
- struct pipe_texture *src_surface,
+ struct pipe_surface *src_surface,
enum pipe_mpeg12_picture_type picture_type,
/*unsigned num_past_surfaces,
- struct pipe_texture *past_surfaces,
+ struct pipe_surface *past_surfaces,
unsigned num_future_surfaces,
- struct pipe_texture *future_surfaces,*/
+ struct pipe_surface *future_surfaces,*/
struct pipe_video_rect *src_area,
- struct pipe_texture *dst_surface,
+ struct pipe_surface *dst_surface,
struct pipe_video_rect *dst_area,
struct pipe_fence_handle **fence)
{
assert(dst_area);
assert(picture_type == PIPE_MPEG12_PICTURE_TYPE_FRAME);
- if (compositor->fb_state.width != dst_surface->width0) {
- compositor->fb_inv_size.x = 1.0f / dst_surface->width0;
- compositor->fb_state.width = dst_surface->width0;
+ if (compositor->fb_state.width != dst_surface->width) {
+ compositor->fb_inv_size.x = 1.0f / dst_surface->width;
+ compositor->fb_state.width = dst_surface->width;
}
- if (compositor->fb_state.height != dst_surface->height0) {
- compositor->fb_inv_size.y = 1.0f / dst_surface->height0;
- compositor->fb_state.height = dst_surface->height0;
+ if (compositor->fb_state.height != dst_surface->height) {
+ compositor->fb_inv_size.y = 1.0f / dst_surface->height;
+ compositor->fb_state.height = dst_surface->height;
}
- compositor->fb_state.cbufs[0] = compositor->pipe->screen->get_tex_surface
- (
- compositor->pipe->screen,
- dst_surface,
- 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ_WRITE
- );
+ compositor->fb_state.cbufs[0] = dst_surface;
compositor->viewport.scale[0] = compositor->fb_state.width;
compositor->viewport.scale[1] = compositor->fb_state.height;
assert(!compositor->dirty_bg && !compositor->dirty_layers);
compositor->pipe->flush(compositor->pipe, PIPE_FLUSH_RENDER_CACHE, fence);
-
- pipe_surface_reference(&compositor->fb_state.cbufs[0], NULL);
}
void vl_compositor_set_csc_matrix(struct vl_compositor *compositor, const float *mat)
#include "vl_types.h"
struct pipe_context;
-struct pipe_texture;
#define VL_COMPOSITOR_MAX_LAYERS 16
struct pipe_vertex_element vertex_elems[2];
struct pipe_buffer *fs_const_buf;
- struct pipe_texture *bg;
+ struct pipe_surface *bg;
struct pipe_video_rect bg_src_rect;
bool dirty_bg;
- struct pipe_texture *layers[VL_COMPOSITOR_MAX_LAYERS];
+ struct pipe_surface *layers[VL_COMPOSITOR_MAX_LAYERS];
struct pipe_video_rect layer_src_rects[VL_COMPOSITOR_MAX_LAYERS];
struct pipe_video_rect layer_dst_rects[VL_COMPOSITOR_MAX_LAYERS];
unsigned dirty_layers;
void vl_compositor_cleanup(struct vl_compositor *compositor);
void vl_compositor_set_background(struct vl_compositor *compositor,
- struct pipe_texture *bg, struct pipe_video_rect *bg_src_rect);
+ struct pipe_surface *bg, struct pipe_video_rect *bg_src_rect);
void vl_compositor_set_layers(struct vl_compositor *compositor,
- struct pipe_texture *layers[],
+ struct pipe_surface *layers[],
struct pipe_video_rect *src_rects[],
struct pipe_video_rect *dst_rects[],
unsigned num_layers);
void vl_compositor_render(struct vl_compositor *compositor,
- struct pipe_texture *src_surface,
+ struct pipe_surface *src_surface,
enum pipe_mpeg12_picture_type picture_type,
/*unsigned num_past_surfaces,
- struct pipe_texture *past_surfaces,
+ struct pipe_surface *past_surfaces,
unsigned num_future_surfaces,
- struct pipe_texture *future_surfaces,*/
+ struct pipe_surface *future_surfaces,*/
struct pipe_video_rect *src_area,
- struct pipe_texture *dst_surface,
+ struct pipe_surface *dst_surface,
struct pipe_video_rect *dst_area,
struct pipe_fence_handle **fence);
gen_macroblock_stream(r, num_macroblocks);
- r->fb_state.cbufs[0] = r->pipe->screen->get_tex_surface
- (
- r->pipe->screen, r->surface,
- 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE
- );
+ r->fb_state.cbufs[0] = r->surface;
r->pipe->set_framebuffer_state(r->pipe, &r->fb_state);
r->pipe->set_viewport_state(r->pipe, &r->viewport);
PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD
);
- vs_consts->denorm.x = r->surface->width0;
- vs_consts->denorm.y = r->surface->height0;
+ vs_consts->denorm.x = r->surface->width;
+ vs_consts->denorm.y = r->surface->height;
pipe_buffer_unmap(r->pipe->screen, r->vs_const_buf);
if (num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] > 0) {
r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems);
- r->textures.individual.ref[0] = r->past;
+ r->textures.individual.ref[0] = r->past->texture;
r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
r->pipe->bind_vs_state(r->pipe, r->p_vs[0]);
if (false /*num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] > 0 */ ) {
r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems);
- r->textures.individual.ref[0] = r->past;
+ r->textures.individual.ref[0] = r->past->texture;
r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
r->pipe->bind_vs_state(r->pipe, r->p_vs[1]);
if (num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] > 0) {
r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems);
- r->textures.individual.ref[0] = r->future;
+ r->textures.individual.ref[0] = r->future->texture;
r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
r->pipe->bind_vs_state(r->pipe, r->p_vs[0]);
if (false /*num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] > 0 */ ) {
r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems);
- r->textures.individual.ref[0] = r->future;
+ r->textures.individual.ref[0] = r->future->texture;
r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
r->pipe->bind_vs_state(r->pipe, r->p_vs[1]);
if (num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] > 0) {
r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all);
r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems);
- r->textures.individual.ref[0] = r->past;
- r->textures.individual.ref[1] = r->future;
+ r->textures.individual.ref[0] = r->past->texture;
+ r->textures.individual.ref[1] = r->future->texture;
r->pipe->set_fragment_sampler_textures(r->pipe, 5, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 5, r->samplers.all);
r->pipe->bind_vs_state(r->pipe, r->b_vs[0]);
if (false /*num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] > 0 */ ) {
r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all);
r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems);
- r->textures.individual.ref[0] = r->past;
- r->textures.individual.ref[1] = r->future;
+ r->textures.individual.ref[0] = r->past->texture;
+ r->textures.individual.ref[1] = r->future->texture;
r->pipe->set_fragment_sampler_textures(r->pipe, 5, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 5, r->samplers.all);
r->pipe->bind_vs_state(r->pipe, r->b_vs[1]);
}
r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence);
- pipe_surface_reference(&r->fb_state.cbufs[0], NULL);
if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE)
for (i = 0; i < 3; ++i)
void
vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer
*renderer,
- struct pipe_texture *surface,
- struct pipe_texture *past,
- struct pipe_texture *future,
+ struct pipe_surface *surface,
+ struct pipe_surface *past,
+ struct pipe_surface *future,
unsigned num_macroblocks,
struct pipe_mpeg12_macroblock
*mpeg12_macroblocks,
renderer->past = past;
renderer->future = future;
renderer->fence = fence;
- renderer->surface_tex_inv_size.x = 1.0f / surface->width0;
- renderer->surface_tex_inv_size.y = 1.0f / surface->height0;
+ renderer->surface_tex_inv_size.x = 1.0f / surface->width;
+ renderer->surface_tex_inv_size.y = 1.0f / surface->height;
}
while (num_macroblocks) {
struct { struct pipe_vertex_buffer ycbcr, ref[2]; } individual;
} vertex_bufs;
- struct pipe_texture *surface, *past, *future;
+ struct pipe_surface *surface, *past, *future;
struct pipe_fence_handle **fence;
unsigned num_macroblocks;
struct pipe_mpeg12_macroblock *macroblock_buf;
void vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer);
void vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer *renderer,
- struct pipe_texture *surface,
- struct pipe_texture *past,
- struct pipe_texture *future,
+ struct pipe_surface *surface,
+ struct pipe_surface *past,
+ struct pipe_surface *future,
unsigned num_macroblocks,
struct pipe_mpeg12_macroblock *mpeg12_macroblocks,
struct pipe_fence_handle **fence);
assert(ctx->decode_target);
vl_mpeg12_mc_renderer_render_macroblocks(&ctx->mc_renderer,
- ctx->decode_target->texture,
- past ? past->texture : NULL,
- future ? future->texture : NULL,
- num_macroblocks, mpeg12_macroblocks, fence);
+ ctx->decode_target,
+ past, future, num_macroblocks,
+ mpeg12_macroblocks, fence);
}
static void
assert(dst_surface);
assert(dst_area);
- vl_compositor_render(&ctx->compositor, src_surface->texture,
- picture_type, src_area, dst_surface->texture, dst_area, fence);
+ vl_compositor_render(&ctx->compositor, src_surface,
+ picture_type, src_area, dst_surface, dst_area, fence);
}
static void
sp_mpeg12_set_picture_background(struct pipe_video_context *vpipe,
- struct pipe_texture *bg,
+ struct pipe_surface *bg,
struct pipe_video_rect *bg_src_rect)
{
struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe;
static void
sp_mpeg12_set_picture_layers(struct pipe_video_context *vpipe,
- struct pipe_texture *layers[],
+ struct pipe_surface *layers[],
struct pipe_video_rect *src_rects[],
struct pipe_video_rect *dst_rects[],
unsigned num_layers)
*/
/*@{*/
void (*set_picture_background)(struct pipe_video_context *vpipe,
- struct pipe_texture *bg,
+ struct pipe_surface *bg,
struct pipe_video_rect *bg_src_rect);
void (*set_picture_layers)(struct pipe_video_context *vpipe,
- struct pipe_texture *layers[],
+ struct pipe_surface *layers[],
struct pipe_video_rect *src_rects[],
struct pipe_video_rect *dst_rects[],
unsigned num_layers);