Path: blob/21.2-virgl/src/intel/perf/intel_perf_mdapi.h
4547 views
/*1* Copyright © 2018 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef INTEL_PERF_MDAPI_H24#define INTEL_PERF_MDAPI_H2526#include <stdint.h>2728#include "dev/intel_device_info.h"2930struct intel_perf_query_result;3132/* Guid has to matches with MDAPI's. */33#define INTEL_PERF_QUERY_GUID_MDAPI "2f01b241-7014-42a7-9eb6-a925cad3daba"3435/*36* Data format expected by MDAPI.37*/3839struct gfx7_mdapi_metrics {40uint64_t TotalTime;4142uint64_t ACounters[45];43uint64_t NOACounters[16];4445uint64_t PerfCounter1;46uint64_t PerfCounter2;47uint32_t SplitOccured;48uint32_t CoreFrequencyChanged;49uint64_t CoreFrequency;50uint32_t ReportId;51uint32_t ReportsCount;52};5354#define GTDI_QUERY_BDW_METRICS_OA_COUNT 3655#define GTDI_QUERY_BDW_METRICS_OA_40b_COUNT 3256#define GTDI_QUERY_BDW_METRICS_NOA_COUNT 1657struct gfx8_mdapi_metrics {58uint64_t TotalTime;59uint64_t GPUTicks;60uint64_t OaCntr[GTDI_QUERY_BDW_METRICS_OA_COUNT];61uint64_t NoaCntr[GTDI_QUERY_BDW_METRICS_NOA_COUNT];62uint64_t BeginTimestamp;63uint64_t Reserved1;64uint64_t Reserved2;65uint32_t Reserved3;66uint32_t OverrunOccured;67uint64_t MarkerUser;68uint64_t MarkerDriver;6970uint64_t SliceFrequency;71uint64_t UnsliceFrequency;72uint64_t PerfCounter1;73uint64_t PerfCounter2;74uint32_t SplitOccured;75uint32_t CoreFrequencyChanged;76uint64_t CoreFrequency;77uint32_t ReportId;78uint32_t ReportsCount;79};8081#define GTDI_MAX_READ_REGS 168283struct gfx9_mdapi_metrics {84uint64_t TotalTime;85uint64_t GPUTicks;86uint64_t OaCntr[GTDI_QUERY_BDW_METRICS_OA_COUNT];87uint64_t NoaCntr[GTDI_QUERY_BDW_METRICS_NOA_COUNT];88uint64_t BeginTimestamp;89uint64_t Reserved1;90uint64_t Reserved2;91uint32_t Reserved3;92uint32_t OverrunOccured;93uint64_t MarkerUser;94uint64_t MarkerDriver;9596uint64_t SliceFrequency;97uint64_t UnsliceFrequency;98uint64_t PerfCounter1;99uint64_t PerfCounter2;100uint32_t SplitOccured;101uint32_t CoreFrequencyChanged;102uint64_t CoreFrequency;103uint32_t ReportId;104uint32_t ReportsCount;105106uint64_t UserCntr[GTDI_MAX_READ_REGS];107uint32_t UserCntrCfgId;108uint32_t Reserved4;109};110111/* Add new definition */112#define gfx11_mdapi_metrics gfx9_mdapi_metrics113114struct mdapi_pipeline_metrics {115uint64_t IAVertices;116uint64_t IAPrimitives;117uint64_t VSInvocations;118uint64_t GSInvocations;119uint64_t GSPrimitives;120uint64_t CInvocations;121uint64_t CPrimitives;122uint64_t PSInvocations;123uint64_t HSInvocations;124uint64_t DSInvocations;125uint64_t CSInvocations;126uint64_t Reserved1; /* Gfx10+ */127};128129int intel_perf_query_result_write_mdapi(void *data, uint32_t data_size,130const struct intel_device_info *devinfo,131const struct intel_perf_query_info *query,132const struct intel_perf_query_result *result);133134static inline void intel_perf_query_mdapi_write_marker(void *data, uint32_t data_size,135const struct intel_device_info *devinfo,136uint64_t value)137{138switch (devinfo->ver) {139case 8: {140if (data_size < sizeof(struct gfx8_mdapi_metrics))141return;142struct gfx8_mdapi_metrics *mdapi_data = data;143mdapi_data->MarkerUser = value;144break;145}146case 9:147case 11: {148if (data_size < sizeof(struct gfx9_mdapi_metrics))149return;150struct gfx9_mdapi_metrics *mdapi_data = data;151mdapi_data->MarkerUser = value;152break;153}154default:155break;156}157}158159#endif /* INTEL_PERF_MDAPI_H */160161162