diff options
Diffstat (limited to 'src/gen7_mfd.c')
-rwxr-xr-x | src/gen7_mfd.c | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c index 9cf44027..57a26b8e 100755 --- a/src/gen7_mfd.c +++ b/src/gen7_mfd.c @@ -51,7 +51,7 @@ static const uint32_t zigzag_direct[64] = { }; static void -gen7_mfd_init_avc_surface(VADriverContextP ctx, +gen7_mfd_init_avc_surface(VADriverContextP ctx, VAPictureParameterBufferH264 *pic_param, struct object_surface *obj_surface) { @@ -122,7 +122,7 @@ gen7_mfd_pipe_mode_select(VADriverContextP ctx, (0 << 2) | /* terminate if AVC CABAC/CAVLC decode error occurs */ (0 << 1) | (0 << 0)); - OUT_BCS_BATCH(batch, 0); /* pic status/error report id */ + OUT_BCS_BATCH(batch, 0); /* pic status/error report id */ OUT_BCS_BATCH(batch, 0); /* reserved */ ADVANCE_BCS_BATCH(batch); } @@ -145,7 +145,7 @@ gen7_mfd_surface_state(VADriverContextP ctx, y_cr_offset = obj_surface->y_cr_offset; surface_format = obj_surface->fourcc == VA_FOURCC_Y800 ? - MFX_SURFACE_MONOCHROME : MFX_SURFACE_PLANAR_420_8; + MFX_SURFACE_MONOCHROME : MFX_SURFACE_PLANAR_420_8; BEGIN_BCS_BATCH(batch, 6); OUT_BCS_BATCH(batch, MFX_SURFACE_STATE | (6 - 2)); @@ -358,12 +358,12 @@ gen7_mfd_avc_img_state(VADriverContextP ctx, BEGIN_BCS_BATCH(batch, 16); OUT_BCS_BATCH(batch, MFX_AVC_IMG_STATE | (16 - 2)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (width_in_mbs * height_in_mbs - 1)); - OUT_BCS_BATCH(batch, - ((height_in_mbs - 1) << 16) | + OUT_BCS_BATCH(batch, + ((height_in_mbs - 1) << 16) | ((width_in_mbs - 1) << 0)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, ((pic_param->second_chroma_qp_index_offset & 0x1f) << 24) | ((pic_param->chroma_qp_index_offset & 0x1f) << 16) | (0 << 14) | /* Max-bit conformance Intra flag ??? FIXME */ @@ -487,8 +487,8 @@ gen7_mfd_avc_directmode_state(VADriverContextP ctx, if (obj_surface) { const VAPictureH264 * const va_pic = avc_find_picture( - obj_surface->base.id, pic_param->ReferenceFrames, - ARRAY_ELEMS(pic_param->ReferenceFrames)); + obj_surface->base.id, pic_param->ReferenceFrames, + ARRAY_ELEMS(pic_param->ReferenceFrames)); assert(va_pic != NULL); OUT_BCS_BATCH(batch, va_pic->TopFieldOrderCnt); @@ -538,7 +538,7 @@ gen7_mfd_avc_slice_state(VADriverContextP ctx, } else if (slice_param->slice_type == SLICE_TYPE_P || slice_param->slice_type == SLICE_TYPE_SP) { slice_type = SLICE_TYPE_P; - } else { + } else { assert(slice_param->slice_type == SLICE_TYPE_B); slice_type = SLICE_TYPE_B; } @@ -558,7 +558,7 @@ gen7_mfd_avc_slice_state(VADriverContextP ctx, } first_mb_in_slice = slice_param->first_mb_in_slice; - slice_hor_pos = first_mb_in_slice % width_in_mbs; + slice_hor_pos = first_mb_in_slice % width_in_mbs; slice_ver_pos = first_mb_in_slice / width_in_mbs; if (mbaff_picture) @@ -566,7 +566,7 @@ gen7_mfd_avc_slice_state(VADriverContextP ctx, if (next_slice_param) { first_mb_in_next_slice = next_slice_param->first_mb_in_slice; - next_slice_hor_pos = first_mb_in_next_slice % width_in_mbs; + next_slice_hor_pos = first_mb_in_next_slice % width_in_mbs; next_slice_ver_pos = first_mb_in_next_slice / width_in_mbs; if (mbaff_picture) @@ -579,26 +579,26 @@ gen7_mfd_avc_slice_state(VADriverContextP ctx, BEGIN_BCS_BATCH(batch, 11); /* FIXME: is it 10??? */ OUT_BCS_BATCH(batch, MFX_AVC_SLICE_STATE | (11 - 2)); OUT_BCS_BATCH(batch, slice_type); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (num_ref_idx_l1 << 24) | (num_ref_idx_l0 << 16) | (slice_param->chroma_log2_weight_denom << 8) | (slice_param->luma_log2_weight_denom << 0)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (slice_param->direct_spatial_mv_pred_flag << 29) | (slice_param->disable_deblocking_filter_idc << 27) | (slice_param->cabac_init_idc << 24) | ((pic_param->pic_init_qp_minus26 + 26 + slice_param->slice_qp_delta) << 16) | ((slice_param->slice_beta_offset_div2 & 0xf) << 8) | ((slice_param->slice_alpha_c0_offset_div2 & 0xf) << 0)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (slice_ver_pos << 24) | - (slice_hor_pos << 16) | + (slice_hor_pos << 16) | (first_mb_in_slice << 0)); OUT_BCS_BATCH(batch, (next_slice_ver_pos << 16) | (next_slice_hor_pos << 0)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (next_slice_param == NULL) << 19); /* last slice flag */ OUT_BCS_BATCH(batch, 0); OUT_BCS_BATCH(batch, 0); @@ -635,7 +635,7 @@ gen7_mfd_avc_weightoffset_state(VADriverContextP ctx, (pic_param->pic_fields.bits.weighted_pred_flag == 1)) { num_weight_offset_table = 1; } - + if ((slice_param->slice_type == SLICE_TYPE_B) && (pic_param->pic_fields.bits.weighted_bipred_idc == 1)) { num_weight_offset_table = 2; @@ -683,15 +683,15 @@ gen7_mfd_avc_bsd_object(VADriverContextP ctx, unsigned int slice_data_bit_offset; slice_data_bit_offset = avc_get_first_mb_bit_offset( - slice_data_bo, - slice_param, - pic_param->pic_fields.bits.entropy_coding_mode_flag - ); + slice_data_bo, + slice_param, + pic_param->pic_fields.bits.entropy_coding_mode_flag + ); /* the input bitsteam format on GEN7 differs from GEN6 */ BEGIN_BCS_BATCH(batch, 6); OUT_BCS_BATCH(batch, MFD_AVC_BSD_OBJECT | (6 - 2)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (slice_param->slice_data_size - slice_param->slice_data_offset)); OUT_BCS_BATCH(batch, slice_param->slice_data_offset); OUT_BCS_BATCH(batch, @@ -758,7 +758,7 @@ gen7_mfd_avc_decode_init(VADriverContextP ctx, assert(decode_state->pic_param && decode_state->pic_param->buffer); pic_param = (VAPictureParameterBufferH264 *)decode_state->pic_param->buffer; intel_update_avc_frame_store_index(ctx, decode_state, pic_param, - gen7_mfd_context->reference_surface, &gen7_mfd_context->fs_ctx); + gen7_mfd_context->reference_surface, &gen7_mfd_context->fs_ctx); width_in_mbs = pic_param->picture_width_in_mbs_minus1 + 1; height_in_mbs = pic_param->picture_height_in_mbs_minus1 + 1; assert(width_in_mbs > 0 && width_in_mbs <= 256); /* 4K */ @@ -859,7 +859,7 @@ gen7_mfd_avc_decode_picture(VADriverContextP ctx, next_slice_group_param = (VASliceParameterBufferH264 *)decode_state->slice_params[j + 1]->buffer; if (j == 0 && slice_param->first_mb_in_slice) - gen7_mfd_avc_phantom_slice_first(ctx, pic_param, slice_param, gen7_mfd_context); + gen7_mfd_avc_phantom_slice_first(ctx, pic_param, slice_param, gen7_mfd_context); for (i = 0; i < decode_state->slice_params[j]->num_elements; i++) { assert(slice_param->slice_data_flag == VA_SLICE_DATA_FLAG_ALL); @@ -965,7 +965,7 @@ gen7_mfd_mpeg2_pic_state(VADriverContextP ctx, pic_param->picture_coding_extension.bits.frame_pred_frame_dct << 10 | pic_param->picture_coding_extension.bits.concealment_motion_vectors << 9 | pic_param->picture_coding_extension.bits.q_scale_type << 8 | - pic_param->picture_coding_extension.bits.intra_vlc_format << 7 | + pic_param->picture_coding_extension.bits.intra_vlc_format << 7 | pic_param->picture_coding_extension.bits.alternate_scan << 6); OUT_BCS_BATCH(batch, pic_param->picture_coding_type << 9); @@ -1056,22 +1056,22 @@ uint32_t mpeg2_get_slice_data_length(dri_bo *slice_data_bo, VASliceParameterBuff buf = (uint8_t *)slice_data_bo->virtual + buf_offset; if (buf_size < 4) - return buf_size; + return buf_size; while (i <= (buf_size - 4)) { - if (buf[i + 2] > 1) { - i += 3; - } else if (buf[i + 1]) { - i += 2; - } else if (buf[i] || buf[i + 2] != 1) { - i++; - } else { - break; - } + if (buf[i + 2] > 1) { + i += 3; + } else if (buf[i + 1]) { + i += 2; + } else if (buf[i] || buf[i + 2] != 1) { + i++; + } else { + break; + } } if (i <= (buf_size - 4)) - buf_size = i; + buf_size = i; dri_bo_unmap(slice_data_bo); return buf_size; @@ -1094,7 +1094,7 @@ gen7_mfd_mpeg2_bsd_object(VADriverContextP ctx, pic_param->picture_coding_extension.bits.picture_structure == MPEG_BOTTOM_FIELD) is_field_pic = 1; is_field_pic_wa = is_field_pic && - gen7_mfd_context->wa_mpeg2_slice_vertical_position > 0; + gen7_mfd_context->wa_mpeg2_slice_vertical_position > 0; vpos0 = slice_param->slice_vertical_position / (1 + is_field_pic_wa); hpos0 = slice_param->slice_horizontal_position; @@ -1111,9 +1111,9 @@ gen7_mfd_mpeg2_bsd_object(VADriverContextP ctx, BEGIN_BCS_BATCH(batch, 5); OUT_BCS_BATCH(batch, MFD_MPEG2_BSD_OBJECT | (5 - 2)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, mpeg2_get_slice_data_length(slice_data_bo, slice_param)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, slice_param->slice_data_offset + (slice_param->macroblock_offset >> 3)); OUT_BCS_BATCH(batch, hpos0 << 24 | @@ -1203,7 +1203,7 @@ static const int b_picture_scale_factor[21] = { 128, 85, 170, 64, 192, 51, 102, 153, 204, 43, 215, 37, 74, 111, 148, - 185, 222, 32, 96, 160, + 185, 222, 32, 96, 160, 224, }; @@ -1220,7 +1220,7 @@ static const int va_to_gen7_vc1_profile[4] = { GEN7_VC1_ADVANCED_PROFILE }; -static void +static void gen7_mfd_free_vc1_surface(void **data) { struct gen7_vc1_surface *gen7_vc1_surface = *data; @@ -1234,7 +1234,7 @@ gen7_mfd_free_vc1_surface(void **data) } static void -gen7_mfd_init_vc1_surface(VADriverContextP ctx, +gen7_mfd_init_vc1_surface(VADriverContextP ctx, VAPictureParameterBufferVC1 *pic_param, struct object_surface *obj_surface) { @@ -1273,12 +1273,12 @@ gen7_mfd_vc1_decode_init(VADriverContextP ctx, dri_bo *bo; int width_in_mbs; int picture_type; - + assert(decode_state->pic_param && decode_state->pic_param->buffer); pic_param = (VAPictureParameterBufferVC1 *)decode_state->pic_param->buffer; width_in_mbs = ALIGN(pic_param->coded_width, 16) / 16; picture_type = pic_param->picture_fields.bits.picture_type; - + intel_update_vc1_frame_store_index(ctx, decode_state, pic_param, @@ -1330,7 +1330,7 @@ gen7_mfd_vc1_decode_init(VADriverContextP ctx, gen7_mfd_context->bitplane_read_buffer.valid = !!pic_param->bitplane_present.value; dri_bo_unreference(gen7_mfd_context->bitplane_read_buffer.bo); - + if (gen7_mfd_context->bitplane_read_buffer.valid) { int width_in_mbs = ALIGN(pic_param->coded_width, 16) / 16; int height_in_mbs = ALIGN(pic_param->coded_height, 16) / 16; @@ -1353,7 +1353,7 @@ gen7_mfd_vc1_decode_init(VADriverContextP ctx, dst = bo->virtual; for (src_h = 0; src_h < height_in_mbs; src_h++) { - for(src_w = 0; src_w < width_in_mbs; src_w++) { + for (src_w = 0; src_w < width_in_mbs; src_w++) { int src_index, dst_index; int src_shift; uint8_t src_value; @@ -1362,7 +1362,7 @@ gen7_mfd_vc1_decode_init(VADriverContextP ctx, src_shift = !((src_h * width_in_mbs + src_w) & 1) * 4; src_value = ((src[src_index] >> src_shift) & 0xf); - if (picture_type == GEN7_VC1_SKIPPED_PICTURE){ + if (picture_type == GEN7_VC1_SKIPPED_PICTURE) { src_value |= 0x2; } @@ -1442,7 +1442,7 @@ gen7_mfd_vc1_pic_state(VADriverContextP ctx, alt_pquant_edge_mask = 0; } break; - + case 0: alt_pquant_edge_mask = 0xf; break; @@ -1484,8 +1484,8 @@ gen7_mfd_vc1_pic_state(VADriverContextP ctx, scale_factor = b_picture_scale_factor[pic_param->b_picture_fraction]; picture_type = va_to_gen7_vc1_pic_type[pic_param->picture_fields.bits.picture_type]; - - if (profile == GEN7_VC1_ADVANCED_PROFILE && + + if (profile == GEN7_VC1_ADVANCED_PROFILE && picture_type == GEN7_VC1_I_PICTURE) picture_type = GEN7_VC1_BI_PICTURE; @@ -1514,7 +1514,7 @@ gen7_mfd_vc1_pic_state(VADriverContextP ctx, if (obj_surface) gen7_vc1_surface = obj_surface->private_data; - if (!gen7_vc1_surface || + if (!gen7_vc1_surface || (va_to_gen7_vc1_pic_type[gen7_vc1_surface->picture_type] == GEN7_VC1_I_PICTURE || va_to_gen7_vc1_pic_type[gen7_vc1_surface->picture_type] == GEN7_VC1_BI_PICTURE)) dmv_surface_valid = 0; @@ -1551,14 +1551,14 @@ gen7_mfd_vc1_pic_state(VADriverContextP ctx, pic_param->picture_fields.bits.picture_type != GEN7_VC1_B_PICTURE) { overlap = 1; } - }else { + } else { if (pic_param->picture_fields.bits.picture_type == GEN7_VC1_P_PICTURE && - pic_param->pic_quantizer_fields.bits.pic_quantizer_scale >= 9){ + pic_param->pic_quantizer_fields.bits.pic_quantizer_scale >= 9) { overlap = 1; } if (pic_param->picture_fields.bits.picture_type == GEN7_VC1_I_PICTURE || - pic_param->picture_fields.bits.picture_type == GEN7_VC1_BI_PICTURE){ - if (pic_param->pic_quantizer_fields.bits.pic_quantizer_scale >= 9){ + pic_param->picture_fields.bits.picture_type == GEN7_VC1_BI_PICTURE) { + if (pic_param->pic_quantizer_fields.bits.pic_quantizer_scale >= 9) { overlap = 1; } else if (va_to_gen7_vc1_condover[pic_param->conditional_overlap_flag] == 2 || va_to_gen7_vc1_condover[pic_param->conditional_overlap_flag] == 3) { @@ -1566,7 +1566,7 @@ gen7_mfd_vc1_pic_state(VADriverContextP ctx, } } } - } + } assert(pic_param->conditional_overlap_flag < 3); assert(pic_param->mv_fields.bits.mv_table < 4); /* FIXME: interlace mode */ @@ -1619,7 +1619,7 @@ gen7_mfd_vc1_pic_state(VADriverContextP ctx, pic_param->mv_fields.bits.extended_mv_range << 8 | alt_pquant_edge_mask << 4 | alt_pquant_config << 2 | - pic_param->pic_quantizer_fields.bits.half_qp << 1 | + pic_param->pic_quantizer_fields.bits.half_qp << 1 | pic_param->pic_quantizer_fields.bits.pic_quantizer_type << 0); OUT_BCS_BATCH(batch, !!pic_param->bitplane_present.value << 31 | @@ -1633,7 +1633,7 @@ gen7_mfd_vc1_pic_state(VADriverContextP ctx, pic_param->mv_fields.bits.mv_table << 20 | pic_param->mv_fields.bits.four_mv_block_pattern_table << 18 | pic_param->mv_fields.bits.two_mv_block_pattern_table << 16 | - pic_param->transform_fields.bits.frame_level_transform_type << 12 | + pic_param->transform_fields.bits.frame_level_transform_type << 12 | pic_param->transform_fields.bits.mb_level_transform_type_flag << 11 | pic_param->mb_mode_table << 8 | trans_ac_y << 6 | @@ -1712,7 +1712,7 @@ gen7_mfd_vc1_directmode_state(VADriverContextP ctx, 0); else OUT_BCS_BATCH(batch, 0); - + ADVANCE_BCS_BATCH(batch); } @@ -1753,7 +1753,7 @@ gen7_mfd_vc1_bsd_object(VADriverContextP ctx, dri_bo_map(slice_data_bo, 0); slice_data = (uint8_t *)(slice_data_bo->virtual + slice_param->slice_data_offset); - macroblock_offset = gen7_mfd_vc1_get_macroblock_bit_offset(slice_data, + macroblock_offset = gen7_mfd_vc1_get_macroblock_bit_offset(slice_data, slice_param->macroblock_offset, pic_param->sequence_fields.bits.profile); dri_bo_unmap(slice_data_bo); @@ -1765,9 +1765,9 @@ gen7_mfd_vc1_bsd_object(VADriverContextP ctx, BEGIN_BCS_BATCH(batch, 5); OUT_BCS_BATCH(batch, MFD_VC1_BSD_OBJECT | (5 - 2)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, slice_param->slice_data_size - (macroblock_offset >> 3)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, slice_param->slice_data_offset + (macroblock_offset >> 3)); OUT_BCS_BATCH(batch, slice_param->slice_vertical_position << 16 | @@ -2112,9 +2112,9 @@ gen7_mfd_jpeg_bsd_object(VADriverContextP ctx, BEGIN_BCS_BATCH(batch, 6); OUT_BCS_BATCH(batch, MFD_JPEG_BSD_OBJECT | (6 - 2)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, slice_param->slice_data_size); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, slice_param->slice_data_offset); OUT_BCS_BATCH(batch, slice_param->slice_horizontal_position << 16 | @@ -2211,7 +2211,7 @@ gen7_jpeg_wa_pipe_mode_select(VADriverContextP ctx, (0 << 2) | /* terminate if AVC CABAC/CAVLC decode error occurs */ (0 << 1) | (0 << 0)); - OUT_BCS_BATCH(batch, 0); /* pic status/error report id */ + OUT_BCS_BATCH(batch, 0); /* pic status/error report id */ OUT_BCS_BATCH(batch, 0); /* reserved */ ADVANCE_BCS_BATCH(batch); } @@ -2267,7 +2267,7 @@ gen7_jpeg_wa_pipe_buf_addr_state(VADriverContextP ctx, obj_surface->bo, I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, 0); - + OUT_BCS_BATCH(batch, 0); /* post deblocking */ OUT_BCS_BATCH(batch, 0); /* ignore for decoding */ @@ -2347,12 +2347,12 @@ gen7_jpeg_wa_avc_img_state(VADriverContextP ctx, BEGIN_BCS_BATCH(batch, 16); OUT_BCS_BATCH(batch, MFX_AVC_IMG_STATE | (16 - 2)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (width_in_mbs * height_in_mbs - 1)); - OUT_BCS_BATCH(batch, - ((height_in_mbs - 1) << 16) | + OUT_BCS_BATCH(batch, + ((height_in_mbs - 1) << 16) | ((width_in_mbs - 1) << 0)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (0 << 24) | (0 << 16) | (0 << 14) | @@ -2480,21 +2480,21 @@ gen7_jpeg_wa_avc_slice_state(VADriverContextP ctx, BEGIN_BCS_BATCH(batch, 11); OUT_BCS_BATCH(batch, MFX_AVC_SLICE_STATE | (11 - 2)); OUT_BCS_BATCH(batch, slice_type); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (num_ref_idx_l1 << 24) | (num_ref_idx_l0 << 16) | (0 << 8) | (0 << 0)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (0 << 29) | (1 << 27) | /* disable Deblocking */ (0 << 24) | (gen7_jpeg_wa_clip.qp << 16) | (0 << 8) | (0 << 0)); - OUT_BCS_BATCH(batch, + OUT_BCS_BATCH(batch, (slice_ver_pos << 24) | - (slice_hor_pos << 16) | + (slice_hor_pos << 16) | (first_mb_in_slice << 0)); OUT_BCS_BATCH(batch, (next_slice_ver_pos << 16) | @@ -2617,8 +2617,8 @@ gen7_mfd_jpeg_decode_picture(VADriverContextP ctx, } static VAStatus -gen7_mfd_decode_picture(VADriverContextP ctx, - VAProfile profile, +gen7_mfd_decode_picture(VADriverContextP ctx, + VAProfile profile, union codec_state *codec_state, struct hw_context *hw_context) @@ -2641,7 +2641,7 @@ gen7_mfd_decode_picture(VADriverContextP ctx, case VAProfileMPEG2Main: gen7_mfd_mpeg2_decode_picture(ctx, decode_state, gen7_mfd_context); break; - + case VAProfileH264ConstrainedBaseline: case VAProfileH264Main: case VAProfileH264High: @@ -2713,7 +2713,7 @@ gen7_mfd_context_destroy(void *hw_context) } static void gen7_mfd_mpeg2_context_init(VADriverContextP ctx, - struct gen7_mfd_context *gen7_mfd_context) + struct gen7_mfd_context *gen7_mfd_context) { gen7_mfd_context->iq_matrix.mpeg2.load_intra_quantiser_matrix = -1; gen7_mfd_context->iq_matrix.mpeg2.load_non_intra_quantiser_matrix = -1; |