[Libva] [Libva-intel-driver PATCH] Rendering: Align the origin coordinate of internal buffer during AVS conversion to fix greenline

Zhao Yakui yakui.zhao at intel.com
Thu Nov 13 20:42:11 PST 2014


The video post-processing is based on 16x16 and will be called by vaPutsurface
under some scenario. But Sometimes the region of internal buffer is not
aligned during VPP AVS conversion. In such case the greenline will appear on
some regions.

Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
 src/i965_post_processing.c |   18 ++++++++++++++----
 src/i965_post_processing.h |    3 ++-
 src/i965_render.c          |    6 ++++--
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c
index 4304d72..865dc3f 100755
--- a/src/i965_post_processing.c
+++ b/src/i965_post_processing.c
@@ -4830,7 +4830,8 @@ i965_post_processing(
     const VARectangle *src_rect,
     const VARectangle *dst_rect,
     unsigned int       va_flags,
-    int               *has_done_scaling  
+    int               *has_done_scaling,
+    VARectangle *calibrated_rect
 )
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
@@ -4854,19 +4855,24 @@ i965_post_processing(
         pp_context = i965->pp_context;
         pp_context->filter_flags = va_flags;
         if (avs_is_needed(va_flags)) {
+            VARectangle tmp_dst_rect;
             struct i965_render_state *render_state = &i965->render_state;
             struct intel_region *dest_region = render_state->draw_region;
 
             if (out_surface_id != VA_INVALID_ID)
                 tmp_id = out_surface_id;
 
+            tmp_dst_rect.x = 0;
+            tmp_dst_rect.y = 0;
+            tmp_dst_rect.width = dst_rect->width;
+            tmp_dst_rect.height = dst_rect->height;
             src_surface.base = (struct object_base *)obj_surface;
             src_surface.type = I965_SURFACE_TYPE_SURFACE;
             src_surface.flags = I965_SURFACE_FLAG_FRAME;
 
             status = i965_CreateSurfaces(ctx,
-                                         dest_region->width,
-                                         dest_region->height,
+                                         dst_rect->width,
+                                         dst_rect->height,
                                          VA_RT_FORMAT_YUV420,
                                          1,
                                          &out_surface_id);
@@ -4884,7 +4890,7 @@ i965_post_processing(
                                           &src_surface,
                                           src_rect,
                                           &dst_surface,
-                                          dst_rect,
+                                          &tmp_dst_rect,
                                           PP_NV12_AVS,
                                           NULL);
 
@@ -4892,6 +4898,10 @@ i965_post_processing(
                 i965_DestroySurfaces(ctx, &tmp_id, 1);
                 
             *has_done_scaling = 1;
+            calibrated_rect->x = 0;
+            calibrated_rect->y = 0;
+            calibrated_rect->width = dst_rect->width;
+            calibrated_rect->height = dst_rect->height;
         }
 
         _i965UnlockMutex(&i965->pp_mutex);
diff --git a/src/i965_post_processing.h b/src/i965_post_processing.h
index 271941e..d434527 100755
--- a/src/i965_post_processing.h
+++ b/src/i965_post_processing.h
@@ -558,7 +558,8 @@ i965_post_processing(
     const VARectangle *src_rect,
     const VARectangle *dst_rect,
     unsigned int       va_flags,
-    int                *has_done_scaling 
+    int                *has_done_scaling,
+    VARectangle *calibrated_rect
 );
 
 VAStatus
diff --git a/src/i965_render.c b/src/i965_render.c
index f34a54a..f941d1b 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -3095,12 +3095,14 @@ intel_render_put_surface(
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct i965_render_state *render_state = &i965->render_state;
     int has_done_scaling = 0;
+    VARectangle calibrated_rect;
     VASurfaceID out_surface_id = i965_post_processing(ctx,
                                                       obj_surface,
                                                       src_rect,
                                                       dst_rect,
                                                       flags,
-                                                      &has_done_scaling);
+                                                      &has_done_scaling,
+                                                      &calibrated_rect);
 
     assert((!has_done_scaling) || (out_surface_id != VA_INVALID_ID));
 
@@ -3111,7 +3113,7 @@ intel_render_put_surface(
             obj_surface = new_obj_surface;
 
         if (has_done_scaling)
-            src_rect = dst_rect;
+            src_rect = &calibrated_rect;
     }
 
     render_state->render_put_surface(ctx, obj_surface, src_rect, dst_rect, flags);
-- 
1.7.10.1



More information about the Libva mailing list