Module: Mesa
Branch: main
Commit: ec656e198402a535a20e7ac31cea277b060ab75a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec656e198402a535a20e7ac31cea277b060ab75a

Author: Mike Blumenkrantz <michael.blumenkra...@gmail.com>
Date:   Tue Sep 12 12:51:01 2023 -0400

lavapipe: maint6

Reviewed-by: Dave Airlie <airl...@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26881>

---

 docs/features.txt                            |  1 +
 src/gallium/frontends/lavapipe/lvp_device.c  | 28 ++++++++++++++++++++++++++--
 src/gallium/frontends/lavapipe/lvp_execute.c | 13 ++++++++-----
 3 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 81e8fad8b0c..30d5b130074 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -521,6 +521,7 @@ Khronos extensions that are not part of any Vulkan version:
   VK_KHR_global_priority                                DONE (radv, tu)
   VK_KHR_incremental_present                            DONE (anv, hasvk, lvp, 
radv, tu, v3dv, vn)
   VK_KHR_maintenance5                                   DONE (anv, lvp, radv, 
tu)
+  VK_KHR_maintenance6                                   DONE (lvp)
   VK_KHR_performance_query                              DONE (anv/gen8+, 
radv/gfx10.3+, tu, v3dv)
   VK_KHR_pipeline_executable_properties                 DONE (anv, nvk, hasvk, 
radv, tu, v3dv)
   VK_KHR_pipeline_library                               DONE (anv, lvp, radv, 
tu, vn)
diff --git a/src/gallium/frontends/lavapipe/lvp_device.c 
b/src/gallium/frontends/lavapipe/lvp_device.c
index 4c291b5aeb9..9f739f6952e 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -123,6 +123,7 @@ static const struct vk_device_extension_table 
lvp_device_extensions_supported =
    .KHR_maintenance3                      = true,
    .KHR_maintenance4                      = true,
    .KHR_maintenance5                      = true,
+   .KHR_maintenance6                      = true,
    .KHR_map_memory2                       = true,
    .KHR_multiview                         = true,
    .KHR_push_descriptor                   = true,
