From: Kenneth Graunke Date: Sat, 2 Nov 2013 00:37:10 +0000 (-0700) Subject: i965: Unvirtualize brw_create_constant_surface; delete Gen7+ variant. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7a974a645e8b5c6a9aca3cc935a5a95cd9f33af8;p=mesa.git i965: Unvirtualize brw_create_constant_surface; delete Gen7+ variant. Now that brw_create_constant_surface uses a virtual function internally, it doesn't need to be virtual itself. We can delete the Gen7+ variant and simplify things. Signed-off-by: Kenneth Graunke Reviewed-by: Paul Berry --- diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 6065782ee0c..c15f8a41798 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -976,12 +976,6 @@ struct brw_context unsigned unit); void (*update_null_renderbuffer_surface)(struct brw_context *brw, unsigned unit); - void (*create_constant_surface)(struct brw_context *brw, - drm_intel_bo *bo, - uint32_t offset, - uint32_t size, - uint32_t *out_offset, - bool dword_pitch); void (*create_raw_surface)(struct brw_context *brw, drm_intel_bo *bo, @@ -1577,6 +1571,12 @@ unsigned brw_get_index_type(GLenum type); /* brw_wm_surface_state.c */ void brw_init_surface_formats(struct brw_context *brw); +void brw_create_constant_surface(struct brw_context *brw, + drm_intel_bo *bo, + uint32_t offset, + uint32_t size, + uint32_t *out_offset, + bool dword_pitch); void brw_update_sol_surface(struct brw_context *brw, struct gl_buffer_object *buffer_obj, diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c index ca8577a9eba..9834c11cc37 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -85,9 +85,9 @@ brw_upload_vec4_pull_constants(struct brw_context *brw, drm_intel_gem_bo_unmap_gtt(stage_state->const_bo); - brw->vtbl.create_constant_surface(brw, stage_state->const_bo, 0, size, - &stage_state->surf_offset[surf_index], - false); + brw_create_constant_surface(brw, stage_state->const_bo, 0, size, + &stage_state->surf_offset[surf_index], + false); brw->state.dirty.brw |= brw_new_constbuf; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index a605c16ca81..5a60a6bfe0b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -321,7 +321,7 @@ brw_update_texture_surface(struct gl_context *ctx, * Create the constant buffer surface. Vertex/fragment shader constants will be * read from this buffer with Data Port Read instructions/messages. */ -static void +void brw_create_constant_surface(struct brw_context *brw, drm_intel_bo *bo, uint32_t offset, @@ -469,9 +469,9 @@ brw_upload_wm_pull_constants(struct brw_context *brw) } drm_intel_gem_bo_unmap_gtt(brw->wm.base.const_bo); - brw->vtbl.create_constant_surface(brw, brw->wm.base.const_bo, 0, size, - &brw->wm.base.surf_offset[surf_index], - true); + brw_create_constant_surface(brw, brw->wm.base.const_bo, 0, size, + &brw->wm.base.surf_offset[surf_index], + true); brw->state.dirty.brw |= BRW_NEW_SURFACES; } @@ -840,10 +840,10 @@ brw_upload_ubo_surfaces(struct brw_context *brw, * glBindBufferRange case is undefined, we can just bind the whole buffer * glBindBufferBase wants and be a correct implementation. */ - brw->vtbl.create_constant_surface(brw, bo, binding->Offset, - bo->size - binding->Offset, - &surf_offsets[i], - shader->Type == GL_FRAGMENT_SHADER); + brw_create_constant_surface(brw, bo, binding->Offset, + bo->size - binding->Offset, + &surf_offsets[i], + shader->Type == GL_FRAGMENT_SHADER); } if (shader->NumUniformBlocks) @@ -931,6 +931,5 @@ gen4_init_vtable_surface_functions(struct brw_context *brw) brw->vtbl.update_renderbuffer_surface = brw_update_renderbuffer_surface; brw->vtbl.update_null_renderbuffer_surface = brw_update_null_renderbuffer_surface; - brw->vtbl.create_constant_surface = brw_create_constant_surface; brw->vtbl.emit_buffer_surface_state = gen4_emit_buffer_surface_state; } diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c index 2a42e32b19f..c52e12dd508 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -397,32 +397,6 @@ gen7_update_texture_surface(struct gl_context *ctx, gen7_check_surface_setup(surf, false /* is_render_target */); } -/** - * Create the constant buffer surface. Vertex/fragment shader constants will - * be read from this buffer with Data Port Read instructions/messages. - */ -static void -gen7_create_constant_surface(struct brw_context *brw, - drm_intel_bo *bo, - uint32_t offset, - uint32_t size, - uint32_t *out_offset, - bool dword_pitch) -{ - uint32_t stride = dword_pitch ? 4 : 16; - uint32_t elements = ALIGN(size, stride) / stride; - - gen7_emit_buffer_surface_state(brw, - out_offset, - bo, - offset, - BRW_SURFACEFORMAT_R32G32B32A32_FLOAT, - elements, - stride, - 0 /* mocs */, - false /* rw */); -} - /** * Create a raw surface for untyped R/W access. */ @@ -613,7 +587,6 @@ gen7_init_vtable_surface_functions(struct brw_context *brw) brw->vtbl.update_renderbuffer_surface = gen7_update_renderbuffer_surface; brw->vtbl.update_null_renderbuffer_surface = gen7_update_null_renderbuffer_surface; - brw->vtbl.create_constant_surface = gen7_create_constant_surface; brw->vtbl.create_raw_surface = gen7_create_raw_surface; brw->vtbl.emit_buffer_surface_state = gen7_emit_buffer_surface_state; }