Re: [Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common

2017-08-28 Thread Leo Liu



On 08/28/2017 05:01 AM, Emil Velikov wrote:

On 28 August 2017 at 03:43, Leo Liu  wrote:


On 08/27/2017 01:49 PM, Emil Velikov wrote:

Hi Leo,

On 24 August 2017 at 16:11, Leo Liu  wrote:

Signed-off-by: Leo Liu 
---
   src/gallium/auxiliary/vl/vl_compositor.c | 87
+---
   src/gallium/auxiliary/vl/vl_compositor.h | 21 
   src/gallium/state_trackers/omx/vid_dec.c | 32 +---
   3 files changed, 68 insertions(+), 72 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_compositor.c
b/src/gallium/auxiliary/vl/vl_compositor.c
index a79bf11264..794c8b5b17 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -885,6 +885,32 @@ draw_layers(struct vl_compositor *c, struct
vl_compositor_state *s, struct u_rec
  }
   }

+static void
+set_yuv_layer(struct vl_compositor_state *s, struct vl_compositor *c,
unsigned layer,

Why did you bother moving and renaming vl_compositor_set_yuv_layer?

Because the only caller now  is moved from OMX to VL, the function is good
enough to be a static, and that is name scheme for static function in vl
layer.


I think you said is perfectly - "good enough to be". Aka it's not required ;-)


You want to either keep it separate patch

No. Separating the patch into vl and st/omx may cause build failing because
of the renaming


Nope it won't:
  a) vl_compositor_yuv_deint: move the omx > vl, still using
vl_compositor_set_yuv_layer
  b) vl_compositor_set_yuv_layer: drop the prefix and make it static
Sounds good. It will be separated in next version when I re-send it to 
the list along with other patches in series.


Cheers,
Leo




-Emil


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common

2017-08-28 Thread Emil Velikov
On 28 August 2017 at 03:43, Leo Liu  wrote:
>
>
> On 08/27/2017 01:49 PM, Emil Velikov wrote:
>>
>> Hi Leo,
>>
>> On 24 August 2017 at 16:11, Leo Liu  wrote:
>>>
>>> Signed-off-by: Leo Liu 
>>> ---
>>>   src/gallium/auxiliary/vl/vl_compositor.c | 87
>>> +---
>>>   src/gallium/auxiliary/vl/vl_compositor.h | 21 
>>>   src/gallium/state_trackers/omx/vid_dec.c | 32 +---
>>>   3 files changed, 68 insertions(+), 72 deletions(-)
>>>
>>> diff --git a/src/gallium/auxiliary/vl/vl_compositor.c
>>> b/src/gallium/auxiliary/vl/vl_compositor.c
>>> index a79bf11264..794c8b5b17 100644
>>> --- a/src/gallium/auxiliary/vl/vl_compositor.c
>>> +++ b/src/gallium/auxiliary/vl/vl_compositor.c
>>> @@ -885,6 +885,32 @@ draw_layers(struct vl_compositor *c, struct
>>> vl_compositor_state *s, struct u_rec
>>>  }
>>>   }
>>>
>>> +static void
>>> +set_yuv_layer(struct vl_compositor_state *s, struct vl_compositor *c,
>>> unsigned layer,
>>
>> Why did you bother moving and renaming vl_compositor_set_yuv_layer?
>
> Because the only caller now  is moved from OMX to VL, the function is good
> enough to be a static, and that is name scheme for static function in vl
> layer.
>
I think you said is perfectly - "good enough to be". Aka it's not required ;-)

>>
>> You want to either keep it separate patch
>
> No. Separating the patch into vl and st/omx may cause build failing because
> of the renaming
>
Nope it won't:
 a) vl_compositor_yuv_deint: move the omx > vl, still using
vl_compositor_set_yuv_layer
 b) vl_compositor_set_yuv_layer: drop the prefix and make it static

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common

2017-08-27 Thread Leo Liu



On 08/27/2017 01:49 PM, Emil Velikov wrote:

Hi Leo,

On 24 August 2017 at 16:11, Leo Liu  wrote:

Signed-off-by: Leo Liu 
---
  src/gallium/auxiliary/vl/vl_compositor.c | 87 +---
  src/gallium/auxiliary/vl/vl_compositor.h | 21 
  src/gallium/state_trackers/omx/vid_dec.c | 32 +---
  3 files changed, 68 insertions(+), 72 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_compositor.c 
