From c4ae047cabd8f7ef8ff90add285804635d8e0c50 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 1 Mar 2016 17:51:36 -0500 Subject: [PATCH] freedreno/ir3: enable shareable shaders Now that we are no longer using the pctx reference in the shader, drop it and turn on shareable shaders. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a3xx/fd3_program.c | 3 ++- src/gallium/drivers/freedreno/a4xx/fd4_program.c | 3 ++- src/gallium/drivers/freedreno/freedreno_screen.c | 6 +++++- src/gallium/drivers/freedreno/ir3/ir3_shader.c | 5 ++--- src/gallium/drivers/freedreno/ir3/ir3_shader.h | 3 +-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.c b/src/gallium/drivers/freedreno/a3xx/fd3_program.c index a64ecf16eab..a0fa40d1c25 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_program.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.c @@ -51,7 +51,8 @@ create_shader_stateobj(struct pipe_context *pctx, const struct pipe_shader_state enum shader_t type) { struct fd3_shader_stateobj *so = CALLOC_STRUCT(fd3_shader_stateobj); - so->shader = ir3_shader_create(pctx, cso, type); + struct ir3_compiler *compiler = fd_context(pctx)->screen->compiler; + so->shader = ir3_shader_create(compiler, cso, type); return so; } diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_program.c b/src/gallium/drivers/freedreno/a4xx/fd4_program.c index 74716fb733f..037c67f59dd 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_program.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_program.c @@ -51,7 +51,8 @@ create_shader_stateobj(struct pipe_context *pctx, const struct pipe_shader_state enum shader_t type) { struct fd4_shader_stateobj *so = CALLOC_STRUCT(fd4_shader_stateobj); - so->shader = ir3_shader_create(pctx, cso, type); + struct ir3_compiler *compiler = fd_context(pctx)->screen->compiler; + so->shader = ir3_shader_create(compiler, cso, type); return so; } diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 2b3ecfe664e..1565a1da38d 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -241,7 +241,6 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_DEPTH_BOUNDS_TEST: case PIPE_CAP_TGSI_TXQS: case PIPE_CAP_FORCE_PERSAMPLE_INTERP: - case PIPE_CAP_SHAREABLE_SHADERS: case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS: case PIPE_CAP_CLEAR_TEXTURE: case PIPE_CAP_DRAW_PARAMETERS: @@ -257,6 +256,11 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_MAX_VIEWPORTS: return 1; + case PIPE_CAP_SHAREABLE_SHADERS: + if (is_ir3(screen)) + return 1; + return 0; + /* Stream output. */ case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS: if (is_ir3(screen)) diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c index d79e05b9fe5..4d0fcca6b92 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c @@ -266,14 +266,13 @@ ir3_shader_destroy(struct ir3_shader *shader) } struct ir3_shader * -ir3_shader_create(struct pipe_context *pctx, +ir3_shader_create(struct ir3_compiler *compiler, const struct pipe_shader_state *cso, enum shader_t type) { struct ir3_shader *shader = CALLOC_STRUCT(ir3_shader); - shader->compiler = fd_context(pctx)->screen->compiler; + shader->compiler = compiler; shader->id = ++shader->compiler->shader_count; - shader->pctx = pctx; shader->type = type; if (fd_mesa_debug & FD_DBG_DISASM) { DBG("dump tgsi: type=%d", shader->type); diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h index f3e7c44f3c7..c6819b17761 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h @@ -241,7 +241,6 @@ struct ir3_shader { struct ir3_compiler *compiler; - struct pipe_context *pctx; /* TODO replace w/ pipe_screen */ nir_shader *nir; struct pipe_stream_output_info stream_output; @@ -250,7 +249,7 @@ struct ir3_shader { void * ir3_shader_assemble(struct ir3_shader_variant *v, uint32_t gpu_id); -struct ir3_shader * ir3_shader_create(struct pipe_context *pctx, +struct ir3_shader * ir3_shader_create(struct ir3_compiler *compiler, const struct pipe_shader_state *cso, enum shader_t type); void ir3_shader_destroy(struct ir3_shader *shader); struct ir3_shader_variant * ir3_shader_variant(struct ir3_shader *shader, -- 2.30.2