Mesa (master): anv/image: Get rid of the memset(aux, 0, sizeof(aux)) hack

Jason Ekstrand jekstrand at kemper.freedesktop.org
Wed May 24 00:35:21 UTC 2017


Module: Mesa
Branch: master
Commit: 4eecd534f0544b62ae831a97708ade007541bd32
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4eecd534f0544b62ae831a97708ade007541bd32

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu May 18 11:31:48 2017 -0700

anv/image: Get rid of the memset(aux, 0, sizeof(aux)) hack

Up until now, we've been memsetting the auxiliary surface to 0 at
BindImageMemory time to ensure that it is properly initialized.
However, this isn't correct because apps are allowed to freely alias
memory between different images and buffers so long as they properly
track whether or not a particular image is valid and, if it isn't,
transition from UNINITIALIZED to something else before using it.  We
now implement those transitions so we can drop the hack.

Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
Cc: "17.1" <mesa-stable at lists.freedesktop.org>

---

 src/intel/vulkan/anv_image.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index c3e2cb51d8..9405a8c0f9 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -332,7 +332,6 @@ VkResult anv_BindImageMemory(
     VkDeviceMemory                              _memory,
     VkDeviceSize                                memoryOffset)
 {
-   ANV_FROM_HANDLE(anv_device, device, _device);
    ANV_FROM_HANDLE(anv_device_memory, mem, _memory);
    ANV_FROM_HANDLE(anv_image, image, _image);
 
@@ -345,33 +344,6 @@ VkResult anv_BindImageMemory(
    image->bo = mem->bo;
    image->offset = memoryOffset;
 
-   if (image->aux_surface.isl.size > 0) {
-
-      /* The offset and size must be a multiple of 4K or else the
-       * anv_gem_mmap call below will fail.
-       */
-      assert((image->offset + image->aux_surface.offset) % 4096 == 0);
-      assert(image->aux_surface.isl.size % 4096 == 0);
-
-      /* Auxiliary surfaces need to have their memory cleared to 0 before they
-       * can be used.  For CCS surfaces, this puts them in the "resolved"
-       * state so they can be used with CCS enabled before we ever touch it
-       * from the GPU.  For HiZ, we need something valid or else we may get
-       * GPU hangs on some hardware and 0 works fine.
-       */
-      void *map = anv_gem_mmap(device, image->bo->gem_handle,
-                               image->offset + image->aux_surface.offset,
-                               image->aux_surface.isl.size,
-                               device->info.has_llc ? 0 : I915_MMAP_WC);
-
-      if (map == MAP_FAILED)
-         return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
-
-      memset(map, 0, image->aux_surface.isl.size);
-
-      anv_gem_munmap(map, image->aux_surface.isl.size);
-   }
-
    return VK_SUCCESS;
 }
 




More information about the mesa-commit mailing list