vl/compositor: set layer of y or uv to render
authorLeo Liu <leo.liu@amd.com>
Wed, 6 Jul 2016 16:42:37 +0000 (12:42 -0400)
committerLeo Liu <leo.liu@amd.com>
Tue, 12 Jul 2016 13:27:53 +0000 (09:27 -0400)
Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Tested-by: Julien Isorce <j.isorce@samsung.com>
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h

index a19d624e1e7c009c34e24019b880c20d9069e78b..f7517f33e83fe4fd3054335b64e58b5b356ed407 100644 (file)
@@ -1110,6 +1110,36 @@ vl_compositor_set_layer_rotation(struct vl_compositor_state *s,
    s->layers[layer].rotate = rotate;
 }
 
+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,
index 6c632ff54965a9098e8f2f05fd7ace917dd23382..ceab5e00471b57cee37e2e7a1c02c4c96fa770de 100644 (file)
@@ -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);
+
 /*@}*/
 
 /**