summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2016-07-06 12:42:37 -0400
committerLeo Liu <[email protected]>2016-07-12 09:27:53 -0400
commit82f875f4d800d05b04a8174e8863b2b70276bbb0 (patch)
treee322df4689ca8cc65e4fdbd58c8220b5f6d8d975 /src
parent14761da9f9bc132b061d4cfa4d7dd93d1b113f6b (diff)
vl/compositor: set layer of y or uv to render
Signed-off-by: Leo Liu <[email protected]> Acked-by: Christian König <[email protected]> Tested-by: Julien Isorce <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.c30
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.h12
2 files changed, 42 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index a19d624e1e7..f7517f33e83 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -1111,6 +1111,36 @@ vl_compositor_set_layer_rotation(struct vl_compositor_state *s,
}
void
+vl_compositor_set_yuv_layer(struct vl_compositor_state *s,
+ struct vl_compositor *c,
+ unsigned layer,
+ struct pipe_video_buffer *buffer,
+ struct u_rect *src_rect,
+ struct u_rect *dst_rect,
+ bool y)
+{
+ struct pipe_sampler_view **sampler_views;
+ unsigned i;
+
+ assert(s && c && buffer);
+
+ assert(layer < VL_COMPOSITOR_MAX_LAYERS);
+
+ s->used_layers |= 1 << layer;
+ sampler_views = buffer->get_sampler_view_components(buffer);
+ for (i = 0; i < 3; ++i) {
+ s->layers[layer].samplers[i] = c->sampler_linear;
+ pipe_sampler_view_reference(&s->layers[layer].sampler_views[i], sampler_views[i]);
+ }
+
+ calc_src_and_dst(&s->layers[layer], buffer->width, buffer->height,
+ src_rect ? *src_rect : default_rect(&s->layers[layer]),
+ dst_rect ? *dst_rect : default_rect(&s->layers[layer]));
+
+ s->layers[layer].fs = (y) ? c->fs_weave_yuv.y : c->fs_weave_yuv.uv;
+}
+
+void
vl_compositor_render(struct vl_compositor_state *s,
struct vl_compositor *c,
struct pipe_surface *dst_surface,
diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h
index 6c632ff5496..ceab5e00471 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.h
+++ b/src/gallium/auxiliary/vl/vl_compositor.h
@@ -241,6 +241,18 @@ vl_compositor_set_layer_rotation(struct vl_compositor_state *state,
unsigned layer,
enum vl_compositor_rotation rotate);
+/**
+ * set a layer of y or uv to render
+ */
+void
+vl_compositor_set_yuv_layer(struct vl_compositor_state *s,
+ struct vl_compositor *c,
+ unsigned layer,
+ struct pipe_video_buffer *buffer,
+ struct u_rect *src_rect,
+ struct u_rect *dst_rect,
+ bool y);
+
/*@}*/
/**