<div dir="ltr"><div><div>Let's hold off on this for now in light of Gwenole's low-power fast path patch. <br><br></div>Thaniks,<br><br></div>Sean<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 20, 2015 at 8:07 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">The VPP API can be used to do pixel format conversion and scaling. The<br>
current implementation uses a 2 pass process where the first pass does<br>
scaling and the second pass does pixel format conversion.<br>
<br>
In the case where we just need pixel format conversion, we can get rid<br>
of the first pass. This patch implements a fast path for this case.<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>><br>
---<br>
</span> src/i965_post_processing.c | 71 +++++++++++++++++++++++++++++++++++++++++++---<br>
 1 file changed, 67 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c<br>
index 3ee3f07..3a6ad55 100755<br>
--- a/src/i965_post_processing.c<br>
+++ b/src/i965_post_processing.c<br>
@@ -5372,9 +5372,35 @@ static const int proc_frame_to_pp_frame[3] = {<br>
<span class="">     I965_SURFACE_FLAG_BOTTOME_FIELD_FIRST<br>
 };<br>
<br>
-VAStatus<br>
-i965_proc_picture(VADriverContextP ctx,<br>
-                  VAProfile profile,<br>
+static bool<br>
+_va_rectangles_equal(VARectangle *rect1, VARectangle *rect2)<br>
+{<br>
+    return (rect1->x == rect2->x &&<br>
+            rect1->y == rect2->y &&<br>
+            rect1->width == rect2->width &&<br>
+            rect1->height == rect2->height);<br>
+}<br>
+<br>
+static bool<br>
+_fourcc_is_rgbx(unsigned int fourcc)<br>
+{<br>
+    return (fourcc == VA_FOURCC_RGBX ||<br>
+            fourcc == VA_FOURCC_BGRX ||<br>
+            fourcc == VA_FOURCC_BGRA ||<br>
+            fourcc == VA_FOURCC_RGBA);<br>
+}<br>
+<br>
</span>+static bool<br>
+_filter_is_noop(VAProcPipelineParameterBuffer *pipeline_param)<br>
+{<br>
+    return (pipeline_param->num_filters == 0 &&<br>
+            pipeline_param->filters == NULL &&<br>
+            (pipeline_param->filter_flags & ~VA_FILTER_SCALING_FAST) == 0);<br>
<span class="">+}<br>
+<br>
+VAStatus<br>
+i965_proc_picture(VADriverContextP ctx,<br>
+                  VAProfile profile,<br>
                   union codec_state *codec_state,<br>
                   struct hw_context *hw_context)<br>
 {<br>
</span>@@ -5382,7 +5408,7 @@ i965_proc_picture(VADriverContextP ctx,<br>
<span class="">     struct i965_proc_context *proc_context = (struct i965_proc_context *)hw_context;<br>
     struct proc_state *proc_state = &codec_state->proc;<br>
     VAProcPipelineParameterBuffer *pipeline_param = (VAProcPipelineParameterBuffer *)proc_state->pipeline_param->buffer;<br>
-    struct object_surface *obj_surface;<br>
+    struct object_surface *obj_surface, *dst_obj_surface;<br>
     struct i965_surface src_surface, dst_surface;<br>
     VARectangle src_rect, dst_rect;<br>
     VAStatus status;<br>
</span>@@ -5415,6 +5441,43 @@ i965_proc_picture(VADriverContextP ctx,<br>
<span class="">         goto error;<br>
     }<br>
<br>
+    dst_obj_surface = SURFACE(proc_state->current_render_target);<br>
+<br>
</span>+    if (_filter_is_noop(pipeline_param) &&<br>
<div class="HOEnZb"><div class="h5">+        _va_rectangles_equal(pipeline_param->surface_region,<br>
+                             pipeline_param->output_region) &&<br>
+        obj_surface->fourcc == VA_FOURCC_NV12 &&<br>
+        _fourcc_is_rgbx(dst_obj_surface->fourcc)) {<br>
+        i965_vpp_clear_surface(ctx,<br>
+                               &proc_context->pp_context,<br>
+                               dst_obj_surface,<br>
+                               pipeline_param->output_background_color);<br>
+<br>
+        src_surface.base = (struct object_base *)obj_surface;<br>
+        src_surface.type = I965_SURFACE_TYPE_SURFACE;<br>
+        src_surface.flags = 0;<br>
+        src_rect.x = pipeline_param->surface_region->x;<br>
+        src_rect.y = pipeline_param->surface_region->y;<br>
+        src_rect.width = pipeline_param->surface_region->width;<br>
+        src_rect.height = pipeline_param->surface_region->height;<br>
+<br>
+        dst_surface.base = (struct object_base *)dst_obj_surface;<br>
+        dst_surface.type = I965_SURFACE_TYPE_SURFACE;<br>
+        dst_surface.flags = 0;<br>
+        dst_rect.x = pipeline_param->output_region->x;<br>
+        dst_rect.y = pipeline_param->output_region->y;<br>
+        dst_rect.width = pipeline_param->output_region->width;<br>
+        dst_rect.height = pipeline_param->output_region->height;<br>
+<br>
+        i965_post_processing_internal(ctx, &proc_context->pp_context,<br>
+                                      &src_surface,<br>
+                                      &src_rect,<br>
+                                      &dst_surface,<br>
+                                      &dst_rect,<br>
+                                      PP_NV12_LOAD_SAVE_RGBX,<br>
+                                      NULL);<br>
+        return VA_STATUS_SUCCESS;<br>
+    }<br>
     in_width = obj_surface->orig_width;<br>
     in_height = obj_surface->orig_height;<br>
     dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);<br>
--<br>
2.1.4<br>
<br>
_______________________________________________<br>
Libva mailing list<br>
<a href="mailto:Libva@lists.freedesktop.org">Libva@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/libva" target="_blank">http://lists.freedesktop.org/mailman/listinfo/libva</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Sean V. Kelley <<a href="mailto:sean.v.kelley@intel.com" target="_blank">sean.v.kelley@intel.com</a>><br>Open Source Technology Center / SSG<br>Intel Corp.<br></div>
</div>