Module: Mesa Branch: vulkan Commit: b63e28c0e1275761f7effe4b0a8202735ff72291 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b63e28c0e1275761f7effe4b0a8202735ff72291
Author: Kristian Høgsberg Kristensen <kristian.h.kristen...@intel.com> Date: Wed Feb 17 11:19:56 2016 -0800 anv: Set correct write domain on window system BOs We need to make sure GEM understands that we're writing to the BO, in case it needs to synchronize with other rings (blitter use in display server, for example). --- src/vulkan/anv_batch_chain.c | 9 ++++++--- src/vulkan/anv_device.c | 1 + src/vulkan/anv_private.h | 6 ++++++ src/vulkan/anv_wsi_wayland.c | 1 + src/vulkan/anv_wsi_x11.c | 1 + 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/vulkan/anv_batch_chain.c b/src/vulkan/anv_batch_chain.c index 79e5519..a050fa0 100644 --- a/src/vulkan/anv_batch_chain.c +++ b/src/vulkan/anv_batch_chain.c @@ -147,6 +147,9 @@ anv_reloc_list_add(struct anv_reloc_list *list, struct drm_i915_gem_relocation_entry *entry; int index; + const uint32_t domain = + target_bo->is_winsys_bo ? I915_GEM_DOMAIN_RENDER : 0; + anv_reloc_list_grow(list, alloc, 1); /* TODO: Handle failure */ @@ -158,8 +161,8 @@ anv_reloc_list_add(struct anv_reloc_list *list, entry->delta = delta; entry->offset = offset; entry->presumed_offset = target_bo->offset; - entry->read_domains = 0; - entry->write_domain = 0; + entry->read_domains = domain; + entry->write_domain = domain; VG(VALGRIND_CHECK_MEM_IS_DEFINED(entry, sizeof(*entry))); return target_bo->offset + delta; @@ -854,7 +857,7 @@ anv_cmd_buffer_add_bo(struct anv_cmd_buffer *cmd_buffer, obj->relocs_ptr = 0; obj->alignment = 0; obj->offset = bo->offset; - obj->flags = 0; + obj->flags = bo->is_winsys_bo ? EXEC_OBJECT_WRITE : 0; obj->rsvd1 = 0; obj->rsvd2 = 0; } diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index dfc29e4..c3a370b 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1070,6 +1070,7 @@ anv_bo_init_new(struct anv_bo *bo, struct anv_device *device, uint64_t size) bo->index = 0; bo->offset = 0; bo->size = size; + bo->is_winsys_bo = false; return VK_SUCCESS; } diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index e2ae011..951a571 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -297,6 +297,12 @@ struct anv_bo { uint64_t size; void *map; + + /* We need to set the WRITE flag on winsys bos so GEM will know we're + * writing to them and synchronize uses on other rings (eg if the display + * server uses the blitter ring). + */ + bool is_winsys_bo; }; /* Represents a lock-free linked list of "free" things. This is used by diff --git a/src/vulkan/anv_wsi_wayland.c b/src/vulkan/anv_wsi_wayland.c index 4ae594b..6f25eaf 100644 --- a/src/vulkan/anv_wsi_wayland.c +++ b/src/vulkan/anv_wsi_wayland.c @@ -656,6 +656,7 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain, struct wsi_wl_image *image, goto fail_image; image->memory = anv_device_memory_from_handle(vk_memory); + image->memory->bo.is_winsys_bo = true; result = anv_BindImageMemory(vk_device, vk_image, vk_memory, 0); diff --git a/src/vulkan/anv_wsi_x11.c b/src/vulkan/anv_wsi_x11.c index 1e08bf3..843a6b6 100644 --- a/src/vulkan/anv_wsi_x11.c +++ b/src/vulkan/anv_wsi_x11.c @@ -624,6 +624,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, &memory_h); memory = anv_device_memory_from_handle(memory_h); + memory->bo.is_winsys_bo = true; anv_BindImageMemory(VK_NULL_HANDLE, anv_image_to_handle(image), memory_h, 0); _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit