1 /* 2 * Copyright © 2016 Red Hat. 3 * Copyright © 2016 Bas Nieuwenhuizen 4 * SPDX-License-Identifier: MIT 5 * 6 * based in part on anv driver which is: 7 * Copyright © 2015 Intel Corporation 8 */ 9 10 #ifndef TU_COMMON_H 11 #define TU_COMMON_H 12 13 #include <assert.h> 14 #include <pthread.h> 15 #include <stdbool.h> 16 #include <stdint.h> 17 #include <stdio.h> 18 #include <stdlib.h> 19 #include <string.h> 20 #ifdef HAVE_VALGRIND 21 #include <memcheck.h> 22 #include <valgrind.h> 23 #define VG(x) x 24 #else 25 #define VG(x) ((void)0) 26 #endif 27 28 #define MESA_LOG_TAG "TU" 29 30 #include "c11/threads.h" 31 #include "util/rounding.h" 32 #include "util/bitscan.h" 33 #include "util/list.h" 34 #include "util/log.h" 35 #include "util/macros.h" 36 #include "util/sparse_array.h" 37 #include "util/u_atomic.h" 38 #include "util/u_dynarray.h" 39 #include "util/xmlconfig.h" 40 #include "util/perf/u_trace.h" 41 #include "vk_alloc.h" 42 #include "vk_debug_report.h" 43 #include "vk_device.h" 44 #include "vk_dispatch_table.h" 45 #include "vk_extensions.h" 46 #include "vk_instance.h" 47 #include "vk_log.h" 48 #include "vk_physical_device.h" 49 #include "vk_shader_module.h" 50 #include "vk_pipeline_cache.h" 51 #include "wsi_common.h" 52 53 #include "ir3/ir3_compiler.h" 54 #include "ir3/ir3_shader.h" 55 56 #include "adreno_common.xml.h" 57 #include "adreno_pm4.xml.h" 58 #include "a6xx.xml.h" 59 #include "fdl/freedreno_layout.h" 60 #include "common/freedreno_dev_info.h" 61 #include "common/freedreno_common.h" 62 #include "perfcntrs/freedreno_perfcntr.h" 63 64 #include <vulkan/vk_android_native_buffer.h> 65 #include <vulkan/vk_icd.h> 66 #include <vulkan/vulkan.h> 67 68 #include "tu_entrypoints.h" 69 #include "vulkan/runtime/vk_common_entrypoints.h" 70 71 #include "vk_format.h" 72 #include "vk_image.h" 73 #include "vk_command_buffer.h" 74 #include "vk_command_pool.h" 75 #include "vk_queue.h" 76 #include "vk_object.h" 77 #include "vk_sync.h" 78 #include "vk_drm_syncobj.h" 79 #include "vk_sync_timeline.h" 80 81 #define MAX_VBS 32 82 #define MAX_VERTEX_ATTRIBS 32 83 #define MAX_RTS 8 84 #define MAX_VSC_PIPES 32 85 #define MAX_VIEWPORTS 16 86 #define MAX_VIEWPORT_SIZE (1 << 14) 87 #define MAX_SCISSORS 16 88 #define MAX_DISCARD_RECTANGLES 4 89 #define MAX_PUSH_CONSTANTS_SIZE 256 90 #define MAX_PUSH_DESCRIPTORS 32 91 #define MAX_DYNAMIC_UNIFORM_BUFFERS 16 92 #define MAX_DYNAMIC_STORAGE_BUFFERS 8 93 #define MAX_DYNAMIC_BUFFERS_SIZE \ 94 (MAX_DYNAMIC_UNIFORM_BUFFERS + 2 * MAX_DYNAMIC_STORAGE_BUFFERS) * \ 95 A6XX_TEX_CONST_DWORDS 96 97 #define TU_MAX_DRM_DEVICES 8 98 #define MAX_VIEWS 16 99 #define MAX_BIND_POINTS 2 /* compute + graphics */ 100 /* The Qualcomm driver exposes 0x20000058 */ 101 #define MAX_STORAGE_BUFFER_RANGE 0x20000000 102 /* We use ldc for uniform buffer loads, just like the Qualcomm driver, so 103 * expose the same maximum range. 104 * TODO: The SIZE bitfield is 15 bits, and in 4-dword units, so the actual 105 * range might be higher. 106 */ 107 #define MAX_UNIFORM_BUFFER_RANGE 0x10000 108 109 #define A6XX_TEX_CONST_DWORDS 16 110 #define A6XX_TEX_SAMP_DWORDS 4 111 112 #define TU_FROM_HANDLE(__tu_type, __name, __handle) \ 113 VK_FROM_HANDLE(__tu_type, __name, __handle) 114 115 /* vk object types */ 116 struct tu_buffer; 117 struct tu_buffer_view; 118 struct tu_cmd_buffer; 119 struct tu_cmd_pool; 120 struct tu_descriptor_pool; 121 struct tu_descriptor_set; 122 struct tu_descriptor_set_layout; 123 struct tu_descriptor_update_template; 124 struct tu_device; 125 struct tu_device_memory; 126 struct tu_event; 127 struct tu_framebuffer; 128 struct tu_image; 129 struct tu_image_view; 130 struct tu_instance; 131 struct tu_physical_device; 132 struct tu_pipeline_layout; 133 struct tu_query_pool; 134 struct tu_queue; 135 struct tu_render_pass; 136 struct tu_sampler; 137 struct tu_sampler_ycbcr_conversion; 138 139 struct breadcrumbs_context; 140 struct tu_bo; 141 struct tu_cs; 142 struct tu_cs_entry; 143 struct tu_suballoc_bo; 144 struct tu_suballocator; 145 struct tu_subpass; 146 struct tu_u_trace_submission_data; 147 148 #endif /* TU_COMMON_H */ 149