b/src/gallium/auxiliary/vl/vl_compositor.c
index a79bf11264..794c8b5b17 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -885,6 +885,32 @@ draw_layers(struct vl_compositor *c, struct 
vl_compositor_state *s, struct u_rec
 }
  }

+static void
+set_yuv_layer(struct vl_compositor_state *s, struct vl_compositor *c, unsigned 
layer,

Why did you bother moving and renaming vl_compositor_set_yuv_layer?
Because the only caller now  is moved from OMX to VL, the function is 
good enough to be a static, and that is name scheme for static function 
in vl layer.





You want to either keep it separate patch
No. Separating the patch into vl and st/omx may cause build failing 
because of the renaming



  or cover mention why in the
commit message.


Sure. I will add the reason in the commit messages.

Thanks,
Leo




Thanks
Emil


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common

2017-08-27 Thread Emil Velikov
Hi Leo,

On 24 August 2017 at 16:11, Leo Liu  wrote:
> Signed-off-by: Leo Liu 
> ---
>  src/gallium/auxiliary/vl/vl_compositor.c | 87 
> +---
>  src/gallium/auxiliary/vl/vl_compositor.h | 21 
>  src/gallium/state_trackers/omx/vid_dec.c | 32 +---
>  3 files changed, 68 insertions(+), 72 deletions(-)
>
> diff --git a/src/gallium/auxiliary/vl/vl_compositor.c 
> b/src/gallium/auxiliary/vl/vl_compositor.c
> index a79bf11264..794c8b5b17 100644
> --- a/src/gallium/auxiliary/vl/vl_compositor.c
> +++ b/src/gallium/auxiliary/vl/vl_compositor.c
> @@ -885,6 +885,32 @@ draw_layers(struct vl_compositor *c, struct 
> vl_compositor_state *s, struct u_rec
> }
>  }
>
> +static void
> +set_yuv_layer(struct vl_compositor_state *s, struct vl_compositor *c, 
> unsigned layer,
Why did you bother moving and renaming vl_compositor_set_yuv_layer?

You want to either keep it separate patch or cover mention why in the
commit message.

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common

2017-08-25 Thread Leo Liu



On 08/24/2017 02:48 PM, Leo Liu wrote:



On 08/24/2017 11:34 AM, Christian König wrote:

Am 24.08.2017 um 17:11 schrieb Leo Liu:

Signed-off-by: Leo Liu 


Reviewed-by: Christian König  for the series.

Andy do you want to test this? Should make VA-API transcoding simpler 
to use.


Just got chance to test the transcoding(encoding previously). There is 
an issue with current patch 2, which is encode/decoder have buffer 
deinterlaced/interlaced.

v3, will address that, and performance keep same as before.
Forget the V4, it's not the right logic, the V3 handling is correct. If 
it's the other way around , and then should ignore,  not reallocated.


Regards,
Leo





Regards,
Leo






Regards,
Christian.


---
  src/gallium/auxiliary/vl/vl_compositor.c | 87 
+---

  src/gallium/auxiliary/vl/vl_compositor.h | 21 
  src/gallium/state_trackers/omx/vid_dec.c | 32 +---
  3 files changed, 68 insertions(+), 72 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_compositor.c 
b/src/gallium/auxiliary/vl/vl_compositor.c

index a79bf11264..794c8b5b17 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -885,6 +885,32 @@ draw_layers(struct vl_compositor *c, struct 
vl_compositor_state *s, struct u_rec

 }
  }
  +static void
+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(>layers[layer].sampler_views[i], 
sampler_views[i]);

+   }
+
+   calc_src_and_dst(>layers[layer], buffer->width, buffer->height,
+src_rect ? *src_rect : 
default_rect(>layers[layer]),
+dst_rect ? *dst_rect : 
default_rect(>layers[layer]));

