anv: Use isl to fill buffer surface states

This commit is contained in:
Jason Ekstrand 2016-02-22 16:54:25 -08:00
parent a0cd20eb7f
commit eb19d640eb
3 changed files with 6 additions and 81 deletions

View File

@ -1697,24 +1697,12 @@ anv_fill_buffer_surface_state(struct anv_device *device, struct anv_state state,
enum isl_format format,
uint32_t offset, uint32_t range, uint32_t stride)
{
switch (device->info.gen) {
case 7:
if (device->info.is_haswell)
gen75_fill_buffer_surface_state(state.map, format, offset, range,
stride);
else
gen7_fill_buffer_surface_state(state.map, format, offset, range,
stride);
break;
case 8:
gen8_fill_buffer_surface_state(state.map, format, offset, range, stride);
break;
case 9:
gen9_fill_buffer_surface_state(state.map, format, offset, range, stride);
break;
default:
unreachable("unsupported gen\n");
}
isl_buffer_fill_state(&device->isl_dev, state.map,
.address = offset,
.mocs = device->default_mocs,
.size = range,
.format = format,
.stride = stride);
if (!device->info.has_llc)
anv_state_clflush(state);

View File

@ -63,37 +63,6 @@ genX(init_device_state)(struct anv_device *device)
return anv_device_submit_simple_batch(device, &batch);
}
void
genX(fill_buffer_surface_state)(void *state, enum isl_format format,
uint32_t offset, uint32_t range,
uint32_t stride)
{
uint32_t num_elements = range / stride;
struct GENX(RENDER_SURFACE_STATE) surface_state = {
.SurfaceType = SURFTYPE_BUFFER,
.SurfaceFormat = format,
.SurfaceVerticalAlignment = VALIGN_4,
.SurfaceHorizontalAlignment = HALIGN_4,
.TiledSurface = false,
.RenderCacheReadWriteMode = false,
.SurfaceObjectControlState = GENX(MOCS),
.Height = ((num_elements - 1) >> 7) & 0x3fff,
.Width = (num_elements - 1) & 0x7f,
.Depth = ((num_elements - 1) >> 21) & 0x3f,
.SurfacePitch = stride - 1,
# if (GEN_IS_HASWELL)
.ShaderChannelSelectRed = SCS_RED,
.ShaderChannelSelectGreen = SCS_GREEN,
.ShaderChannelSelectBlue = SCS_BLUE,
.ShaderChannelSelectAlpha = SCS_ALPHA,
# endif
.SurfaceBaseAddress = { NULL, offset },
};
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &surface_state);
}
VkResult genX(CreateSampler)(
VkDevice _device,
const VkSamplerCreateInfo* pCreateInfo,

View File

@ -139,38 +139,6 @@ genX(init_device_state)(struct anv_device *device)
return anv_device_submit_simple_batch(device, &batch);
}
void
genX(fill_buffer_surface_state)(void *state, enum isl_format format,
uint32_t offset, uint32_t range, uint32_t stride)
{
uint32_t num_elements = range / stride;
struct GENX(RENDER_SURFACE_STATE) surface_state = {
.SurfaceType = SURFTYPE_BUFFER,
.SurfaceArray = false,
.SurfaceFormat = format,
.SurfaceVerticalAlignment = VALIGN4,
.SurfaceHorizontalAlignment = HALIGN4,
.TileMode = LINEAR,
.SamplerL2BypassModeDisable = true,
.RenderCacheReadWriteMode = WriteOnlyCache,
.MemoryObjectControlState = GENX(MOCS),
.Height = ((num_elements - 1) >> 7) & 0x3fff,
.Width = (num_elements - 1) & 0x7f,
.Depth = ((num_elements - 1) >> 21) & 0x3f,
.SurfacePitch = stride - 1,
.NumberofMultisamples = MULTISAMPLECOUNT_1,
.ShaderChannelSelectRed = SCS_RED,
.ShaderChannelSelectGreen = SCS_GREEN,
.ShaderChannelSelectBlue = SCS_BLUE,
.ShaderChannelSelectAlpha = SCS_ALPHA,
/* FIXME: We assume that the image must be bound at this time. */
.SurfaceBaseAddress = { NULL, offset },
};
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &surface_state);
}
VkResult genX(CreateSampler)(
VkDevice _device,
const VkSamplerCreateInfo* pCreateInfo,