turnip: add tu_pass.h

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17811>
This commit is contained in:
Chia-I Wu
2022-07-29 16:37:19 -07:00
committed by Marge Bot
parent 3c607309c9
commit 543fac108d
4 changed files with 131 additions and 110 deletions
+2
View File
@@ -126,6 +126,7 @@ struct tu_image_view;
struct tu_instance;
struct tu_pipeline_layout;
struct tu_query_pool;
struct tu_render_pass;
struct tu_sampler;
struct tu_sampler_ycbcr_conversion;
@@ -135,5 +136,6 @@ struct tu_cs;
struct tu_cs_entry;
struct tu_suballoc_bo;
struct tu_suballocator;
struct tu_subpass;
#endif /* TU_COMMON_H */
+2
View File
@@ -24,6 +24,8 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "tu_pass.h"
#include "tu_private.h"
#include "vk_util.h"
+126
View File
@@ -0,0 +1,126 @@
/*
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
* SPDX-License-Identifier: MIT
*
* based in part on anv driver which is:
* Copyright © 2015 Intel Corporation
*/
#ifndef TU_PASS_H
#define TU_PASS_H
#include "tu_common.h"
enum tu_gmem_layout
{
/* Use all of GMEM for attachments */
TU_GMEM_LAYOUT_FULL,
/* Avoid using the region of GMEM that the CCU needs */
TU_GMEM_LAYOUT_AVOID_CCU,
/* Number of layouts we have, also the value set when we don't know the layout in a secondary. */
TU_GMEM_LAYOUT_COUNT,
};
struct tu_subpass_barrier {
VkPipelineStageFlags2 src_stage_mask;
VkPipelineStageFlags2 dst_stage_mask;
VkAccessFlags2 src_access_mask;
VkAccessFlags2 dst_access_mask;
bool incoherent_ccu_color, incoherent_ccu_depth;
};
struct tu_subpass_attachment
{
uint32_t attachment;
/* For input attachments, true if it needs to be patched to refer to GMEM
* in GMEM mode. This is false if it hasn't already been written as an
* attachment.
*/
bool patch_input_gmem;
};
struct tu_subpass
{
uint32_t input_count;
uint32_t color_count;
uint32_t resolve_count;
bool resolve_depth_stencil;
bool feedback_loop_color;
bool feedback_loop_ds;
/* True if we must invalidate UCHE thanks to a feedback loop. */
bool feedback_invalidate;
/* In other words - framebuffer fetch support */
bool raster_order_attachment_access;
struct tu_subpass_attachment *input_attachments;
struct tu_subpass_attachment *color_attachments;
struct tu_subpass_attachment *resolve_attachments;
struct tu_subpass_attachment depth_stencil_attachment;
VkSampleCountFlagBits samples;
uint32_t srgb_cntl;
uint32_t multiview_mask;
struct tu_subpass_barrier start_barrier;
};
struct tu_render_pass_attachment
{
VkFormat format;
uint32_t samples;
uint32_t cpp;
VkImageAspectFlags clear_mask;
uint32_t clear_views;
bool load;
bool store;
bool gmem;
int32_t gmem_offset[TU_GMEM_LAYOUT_COUNT];
bool will_be_resolved;
/* for D32S8 separate stencil: */
bool load_stencil;
bool store_stencil;
bool cond_load_allowed;
bool cond_store_allowed;
int32_t gmem_offset_stencil[TU_GMEM_LAYOUT_COUNT];
};
struct tu_render_pass
{
struct vk_object_base base;
uint32_t attachment_count;
uint32_t subpass_count;
uint32_t gmem_pixels[TU_GMEM_LAYOUT_COUNT];
uint32_t tile_align_w;
/* memory bandwidth costs (in bytes) for gmem / sysmem rendering */
uint32_t gmem_bandwidth_per_pixel;
uint32_t sysmem_bandwidth_per_pixel;
struct tu_subpass_attachment *subpass_attachments;
struct tu_render_pass_attachment *attachments;
struct tu_subpass_barrier end_barrier;
struct tu_subpass subpasses[0];
};
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_render_pass, base, VkRenderPass,
VK_OBJECT_TYPE_RENDER_PASS)
void tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer,
const VkRenderingInfo *pRenderingInfo);
void tu_setup_dynamic_inheritance(struct tu_cmd_buffer *cmd_buffer,
const VkCommandBufferInheritanceRenderingInfo *info);
uint32_t
tu_subpass_get_attachment_to_resolve(const struct tu_subpass *subpass, uint32_t index);
#endif /* TU_PASS_H */
+1 -110
View File
@@ -38,6 +38,7 @@
#include "tu_formats.h"
#include "tu_image.h"
#include "tu_lrz.h"
#include "tu_pass.h"
#include "tu_perfetto.h"
#include "tu_pipeline.h"
#include "tu_query.h"
@@ -530,16 +531,6 @@ struct tu_tiling_config {
uint32_t pipe_sizes[MAX_VSC_PIPES];
};
enum tu_gmem_layout
{
/* Use all of GMEM for attachments */
TU_GMEM_LAYOUT_FULL,
/* Avoid using the region of GMEM that the CCU needs */
TU_GMEM_LAYOUT_AVOID_CCU,
/* Number of layouts we have, also the value set when we don't know the layout in a secondary. */
TU_GMEM_LAYOUT_COUNT,
};
struct tu_framebuffer
{
struct vk_object_base base;
@@ -554,95 +545,6 @@ struct tu_framebuffer
struct tu_attachment_info attachments[0];
};
struct tu_subpass_barrier {
VkPipelineStageFlags2 src_stage_mask;
VkPipelineStageFlags2 dst_stage_mask;
VkAccessFlags2 src_access_mask;
VkAccessFlags2 dst_access_mask;
bool incoherent_ccu_color, incoherent_ccu_depth;
};
struct tu_subpass_attachment
{
uint32_t attachment;
/* For input attachments, true if it needs to be patched to refer to GMEM
* in GMEM mode. This is false if it hasn't already been written as an
* attachment.
*/
bool patch_input_gmem;
};
struct tu_subpass
{
uint32_t input_count;
uint32_t color_count;
uint32_t resolve_count;
bool resolve_depth_stencil;
bool feedback_loop_color;
bool feedback_loop_ds;
/* True if we must invalidate UCHE thanks to a feedback loop. */
bool feedback_invalidate;
/* In other words - framebuffer fetch support */
bool raster_order_attachment_access;
struct tu_subpass_attachment *input_attachments;
struct tu_subpass_attachment *color_attachments;
struct tu_subpass_attachment *resolve_attachments;
struct tu_subpass_attachment depth_stencil_attachment;
VkSampleCountFlagBits samples;
uint32_t srgb_cntl;
uint32_t multiview_mask;
struct tu_subpass_barrier start_barrier;
};
struct tu_render_pass_attachment
{
VkFormat format;
uint32_t samples;
uint32_t cpp;
VkImageAspectFlags clear_mask;
uint32_t clear_views;
bool load;
bool store;
bool gmem;
int32_t gmem_offset[TU_GMEM_LAYOUT_COUNT];
bool will_be_resolved;
/* for D32S8 separate stencil: */
bool load_stencil;
bool store_stencil;
bool cond_load_allowed;
bool cond_store_allowed;
int32_t gmem_offset_stencil[TU_GMEM_LAYOUT_COUNT];
};
struct tu_render_pass
{
struct vk_object_base base;
uint32_t attachment_count;
uint32_t subpass_count;
uint32_t gmem_pixels[TU_GMEM_LAYOUT_COUNT];
uint32_t tile_align_w;
/* memory bandwidth costs (in bytes) for gmem / sysmem rendering */
uint32_t gmem_bandwidth_per_pixel;
uint32_t sysmem_bandwidth_per_pixel;
struct tu_subpass_attachment *subpass_attachments;
struct tu_render_pass_attachment *attachments;
struct tu_subpass_barrier end_barrier;
struct tu_subpass subpasses[0];
};
void
tu_framebuffer_tiling_config(struct tu_framebuffer *fb,
const struct tu_device *device,
@@ -1222,12 +1124,6 @@ void tu_emit_cache_flush_ccu(struct tu_cmd_buffer *cmd_buffer,
struct tu_cs *cs,
enum tu_cmd_ccu_state ccu_state);
void tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer,
const VkRenderingInfo *pRenderingInfo);
void tu_setup_dynamic_inheritance(struct tu_cmd_buffer *cmd_buffer,
const VkCommandBufferInheritanceRenderingInfo *info);
void tu_setup_dynamic_framebuffer(struct tu_cmd_buffer *cmd_buffer,
const VkRenderingInfo *pRenderingInfo);
@@ -1298,9 +1194,6 @@ tu_import_memory_from_gralloc_handle(VkDevice device_h,
const VkAllocationCallbacks *alloc,
VkImage image_h);
uint32_t
tu_subpass_get_attachment_to_resolve(const struct tu_subpass *subpass, uint32_t index);
VkResult
tu_physical_device_init(struct tu_physical_device *device,
struct tu_instance *instance);
@@ -1368,8 +1261,6 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(tu_device_memory, base, VkDeviceMemory,
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_event, base, VkEvent, VK_OBJECT_TYPE_EVENT)
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_framebuffer, base, VkFramebuffer,
VK_OBJECT_TYPE_FRAMEBUFFER)
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_render_pass, base, VkRenderPass,
VK_OBJECT_TYPE_RENDER_PASS)
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_sampler, base, VkSampler,
VK_OBJECT_TYPE_SAMPLER)