summaryrefslogtreecommitdiff
path: root/lib/mesa/src/intel
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-09-09 09:59:16 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-09-09 09:59:16 +0000
commit884abe30143f8f6bceb6f3fc7febec2c07d51821 (patch)
tree21cfa7f0f49cdb4a078e8bfd76b4cc5a8711c444 /lib/mesa/src/intel
parent17251c8fe97e6c8f1f6e21767313ce4bfa80a547 (diff)
Merge Mesa 21.1.8
Diffstat (limited to 'lib/mesa/src/intel')
-rw-r--r--lib/mesa/src/intel/compiler/brw_fs.cpp13
-rw-r--r--lib/mesa/src/intel/compiler/brw_fs_nir.cpp1
-rw-r--r--lib/mesa/src/intel/isl/gen_format_layout.py1
-rw-r--r--lib/mesa/src/intel/vulkan/anv_device.c9
-rw-r--r--lib/mesa/src/intel/vulkan/anv_gem.c11
-rw-r--r--lib/mesa/src/intel/vulkan/anv_image.c24
-rw-r--r--lib/mesa/src/intel/vulkan/anv_queue.c7
7 files changed, 58 insertions, 8 deletions
diff --git a/lib/mesa/src/intel/compiler/brw_fs.cpp b/lib/mesa/src/intel/compiler/brw_fs.cpp
index 96ce9ec88..1d749a31e 100644
--- a/lib/mesa/src/intel/compiler/brw_fs.cpp
+++ b/lib/mesa/src/intel/compiler/brw_fs.cpp
@@ -2595,16 +2595,23 @@ fs_visitor::assign_constant_locations()
/* Now that we know how many regular uniforms we'll push, reduce the
* UBO push ranges so we don't exceed the 3DSTATE_CONSTANT limits.
*/
+ /* For gen4/5:
+ * Only allow 16 registers (128 uniform components) as push constants.
+ *
+ * If changing this value, note the limitation about total_regs in
+ * brw_curbe.c/crocus_state.c
+ */
+ const unsigned max_push_length = compiler->devinfo->ver < 6 ? 16 : 64;
unsigned push_length = DIV_ROUND_UP(stage_prog_data->nr_params, 8);
for (int i = 0; i < 4; i++) {
struct brw_ubo_range *range = &prog_data->ubo_ranges[i];
- if (push_length + range->length > 64)
- range->length = 64 - push_length;
+ if (push_length + range->length > max_push_length)
+ range->length = max_push_length - push_length;
push_length += range->length;
}
- assert(push_length <= 64);
+ assert(push_length <= max_push_length);
}
bool
diff --git a/lib/mesa/src/intel/compiler/brw_fs_nir.cpp b/lib/mesa/src/intel/compiler/brw_fs_nir.cpp
index 5181ce900..e5a1c26f7 100644
--- a/lib/mesa/src/intel/compiler/brw_fs_nir.cpp
+++ b/lib/mesa/src/intel/compiler/brw_fs_nir.cpp
@@ -353,6 +353,7 @@ fs_visitor::nir_emit_if(nir_if *if_stmt)
if (cond != NULL && cond->op == nir_op_inot) {
invert = true;
cond_reg = get_nir_src(cond->src[0].src);
+ cond_reg = offset(cond_reg, bld, cond->src[0].swizzle[0]);
} else {
invert = false;
cond_reg = get_nir_src(if_stmt->condition);
diff --git a/lib/mesa/src/intel/isl/gen_format_layout.py b/lib/mesa/src/intel/isl/gen_format_layout.py
index b1c4df257..dda318c13 100644
--- a/lib/mesa/src/intel/isl/gen_format_layout.py
+++ b/lib/mesa/src/intel/isl/gen_format_layout.py
@@ -159,7 +159,6 @@ class Format(object):
# pylint: disable=invalid-name
self.name = line[0].strip()
- # Future division makes this work in python 2.
self.bpb = int(line[1])
self.bw = line[2].strip()
self.bh = line[3].strip()
diff --git a/lib/mesa/src/intel/vulkan/anv_device.c b/lib/mesa/src/intel/vulkan/anv_device.c
index a53b4e315..e2d2187f7 100644
--- a/lib/mesa/src/intel/vulkan/anv_device.c
+++ b/lib/mesa/src/intel/vulkan/anv_device.c
@@ -3048,6 +3048,15 @@ VkResult anv_CreateDevice(
goto fail_fd;
}
+ /* Here we tell the kernel not to attempt to recover our context but
+ * immediately (on the next batchbuffer submission) report that the
+ * context is lost, and we will do the recovery ourselves. In the case
+ * of Vulkan, recovery means throwing VK_ERROR_DEVICE_LOST and letting
+ * the client clean up the pieces.
+ */
+ anv_gem_set_context_param(device->fd, device->context_id,
+ I915_CONTEXT_PARAM_RECOVERABLE, false);
+
device->has_thread_submit = physical_device->has_thread_submit;
device->queues =
diff --git a/lib/mesa/src/intel/vulkan/anv_gem.c b/lib/mesa/src/intel/vulkan/anv_gem.c
index f78070a64..cdb4fdcd3 100644
--- a/lib/mesa/src/intel/vulkan/anv_gem.c
+++ b/lib/mesa/src/intel/vulkan/anv_gem.c
@@ -762,8 +762,13 @@ anv_i915_query(int fd, uint64_t query_id, void *buffer,
};
int ret = intel_ioctl(fd, DRM_IOCTL_I915_QUERY, &args);
+ if (ret != 0)
+ return -errno;
+ else if (item.length < 0)
+ return item.length;
+
*buffer_len = item.length;
- return ret;
+ return 0;
}
struct drm_i915_query_engine_info *
@@ -771,14 +776,14 @@ anv_gem_get_engine_info(int fd)
{
int32_t length = 0;
int ret = anv_i915_query(fd, DRM_I915_QUERY_ENGINE_INFO, NULL, &length);
- if (ret == -1)
+ if (ret < 0)
return NULL;
struct drm_i915_query_engine_info *info = calloc(1, length);
ret = anv_i915_query(fd, DRM_I915_QUERY_ENGINE_INFO, info, &length);
assert(ret == 0);
- if (ret != 0) {
+ if (ret < 0) {
free(info);
return NULL;
}
diff --git a/lib/mesa/src/intel/vulkan/anv_image.c b/lib/mesa/src/intel/vulkan/anv_image.c
index b99891a4f..7ddbec248 100644
--- a/lib/mesa/src/intel/vulkan/anv_image.c
+++ b/lib/mesa/src/intel/vulkan/anv_image.c
@@ -1477,11 +1477,17 @@ anv_CreateImage(VkDevice device,
return anv_image_from_gralloc(device, pCreateInfo, gralloc_info,
pAllocator, pImage);
+#ifndef VK_USE_PLATFORM_ANDROID_KHR
+ /* Ignore swapchain creation info on Android. Since we don't have an
+ * implementation in Mesa, we're guaranteed to access an Android object
+ * incorrectly.
+ */
const VkImageSwapchainCreateInfoKHR *swapchain_info =
vk_find_struct_const(pCreateInfo->pNext, IMAGE_SWAPCHAIN_CREATE_INFO_KHR);
if (swapchain_info && swapchain_info->swapchain != VK_NULL_HANDLE)
return anv_image_from_swapchain(device, pCreateInfo, swapchain_info,
pAllocator, pImage);
+#endif
return anv_image_create(device,
&(struct anv_image_create_info) {
@@ -1751,6 +1757,10 @@ VkResult anv_BindImageMemory2(
break;
}
case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR: {
+ /* Ignore this struct on Android, we cannot access swapchain
+ * structures threre.
+ */
+#ifndef VK_USE_PLATFORM_ANDROID_KHR
const VkBindImageMemorySwapchainInfoKHR *swapchain_info =
(const VkBindImageMemorySwapchainInfoKHR *) s;
struct anv_image *swapchain_image =
@@ -1772,8 +1782,22 @@ VkResult anv_BindImageMemory2(
anv_bo_ref(private_bo);
did_bind = true;
+#endif
+ break;
+ }
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wswitch"
+ case VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID: {
+ const VkNativeBufferANDROID *gralloc_info =
+ (const VkNativeBufferANDROID *)s;
+ VkResult result = anv_image_bind_from_gralloc(device, image,
+ gralloc_info);
+ if (result != VK_SUCCESS)
+ return result;
+ did_bind = true;
break;
}
+#pragma GCC diagnostic pop
default:
anv_debug_ignored_stype(s->sType);
break;
diff --git a/lib/mesa/src/intel/vulkan/anv_queue.c b/lib/mesa/src/intel/vulkan/anv_queue.c
index 19abe9931..f271d5c8e 100644
--- a/lib/mesa/src/intel/vulkan/anv_queue.c
+++ b/lib/mesa/src/intel/vulkan/anv_queue.c
@@ -1220,7 +1220,12 @@ anv_queue_submit_add_cmd_buffer(struct anv_queue_submit *submit,
}
submit->cmd_buffers[submit->cmd_buffer_count++] = cmd_buffer;
- submit->perf_query_pool = cmd_buffer->perf_query_pool;
+ /* Only update the perf_query_pool if there is one. We can decide to batch
+ * 2 command buffers if the second one doesn't use a query pool, but we
+ * can't drop the already chosen one.
+ */
+ if (cmd_buffer->perf_query_pool)
+ submit->perf_query_pool = cmd_buffer->perf_query_pool;
submit->perf_query_pass = perf_pass;
return VK_SUCCESS;