[Libva] [PATCH Intel-driver 9/9] Remove unnecessary check with IS_GEN8()

Gwenole Beauchesne gb.devel at gmail.com
Mon Apr 21 09:38:10 PDT 2014


2014-04-18 18:21 GMT+02:00 Xiang, Haihao <haihao.xiang at intel.com>:
> From: "Xiang, Haihao" <haihao.xiang at intel.com>
>
> It is always true or false
>
> Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
> ---
>  src/gen8_post_processing.c | 32 ++++++++++----------------------
>  src/gen8_render.c          |  6 ++----
>  src/i965_post_processing.c | 37 +++++++++++--------------------------
>  src/i965_render.c          |  3 +--
>  4 files changed, 24 insertions(+), 54 deletions(-)
>
> diff --git a/src/gen8_post_processing.c b/src/gen8_post_processing.c
> index b9a7268..adafefa 100644
> --- a/src/gen8_post_processing.c
> +++ b/src/gen8_post_processing.c
> @@ -1364,8 +1364,7 @@ gen8_pp_curbe_load(VADriverContextP ctx,
>      struct i965_driver_data *i965 = i965_driver_data(ctx);
>      int param_size = 64;
>
> -    if (IS_GEN8(i965->intel.device_info))
> -        param_size = sizeof(struct gen7_pp_static_parameter);
> +    param_size = sizeof(struct gen7_pp_static_parameter);
>
>      BEGIN_BATCH(batch, 4);
>      OUT_BATCH(batch, CMD_MEDIA_CURBE_LOAD | (4 - 2));
> @@ -1388,8 +1387,6 @@ gen8_pp_object_walker(VADriverContextP ctx,
>      unsigned int *command_ptr;
>
>      param_size = sizeof(struct gen7_pp_inline_parameter);
> -    if (IS_GEN8(i965->intel.device_info))
> -        param_size = sizeof(struct gen7_pp_inline_parameter);
>
>      x_steps = pp_context->pp_x_steps(pp_context->private_context);
>      y_steps = pp_context->pp_y_steps(pp_context->private_context);
> @@ -1430,14 +1427,12 @@ gen8_pp_object_walker(VADriverContextP ctx,
>
>      dri_bo_unmap(command_buffer);
>
> -    if (IS_GEN8(i965->intel.device_info)) {
> -       BEGIN_BATCH(batch, 3);
> -       OUT_BATCH(batch, MI_BATCH_BUFFER_START | (1 << 8) | (1 << 0));
> -       OUT_RELOC(batch, command_buffer,
> -                 I915_GEM_DOMAIN_COMMAND, 0, 0);
> -       OUT_BATCH(batch, 0);
> -       ADVANCE_BATCH(batch);
> -    }
> +    BEGIN_BATCH(batch, 3);
> +    OUT_BATCH(batch, MI_BATCH_BUFFER_START | (1 << 8) | (1 << 0));
> +    OUT_RELOC(batch, command_buffer,
> +              I915_GEM_DOMAIN_COMMAND, 0, 0);
> +    OUT_BATCH(batch, 0);
> +    ADVANCE_BATCH(batch);
>
>      dri_bo_unreference(command_buffer);
>
> @@ -1557,12 +1552,7 @@ gen8_post_processing_context_init(VADriverContextP ctx,
>
>      assert(NUM_PP_MODULES == ARRAY_ELEMS(pp_modules_gen8));
>
> -    if (IS_GEN8(i965->intel.device_info))
> -        memcpy(pp_context->pp_modules, pp_modules_gen8, sizeof(pp_context->pp_modules));
> -    else {
> -        /* should never get here !!! */
> -        assert(0);
> -    }
> +    memcpy(pp_context->pp_modules, pp_modules_gen8, sizeof(pp_context->pp_modules));
>
>      kernel_size = 4096 ;
>
> @@ -1611,10 +1601,8 @@ gen8_post_processing_context_init(VADriverContextP ctx,
>      dri_bo_unmap(pp_context->instruction_state.bo);
>
>      /* static & inline parameters */
> -    if (IS_GEN8(i965->intel.device_info)) {
> -        pp_context->pp_static_parameter = calloc(sizeof(struct gen7_pp_static_parameter), 1);
> -        pp_context->pp_inline_parameter = calloc(sizeof(struct gen7_pp_inline_parameter), 1);
> -    }
> +    pp_context->pp_static_parameter = calloc(sizeof(struct gen7_pp_static_parameter), 1);
> +    pp_context->pp_inline_parameter = calloc(sizeof(struct gen7_pp_inline_parameter), 1);
>
>      pp_context->pp_dndi_context.current_out_surface = VA_INVALID_SURFACE;
>      pp_context->pp_dndi_context.current_out_obj_surface = NULL;
> diff --git a/src/gen8_render.c b/src/gen8_render.c
> index ca731d2..98dd319 100644
> --- a/src/gen8_render.c
> +++ b/src/gen8_render.c
> @@ -1769,10 +1769,8 @@ gen8_render_init(VADriverContextP ctx)
>      render_state->render_put_subpicture = gen8_render_put_subpicture;
>      render_state->render_terminate = gen8_render_terminate;
>
> -    if (IS_GEN8(i965->intel.device_info)) {
> -        memcpy(render_state->render_kernels, render_kernels_gen8,
> -                       sizeof(render_state->render_kernels));
> -    }
> +    memcpy(render_state->render_kernels, render_kernels_gen8,
> +           sizeof(render_state->render_kernels));
>
>      kernel_size = 4096;
>
> diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c
> index c80c6bd..2602712 100755
> --- a/src/i965_post_processing.c
> +++ b/src/i965_post_processing.c
> @@ -4358,8 +4358,7 @@ gen6_pp_upload_constants(VADriverContextP ctx,
>      assert(sizeof(struct pp_static_parameter) == 128);
>      assert(sizeof(struct gen7_pp_static_parameter) == 192);
>
> -    if (IS_GEN7(i965->intel.device_info) ||
> -        IS_GEN8(i965->intel.device_info))
> +    if (IS_GEN7(i965->intel.device_info))
>          param_size = sizeof(struct gen7_pp_static_parameter);
>      else
>          param_size = sizeof(struct pp_static_parameter);
> @@ -4442,8 +4441,7 @@ gen6_pp_curbe_load(VADriverContextP ctx,
>      struct i965_driver_data *i965 = i965_driver_data(ctx);
>      int param_size;
>
> -    if (IS_GEN7(i965->intel.device_info) ||
> -        IS_GEN8(i965->intel.device_info))
> +    if (IS_GEN7(i965->intel.device_info))
>          param_size = sizeof(struct gen7_pp_static_parameter);
>      else
>          param_size = sizeof(struct pp_static_parameter);
> @@ -4529,8 +4527,7 @@ gen6_pp_object_walker(VADriverContextP ctx,
>      dri_bo *command_buffer;
>      unsigned int *command_ptr;
>
> -    if (IS_GEN7(i965->intel.device_info) ||
> -        IS_GEN8(i965->intel.device_info))
> +    if (IS_GEN7(i965->intel.device_info))
>          param_size = sizeof(struct gen7_pp_inline_parameter);
>      else
>          param_size = sizeof(struct pp_inline_parameter);
> @@ -4572,23 +4569,13 @@ gen6_pp_object_walker(VADriverContextP ctx,
>
>      dri_bo_unmap(command_buffer);
>
> -    if (IS_GEN8(i965->intel.device_info)) {
> -       BEGIN_BATCH(batch, 3);
> -       OUT_BATCH(batch, MI_BATCH_BUFFER_START | (1 << 8) | (1 << 0));
> -       OUT_RELOC(batch, command_buffer,
> -              I915_GEM_DOMAIN_COMMAND, 0,
> -              0);
> -       OUT_BATCH(batch, 0);
> -       ADVANCE_BATCH(batch);
> -    } else {
> -       BEGIN_BATCH(batch, 2);
> -       OUT_BATCH(batch, MI_BATCH_BUFFER_START | (1 << 8));
> -       OUT_RELOC(batch, command_buffer,
> -              I915_GEM_DOMAIN_COMMAND, 0,
> +    BEGIN_BATCH(batch, 2);
> +    OUT_BATCH(batch, MI_BATCH_BUFFER_START | (1 << 8));
> +    OUT_RELOC(batch, command_buffer,
> +              I915_GEM_DOMAIN_COMMAND, 0,
>                0);

48b addresses on Broadwell, so you may still need to set the upper
bits to zero in the Gen8 case.

> -       ADVANCE_BATCH(batch);
> -    }
> -
> +    ADVANCE_BATCH(batch);
> +
>      dri_bo_unreference(command_buffer);
>
>      /* Have to execute the batch buffer here becuase MI_BATCH_BUFFER_END
> @@ -4731,8 +4718,7 @@ i965_vpp_clear_surface(VADriverContextP ctx,
>      br13 |= pitch;
>
>      if (IS_GEN6(i965->intel.device_info) ||
> -        IS_GEN7(i965->intel.device_info) ||
> -        IS_GEN8(i965->intel.device_info)) {
> +        IS_GEN7(i965->intel.device_info)) {
>          intel_batchbuffer_start_atomic_blt(batch, 48);
>          BEGIN_BLT_BATCH(batch, 12);
>      } else {
> @@ -5416,8 +5402,7 @@ i965_post_processing_context_init(VADriverContextP ctx,
>      }
>
>      /* static & inline parameters */
> -    if (IS_GEN7(i965->intel.device_info) ||
> -        IS_GEN8(i965->intel.device_info)) {
> +    if (IS_GEN7(i965->intel.device_info)) {
>          pp_context->pp_static_parameter = calloc(sizeof(struct gen7_pp_static_parameter), 1);
>          pp_context->pp_inline_parameter = calloc(sizeof(struct gen7_pp_inline_parameter), 1);
>      } else {
> diff --git a/src/i965_render.c b/src/i965_render.c
> index aed78c0..5ebe4b0 100644
> --- a/src/i965_render.c
> +++ b/src/i965_render.c
> @@ -1537,8 +1537,7 @@ i965_clear_dest_region(VADriverContextP ctx)
>      br13 |= pitch;
>
>      if (IS_GEN6(i965->intel.device_info) ||
> -        IS_GEN7(i965->intel.device_info) ||
> -        IS_GEN8(i965->intel.device_info)) {
> +        IS_GEN7(i965->intel.device_info)) {
>          intel_batchbuffer_start_atomic_blt(batch, 24);
>          BEGIN_BLT_BATCH(batch, 6);
>      } else {
> --
> 1.8.3.2
>
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva


More information about the Libva mailing list