@@ -603,6 +604,9 @@ lvp_get_features(const struct lvp_physical_device *pdevice,
       /* VK_EXT_ycbcr_image_arrays */
       .ycbcrImageArrays = true,
 
+      /* maintenance6 */
+      .maintenance6 = true,
+
       /* VK_AMDX_shader_enqueue */
 #ifdef VK_ENABLE_BETA_EXTENSIONS
       .shaderEnqueue = true,
@@ -910,6 +914,9 @@ lvp_get_properties(const struct lvp_physical_device 
*device, struct vk_propertie
       .nonStrictSinglePixelWideLinesUseParallelogram = false,
       .nonStrictWideLinesUseParallelogram = false,
 
+      /* maintenance6 */
+      .maxCombinedImageSamplerDescriptorCount = 3,
+
       /* VK_EXT_extended_dynamic_state3 */
       .dynamicPrimitiveTopologyUnrestricted = VK_TRUE,
 
@@ -1061,6 +1068,9 @@ lvp_get_properties(const struct lvp_physical_device 
*device, struct vk_propertie
    else
       p->maxVertexAttribDivisor = 1;
 
+   /* maintenance6 */
+   p->blockTexelViewCompatibleMultipleLayers = true,
+
    /* VK_EXT_shader_object */
    /* this is basically unsupported */
    lvp_device_get_cache_uuid(p->shaderBinaryUUID);
@@ -2001,6 +2011,7 @@ VKAPI_ATTR VkResult VKAPI_CALL 
lvp_BindBufferMemory2(VkDevice _device,
    for (uint32_t i = 0; i < bindInfoCount; ++i) {
       LVP_FROM_HANDLE(lvp_device_memory, mem, pBindInfos[i].memory);
       LVP_FROM_HANDLE(lvp_buffer, buffer, pBindInfos[i].buffer);
+      VkBindMemoryStatusKHR *status = 
(void*)vk_find_struct_const(&pBindInfos[i], BIND_MEMORY_STATUS_KHR);
 
       buffer->pmem = mem->pmem;
       buffer->offset = pBindInfos[i].memoryOffset;
@@ -2008,6 +2019,8 @@ VKAPI_ATTR VkResult VKAPI_CALL 
lvp_BindBufferMemory2(VkDevice _device,
                                              buffer->bo,
                                              mem->pmem,
                                              pBindInfos[i].memoryOffset);
+      if (status)
+         *status->pResult = VK_SUCCESS;
    }
    return VK_SUCCESS;
 }
@@ -2042,10 +2055,12 @@ VKAPI_ATTR VkResult VKAPI_CALL 
lvp_BindImageMemory2(VkDevice _device,
                               const VkBindImageMemoryInfo *pBindInfos)
 {
    LVP_FROM_HANDLE(lvp_device, device, _device);
+   VkResult res = VK_SUCCESS;
    for (uint32_t i = 0; i < bindInfoCount; ++i) {
       const VkBindImageMemoryInfo *bind_info = &pBindInfos[i];
       LVP_FROM_HANDLE(lvp_device_memory, mem, bind_info->memory);
       LVP_FROM_HANDLE(lvp_image, image, bind_info->image);
+      VkBindMemoryStatusKHR *status = 
(void*)vk_find_struct_const(&pBindInfos[i], BIND_MEMORY_STATUS_KHR);
       bool did_bind = false;
 
       vk_foreach_struct_const(s, bind_info->pNext) {
@@ -2064,6 +2079,8 @@ VKAPI_ATTR VkResult VKAPI_CALL 
lvp_BindImageMemory2(VkDevice _device,
                                                    image->planes[0].pmem,
                                                    
image->planes[0].memory_offset);
             did_bind = true;
+            if (status)
+               *status->pResult = VK_SUCCESS;
             break;
          }
          default:
@@ -2080,19 +2097,26 @@ VKAPI_ATTR VkResult VKAPI_CALL 
lvp_BindImageMemory2(VkDevice _device,
             uint8_t plane = lvp_image_aspects_to_plane(image, 
plane_info->planeAspect);
             result = lvp_image_plane_bind(device, &image->planes[plane],
                                           mem, bind_info->memoryOffset, 
&offset_B);
+            if (status)
+               *status->pResult = result;
             if (result != VK_SUCCESS)
                return result;
          } else {
+            VkResult fail = VK_SUCCESS;
             for (unsigned plane = 0; plane < image->plane_count; plane++) {
                result = lvp_image_plane_bind(device, &image->planes[plane],
                                              mem, bind_info->memoryOffset, 
&offset_B);
+               if (status)
+                  *status->pResult = res;
                if (result != VK_SUCCESS)
-                  return result;
+                  fail = result;
             }
+            if (fail != VK_SUCCESS)
+               return fail;
          }
       }
    }
-   return VK_SUCCESS;
+   return res;
 }
 
 #ifdef PIPE_MEMORY_FD
diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c 
b/src/gallium/frontends/lavapipe/lvp_execute.c
index a69534df98f..360db1b682d 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -2638,13 +2638,15 @@ static void handle_index_buffer2(struct 
vk_cmd_queue_entry *cmd,
                                  struct rendering_state *state)
 {
    struct vk_cmd_bind_index_buffer2_khr *ib = &cmd->u.bind_index_buffer2_khr;
-   state->index_size = vk_index_type_to_bytes(ib->index_type);
-   state->index_buffer_size = ib->size;
 
    if (ib->buffer) {
+      state->index_size = vk_index_type_to_bytes(ib->index_type);
+      state->index_buffer_size = ib->size;
       state->index_offset = ib->offset;
       state->index_buffer = lvp_buffer_from_handle(ib->buffer)->bo;
    } else {
+      state->index_size = 4;
+      state->index_buffer_size = sizeof(uint32_t);
       state->index_offset = 0;
       state->index_buffer = state->device->zero_buffer;
    }
@@ -4327,12 +4329,9 @@ void lvp_add_enqueue_cmd_entrypoints(struct 
vk_device_dispatch_table *disp)
    ENQUEUE_CMD(CmdEndQuery)
    ENQUEUE_CMD(CmdResetQueryPool)
    ENQUEUE_CMD(CmdCopyQueryPoolResults)
-   // ENQUEUE_CMD(CmdPushConstants2KHR)
    ENQUEUE_CMD(CmdExecuteCommands)
    ENQUEUE_CMD(CmdDrawIndirectCount)
    ENQUEUE_CMD(CmdDrawIndexedIndirectCount)
-   ENQUEUE_CMD(CmdPushDescriptorSet2KHR)
-//   ENQUEUE_CMD(CmdPushDescriptorSetWithTemplateKHR)
    ENQUEUE_CMD(CmdBindTransformFeedbackBuffersEXT)
    ENQUEUE_CMD(CmdBeginTransformFeedbackEXT)
    ENQUEUE_CMD(CmdEndTransformFeedbackEXT)
@@ -4821,6 +4820,10 @@ VkResult lvp_execute_cmds(struct lvp_device *device,
    state->rs_state.no_ms_sample_mask_out = true;
    state->blend_state.independent_blend_enable = true;
 
+   state->index_size = 4;
+   state->index_buffer_size = sizeof(uint32_t);
+   state->index_buffer = state->device->zero_buffer;
+
    /* create a gallium context */
    lvp_execute_cmd_buffer(&cmd_buffer->vk.cmd_queue.cmds, state, 
device->print_cmds);
 

Reply via email to