Module: Mesa Branch: main Commit: 57d2d7523724931d156d955f073cdd43e80ccdf9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=57d2d7523724931d156d955f073cdd43e80ccdf9
Author: Chia-I Wu <[email protected]> Date: Tue Aug 23 13:09:35 2022 -0700 turnip: clean up tu_perfetto.h Move enums, stages, queues, and some function declarations to tu_perfetto.cc. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18238> --- src/freedreno/vulkan/tu_perfetto.cc | 65 +++++++++++++++++++++++++++++++ src/freedreno/vulkan/tu_perfetto.h | 77 +++++-------------------------------- 2 files changed, 74 insertions(+), 68 deletions(-) diff --git a/src/freedreno/vulkan/tu_perfetto.cc b/src/freedreno/vulkan/tu_perfetto.cc index 6f833e90cb5..64c348afa31 100644 --- a/src/freedreno/vulkan/tu_perfetto.cc +++ b/src/freedreno/vulkan/tu_perfetto.cc @@ -13,6 +13,71 @@ #include "tu_tracepoints.h" #include "tu_tracepoints_perfetto.h" +/* we can't include tu_drm.h and tu_device.h */ +extern "C" { +int +tu_device_get_gpu_timestamp(struct tu_device *dev, + uint64_t *ts); +int +tu_device_get_suspend_count(struct tu_device *dev, + uint64_t *suspend_count); +uint64_t +tu_device_ticks_to_ns(struct tu_device *dev, uint64_t ts); + +} + +/** + * Queue-id's + */ +enum { + DEFAULT_HW_QUEUE_ID, +}; + +/** + * Render-stage id's + */ +enum tu_stage_id { + SURFACE_STAGE_ID, /* Surface is a sort of meta-stage for render-target info */ + BINNING_STAGE_ID, + GMEM_STAGE_ID, + BYPASS_STAGE_ID, + BLIT_STAGE_ID, + COMPUTE_STAGE_ID, + CLEAR_SYSMEM_STAGE_ID, + CLEAR_GMEM_STAGE_ID, + GMEM_LOAD_STAGE_ID, + GMEM_STORE_STAGE_ID, + SYSMEM_RESOLVE_STAGE_ID, + // TODO add the rest + + NUM_STAGES +}; + +static const struct { + const char *name; + const char *desc; +} queues[] = { + [DEFAULT_HW_QUEUE_ID] = {"GPU Queue 0", "Default Adreno Hardware Queue"}, +}; + +static const struct { + const char *name; + const char *desc; +} stages[] = { + [SURFACE_STAGE_ID] = {"Surface"}, + [BINNING_STAGE_ID] = {"Binning", "Perform Visibility pass and determine target bins"}, + [GMEM_STAGE_ID] = {"Render", "Rendering to GMEM"}, + [BYPASS_STAGE_ID] = {"Render", "Rendering to system memory"}, + [BLIT_STAGE_ID] = {"Blit", "Performing a Blit operation"}, + [COMPUTE_STAGE_ID] = {"Compute", "Compute job"}, + [CLEAR_SYSMEM_STAGE_ID] = {"Clear Sysmem", ""}, + [CLEAR_GMEM_STAGE_ID] = {"Clear GMEM", "Per-tile (GMEM) clear"}, + [GMEM_LOAD_STAGE_ID] = {"GMEM Load", "Per tile system memory to GMEM load"}, + [GMEM_STORE_STAGE_ID] = {"GMEM Store", "Per tile GMEM to system memory store"}, + [SYSMEM_RESOLVE_STAGE_ID] = {"SysMem Resolve", "System memory MSAA resolve"}, + // TODO add the rest +}; + static uint32_t gpu_clock_id; static uint64_t next_clock_sync_ns; /* cpu time of next clk sync */ diff --git a/src/freedreno/vulkan/tu_perfetto.h b/src/freedreno/vulkan/tu_perfetto.h index 647cbed1caa..f01c4031a7c 100644 --- a/src/freedreno/vulkan/tu_perfetto.h +++ b/src/freedreno/vulkan/tu_perfetto.h @@ -6,65 +6,19 @@ #ifndef TU_PERFETTO_H_ #define TU_PERFETTO_H_ +#ifdef HAVE_PERFETTO + +/* we can't include tu_common.h because ir3 headers are not C++-compatible */ +#include <stdint.h> + #ifdef __cplusplus extern "C" { #endif -#ifdef HAVE_PERFETTO - #define TU_PERFETTO_MAX_STACK_DEPTH 8 -/** - * Render-stage id's - */ -enum tu_stage_id { - SURFACE_STAGE_ID, /* Surface is a sort of meta-stage for render-target info */ - BINNING_STAGE_ID, - GMEM_STAGE_ID, - BYPASS_STAGE_ID, - BLIT_STAGE_ID, - COMPUTE_STAGE_ID, - CLEAR_SYSMEM_STAGE_ID, - CLEAR_GMEM_STAGE_ID, - GMEM_LOAD_STAGE_ID, - GMEM_STORE_STAGE_ID, - SYSMEM_RESOLVE_STAGE_ID, - // TODO add the rest - - NUM_STAGES -}; - -static const struct { - const char *name; - const char *desc; -} stages[] = { - [SURFACE_STAGE_ID] = {"Surface"}, - [BINNING_STAGE_ID] = {"Binning", "Perform Visibility pass and determine target bins"}, - [GMEM_STAGE_ID] = {"Render", "Rendering to GMEM"}, - [BYPASS_STAGE_ID] = {"Render", "Rendering to system memory"}, - [BLIT_STAGE_ID] = {"Blit", "Performing a Blit operation"}, - [COMPUTE_STAGE_ID] = {"Compute", "Compute job"}, - [CLEAR_SYSMEM_STAGE_ID] = {"Clear Sysmem", ""}, - [CLEAR_GMEM_STAGE_ID] = {"Clear GMEM", "Per-tile (GMEM) clear"}, - [GMEM_LOAD_STAGE_ID] = {"GMEM Load", "Per tile system memory to GMEM load"}, - [GMEM_STORE_STAGE_ID] = {"GMEM Store", "Per tile GMEM to system memory store"}, - [SYSMEM_RESOLVE_STAGE_ID] = {"SysMem Resolve", "System memory MSAA resolve"}, - // TODO add the rest -}; - -/** - * Queue-id's - */ -enum { - DEFAULT_HW_QUEUE_ID, -}; - -static const struct { - const char *name; - const char *desc; -} queues[] = { - [DEFAULT_HW_QUEUE_ID] = {"GPU Queue 0", "Default Adreno Hardware Queue"}, -}; +struct tu_device; +struct tu_u_trace_submission_data; struct tu_perfetto_stage { int stage_id; @@ -79,7 +33,6 @@ struct tu_perfetto_state { void tu_perfetto_init(void); -struct tu_device; void tu_perfetto_submit(struct tu_device *dev, uint32_t submission_id); /* Helpers */ @@ -87,25 +40,13 @@ void tu_perfetto_submit(struct tu_device *dev, uint32_t submission_id); struct tu_perfetto_state * tu_device_get_perfetto_state(struct tu_device *dev); -int -tu_device_get_gpu_timestamp(struct tu_device *dev, - uint64_t *ts); - -int -tu_device_get_suspend_count(struct tu_device *dev, - uint64_t *suspend_count); - -uint64_t -tu_device_ticks_to_ns(struct tu_device *dev, uint64_t ts); - -struct tu_u_trace_submission_data; uint32_t tu_u_trace_submission_data_get_submit_id(const struct tu_u_trace_submission_data *data); -#endif - #ifdef __cplusplus } #endif +#endif /* HAVE_PERFETTO */ + #endif /* TU_PERFETTO_H_ */
