From: Mike Blumenkrantz Date: Fri, 18 Aug 2023 15:06:49 +0000 (-0400) Subject: zink: add a fixup method for extra driver props X-Git-Tag: upstream/23.3.3~2235 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9907573d9813f932863a581a1ab3c73c16e7705d;p=platform%2Fupstream%2Fmesa.git zink: add a fixup method for extra driver props some extensions have "extra" props which need the get_count -> get_prop_array dance, and codegen is too stupid to figure this out (and probably always will be) Part-of: --- diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 894adec..dc5bd31 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -2840,6 +2840,32 @@ init_driver_workarounds(struct zink_screen *screen) } static void +fixup_driver_props(struct zink_screen *screen) +{ + VkPhysicalDeviceProperties2 props = { + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 + }; + if (screen->info.have_EXT_host_image_copy) { + /* fill in layouts */ + screen->info.hic_props.pNext = props.pNext; + props.pNext = &screen->info.hic_props; + screen->info.hic_props.pCopySrcLayouts = ralloc_array(screen, VkImageLayout, screen->info.hic_props.copySrcLayoutCount); + screen->info.hic_props.pCopyDstLayouts = ralloc_array(screen, VkImageLayout, screen->info.hic_props.copyDstLayoutCount); + } + if (props.pNext) + screen->vk.GetPhysicalDeviceProperties2(screen->pdev, &props); + + if (screen->info.have_EXT_host_image_copy) { + for (unsigned i = 0; i < screen->info.hic_props.copyDstLayoutCount; i++) { + if (screen->info.hic_props.pCopyDstLayouts[i] == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { + screen->can_hic_shader_read = true; + break; + } + } + } +} + +static void init_optimal_keys(struct zink_screen *screen) { screen->optimal_keys = !screen->need_decompose_attrs && @@ -3160,6 +3186,8 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev screen->debug_mem_sizes = _mesa_hash_table_create(screen, _mesa_hash_string, _mesa_key_string_equal); } + fixup_driver_props(screen); + init_driver_workarounds(screen); screen->dev = zink_create_logical_device(screen); diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 5a85c61..ffbb03a 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -1469,6 +1469,7 @@ struct zink_screen { bool need_2D_zs; bool need_2D_sparse; bool faked_e5sparse; //drivers may not expose R9G9B9E5 but cts requires it + bool can_hic_shader_read; uint32_t gfx_queue; uint32_t sparse_queue;