hardware/intel/intel-driver
Revisión | e3019df98cc40d46579eec3599ce94aabec72292 (tree) |
---|---|
Tiempo | 2014-12-14 01:42:17 |
Autor | Xiang, Haihao <haihao.xiang@inte...> |
Commiter | Xiang, Haihao |
HEVC: gen9_hcpd_pipe_buf_addr_state()
Set memory base address for all internal buffers and output buffer
in HCP_PIPE_BUF_ADDR_STATE
v2: Fix the command length and payload
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 44a175a30e4e4d21781d90bad1138eeff3797ce0)
@@ -40,6 +40,26 @@ | ||
40 | 40 | #include "gen9_mfd.h" |
41 | 41 | #include "intel_media.h" |
42 | 42 | |
43 | +#define OUT_BUFFER(buf_bo, is_target, ma) do { \ | |
44 | + if (buf_bo) { \ | |
45 | + OUT_BCS_RELOC(batch, \ | |
46 | + buf_bo, \ | |
47 | + I915_GEM_DOMAIN_RENDER, \ | |
48 | + is_target ? I915_GEM_DOMAIN_RENDER : 0, \ | |
49 | + 0); \ | |
50 | + } else { \ | |
51 | + OUT_BCS_BATCH(batch, 0); \ | |
52 | + } \ | |
53 | + OUT_BCS_BATCH(batch, 0); \ | |
54 | + if (ma) \ | |
55 | + OUT_BCS_BATCH(batch, 0); \ | |
56 | + } while (0) | |
57 | + | |
58 | +#define OUT_BUFFER_MA_TARGET(buf_bo) OUT_BUFFER(buf_bo, 1, 1) | |
59 | +#define OUT_BUFFER_MA_REFERENCE(buf_bo) OUT_BUFFER(buf_bo, 0, 1) | |
60 | +#define OUT_BUFFER_NMA_TARGET(buf_bo) OUT_BUFFER(buf_bo, 1, 0) | |
61 | +#define OUT_BUFFER_NMA_REFERENCE(buf_bo) OUT_BUFFER(buf_bo, 0, 0) | |
62 | + | |
43 | 63 | static void |
44 | 64 | gen9_hcpd_init_hevc_surface(VADriverContextP ctx, |
45 | 65 | VAPictureParameterBufferHEVC *pic_param, |
@@ -222,6 +242,75 @@ gen9_hcpd_surface_state(VADriverContextP ctx, | ||
222 | 242 | ADVANCE_BCS_BATCH(batch); |
223 | 243 | } |
224 | 244 | |
245 | +static void | |
246 | +gen9_hcpd_pipe_buf_addr_state(VADriverContextP ctx, | |
247 | + struct decode_state *decode_state, | |
248 | + struct gen9_hcpd_context *gen9_hcpd_context) | |
249 | +{ | |
250 | + struct intel_batchbuffer *batch = gen9_hcpd_context->base.batch; | |
251 | + struct object_surface *obj_surface; | |
252 | + GenHevcSurface *gen9_hevc_surface; | |
253 | + int i; | |
254 | + | |
255 | + BEGIN_BCS_BATCH(batch, 95); | |
256 | + | |
257 | + OUT_BCS_BATCH(batch, HCP_PIPE_BUF_ADDR_STATE | (95 - 2)); | |
258 | + | |
259 | + obj_surface = decode_state->render_object; | |
260 | + assert(obj_surface && obj_surface->bo); | |
261 | + gen9_hevc_surface = obj_surface->private_data; | |
262 | + assert(gen9_hevc_surface && gen9_hevc_surface->motion_vector_temporal_bo); | |
263 | + | |
264 | + OUT_BUFFER_MA_TARGET(obj_surface->bo); /* DW 1..3 */ | |
265 | + OUT_BUFFER_MA_TARGET(gen9_hcpd_context->deblocking_filter_line_buffer.bo);/* DW 4..6 */ | |
266 | + OUT_BUFFER_MA_TARGET(gen9_hcpd_context->deblocking_filter_tile_line_buffer.bo); /* DW 7..9 */ | |
267 | + OUT_BUFFER_MA_TARGET(gen9_hcpd_context->deblocking_filter_tile_column_buffer.bo); /* DW 10..12 */ | |
268 | + OUT_BUFFER_MA_TARGET(gen9_hcpd_context->metadata_line_buffer.bo); /* DW 13..15 */ | |
269 | + OUT_BUFFER_MA_TARGET(gen9_hcpd_context->metadata_tile_line_buffer.bo); /* DW 16..18 */ | |
270 | + OUT_BUFFER_MA_TARGET(gen9_hcpd_context->metadata_tile_column_buffer.bo); /* DW 19..21 */ | |
271 | + OUT_BUFFER_MA_TARGET(gen9_hcpd_context->sao_line_buffer.bo); /* DW 22..24 */ | |
272 | + OUT_BUFFER_MA_TARGET(gen9_hcpd_context->sao_tile_line_buffer.bo); /* DW 25..27 */ | |
273 | + OUT_BUFFER_MA_TARGET(gen9_hcpd_context->sao_tile_column_buffer.bo); /* DW 28..30 */ | |
274 | + OUT_BUFFER_MA_TARGET(gen9_hevc_surface->motion_vector_temporal_bo); /* DW 31..33 */ | |
275 | + OUT_BUFFER_MA_TARGET(NULL); /* DW 34..36, reserved */ | |
276 | + | |
277 | + for (i = 0; i < ARRAY_ELEMS(gen9_hcpd_context->reference_surfaces); i++) { | |
278 | + obj_surface = gen9_hcpd_context->reference_surfaces[i].obj_surface; | |
279 | + | |
280 | + if (obj_surface) | |
281 | + OUT_BUFFER_NMA_REFERENCE(obj_surface->bo); | |
282 | + else | |
283 | + OUT_BUFFER_NMA_REFERENCE(NULL); | |
284 | + } | |
285 | + OUT_BCS_BATCH(batch, 0); /* DW 53, memory address attributes */ | |
286 | + | |
287 | + OUT_BUFFER_MA_REFERENCE(NULL); /* DW 54..56, ignore for decoding mode */ | |
288 | + OUT_BUFFER_MA_TARGET(NULL); | |
289 | + OUT_BUFFER_MA_TARGET(NULL); | |
290 | + OUT_BUFFER_MA_TARGET(NULL); | |
291 | + | |
292 | + for (i = 0; i < ARRAY_ELEMS(gen9_hcpd_context->reference_surfaces); i++) { | |
293 | + obj_surface = gen9_hcpd_context->reference_surfaces[i].obj_surface; | |
294 | + gen9_hevc_surface = NULL; | |
295 | + | |
296 | + if (obj_surface && obj_surface->private_data) | |
297 | + gen9_hevc_surface = obj_surface->private_data; | |
298 | + | |
299 | + if (gen9_hevc_surface) | |
300 | + OUT_BUFFER_NMA_REFERENCE(gen9_hevc_surface->motion_vector_temporal_bo); | |
301 | + else | |
302 | + OUT_BUFFER_NMA_REFERENCE(NULL); | |
303 | + } | |
304 | + OUT_BCS_BATCH(batch, 0); /* DW 82, memory address attributes */ | |
305 | + | |
306 | + OUT_BUFFER_MA_TARGET(NULL); /* DW 83..85, ignore for HEVC */ | |
307 | + OUT_BUFFER_MA_TARGET(NULL); /* DW 86..88, ignore for HEVC */ | |
308 | + OUT_BUFFER_MA_TARGET(NULL); /* DW 89..91, ignore for HEVC */ | |
309 | + OUT_BUFFER_MA_TARGET(NULL); /* DW 92..94, ignore for HEVC */ | |
310 | + | |
311 | + ADVANCE_BCS_BATCH(batch); | |
312 | +} | |
313 | + | |
225 | 314 | static VAStatus |
226 | 315 | gen9_hcpd_hevc_decode_picture(VADriverContextP ctx, |
227 | 316 | struct decode_state *decode_state, |
@@ -240,6 +329,7 @@ gen9_hcpd_hevc_decode_picture(VADriverContextP ctx, | ||
240 | 329 | |
241 | 330 | gen9_hcpd_pipe_mode_select(ctx, decode_state, HCP_CODEC_HEVC, gen9_hcpd_context); |
242 | 331 | gen9_hcpd_surface_state(ctx, decode_state, gen9_hcpd_context); |
332 | + gen9_hcpd_pipe_buf_addr_state(ctx, decode_state, gen9_hcpd_context); | |
243 | 333 | |
244 | 334 | intel_batchbuffer_end_atomic(batch); |
245 | 335 | intel_batchbuffer_flush(batch); |