anv: Use isl to fill buffer surface states
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 23 Feb 2016 00:54:25 +0000 (16:54 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 27 Feb 2016 18:26:14 +0000 (10:26 -0800)
src/intel/vulkan/anv_device.c
src/intel/vulkan/gen7_state.c
src/intel/vulkan/gen8_state.c

index 59930552f59b3729777b6be7e16d1b1f6343cdd7..857c4b1d1f4b3040901c455b217b7ef2d89ada15 100644 (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);
index ac5b5ed21cdf2a87b941c5a9682ea70e7253dbdd..1360697f0de161d6c389a10211330b7bc03ec713 100644 (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,
index 1ecd34058d9961ad849bd440e841b789f4545269..784269b98cb2d1bf8913df09be367b72bb50742b 100644 (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,