diff options
author | Dave Airlie <[email protected]> | 2017-02-13 04:00:24 +0000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-02-13 20:02:45 +0000 |
commit | 592069c1fbccf55e26d2822337dfab40edf6948e (patch) | |
tree | 1dcc156dba67e9f0fb250a506b0ca3161baab948 /src/amd/vulkan/si_cmd_buffer.c | |
parent | b26253b34d53a7b8235bf301b68889ba6c3a19a6 (diff) |
radv: use indirect buffer for initial gfx state.
This puts the common gfx state for the device into an
indirect buffer, and just calls out to it, on CIK and above.
This is taken from what radeonsi does.
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/si_cmd_buffer.c')
-rw-r--r-- | src/amd/vulkan/si_cmd_buffer.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/amd/vulkan/si_cmd_buffer.c b/src/amd/vulkan/si_cmd_buffer.c index 4de24ced06f..cb137aadfc4 100644 --- a/src/amd/vulkan/si_cmd_buffer.c +++ b/src/amd/vulkan/si_cmd_buffer.c @@ -432,9 +432,40 @@ si_emit_config(struct radv_physical_device *physical_device, void si_init_config(struct radv_cmd_buffer *cmd_buffer) { struct radv_physical_device *physical_device = cmd_buffer->device->physical_device; + si_emit_config(physical_device, cmd_buffer->cs); } +void +cik_create_gfx_config(struct radv_device *device) +{ + struct radeon_winsys_cs *cs = device->ws->cs_create(device->ws, RING_GFX); + if (!cs) + return; + + si_emit_config(device->physical_device, cs); + + device->gfx_init = device->ws->buffer_create(device->ws, + cs->cdw * 4, 4096, + RADEON_DOMAIN_GTT, + RADEON_FLAG_CPU_ACCESS); + if (!device->gfx_init) + goto fail; + + void *map = device->ws->buffer_map(device->gfx_init); + if (!map) { + device->ws->buffer_destroy(device->gfx_init); + device->gfx_init = NULL; + goto fail; + } + memcpy(map, cs->buf, cs->cdw * 4); + + device->ws->buffer_unmap(device->gfx_init); + device->gfx_init_size_dw = cs->cdw; +fail: + device->ws->cs_destroy(cs); +} + static void get_viewport_xform(const VkViewport *viewport, float scale[3], float translate[3]) |