diff options
-rw-r--r-- | src/gen8_render.c | 71 | ||||
-rw-r--r-- | src/i965_device_info.c | 14 | ||||
-rw-r--r-- | src/i965_drv_video.h | 2 | ||||
-rw-r--r-- | src/i965_render.c | 104 | ||||
-rw-r--r-- | src/i965_render.h | 4 |
5 files changed, 109 insertions, 86 deletions
diff --git a/src/gen8_render.c b/src/gen8_render.c index 54f6225..ca731d2 100644 --- a/src/gen8_render.c +++ b/src/gen8_render.c @@ -1721,6 +1721,40 @@ gen8_render_put_subpicture( intel_batchbuffer_flush(batch); } +static void +gen8_render_terminate(VADriverContextP ctx) +{ + struct i965_driver_data *i965 = i965_driver_data(ctx); + struct i965_render_state *render_state = &i965->render_state; + + dri_bo_unreference(render_state->vb.vertex_buffer); + render_state->vb.vertex_buffer = NULL; + + dri_bo_unreference(render_state->wm.surface_state_binding_table_bo); + render_state->wm.surface_state_binding_table_bo = NULL; + + if (render_state->instruction_state.bo) { + dri_bo_unreference(render_state->instruction_state.bo); + render_state->instruction_state.bo = NULL; + } + + if (render_state->dynamic_state.bo) { + dri_bo_unreference(render_state->dynamic_state.bo); + render_state->dynamic_state.bo = NULL; + } + + if (render_state->indirect_state.bo) { + dri_bo_unreference(render_state->indirect_state.bo); + render_state->indirect_state.bo = NULL; + } + + if (render_state->draw_region) { + dri_bo_unreference(render_state->draw_region->bo); + free(render_state->draw_region); + render_state->draw_region = NULL; + } +} + bool gen8_render_init(VADriverContextP ctx) { @@ -1733,6 +1767,7 @@ gen8_render_init(VADriverContextP ctx) render_state->render_put_surface = gen8_render_put_surface; 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, @@ -1786,39 +1821,3 @@ gen8_render_init(VADriverContextP ctx) return true; } - - -void -gen8_render_terminate(VADriverContextP ctx) -{ - struct i965_driver_data *i965 = i965_driver_data(ctx); - struct i965_render_state *render_state = &i965->render_state; - - dri_bo_unreference(render_state->vb.vertex_buffer); - render_state->vb.vertex_buffer = NULL; - - dri_bo_unreference(render_state->wm.surface_state_binding_table_bo); - render_state->wm.surface_state_binding_table_bo = NULL; - - if (render_state->instruction_state.bo) { - dri_bo_unreference(render_state->instruction_state.bo); - render_state->instruction_state.bo = NULL; - } - - if (render_state->dynamic_state.bo) { - dri_bo_unreference(render_state->dynamic_state.bo); - render_state->dynamic_state.bo = NULL; - } - - if (render_state->indirect_state.bo) { - dri_bo_unreference(render_state->indirect_state.bo); - render_state->indirect_state.bo = NULL; - } - - if (render_state->draw_region) { - dri_bo_unreference(render_state->draw_region->bo); - free(render_state->draw_region); - render_state->draw_region = NULL; - } -} - diff --git a/src/i965_device_info.c b/src/i965_device_info.c index 55e762b..a15a31b 100644 --- a/src/i965_device_info.c +++ b/src/i965_device_info.c @@ -29,10 +29,14 @@ extern struct hw_context *i965_proc_context_init(VADriverContextP, struct object_config *); extern struct hw_context *g4x_dec_hw_context_init(VADriverContextP, struct object_config *); +extern bool genx_render_init(VADriverContextP); + static const struct hw_codec_info g4x_hw_codec_info = { .dec_hw_context_init = g4x_dec_hw_context_init, .enc_hw_context_init = NULL, .proc_hw_context_init = NULL, + .render_init = genx_render_init, + .max_width = 2048, .max_height = 2048, @@ -46,6 +50,8 @@ static const struct hw_codec_info ilk_hw_codec_info = { .dec_hw_context_init = ironlake_dec_hw_context_init, .enc_hw_context_init = NULL, .proc_hw_context_init = i965_proc_context_init, + .render_init = genx_render_init, + .max_width = 2048, .max_height = 2048, @@ -63,6 +69,8 @@ static const struct hw_codec_info snb_hw_codec_info = { .dec_hw_context_init = gen6_dec_hw_context_init, .enc_hw_context_init = gen6_enc_hw_context_init, .proc_hw_context_init = i965_proc_context_init, + .render_init = genx_render_init, + .max_width = 2048, .max_height = 2048, @@ -88,6 +96,8 @@ static const struct hw_codec_info ivb_hw_codec_info = { .dec_hw_context_init = gen7_dec_hw_context_init, .enc_hw_context_init = gen7_enc_hw_context_init, .proc_hw_context_init = i965_proc_context_init, + .render_init = genx_render_init, + .max_width = 4096, .max_height = 4096, @@ -117,6 +127,8 @@ static const struct hw_codec_info hsw_hw_codec_info = { .dec_hw_context_init = gen75_dec_hw_context_init, .enc_hw_context_init = gen75_enc_hw_context_init, .proc_hw_context_init = gen75_proc_context_init, + .render_init = genx_render_init, + .max_width = 4096, .max_height = 4096, @@ -149,6 +161,8 @@ static const struct hw_codec_info bdw_hw_codec_info = { .dec_hw_context_init = gen8_dec_hw_context_init, .enc_hw_context_init = gen8_enc_hw_context_init, .proc_hw_context_init = gen75_proc_context_init, + .render_init = gen8_render_init, + .max_width = 4096, .max_height = 4096, diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h index eddf83d..2de9928 100644 --- a/src/i965_drv_video.h +++ b/src/i965_drv_video.h @@ -286,6 +286,8 @@ struct hw_codec_info struct hw_context *(*dec_hw_context_init)(VADriverContextP, struct object_config *); struct hw_context *(*enc_hw_context_init)(VADriverContextP, struct object_config *); struct hw_context *(*proc_hw_context_init)(VADriverContextP, struct object_config *); + bool (*render_init)(VADriverContextP); + int max_width; int max_height; diff --git a/src/i965_render.c b/src/i965_render.c index 6b0cb19..aed78c0 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -3132,9 +3132,52 @@ intel_render_put_subpicture( render_state->render_put_subpicture(ctx, obj_surface, src_rect, dst_rect); } +static void +genx_render_terminate(VADriverContextP ctx) +{ + int i; + struct i965_driver_data *i965 = i965_driver_data(ctx); + struct i965_render_state *render_state = &i965->render_state; + + dri_bo_unreference(render_state->curbe.bo); + render_state->curbe.bo = NULL; + + for (i = 0; i < NUM_RENDER_KERNEL; i++) { + struct i965_kernel *kernel = &render_state->render_kernels[i]; + + dri_bo_unreference(kernel->bo); + kernel->bo = NULL; + } + + dri_bo_unreference(render_state->vb.vertex_buffer); + render_state->vb.vertex_buffer = NULL; + dri_bo_unreference(render_state->vs.state); + render_state->vs.state = NULL; + dri_bo_unreference(render_state->sf.state); + render_state->sf.state = NULL; + dri_bo_unreference(render_state->wm.sampler); + render_state->wm.sampler = NULL; + dri_bo_unreference(render_state->wm.state); + render_state->wm.state = NULL; + dri_bo_unreference(render_state->wm.surface_state_binding_table_bo); + dri_bo_unreference(render_state->cc.viewport); + render_state->cc.viewport = NULL; + dri_bo_unreference(render_state->cc.state); + render_state->cc.state = NULL; + dri_bo_unreference(render_state->cc.blend); + render_state->cc.blend = NULL; + dri_bo_unreference(render_state->cc.depth_stencil); + render_state->cc.depth_stencil = NULL; + + if (render_state->draw_region) { + dri_bo_unreference(render_state->draw_region->bo); + free(render_state->draw_region); + render_state->draw_region = NULL; + } +} bool -i965_render_init(VADriverContextP ctx) +genx_render_init(VADriverContextP ctx) { struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_render_state *render_state = &i965->render_state; @@ -3146,9 +3189,7 @@ i965_render_init(VADriverContextP ctx) assert(NUM_RENDER_KERNEL == (sizeof(render_kernels_gen6) / sizeof(render_kernels_gen6[0]))); - if (IS_GEN8(i965->intel.device_info)) { - return gen8_render_init(ctx); - } else if (IS_GEN7(i965->intel.device_info)) { + if (IS_GEN7(i965->intel.device_info)) { memcpy(render_state->render_kernels, (IS_HASWELL(i965->intel.device_info) ? render_kernels_gen7_haswell : render_kernels_gen7), sizeof(render_state->render_kernels)); @@ -3168,6 +3209,8 @@ i965_render_init(VADriverContextP ctx) render_state->render_put_subpicture = i965_render_put_subpicture; } + render_state->render_terminate = genx_render_terminate; + for (i = 0; i < NUM_RENDER_KERNEL; i++) { struct i965_kernel *kernel = &render_state->render_kernels[i]; @@ -3190,52 +3233,19 @@ i965_render_init(VADriverContextP ctx) return true; } -void -i965_render_terminate(VADriverContextP ctx) +bool +i965_render_init(VADriverContextP ctx) { - int i; struct i965_driver_data *i965 = i965_driver_data(ctx); - struct i965_render_state *render_state = &i965->render_state; - - if (IS_GEN8(i965->intel.device_info)) { - gen8_render_terminate(ctx); - return; - } - - dri_bo_unreference(render_state->curbe.bo); - render_state->curbe.bo = NULL; - for (i = 0; i < NUM_RENDER_KERNEL; i++) { - struct i965_kernel *kernel = &render_state->render_kernels[i]; - - dri_bo_unreference(kernel->bo); - kernel->bo = NULL; - } + return i965->codec_info->render_init(ctx); +} - dri_bo_unreference(render_state->vb.vertex_buffer); - render_state->vb.vertex_buffer = NULL; - dri_bo_unreference(render_state->vs.state); - render_state->vs.state = NULL; - dri_bo_unreference(render_state->sf.state); - render_state->sf.state = NULL; - dri_bo_unreference(render_state->wm.sampler); - render_state->wm.sampler = NULL; - dri_bo_unreference(render_state->wm.state); - render_state->wm.state = NULL; - dri_bo_unreference(render_state->wm.surface_state_binding_table_bo); - dri_bo_unreference(render_state->cc.viewport); - render_state->cc.viewport = NULL; - dri_bo_unreference(render_state->cc.state); - render_state->cc.state = NULL; - dri_bo_unreference(render_state->cc.blend); - render_state->cc.blend = NULL; - dri_bo_unreference(render_state->cc.depth_stencil); - render_state->cc.depth_stencil = NULL; +void +i965_render_terminate(VADriverContextP ctx) +{ + struct i965_driver_data *i965 = i965_driver_data(ctx); + struct i965_render_state *render_state = &i965->render_state; - if (render_state->draw_region) { - dri_bo_unreference(render_state->draw_region->bo); - free(render_state->draw_region); - render_state->draw_region = NULL; - } + render_state->render_terminate(ctx); } - diff --git a/src/i965_render.h b/src/i965_render.h index afbce49..fde398b 100644 --- a/src/i965_render.h +++ b/src/i965_render.h @@ -123,7 +123,7 @@ struct i965_render_state void (*render_put_subpicture)(VADriverContextP ctx, struct object_surface *, const VARectangle *src_rec, const VARectangle *dst_rect); - + void (*render_terminate)(VADriverContextP ctx); }; bool i965_render_init(VADriverContextP ctx); @@ -157,6 +157,4 @@ gen8_render_set_surface_scs(struct gen8_surface_state *ss); extern bool gen8_render_init(VADriverContextP ctx); -extern void gen8_render_terminate(VADriverContextP ctx); - #endif /* _I965_RENDER_H_ */ |