hardware/intel/intel-driver
Revision | 9f4d9a929f1be68035e2db5dad6e978c2f82db32 (tree) |
---|---|
Time | 2015-06-24 07:38:53 |
Author | Zhao Yakui <yakui.zhao@inte...> |
Commiter | Zhao, Yakui |
VPP: Configure SURFACE_STATE based on HW requirement to fix out-of-bound access issue
Otherwise some pixles will be regarded as out-of-bound and the
access will be dropped.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Xiang haihao <haihao.xiang@intel.com>
(cherry picked from commit d5cd551887c8f4e5408327aba993e9927dd7d297)
@@ -529,25 +529,25 @@ gen8_pp_set_media_rw_message_surface(VADriverContextP ctx, struct i965_post_proc | ||
529 | 529 | if (is_target) { |
530 | 530 | gen8_pp_set_surface_state(ctx, pp_context, |
531 | 531 | bo, 0, |
532 | - width[0] / 4, height[0], pitch[0], | |
532 | + ALIGN(width[0], 4) / 4, height[0], pitch[0], | |
533 | 533 | I965_SURFACEFORMAT_R8_UINT, |
534 | 534 | base_index, 1); |
535 | 535 | |
536 | 536 | if (fourcc_info->num_planes == 2) { |
537 | 537 | gen8_pp_set_surface_state(ctx, pp_context, |
538 | 538 | bo, offset[1], |
539 | - width[1] / 2, height[1], pitch[1], | |
539 | + ALIGN(width[1], 2) / 2, height[1], pitch[1], | |
540 | 540 | I965_SURFACEFORMAT_R8G8_SINT, |
541 | 541 | base_index + 1, 1); |
542 | 542 | } else if (fourcc_info->num_planes == 3) { |
543 | 543 | gen8_pp_set_surface_state(ctx, pp_context, |
544 | 544 | bo, offset[1], |
545 | - width[1] / 4, height[1], pitch[1], | |
545 | + ALIGN(width[1], 4) / 4, height[1], pitch[1], | |
546 | 546 | I965_SURFACEFORMAT_R8_SINT, |
547 | 547 | base_index + 1, 1); |
548 | 548 | gen8_pp_set_surface_state(ctx, pp_context, |
549 | 549 | bo, offset[2], |
550 | - width[2] / 4, height[2], pitch[2], | |
550 | + ALIGN(width[2], 4) / 4, height[2], pitch[2], | |
551 | 551 | I965_SURFACEFORMAT_R8_SINT, |
552 | 552 | base_index + 2, 1); |
553 | 553 | } |
@@ -2051,26 +2051,26 @@ pp_set_media_rw_message_surface(VADriverContextP ctx, struct i965_post_processin | ||
2051 | 2051 | /* Y surface */ |
2052 | 2052 | i965_pp_set_surface_state(ctx, pp_context, |
2053 | 2053 | bo, offset[Y], |
2054 | - width[Y] *scale_factor_of_1st_plane_width_in_byte / 4, height[Y], pitch[Y], I965_SURFACEFORMAT_R8_UNORM, | |
2054 | + ALIGN(width[Y] *scale_factor_of_1st_plane_width_in_byte, 4) / 4, height[Y], pitch[Y], I965_SURFACEFORMAT_R8_UNORM, | |
2055 | 2055 | base_index, is_target); |
2056 | 2056 | |
2057 | 2057 | if (!packed_yuv && !full_packed_format) { |
2058 | 2058 | if (interleaved_uv) { |
2059 | 2059 | i965_pp_set_surface_state(ctx, pp_context, |
2060 | 2060 | bo, offset[UV], |
2061 | - width[UV] / 4, height[UV], pitch[UV], I965_SURFACEFORMAT_R8_UNORM, | |
2061 | + ALIGN(width[UV], 4) / 4, height[UV], pitch[UV], I965_SURFACEFORMAT_R8_UNORM, | |
2062 | 2062 | base_index + 1, is_target); |
2063 | 2063 | } else { |
2064 | 2064 | /* U surface */ |
2065 | 2065 | i965_pp_set_surface_state(ctx, pp_context, |
2066 | 2066 | bo, offset[U], |
2067 | - width[U] / 4, height[U], pitch[U], I965_SURFACEFORMAT_R8_UNORM, | |
2067 | + ALIGN(width[U], 4) / 4, height[U], pitch[U], I965_SURFACEFORMAT_R8_UNORM, | |
2068 | 2068 | base_index + 1, is_target); |
2069 | 2069 | |
2070 | 2070 | /* V surface */ |
2071 | 2071 | i965_pp_set_surface_state(ctx, pp_context, |
2072 | 2072 | bo, offset[V], |
2073 | - width[V] / 4, height[V], pitch[V], I965_SURFACEFORMAT_R8_UNORM, | |
2073 | + ALIGN(width[V], 4) / 4, height[V], pitch[V], I965_SURFACEFORMAT_R8_UNORM, | |
2074 | 2074 | base_index + 2, is_target); |
2075 | 2075 | } |
2076 | 2076 | } |
@@ -2153,25 +2153,25 @@ gen7_pp_set_media_rw_message_surface(VADriverContextP ctx, struct i965_post_proc | ||
2153 | 2153 | if (is_target) { |
2154 | 2154 | gen7_pp_set_surface_state(ctx, pp_context, |
2155 | 2155 | bo, 0, |
2156 | - width[0] / 4, height[0], pitch[0], | |
2156 | + ALIGN(width[0], 4) / 4, height[0], pitch[0], | |
2157 | 2157 | I965_SURFACEFORMAT_R8_UINT, |
2158 | 2158 | base_index, 1); |
2159 | 2159 | |
2160 | 2160 | if (fourcc_info->num_planes == 2) { |
2161 | 2161 | gen7_pp_set_surface_state(ctx, pp_context, |
2162 | 2162 | bo, offset[1], |
2163 | - width[1] / 2, height[1], pitch[1], | |
2163 | + ALIGN(width[1], 2) / 2, height[1], pitch[1], | |
2164 | 2164 | I965_SURFACEFORMAT_R8G8_SINT, |
2165 | 2165 | base_index + 1, 1); |
2166 | 2166 | } else if (fourcc_info->num_planes == 3) { |
2167 | 2167 | gen7_pp_set_surface_state(ctx, pp_context, |
2168 | 2168 | bo, offset[1], |
2169 | - width[1] / 4, height[1], pitch[1], | |
2169 | + ALIGN(width[1], 4) / 4, height[1], pitch[1], | |
2170 | 2170 | I965_SURFACEFORMAT_R8_SINT, |
2171 | 2171 | base_index + 1, 1); |
2172 | 2172 | gen7_pp_set_surface_state(ctx, pp_context, |
2173 | 2173 | bo, offset[2], |
2174 | - width[2] / 4, height[2], pitch[2], | |
2174 | + ALIGN(width[2], 4) / 4, height[2], pitch[2], | |
2175 | 2175 | I965_SURFACEFORMAT_R8_SINT, |
2176 | 2176 | base_index + 2, 1); |
2177 | 2177 | } |
@@ -2451,7 +2451,7 @@ pp_nv12_scaling_initialize(VADriverContextP ctx, struct i965_post_processing_con | ||
2451 | 2451 | /* source UV surface index 2 */ |
2452 | 2452 | i965_pp_set_surface_state(ctx, pp_context, |
2453 | 2453 | obj_surface->bo, in_wpitch * in_hpitch, |
2454 | - in_w / 2, in_h / 2, in_wpitch, I965_SURFACEFORMAT_R8G8_UNORM, | |
2454 | + ALIGN(in_w, 2) / 2, in_h / 2, in_wpitch, I965_SURFACEFORMAT_R8G8_UNORM, | |
2455 | 2455 | 2, 0); |
2456 | 2456 | |
2457 | 2457 | /* destination surface */ |
@@ -2464,13 +2464,13 @@ pp_nv12_scaling_initialize(VADriverContextP ctx, struct i965_post_processing_con | ||
2464 | 2464 | /* destination Y surface index 7 */ |
2465 | 2465 | i965_pp_set_surface_state(ctx, pp_context, |
2466 | 2466 | obj_surface->bo, 0, |
2467 | - out_w / 4, out_h, out_wpitch, I965_SURFACEFORMAT_R8_UNORM, | |
2467 | + ALIGN(out_w, 4) / 4, out_h, out_wpitch, I965_SURFACEFORMAT_R8_UNORM, | |
2468 | 2468 | 7, 1); |
2469 | 2469 | |
2470 | 2470 | /* destination UV surface index 8 */ |
2471 | 2471 | i965_pp_set_surface_state(ctx, pp_context, |
2472 | 2472 | obj_surface->bo, out_wpitch * out_hpitch, |
2473 | - out_w / 4, out_h / 2, out_wpitch, I965_SURFACEFORMAT_R8G8_UNORM, | |
2473 | + ALIGN(out_w, 4) / 4, out_h / 2, out_wpitch, I965_SURFACEFORMAT_R8G8_UNORM, | |
2474 | 2474 | 8, 1); |
2475 | 2475 | |
2476 | 2476 | /* sampler state */ |
@@ -2739,13 +2739,13 @@ pp_nv12_avs_initialize(VADriverContextP ctx, struct i965_post_processing_context | ||
2739 | 2739 | /* destination Y surface index 7 */ |
2740 | 2740 | i965_pp_set_surface_state(ctx, pp_context, |
2741 | 2741 | obj_surface->bo, 0, |
2742 | - out_w / 4, out_h, out_wpitch, I965_SURFACEFORMAT_R8_UNORM, | |
2742 | + ALIGN(out_w, 4) / 4, out_h, out_wpitch, I965_SURFACEFORMAT_R8_UNORM, | |
2743 | 2743 | 7, 1); |
2744 | 2744 | |
2745 | 2745 | /* destination UV surface index 8 */ |
2746 | 2746 | i965_pp_set_surface_state(ctx, pp_context, |
2747 | 2747 | obj_surface->bo, out_wpitch * out_hpitch, |
2748 | - out_w / 4, out_h / 2, out_wpitch, I965_SURFACEFORMAT_R8G8_UNORM, | |
2748 | + ALIGN(out_w, 4) / 4, out_h / 2, out_wpitch, I965_SURFACEFORMAT_R8G8_UNORM, | |
2749 | 2749 | 8, 1); |
2750 | 2750 | |
2751 | 2751 | /* sampler 8x8 state */ |
@@ -3401,9 +3401,9 @@ pp_nv12_dndi_initialize(VADriverContextP ctx, struct i965_post_processing_contex | ||
3401 | 3401 | orig_h = obj_surface->orig_height; |
3402 | 3402 | |
3403 | 3403 | i965_pp_set_surface_state(ctx, pp_context, obj_surface->bo, 0, |
3404 | - orig_w / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, 7, 1); | |
3404 | + ALIGN(orig_w, 4) / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, 7, 1); | |
3405 | 3405 | i965_pp_set_surface_state(ctx, pp_context, obj_surface->bo, w * h, |
3406 | - orig_w / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, 8, 1); | |
3406 | + ALIGN(orig_w, 4) / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, 8, 1); | |
3407 | 3407 | |
3408 | 3408 | /* Current output surfaces (index = { 10, 11 }) */ |
3409 | 3409 | obj_surface = dndi_ctx->frame_store[DNDI_FRAME_OUT_CURRENT].obj_surface; |
@@ -3413,9 +3413,9 @@ pp_nv12_dndi_initialize(VADriverContextP ctx, struct i965_post_processing_contex | ||
3413 | 3413 | orig_h = obj_surface->orig_height; |
3414 | 3414 | |
3415 | 3415 | i965_pp_set_surface_state(ctx, pp_context, obj_surface->bo, 0, |
3416 | - orig_w / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, 10, 1); | |
3416 | + ALIGN(orig_w, 4) / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, 10, 1); | |
3417 | 3417 | i965_pp_set_surface_state(ctx, pp_context, obj_surface->bo, w * h, |
3418 | - orig_w / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, 11, 1); | |
3418 | + ALIGN(orig_w, 4) / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, 11, 1); | |
3419 | 3419 | |
3420 | 3420 | /* STMM output surface (index = 20) */ |
3421 | 3421 | obj_surface = dndi_ctx->frame_store[DNDI_FRAME_OUT_STMM].obj_surface; |
@@ -3596,7 +3596,7 @@ pp_nv12_dn_initialize(VADriverContextP ctx, struct i965_post_processing_context | ||
3596 | 3596 | /* source UV surface index 2 */ |
3597 | 3597 | i965_pp_set_surface_state(ctx, pp_context, |
3598 | 3598 | obj_surface->bo, w * h, |
3599 | - orig_w / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, | |
3599 | + ALIGN(orig_w, 4) / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, | |
3600 | 3600 | 2, 0); |
3601 | 3601 | |
3602 | 3602 | /* source YUV surface index 4 */ |
@@ -3623,13 +3623,13 @@ pp_nv12_dn_initialize(VADriverContextP ctx, struct i965_post_processing_context | ||
3623 | 3623 | /* destination Y surface index 7 */ |
3624 | 3624 | i965_pp_set_surface_state(ctx, pp_context, |
3625 | 3625 | obj_surface->bo, 0, |
3626 | - orig_w / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, | |
3626 | + ALIGN(orig_w, 4) / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, | |
3627 | 3627 | 7, 1); |
3628 | 3628 | |
3629 | 3629 | /* destination UV surface index 8 */ |
3630 | 3630 | i965_pp_set_surface_state(ctx, pp_context, |
3631 | 3631 | obj_surface->bo, w * h, |
3632 | - orig_w / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, | |
3632 | + ALIGN(orig_w, 4) / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, | |
3633 | 3633 | 8, 1); |
3634 | 3634 | /* sampler dn */ |
3635 | 3635 | dri_bo_map(pp_context->sampler_state_table.bo, True); |
@@ -3807,9 +3807,9 @@ gen7_pp_nv12_dndi_initialize(VADriverContextP ctx, struct i965_post_processing_c | ||
3807 | 3807 | orig_h = obj_surface->orig_height; |
3808 | 3808 | |
3809 | 3809 | gen7_pp_set_surface_state(ctx, pp_context, obj_surface->bo, 0, |
3810 | - orig_w / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, 27, 1); | |
3810 | + ALIGN(orig_w, 4) / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, 27, 1); | |
3811 | 3811 | gen7_pp_set_surface_state(ctx, pp_context, obj_surface->bo, w * h, |
3812 | - orig_w / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, 28, 1); | |
3812 | + ALIGN(orig_w, 4) / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, 28, 1); | |
3813 | 3813 | |
3814 | 3814 | /* Current output surfaces (index = { 30, 31 }) */ |
3815 | 3815 | obj_surface = dndi_ctx->frame_store[DNDI_FRAME_OUT_CURRENT].obj_surface; |
@@ -3819,9 +3819,9 @@ gen7_pp_nv12_dndi_initialize(VADriverContextP ctx, struct i965_post_processing_c | ||
3819 | 3819 | orig_h = obj_surface->orig_height; |
3820 | 3820 | |
3821 | 3821 | gen7_pp_set_surface_state(ctx, pp_context, obj_surface->bo, 0, |
3822 | - orig_w / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, 30, 1); | |
3822 | + ALIGN(orig_w, 4) / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, 30, 1); | |
3823 | 3823 | gen7_pp_set_surface_state(ctx, pp_context, obj_surface->bo, w * h, |
3824 | - orig_w / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, 31, 1); | |
3824 | + ALIGN(orig_w, 4) / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, 31, 1); | |
3825 | 3825 | |
3826 | 3826 | /* STMM output surface (index = 33) */ |
3827 | 3827 | obj_surface = dndi_ctx->frame_store[DNDI_FRAME_OUT_STMM].obj_surface; |
@@ -4015,7 +4015,7 @@ gen7_pp_nv12_dn_initialize(VADriverContextP ctx, struct i965_post_processing_con | ||
4015 | 4015 | /* source UV surface index 1 */ |
4016 | 4016 | gen7_pp_set_surface_state(ctx, pp_context, |
4017 | 4017 | obj_surface->bo, w * h, |
4018 | - orig_w / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, | |
4018 | + ALIGN(orig_w, 4) / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, | |
4019 | 4019 | 1, 0); |
4020 | 4020 | |
4021 | 4021 | /* source YUV surface index 3 */ |
@@ -4050,13 +4050,13 @@ gen7_pp_nv12_dn_initialize(VADriverContextP ctx, struct i965_post_processing_con | ||
4050 | 4050 | /* destination Y surface index 24 */ |
4051 | 4051 | gen7_pp_set_surface_state(ctx, pp_context, |
4052 | 4052 | obj_surface->bo, 0, |
4053 | - orig_w / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, | |
4053 | + ALIGN(orig_w, 4) / 4, orig_h, w, I965_SURFACEFORMAT_R8_UNORM, | |
4054 | 4054 | 24, 1); |
4055 | 4055 | |
4056 | 4056 | /* destination UV surface index 25 */ |
4057 | 4057 | gen7_pp_set_surface_state(ctx, pp_context, |
4058 | 4058 | obj_surface->bo, w * h, |
4059 | - orig_w / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, | |
4059 | + ALIGN(orig_w, 4) / 4, orig_h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM, | |
4060 | 4060 | 25, 1); |
4061 | 4061 | |
4062 | 4062 | /* sampler dn */ |