hardware/intel/intel-driver
Revisión | 228bc307097e6b13e3d14453d9679c5a8a06ffeb (tree) |
---|---|
Tiempo | 2014-11-19 22:13:06 |
Autor | Sirisha Muppavarapu <sirisha.muppavarapu@inte...> |
Commiter | Xiang, Haihao |
JPEG Encode: Bypass VME for JPEG Encode
(cherry picked from commit 2910b0ca5357d871d1d8d60b05aeab24218eb2e9)
@@ -1155,7 +1155,7 @@ gen8_vme_context_destroy(void *context) | ||
1155 | 1155 | |
1156 | 1156 | Bool gen8_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context) |
1157 | 1157 | { |
1158 | - struct gen6_vme_context *vme_context = calloc(1, sizeof(struct gen6_vme_context)); | |
1158 | + struct gen6_vme_context *vme_context = NULL; | |
1159 | 1159 | struct i965_kernel *vme_kernel_list = NULL; |
1160 | 1160 | int i965_kernel_num; |
1161 | 1161 |
@@ -1171,7 +1171,13 @@ Bool gen8_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *e | ||
1171 | 1171 | vme_kernel_list = gen8_vme_mpeg2_kernels; |
1172 | 1172 | encoder_context->vme_pipeline = gen8_vme_mpeg2_pipeline; |
1173 | 1173 | i965_kernel_num = sizeof(gen8_vme_mpeg2_kernels) / sizeof(struct i965_kernel); |
1174 | + break; | |
1174 | 1175 | |
1176 | + case CODEC_JPEG: | |
1177 | + //JPEG encode doesnt have vme. So, set the corresponding fields to NULL. | |
1178 | + encoder_context->vme_context = NULL; | |
1179 | + encoder_context->vme_pipeline = NULL; | |
1180 | + encoder_context->vme_context_destroy = NULL; | |
1175 | 1181 | break; |
1176 | 1182 | |
1177 | 1183 | default: |
@@ -1180,35 +1186,40 @@ Bool gen8_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *e | ||
1180 | 1186 | |
1181 | 1187 | break; |
1182 | 1188 | } |
1183 | - vme_context->vme_kernel_sum = i965_kernel_num; | |
1184 | - vme_context->gpe_context.surface_state_binding_table.length = (SURFACE_STATE_PADDED_SIZE + sizeof(unsigned int)) * MAX_MEDIA_SURFACES_GEN6; | |
1185 | 1189 | |
1186 | - vme_context->gpe_context.idrt_size = sizeof(struct gen8_interface_descriptor_data) * MAX_INTERFACE_DESC_GEN6; | |
1187 | - vme_context->gpe_context.curbe_size = CURBE_TOTAL_DATA_LENGTH; | |
1188 | - vme_context->gpe_context.sampler_size = 0; | |
1190 | + //If the codec is JPEG, bypass VME | |
1191 | + if(encoder_context->codec != CODEC_JPEG) { | |
1192 | + vme_context = calloc(1, sizeof(struct gen6_vme_context)); | |
1193 | + vme_context->vme_kernel_sum = i965_kernel_num; | |
1194 | + vme_context->gpe_context.surface_state_binding_table.length = (SURFACE_STATE_PADDED_SIZE + sizeof(unsigned int)) * MAX_MEDIA_SURFACES_GEN6; | |
1195 | + | |
1196 | + vme_context->gpe_context.idrt_size = sizeof(struct gen8_interface_descriptor_data) * MAX_INTERFACE_DESC_GEN6; | |
1197 | + vme_context->gpe_context.curbe_size = CURBE_TOTAL_DATA_LENGTH; | |
1198 | + vme_context->gpe_context.sampler_size = 0; | |
1189 | 1199 | |
1190 | 1200 | |
1191 | - vme_context->gpe_context.vfe_state.max_num_threads = 60 - 1; | |
1192 | - vme_context->gpe_context.vfe_state.num_urb_entries = 64; | |
1193 | - vme_context->gpe_context.vfe_state.gpgpu_mode = 0; | |
1194 | - vme_context->gpe_context.vfe_state.urb_entry_size = 16; | |
1195 | - vme_context->gpe_context.vfe_state.curbe_allocation_size = CURBE_ALLOCATION_SIZE - 1; | |
1201 | + vme_context->gpe_context.vfe_state.max_num_threads = 60 - 1; | |
1202 | + vme_context->gpe_context.vfe_state.num_urb_entries = 64; | |
1203 | + vme_context->gpe_context.vfe_state.gpgpu_mode = 0; | |
1204 | + vme_context->gpe_context.vfe_state.urb_entry_size = 16; | |
1205 | + vme_context->gpe_context.vfe_state.curbe_allocation_size = CURBE_ALLOCATION_SIZE - 1; | |
1196 | 1206 | |
1197 | - gen7_vme_scoreboard_init(ctx, vme_context); | |
1207 | + gen7_vme_scoreboard_init(ctx, vme_context); | |
1198 | 1208 | |
1199 | - gen8_gpe_load_kernels(ctx, | |
1209 | + gen8_gpe_load_kernels(ctx, | |
1200 | 1210 | &vme_context->gpe_context, |
1201 | 1211 | vme_kernel_list, |
1202 | 1212 | i965_kernel_num); |
1203 | - vme_context->vme_surface2_setup = gen8_gpe_surface2_setup; | |
1204 | - vme_context->vme_media_rw_surface_setup = gen8_gpe_media_rw_surface_setup; | |
1205 | - vme_context->vme_buffer_suface_setup = gen8_gpe_buffer_suface_setup; | |
1206 | - vme_context->vme_media_chroma_surface_setup = gen8_gpe_media_chroma_surface_setup; | |
1213 | + vme_context->vme_surface2_setup = gen8_gpe_surface2_setup; | |
1214 | + vme_context->vme_media_rw_surface_setup = gen8_gpe_media_rw_surface_setup; | |
1215 | + vme_context->vme_buffer_suface_setup = gen8_gpe_buffer_suface_setup; | |
1216 | + vme_context->vme_media_chroma_surface_setup = gen8_gpe_media_chroma_surface_setup; | |
1207 | 1217 | |
1208 | - encoder_context->vme_context = vme_context; | |
1209 | - encoder_context->vme_context_destroy = gen8_vme_context_destroy; | |
1218 | + encoder_context->vme_context = vme_context; | |
1219 | + encoder_context->vme_context_destroy = gen8_vme_context_destroy; | |
1210 | 1220 | |
1211 | - vme_context->vme_state_message = malloc(VME_MSG_LENGTH * sizeof(int)); | |
1221 | + vme_context->vme_state_message = malloc(VME_MSG_LENGTH * sizeof(int)); | |
1222 | + } | |
1212 | 1223 | |
1213 | 1224 | return True; |
1214 | 1225 | } |