+
+   s->layers[layer].fs = (y) ? c->fs_weave_yuv.y : c->fs_weave_yuv.uv;
+}
+
  void
  vl_compositor_reset_dirty_area(struct u_rect *dirty)
  {
@@ -1143,36 +1169,6 @@ 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(>layers[layer].sampler_views[i], 
sampler_views[i]);

-   }
-
-   calc_src_and_dst(>layers[layer], buffer->width, buffer->height,
-src_rect ? *src_rect : 
default_rect(>layers[layer]),
-dst_rect ? *dst_rect : 
default_rect(>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,
@@ -1215,6 +1211,37 @@ vl_compositor_render(struct 
vl_compositor_state *s,

 draw_layers(c, s, dirty_area);
  }
  +void
+vl_compositor_yuv_deint(struct vl_compositor_state *s,
+struct vl_compositor *c,
+struct pipe_video_buffer *src,
+struct pipe_video_buffer *dst)
+{
+   struct pipe_surface **dst_surfaces;
+   struct u_rect dst_rect;
+
+   dst_surfaces = dst->get_surfaces(dst);
+   vl_compositor_clear_layers(s);
+
+   dst_rect.x0 = 0;
+   dst_rect.x1 = src->width;
+   dst_rect.y0 = 0;
+   dst_rect.y1 = src->height;
+
+   set_yuv_layer(s, c, 0, src, NULL, NULL, true);
+   vl_compositor_set_layer_dst_area(s, 0, _rect);
+   vl_compositor_render(s, c, dst_surfaces[0], NULL, false);
+
+   dst_rect.x1 /= 2;
+   dst_rect.y1 /= 2;
+
+   set_yuv_layer(s, c, 0, src, NULL, NULL, false);
+   vl_compositor_set_layer_dst_area(s, 0, _rect);
+   vl_compositor_render(s, c, dst_surfaces[1], NULL, false);
+
+   s->pipe->flush(s->pipe, NULL, 0);
+}
+
  bool
  vl_compositor_init(struct vl_compositor *c, struct pipe_context 
*pipe)

  {
diff --git a/src/gallium/auxiliary/vl/vl_compositor.h 
b/src/gallium/auxiliary/vl/vl_compositor.h

index 535abb75cd..2546d75b23 100644
--- 

Re: [Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common

2017-08-24 Thread Andy Furniss

Christian König wrote:

Am 24.08.2017 um 17:11 schrieb Leo Liu:

Signed-off-by: Leo Liu 


Reviewed-by: Christian König  for the series.

Andy do you want to test this? Should make VA-API transcoding simpler to 
use.


Oh, nice it will be great to loose that env.

I started testing before mention of v3 patch - but one thing they seem 
to have fixed is the


[drm:amdgpu_vce_cs_reloc [amdgpu]] *ERROR* BO to small for addr 
0x01000a 48 47


that I had with 2160p raw vid enc since

st/va: clear the video surface on allocation

:-)

I'll try with the latest version tomorrow.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common

2017-08-24 Thread Leo Liu



On 08/24/2017 11:34 AM, Christian König wrote:

Am 24.08.2017 um 17:11 schrieb Leo Liu:

Signed-off-by: Leo Liu 


Reviewed-by: Christian König  for the series.

Andy do you want to test this? Should make VA-API transcoding simpler 
to use.


Just got chance to test the transcoding(encoding previously). There is 
an issue with current patch 2, which is encode/decoder have buffer 
deinterlaced/interlaced.

v3, will address that, and performance keep same as before.

Regards,
Leo






Regards,
Christian.


---
  src/gallium/auxiliary/vl/vl_compositor.c | 87 
+---

  src/gallium/auxiliary/vl/vl_compositor.h | 21 
  src/gallium/state_trackers/omx/vid_dec.c | 32 +---
  3 files changed, 68 insertions(+), 72 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_compositor.c 
b/src/gallium/auxiliary/vl/vl_compositor.c

index a79bf11264..794c8b5b17 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -885,6 +885,32 @@ draw_layers(struct vl_compositor *c, struct 
vl_compositor_state *s, struct u_rec

 }
  }
  +static void
+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(>layers[layer].sampler_views[i], 
sampler_views[i]);

+   }
+
+   calc_src_and_dst(>layers[layer], buffer->width, buffer->height,
+src_rect ? *src_rect : 
default_rect(>layers[layer]),
+dst_rect ? *dst_rect : 
default_rect(>layers[layer]));

+
+   s->layers[layer].fs = (y) ? c->fs_weave_yuv.y : c->fs_weave_yuv.uv;
+}
+
  void
  vl_compositor_reset_dirty_area(struct u_rect *dirty)
  {
@@ -1143,36 +1169,6 @@ 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(>layers[layer].sampler_views[i], 
sampler_views[i]);

-   }
-
-   calc_src_and_dst(>layers[layer], buffer->width, buffer->height,
-src_rect ? *src_rect : 
default_rect(>layers[layer]),
-dst_rect ? *dst_rect : 
default_rect(>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,
@@ -1215,6 +1211,37 @@ vl_compositor_render(struct 
vl_compositor_state *s,

 draw_layers(c, s, dirty_area);
  }
  +void
+vl_compositor_yuv_deint(struct vl_compositor_state *s,
+struct vl_compositor *c,
+struct pipe_video_buffer *src,
+struct pipe_video_buffer *dst)
+{
+   struct pipe_surface **dst_surfaces;
+   struct u_rect dst_rect;
+
+   dst_surfaces = dst->get_surfaces(dst);
+   vl_compositor_clear_layers(s);
+
+   dst_rect.x0 = 0;
+   dst_rect.x1 = src->width;
+   dst_rect.y0 = 0;
+   dst_rect.y1 = src->height;
+
+   set_yuv_layer(s, c, 0, src, NULL, NULL, true);
+   vl_compositor_set_layer_dst_area(s, 0, _rect);
+   vl_compositor_render(s, c, dst_surfaces[0], NULL, false);
+
+   dst_rect.x1 /= 2;
+   dst_rect.y1 /= 2;
+
+   set_yuv_layer(s, c, 0, src, NULL, NULL, false);
+   vl_compositor_set_layer_dst_area(s, 0, _rect);
+   vl_compositor_render(s, c, dst_surfaces[1], NULL, false);
+
+   s->pipe->flush(s->pipe, NULL, 0);
+}
+
  bool
  vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe)
  {
diff --git a/src/gallium/auxiliary/vl/vl_compositor.h 
b/src/gallium/auxiliary/vl/vl_compositor.h

index 535abb75cd..2546d75b23 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.h
+++ b/src/gallium/auxiliary/vl/vl_compositor.h
@@ -240,18 +240,6 @@ vl_compositor_set_layer_rotation(struct 
vl_compositor_state *state,


Re: [Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common

2017-08-24 Thread Christian König

Am 24.08.2017 um 17:11 schrieb Leo Liu:

Signed-off-by: Leo Liu 


Reviewed-by: Christian König  for the series.

Andy do you want to test this? Should make VA-API transcoding simpler to 
use.


Regards,
Christian.


---
  src/gallium/auxiliary/vl/vl_compositor.c | 87 +---
  src/gallium/auxiliary/vl/vl_compositor.h | 21 
  src/gallium/state_trackers/omx/vid_dec.c | 32 +---
  3 files changed, 68 insertions(+), 72 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_compositor.c 
b/src/gallium/auxiliary/vl/vl_compositor.c
index a79bf11264..794c8b5b17 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -885,6 +885,32 @@ draw_layers(struct vl_compositor *c, struct 
vl_compositor_state *s, struct u_rec
 }
  }
  
+static void

+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(>layers[layer].sampler_views[i], 
sampler_views[i]);
+   }
+
+   calc_src_and_dst(>layers[layer], buffer->width, buffer->height,
+src_rect ? *src_rect : default_rect(>layers[layer]),
+dst_rect ? *dst_rect : default_rect(>layers[layer]));
+
+   s->layers[layer].fs = (y) ? c->fs_weave_yuv.y : c->fs_weave_yuv.uv;
+}
+
  void
  vl_compositor_reset_dirty_area(struct u_rect *dirty)
  {
@@ -1143,36 +1169,6 @@ 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(>layers[layer].sampler_views[i], 
sampler_views[i]);
-   }
-
-   calc_src_and_dst(>layers[layer], buffer->width, buffer->height,
-src_rect ? *src_rect : default_rect(>layers[layer]),
-dst_rect ? *dst_rect : default_rect(>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,
@@ -1215,6 +1211,37 @@ vl_compositor_render(struct vl_compositor_state *s,
 draw_layers(c, s, dirty_area);
  }
  
+void

+vl_compositor_yuv_deint(struct vl_compositor_state *s,
+struct vl_compositor *c,
+struct pipe_video_buffer *src,
+struct pipe_video_buffer *dst)
+{
+   struct pipe_surface **dst_surfaces;
+   struct u_rect dst_rect;
+
+   dst_surfaces = dst->get_surfaces(dst);
+   vl_compositor_clear_layers(s);
+
+   dst_rect.x0 = 0;
+   dst_rect.x1 = src->width;
+   dst_rect.y0 = 0;
+   dst_rect.y1 = src->height;
+
+   set_yuv_layer(s, c, 0, src, NULL, NULL, true);
+   vl_compositor_set_layer_dst_area(s, 0, _rect);
+   vl_compositor_render(s, c, dst_surfaces[0], NULL, false);
+
+   dst_rect.x1 /= 2;
+   dst_rect.y1 /= 2;
+
+   set_yuv_layer(s, c, 0, src, NULL, NULL, false);
+   vl_compositor_set_layer_dst_area(s, 0, _rect);
+   vl_compositor_render(s, c, dst_surfaces[1], NULL, false);
+
+   s->pipe->flush(s->pipe, NULL, 0);
+}
+
  bool
  vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe)
  {
diff --git a/src/gallium/auxiliary/vl/vl_compositor.h 
b/src/gallium/auxiliary/vl/vl_compositor.h
index 535abb75cd..2546d75b23 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.h
+++ b/src/gallium/auxiliary/vl/vl_compositor.h
@@ -240,18 +240,6 @@ 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,
-

[Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common

2017-08-24 Thread Leo Liu
Signed-off-by: Leo Liu 
---
 src/gallium/auxiliary/vl/vl_compositor.c | 87 +---
 src/gallium/auxiliary/vl/vl_compositor.h | 21 
 src/gallium/state_trackers/omx/vid_dec.c | 32 +---
 3 files changed, 68 insertions(+), 72 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_compositor.c 
b/src/gallium/auxiliary/vl/vl_compositor.c
index a79bf11264..794c8b5b17 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -885,6 +885,32 @@ draw_layers(struct vl_compositor *c, struct 
vl_compositor_state *s, struct u_rec
}
 }
 
+static void
+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(>layers[layer].sampler_views[i], 
sampler_views[i]);
+   }
+
+   calc_src_and_dst(>layers[layer], buffer->width, buffer->height,
+src_rect ? *src_rect : default_rect(>layers[layer]),
+dst_rect ? *dst_rect : default_rect(>layers[layer]));
+
+   s->layers[layer].fs = (y) ? c->fs_weave_yuv.y : c->fs_weave_yuv.uv;
+}
+
 void
 vl_compositor_reset_dirty_area(struct u_rect *dirty)
 {
@@ -1143,36 +1169,6 @@ 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(>layers[layer].sampler_views[i], 
sampler_views[i]);
-   }
-
-   calc_src_and_dst(>layers[layer], buffer->width, buffer->height,
-src_rect ? *src_rect : default_rect(>layers[layer]),
-dst_rect ? *dst_rect : default_rect(>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,
@@ -1215,6 +1211,37 @@ vl_compositor_render(struct vl_compositor_state *s,
draw_layers(c, s, dirty_area);
 }
 
+void
+vl_compositor_yuv_deint(struct vl_compositor_state *s,
+struct vl_compositor *c,
+struct pipe_video_buffer *src,
+struct pipe_video_buffer *dst)
+{
+   struct pipe_surface **dst_surfaces;
+   struct u_rect dst_rect;
+
+   dst_surfaces = dst->get_surfaces(dst);
+   vl_compositor_clear_layers(s);
+
+   dst_rect.x0 = 0;
+   dst_rect.x1 = src->width;
+   dst_rect.y0 = 0;
+   dst_rect.y1 = src->height;
+
+   set_yuv_layer(s, c, 0, src, NULL, NULL, true);
+   vl_compositor_set_layer_dst_area(s, 0, _rect);
+   vl_compositor_render(s, c, dst_surfaces[0], NULL, false);
+
+   dst_rect.x1 /= 2;
+   dst_rect.y1 /= 2;
+
+   set_yuv_layer(s, c, 0, src, NULL, NULL, false);
+   vl_compositor_set_layer_dst_area(s, 0, _rect);
+   vl_compositor_render(s, c, dst_surfaces[1], NULL, false);
+
+   s->pipe->flush(s->pipe, NULL, 0);
+}
+
 bool
 vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe)
 {
diff --git a/src/gallium/auxiliary/vl/vl_compositor.h 
b/src/gallium/auxiliary/vl/vl_compositor.h
index 535abb75cd..2546d75b23 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.h
+++ b/src/gallium/auxiliary/vl/vl_compositor.h
@@ -240,18 +240,6 @@ 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);
-
 /*@}*/
 
 /**
@@