summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/v3d
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-12-26 20:41:42 -0800
committerEric Anholt <[email protected]>2019-01-27 08:30:03 -0800
commit5fe4250a2c7294d4d552759ccce43314dc61189f (patch)
treef8bc358933a1063ac93544bd7ca6030a0613c561 /src/gallium/drivers/v3d
parent09472006ff15316900fb2bb23fb639066f148fb5 (diff)
v3d: Move the sampler state to the long-lived state uploader.
Samplers are small (8-24 bytes), so allocating 4k for them is a huge waste.
Diffstat (limited to 'src/gallium/drivers/v3d')
-rw-r--r--src/gallium/drivers/v3d/v3d_context.h3
-rw-r--r--src/gallium/drivers/v3d/v3d_uniforms.c4
-rw-r--r--src/gallium/drivers/v3d/v3dx_state.c12
3 files changed, 13 insertions, 6 deletions
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h
index ef873237c0c..1b37681c702 100644
--- a/src/gallium/drivers/v3d/v3d_context.h
+++ b/src/gallium/drivers/v3d/v3d_context.h
@@ -114,7 +114,8 @@ struct v3d_sampler_state {
/* V3D 3.x: Packed texture state. */
uint8_t texture_shader_state[32];
/* V3D 4.x: Sampler state struct. */
- struct v3d_bo *bo;
+ struct pipe_resource *sampler_state;
+ uint32_t sampler_state_offset;
};
struct v3d_texture_stateobj {
diff --git a/src/gallium/drivers/v3d/v3d_uniforms.c b/src/gallium/drivers/v3d/v3d_uniforms.c
index 5a3286013cd..1dd9aba9340 100644
--- a/src/gallium/drivers/v3d/v3d_uniforms.c
+++ b/src/gallium/drivers/v3d/v3d_uniforms.c
@@ -214,7 +214,9 @@ write_tmu_p1(struct v3d_job *job,
struct pipe_sampler_state *psampler = texstate->samplers[unit];
struct v3d_sampler_state *sampler = v3d_sampler_state(psampler);
- cl_aligned_reloc(&job->indirect, uniforms, sampler->bo,
+ cl_aligned_reloc(&job->indirect, uniforms,
+ v3d_resource(sampler->sampler_state)->bo,
+ sampler->sampler_state_offset |
v3d_tmu_config_data_get_value(data));
}
diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c
index eafa8853cb9..598a7e870f8 100644
--- a/src/gallium/drivers/v3d/v3dx_state.c
+++ b/src/gallium/drivers/v3d/v3dx_state.c
@@ -542,9 +542,13 @@ v3d_create_sampler_state(struct pipe_context *pctx,
cso->min_img_filter == PIPE_TEX_MIPFILTER_NEAREST);
#if V3D_VERSION >= 40
- so->bo = v3d_bo_alloc(v3d->screen, cl_packet_length(SAMPLER_STATE),
- "sampler");
- void *map = v3d_bo_map(so->bo);
+ void *map;
+ u_upload_alloc(v3d->state_uploader, 0,
+ cl_packet_length(SAMPLER_STATE),
+ 32, /* XXX: 8 for unextended samplers. */
+ &so->sampler_state_offset,
+ &so->sampler_state,
+ &map);
v3dx_pack(map, SAMPLER_STATE, sampler) {
sampler.wrap_i_border = false;
@@ -656,7 +660,7 @@ v3d_sampler_state_delete(struct pipe_context *pctx,
struct pipe_sampler_state *psampler = hwcso;
struct v3d_sampler_state *sampler = v3d_sampler_state(psampler);
- v3d_bo_unreference(&sampler->bo);
+ pipe_resource_reference(&sampler->sampler_state, NULL);
free(psampler);
}