#include "util/slab.h"
#include "util/u_debug.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
-#include "state_tracker/sw_winsys.h"
+#include "frontend/sw_winsys.h"
static void
zink_resource_destroy(struct pipe_screen *pscreen,
templ->target == PIPE_TEXTURE_CUBE_ARRAY)
ici.arrayLayers *= 6;
- if (templ->bind & (PIPE_BIND_DISPLAY_TARGET |
- PIPE_BIND_SCANOUT |
- PIPE_BIND_SHARED)) {
- // assert(ici.tiling == VK_IMAGE_TILING_LINEAR);
+ if (templ->bind & PIPE_BIND_SHARED)
ici.tiling = VK_IMAGE_TILING_LINEAR;
- }
if (templ->usage == PIPE_USAGE_STAGING)
ici.tiling = VK_IMAGE_TILING_LINEAR;
};
if (whandle && whandle->type == WINSYS_HANDLE_TYPE_FD) {
- imfi.sType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
imfi.pNext = NULL;
imfi.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
imfi.fd = whandle->handle;
}
if (whandle->type == WINSYS_HANDLE_TYPE_FD) {
-
- if (!screen->vk_GetMemoryFdKHR)
- screen->vk_GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR)vkGetDeviceProcAddr(screen->dev, "vkGetMemoryFdKHR");
- if (!screen->vk_GetMemoryFdKHR)
- return false;
fd_info.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR;
fd_info.memory = res->mem;
fd_info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
void *ptr;
if (pres->target == PIPE_BUFFER) {
+ if (usage & PIPE_TRANSFER_READ) {
+ /* need to wait for rendering to finish
+ * TODO: optimize/fix this to be much less obtrusive
+ * mesa/mesa#2966
+ */
+ struct pipe_fence_handle *fence = NULL;
+ pctx->flush(pctx, &fence, PIPE_FLUSH_HINT_FINISH);
+ if (fence) {
+ pctx->screen->fence_finish(pctx->screen, NULL, fence,
+ PIPE_TIMEOUT_INFINITE);
+ pctx->screen->fence_reference(pctx->screen, &fence, NULL);
+ }
+ }
+
+
VkResult result = vkMapMemory(screen->dev, res->mem, res->offset, res->size, 0, &ptr);
if (result != VK_SUCCESS)
return NULL;