[Libva] [PATCH 1/2] i965_drv_video: simplify put_surface() and put_subpicture() args.

Gwenole Beauchesne gb.devel at gmail.com
Mon Jun 27 21:10:32 PDT 2011


From: Gwenole Beauchesne <gwenole.beauchesne at intel.com>

---
 i965_drv_video/i965_drv_video.c       |   23 ++-
 i965_drv_video/i965_post_processing.c |  155 ++++++---------
 i965_drv_video/i965_post_processing.h |   19 +-
 i965_drv_video/i965_render.c          |  359 +++++++++++----------------------
 i965_drv_video/i965_render.h          |   36 ++--
 5 files changed, 221 insertions(+), 371 deletions(-)

diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index cc49ac6..b147b84 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -2244,10 +2244,12 @@ i965_PutSurface(VADriverContextP ctx,
     union dri_buffer *buffer;
     struct intel_region *dest_region;
     struct object_surface *obj_surface; 
+    VARectangle src_rect, dst_rect;
     int ret;
     uint32_t name;
     Bool new_region = False;
     int pp_flag = 0;
+
     /* Currently don't support DRI1 */
     if (dri_state->driConnectedFlag != VA_DRI2)
         return VA_STATUS_ERROR_UNKNOWN;
@@ -2305,16 +2307,21 @@ i965_PutSurface(VADriverContextP ctx,
     if (flags & (VA_BOTTOM_FIELD | VA_TOP_FIELD))
         pp_flag |= I965_PP_FLAG_DEINTERLACING;
 
-    intel_render_put_surface(ctx, surface,
-                             srcx, srcy, srcw, srch,
-                             destx, desty, destw, desth,
-                             pp_flag);
+    src_rect.x      = srcx;
+    src_rect.y      = srcy;
+    src_rect.width  = srcw;
+    src_rect.height = srch;
+
+    dst_rect.x      = destx;
+    dst_rect.y      = desty;
+    dst_rect.width  = destw;
+    dst_rect.height = desth;
+
+    intel_render_put_surface(ctx, surface, &src_rect, &dst_rect, pp_flag);
 
     if(obj_surface->subpic != VA_INVALID_ID) {
-        intel_render_put_subpicture(ctx, surface,
-                                    srcx, srcy, srcw, srch,
-                                    destx, desty, destw, desth);
-    } 
+        intel_render_put_subpicture(ctx, surface, &src_rect, &dst_rect);
+    }
 
     dri_swap_buffer(ctx, dri_drawable);
     obj_surface->flags |= SURFACE_DISPLAYED;
diff --git a/i965_drv_video/i965_post_processing.c b/i965_drv_video/i965_post_processing.c
index 23ca083..d0ad586 100644
--- a/i965_drv_video/i965_post_processing.c
+++ b/i965_drv_video/i965_post_processing.c
@@ -1748,18 +1748,14 @@ void pp_nv12_dndi_initialize(VADriverContextP ctx, VASurfaceID surface, int inpu
 }
 
 static void
-ironlake_pp_initialize(VADriverContextP ctx,
-                       VASurfaceID surface,
-                       int input,
-                       short srcx,
-                       short srcy,
-                       unsigned short srcw,
-                       unsigned short srch,
-                       short destx,
-                       short desty,
-                       unsigned short destw,
-                       unsigned short desth,
-                       int pp_index)
+ironlake_pp_initialize(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    int                input,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    int                pp_index
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct i965_post_processing_context *pp_context = i965->pp_context;
@@ -1842,44 +1838,35 @@ ironlake_pp_initialize(VADriverContextP ctx,
     pp_module = &pp_context->pp_modules[pp_index];
     
     if (pp_module->initialize)
-        pp_module->initialize(ctx, surface, input, srcw, srch, destw, desth);
+        pp_module->initialize(ctx, surface, input,
+                              src_rect->width, src_rect->height,
+                              dst_rect->width, dst_rect->height);
 }
 
 static void
-ironlake_post_processing(VADriverContextP ctx,
-                         VASurfaceID surface,
-                         int input,
-                         short srcx,
-                         short srcy,
-                         unsigned short srcw,
-                         unsigned short srch,
-                         short destx,
-                         short desty,
-                         unsigned short destw,
-                         unsigned short desth,
-                         int pp_index)
+ironlake_post_processing(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    int                input,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    int                pp_index
+)
 {
-    ironlake_pp_initialize(ctx, surface, input,
-                           srcx, srcy, srcw, srch,
-                           destx, desty, destw, desth,
-                           pp_index);
+    ironlake_pp_initialize(ctx, surface, input, src_rect, dst_rect, pp_index);
     ironlake_pp_states_setup(ctx);
     ironlake_pp_pipeline_setup(ctx);
 }
 
 static void
-gen6_pp_initialize(VADriverContextP ctx,
-                   VASurfaceID surface,
-                   int input,
-                   short srcx,
-                   short srcy,
-                   unsigned short srcw,
-                   unsigned short srch,
-                   short destx,
-                   short desty,
-                   unsigned short destw,
-                   unsigned short desth,
-                   int pp_index)
+gen6_pp_initialize(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    int                input,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    int                pp_index
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct i965_post_processing_context *pp_context = i965->pp_context;
@@ -1962,7 +1949,9 @@ gen6_pp_initialize(VADriverContextP ctx,
     pp_module = &pp_context->pp_modules[pp_index];
     
     if (pp_module->initialize)
-        pp_module->initialize(ctx, surface, input, srcw, srch, destw, desth);
+        pp_module->initialize(ctx, surface, input,
+                              src_rect->width, src_rect->height,
+                              dst_rect->width, dst_rect->height);
 }
 
 static void
@@ -2206,68 +2195,48 @@ gen6_pp_pipeline_setup(VADriverContextP ctx)
 }
 
 static void
-gen6_post_processing(VADriverContextP ctx,
-                     VASurfaceID surface,
-                     int input,
-                     short srcx,
-                     short srcy,
-                     unsigned short srcw,
-                     unsigned short srch,
-                     short destx,
-                     short desty,
-                     unsigned short destw,
-                     unsigned short desth,
-                     int pp_index)
+gen6_post_processing(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    int                input,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    int                pp_index
+)
 {
-    gen6_pp_initialize(ctx, surface, input,
-                       srcx, srcy, srcw, srch,
-                       destx, desty, destw, desth,
-                       pp_index);
+    gen6_pp_initialize(ctx, surface, input, src_rect, dst_rect, pp_index);
     gen6_pp_states_setup(ctx);
     gen6_pp_pipeline_setup(ctx);
 }
 
 static void
-i965_post_processing_internal(VADriverContextP ctx,
-                              VASurfaceID surface,
-                              int input,
-                              short srcx,
-                              short srcy,
-                              unsigned short srcw,
-                              unsigned short srch,
-                              short destx,
-                              short desty,
-                              unsigned short destw,
-                              unsigned short desth,
-                              int pp_index)
+i965_post_processing_internal(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    int                input,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    int                pp_index
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
 
     if (IS_GEN6(i965->intel.device_id) ||
         IS_GEN7(i965->intel.device_id))
-        gen6_post_processing(ctx, surface, input,
-                             srcx, srcy, srcw, srch,
-                             destx, desty, destw, desth,
-                             pp_index);
+        gen6_post_processing(ctx, surface, input, src_rect, dst_rect, pp_index);
     else
-        ironlake_post_processing(ctx, surface, input,
-                                 srcx, srcy, srcw, srch,
-                                 destx, desty, destw, desth,
+        ironlake_post_processing(ctx, surface, input, src_rect, dst_rect,
                                  pp_index);
 }
 
 void
-i965_post_processing(VADriverContextP ctx,
-                     VASurfaceID surface,
-                     short srcx,
-                     short srcy,
-                     unsigned short srcw,
-                     unsigned short srch,
-                     short destx,
-                     short desty,
-                     unsigned short destw,
-                     unsigned short desth,
-                     unsigned int flag)
+i965_post_processing(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    unsigned int       flags
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
 
@@ -2276,18 +2245,16 @@ i965_post_processing(VADriverContextP ctx,
         if (i965->render_state.interleaved_uv) {
             int internal_input = 0;
 
-            if (flag & I965_PP_FLAG_DEINTERLACING) {
+            if (flags & I965_PP_FLAG_DEINTERLACING) {
                 i965_post_processing_internal(ctx, surface, internal_input,
-                                              srcx, srcy, srcw, srch,
-                                              destx, desty, destw, desth,
+                                              src_rect, dst_rect,
                                               PP_NV12_DNDI);
                 internal_input = 1;
             }
 
-            if (flag & I965_PP_FLAG_AVS) {
+            if (flags & I965_PP_FLAG_AVS) {
                 i965_post_processing_internal(ctx, surface, internal_input,
-                                              srcx, srcy, srcw, srch,
-                                              destx, desty, destw, desth,
+                                              src_rect, dst_rect,
                                               PP_NV12_AVS);
             }
         }
diff --git a/i965_drv_video/i965_post_processing.h b/i965_drv_video/i965_post_processing.h
index 702014d..0982410 100644
--- a/i965_drv_video/i965_post_processing.h
+++ b/i965_drv_video/i965_post_processing.h
@@ -351,17 +351,14 @@ struct i965_post_processing_context
 };
 
 void
-i965_post_processing(VADriverContextP ctx,
-                     VASurfaceID surface,
-                     short srcx,
-                     short srcy,
-                     unsigned short srcw,
-                     unsigned short srch,
-                     short destx,
-                     short desty,
-                     unsigned short destw,
-                     unsigned short desth,
-                     unsigned int pp_index);
+i965_post_processing(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    unsigned int       flags
+);
+
 Bool
 i965_post_processing_terminate(VADriverContextP ctx);
 Bool
diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c
index a05e40b..1742fe5 100644
--- a/i965_drv_video/i965_render.c
+++ b/i965_drv_video/i965_render.c
@@ -927,16 +927,12 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx,
 }
 
 static void 
-i965_render_upload_vertex(VADriverContextP ctx,
-                          VASurfaceID surface,
-                          short srcx,
-                          short srcy,
-                          unsigned short srcw,
-                          unsigned short srch,
-                          short destx,
-                          short desty,
-                          unsigned short destw,
-                          unsigned short desth)
+i965_render_upload_vertex(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct i965_render_state *render_state = &i965->render_state;
@@ -946,20 +942,20 @@ i965_render_upload_vertex(VADriverContextP ctx,
 
     float u1, v1, u2, v2;
     int i, width, height;
-    int box_x1 = dest_region->x + destx;
-    int box_y1 = dest_region->y + desty;
-    int box_x2 = box_x1 + destw;
-    int box_y2 = box_y1 + desth;
+    int box_x1 = dest_region->x + dst_rect->x;
+    int box_y1 = dest_region->y + dst_rect->y;
+    int box_x2 = box_x1 + dst_rect->width;
+    int box_y2 = box_y1 + dst_rect->height;
 
     obj_surface = SURFACE(surface);
     assert(surface);
     width = obj_surface->orig_width;
     height = obj_surface->orig_height;
 
-    u1 = (float)srcx / width;
-    v1 = (float)srcy / height;
-    u2 = (float)(srcx + srcw) / width;
-    v2 = (float)(srcy + srch) / height;
+    u1 = (float)src_rect->x / width;
+    v1 = (float)src_rect->y / height;
+    u2 = (float)(src_rect->x + src_rect->width) / width;
+    v2 = (float)(src_rect->y + src_rect->height) / height;
 
     dri_bo_map(render_state->vb.vertex_buffer, 1);
     assert(render_state->vb.vertex_buffer->virtual);
@@ -1008,16 +1004,12 @@ i965_render_upload_constants(VADriverContextP ctx)
 }
 
 static void
-i965_surface_render_state_setup(VADriverContextP ctx,
-                        VASurfaceID surface,
-                        short srcx,
-                        short srcy,
-                        unsigned short srcw,
-                        unsigned short srch,
-                        short destx,
-                        short desty,
-                        unsigned short destw,
-                        unsigned short desth)
+i965_surface_render_state_setup(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
     i965_render_vs_unit(ctx);
     i965_render_sf_unit(ctx);
@@ -1027,22 +1019,16 @@ i965_surface_render_state_setup(VADriverContextP ctx,
     i965_render_wm_unit(ctx);
     i965_render_cc_viewport(ctx);
     i965_render_cc_unit(ctx);
-    i965_render_upload_vertex(ctx, surface,
-                              srcx, srcy, srcw, srch,
-                              destx, desty, destw, desth);
+    i965_render_upload_vertex(ctx, surface, src_rect, dst_rect);
     i965_render_upload_constants(ctx);
 }
 static void
-i965_subpic_render_state_setup(VADriverContextP ctx,
-                        VASurfaceID surface,
-                        short srcx,
-                        short srcy,
-                        unsigned short srcw,
-                        unsigned short srch,
-                        short destx,
-                        short desty,
-                        unsigned short destw,
-                        unsigned short desth)
+i965_subpic_render_state_setup(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
     i965_render_vs_unit(ctx);
     i965_render_sf_unit(ctx);
@@ -1052,13 +1038,7 @@ i965_subpic_render_state_setup(VADriverContextP ctx,
     i965_subpic_render_wm_unit(ctx);
     i965_render_cc_viewport(ctx);
     i965_subpic_render_cc_unit(ctx);
-
-    VARectangle output_rect;
-    output_rect.x      = destx;
-    output_rect.y      = desty;
-    output_rect.width  = destw;
-    output_rect.height = desth;
-    i965_subpic_render_upload_vertex(ctx, surface, &output_rect);
+    i965_subpic_render_upload_vertex(ctx, surface, dst_rect);
 }
 
 
@@ -1546,40 +1526,30 @@ i965_render_initialize(VADriverContextP ctx)
 }
 
 static void
-i965_render_put_surface(VADriverContextP ctx,
-                        VASurfaceID surface,
-                        short srcx,
-                        short srcy,
-                        unsigned short srcw,
-                        unsigned short srch,
-                        short destx,
-                        short desty,
-                        unsigned short destw,
-                        unsigned short desth,
-                        unsigned int flag)
+i965_render_put_surface(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    unsigned int       flags
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct intel_batchbuffer *batch = i965->batch;
 
     i965_render_initialize(ctx);
-    i965_surface_render_state_setup(ctx, surface,
-                            srcx, srcy, srcw, srch,
-                            destx, desty, destw, desth);
+    i965_surface_render_state_setup(ctx, surface, src_rect, dst_rect);
     i965_surface_render_pipeline_setup(ctx);
     intel_batchbuffer_flush(batch);
 }
 
 static void
-i965_render_put_subpicture(VADriverContextP ctx,
-                           VASurfaceID surface,
-                           short srcx,
-                           short srcy,
-                           unsigned short srcw,
-                           unsigned short srch,
-                           short destx,
-                           short desty,
-                           unsigned short destw,
-                           unsigned short desth)
+i965_render_put_subpicture(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct intel_batchbuffer *batch = i965->batch;
@@ -1589,9 +1559,7 @@ i965_render_put_subpicture(VADriverContextP ctx,
     assert(obj_subpic);
 
     i965_render_initialize(ctx);
-    i965_subpic_render_state_setup(ctx, surface,
-                                   srcx, srcy, srcw, srch,
-                                   destx, desty, destw, desth);
+    i965_subpic_render_state_setup(ctx, surface, src_rect, dst_rect);
     i965_subpic_render_pipeline_setup(ctx);
     i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff);
     intel_batchbuffer_flush(batch);
@@ -1720,16 +1688,12 @@ gen6_render_depth_stencil_state(VADriverContextP ctx)
 }
 
 static void
-gen6_render_setup_states(VADriverContextP ctx,
-                         VASurfaceID surface,
-                         short srcx,
-                         short srcy,
-                         unsigned short srcw,
-                         unsigned short srch,
-                         short destx,
-                         short desty,
-                         unsigned short destw,
-                         unsigned short desth)
+gen6_render_setup_states(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
     i965_render_dest_surface_state(ctx, 0);
     i965_render_src_surfaces_state(ctx, surface);
@@ -1739,9 +1703,7 @@ gen6_render_setup_states(VADriverContextP ctx,
     gen6_render_blend_state(ctx);
     gen6_render_depth_stencil_state(ctx);
     i965_render_upload_constants(ctx);
-    i965_render_upload_vertex(ctx, surface,
-                              srcx, srcy, srcw, srch,
-                              destx, desty, destw, desth);
+    i965_render_upload_vertex(ctx, surface, src_rect, dst_rect);
 }
 
 static void
@@ -2088,25 +2050,19 @@ gen6_render_emit_states(VADriverContextP ctx, int kernel)
 }
 
 static void
-gen6_render_put_surface(VADriverContextP ctx,
-                        VASurfaceID surface,
-                        short srcx,
-                        short srcy,
-                        unsigned short srcw,
-                        unsigned short srch,
-                        short destx,
-                        short desty,
-                        unsigned short destw,
-                        unsigned short desth,
-                        unsigned int flag)
+gen6_render_put_surface(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    unsigned int       flags
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct intel_batchbuffer *batch = i965->batch;
 
     gen6_render_initialize(ctx);
-    gen6_render_setup_states(ctx, surface,
-                             srcx, srcy, srcw, srch,
-                             destx, desty, destw, desth);
+    gen6_render_setup_states(ctx, surface, src_rect, dst_rect);
     i965_clear_dest_region(ctx);
     gen6_render_emit_states(ctx, PS_KERNEL);
     intel_batchbuffer_flush(batch);
@@ -2135,24 +2091,13 @@ gen6_subpicture_render_blend_state(VADriverContextP ctx)
 }
 
 static void
-gen6_subpicture_render_setup_states(VADriverContextP ctx,
-                                    VASurfaceID surface,
-                                    short srcx,
-                                    short srcy,
-                                    unsigned short srcw,
-                                    unsigned short srch,
-                                    short destx,
-                                    short desty,
-                                    unsigned short destw,
-                                    unsigned short desth)
+gen6_subpicture_render_setup_states(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
-    VARectangle output_rect;
-
-    output_rect.x      = destx;
-    output_rect.y      = desty;
-    output_rect.width  = destw;
-    output_rect.height = desth;
-
     i965_render_dest_surface_state(ctx, 0);
     i965_subpic_render_src_surfaces_state(ctx, surface);
     i965_render_sampler(ctx);
@@ -2160,20 +2105,16 @@ gen6_subpicture_render_setup_states(VADriverContextP ctx,
     gen6_render_color_calc_state(ctx);
     gen6_subpicture_render_blend_state(ctx);
     gen6_render_depth_stencil_state(ctx);
-    i965_subpic_render_upload_vertex(ctx, surface, &output_rect);
+    i965_subpic_render_upload_vertex(ctx, surface, dst_rect);
 }
 
 static void
-gen6_render_put_subpicture(VADriverContextP ctx,
-                           VASurfaceID surface,
-                           short srcx,
-                           short srcy,
-                           unsigned short srcw,
-                           unsigned short srch,
-                           short destx,
-                           short desty,
-                           unsigned short destw,
-                           unsigned short desth)
+gen6_render_put_subpicture(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct intel_batchbuffer *batch = i965->batch;
@@ -2182,9 +2123,7 @@ gen6_render_put_subpicture(VADriverContextP ctx,
 
     assert(obj_subpic);
     gen6_render_initialize(ctx);
-    gen6_subpicture_render_setup_states(ctx, surface,
-                                        srcx, srcy, srcw, srch,
-                                        destx, desty, destw, desth);
+    gen6_subpicture_render_setup_states(ctx, surface, src_rect, dst_rect);
     gen6_render_emit_states(ctx, PS_SUBPIC_KERNEL);
     i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff);
     intel_batchbuffer_flush(batch);
@@ -2341,16 +2280,12 @@ gen7_render_sampler(VADriverContextP ctx)
 }
 
 static void
-gen7_render_setup_states(VADriverContextP ctx,
-                         VASurfaceID surface,
-                         short srcx,
-                         short srcy,
-                         unsigned short srcw,
-                         unsigned short srch,
-                         short destx,
-                         short desty,
-                         unsigned short destw,
-                         unsigned short desth)
+gen7_render_setup_states(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
     i965_render_dest_surface_state(ctx, 0);
     i965_render_src_surfaces_state(ctx, surface);
@@ -2360,9 +2295,7 @@ gen7_render_setup_states(VADriverContextP ctx,
     gen7_render_blend_state(ctx);
     gen7_render_depth_stencil_state(ctx);
     i965_render_upload_constants(ctx);
-    i965_render_upload_vertex(ctx, surface,
-                              srcx, srcy, srcw, srch,
-                              destx, desty, destw, desth);
+    i965_render_upload_vertex(ctx, surface, src_rect, dst_rect);
 }
 
 static void
@@ -2882,25 +2815,19 @@ gen7_render_emit_states(VADriverContextP ctx, int kernel)
 }
 
 static void
-gen7_render_put_surface(VADriverContextP ctx,
-                        VASurfaceID surface,
-                        short srcx,
-                        short srcy,
-                        unsigned short srcw,
-                        unsigned short srch,
-                        short destx,
-                        short desty,
-                        unsigned short destw,
-                        unsigned short desth,
-                        unsigned int flag)
+gen7_render_put_surface(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    unsigned int       flags
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct intel_batchbuffer *batch = i965->batch;
 
     gen7_render_initialize(ctx);
-    gen7_render_setup_states(ctx, surface,
-                             srcx, srcy, srcw, srch,
-                             destx, desty, destw, desth);
+    gen7_render_setup_states(ctx, surface, src_rect, dst_rect);
     i965_clear_dest_region(ctx);
     gen7_render_emit_states(ctx, PS_KERNEL);
     intel_batchbuffer_flush(batch);
@@ -2929,24 +2856,13 @@ gen7_subpicture_render_blend_state(VADriverContextP ctx)
 }
 
 static void
-gen7_subpicture_render_setup_states(VADriverContextP ctx,
-                                    VASurfaceID surface,
-                                    short srcx,
-                                    short srcy,
-                                    unsigned short srcw,
-                                    unsigned short srch,
-                                    short destx,
-                                    short desty,
-                                    unsigned short destw,
-                                    unsigned short desth)
+gen7_subpicture_render_setup_states(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
-    VARectangle output_rect;
-
-    output_rect.x      = destx;
-    output_rect.y      = desty;
-    output_rect.width  = destw;
-    output_rect.height = desth;
-
     i965_render_dest_surface_state(ctx, 0);
     i965_subpic_render_src_surfaces_state(ctx, surface);
     i965_render_sampler(ctx);
@@ -2954,20 +2870,16 @@ gen7_subpicture_render_setup_states(VADriverContextP ctx,
     gen7_render_color_calc_state(ctx);
     gen7_subpicture_render_blend_state(ctx);
     gen7_render_depth_stencil_state(ctx);
-    i965_subpic_render_upload_vertex(ctx, surface, &output_rect);
+    i965_subpic_render_upload_vertex(ctx, surface, dst_rect);
 }
 
 static void
-gen7_render_put_subpicture(VADriverContextP ctx,
-                           VASurfaceID surface,
-                           short srcx,
-                           short srcy,
-                           unsigned short srcw,
-                           unsigned short srch,
-                           short destx,
-                           short desty,
-                           unsigned short destw,
-                           unsigned short desth)
+gen7_render_put_subpicture(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct intel_batchbuffer *batch = i965->batch;
@@ -2976,9 +2888,7 @@ gen7_render_put_subpicture(VADriverContextP ctx,
 
     assert(obj_subpic);
     gen7_render_initialize(ctx);
-    gen7_subpicture_render_setup_states(ctx, surface,
-                                        srcx, srcy, srcw, srch,
-                                        destx, desty, destw, desth);
+    gen7_subpicture_render_setup_states(ctx, surface, src_rect, dst_rect);
     gen7_render_emit_states(ctx, PS_SUBPIC_KERNEL);
     i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff);
     intel_batchbuffer_flush(batch);
@@ -2988,69 +2898,44 @@ gen7_render_put_subpicture(VADriverContextP ctx,
 /*
  * global functions
  */
+
 void
-intel_render_put_surface(VADriverContextP ctx,
-                        VASurfaceID surface,
-                        short srcx,
-                        short srcy,
-                        unsigned short srcw,
-                        unsigned short srch,
-                        short destx,
-                        short desty,
-                        unsigned short destw,
-                        unsigned short desth,
-                        unsigned int flag)
+intel_render_put_surface(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    unsigned int       flags
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
 
-    i965_post_processing(ctx, surface,
-                         srcx, srcy, srcw, srch,
-                         destx, desty, destw, desth,
-                         flag);
+    i965_post_processing(ctx, surface, src_rect, dst_rect, flags);
 
     if (IS_GEN7(i965->intel.device_id))
-        gen7_render_put_surface(ctx, surface,
-                                srcx, srcy, srcw, srch,
-                                destx, desty, destw, desth,
-                                flag);
+        gen7_render_put_surface(ctx, surface, src_rect, dst_rect, flags);
     else if (IS_GEN6(i965->intel.device_id))
-        gen6_render_put_surface(ctx, surface,
-                                srcx, srcy, srcw, srch,
-                                destx, desty, destw, desth,
-                                flag);
+        gen6_render_put_surface(ctx, surface, src_rect, dst_rect, flags);
     else
-        i965_render_put_surface(ctx, surface,
-                                srcx, srcy, srcw, srch,
-                                destx, desty, destw, desth,
-                                flag);
+        i965_render_put_surface(ctx, surface, src_rect, dst_rect, flags);
 }
 
 void
-intel_render_put_subpicture(VADriverContextP ctx,
-                           VASurfaceID surface,
-                           short srcx,
-                           short srcy,
-                           unsigned short srcw,
-                           unsigned short srch,
-                           short destx,
-                           short desty,
-                           unsigned short destw,
-                           unsigned short desth)
+intel_render_put_subpicture(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
 
     if (IS_GEN7(i965->intel.device_id))
-        gen7_render_put_subpicture(ctx, surface,
-                                   srcx, srcy, srcw, srch,
-                                   destx, desty, destw, desth);
+        gen7_render_put_subpicture(ctx, surface, src_rect, dst_rect);
     else if (IS_GEN6(i965->intel.device_id))
-        gen6_render_put_subpicture(ctx, surface,
-                                   srcx, srcy, srcw, srch,
-                                   destx, desty, destw, desth);
+        gen6_render_put_subpicture(ctx, surface, src_rect, dst_rect);
     else
-        i965_render_put_subpicture(ctx, surface,
-                                   srcx, srcy, srcw, srch,
-                                   destx, desty, destw, desth);
+        i965_render_put_subpicture(ctx, surface, src_rect, dst_rect);
 }
 
 Bool 
diff --git a/i965_drv_video/i965_render.h b/i965_drv_video/i965_render.h
index fd4be8f..a5034d9 100644
--- a/i965_drv_video/i965_render.h
+++ b/i965_drv_video/i965_render.h
@@ -81,28 +81,22 @@ struct i965_render_state
 
 Bool i965_render_init(VADriverContextP ctx);
 Bool i965_render_terminate(VADriverContextP ctx);
-void intel_render_put_surface(VADriverContextP ctx,
-                             VASurfaceID surface,
-                             short srcx,
-                             short srcy,
-                             unsigned short srcw,
-                             unsigned short srch,
-                             short destx,
-                             short desty,
-                             unsigned short destw,
-                             unsigned short desth,
-                             unsigned int flag);
 
+void
+intel_render_put_surface(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect,
+    unsigned int       flags
+);
 
 void
-intel_render_put_subpicture(VADriverContextP ctx,
-                        VASurfaceID surface,
-                        short srcx,
-                        short srcy,
-                        unsigned short srcw,
-                        unsigned short srch,
-                        short destx,
-                        short desty,
-                        unsigned short destw,
-                        unsigned short desth);
+intel_render_put_subpicture(
+    VADriverContextP   ctx,
+    VASurfaceID        surface,
+    const VARectangle *src_rect,
+    const VARectangle *dst_rect
+);
+
 #endif /* _I965_RENDER_H_ */
-- 
1.7.4.1



More information about the Libva mailing list