OSDN Git Service

anv/wsi: Allocate enough memory for the entire image
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 7 Oct 2017 21:37:50 +0000 (14:37 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sun, 8 Oct 2017 00:12:38 +0000 (17:12 -0700)
Previously, we allocated memory for image->plane[0].surface.isl.size
which is great if there is no compression.  However, on BDW, we can do
CCS_D on X-tiled images so we also have to allocate space for the
auxiliary buffer.  This fixes hangs in some of the WSI CTS tests and
should also reduce hangs in real applications.  In particular, it fixes
the dEQP-VK.wsi.*.incremental_present.* test group.

When we hand the image off to X11 or Wayland, it will ignore the CCS
entirely which is ok because we do a resolve when it's transitioned to
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable@lists.freedesktop.org
src/intel/vulkan/anv_wsi.c

index 3fca076..fc0c288 100644 (file)
@@ -221,7 +221,7 @@ anv_wsi_image_create(VkDevice device_h,
    result = anv_AllocateMemory(anv_device_to_handle(device),
       &(VkMemoryAllocateInfo) {
          .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
-         .allocationSize = image->planes[0].surface.isl.size,
+         .allocationSize = image->size,
          .memoryTypeIndex = 0,
       },
       NULL /* XXX: pAllocator */,
@@ -239,6 +239,7 @@ anv_wsi_image_create(VkDevice device_h,
    memory->bo->flags |= EXEC_OBJECT_WRITE;
 
    anv_BindImageMemory(device_h, image_h, memory_h, 0);
+   assert(image->size == 0);
 
    struct anv_surface *surface = &image->planes[0].surface;
    assert(surface->isl.tiling == ISL_TILING_X);
@@ -266,8 +267,8 @@ anv_wsi_image_create(VkDevice device_h,
    *image_p = image_h;
    *memory_p = memory_h;
    *fd_p = fd;
-   *size = image->planes[0].surface.isl.size;
-   *offset = image->planes[0].surface.offset;
+   *size = image->size;
+   *offset = 0;
    return VK_SUCCESS;
 fail_alloc_memory:
    anv_FreeMemory(device_h, memory_h, pAllocator);