17ec681f3Smrg/* 27ec681f3Smrg * Copyright © 2019 Intel Corporation 37ec681f3Smrg * 47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 57ec681f3Smrg * copy of this software and associated documentation files (the "Software"), 67ec681f3Smrg * to deal in the Software without restriction, including without limitation 77ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 87ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the 97ec681f3Smrg * Software is furnished to do so, subject to the following conditions: 107ec681f3Smrg * 117ec681f3Smrg * The above copyright notice and this permission notice (including the next 127ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the 137ec681f3Smrg * Software. 147ec681f3Smrg * 157ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 167ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 177ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 187ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 197ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 207ec681f3Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 217ec681f3Smrg * IN THE SOFTWARE. 227ec681f3Smrg */ 237ec681f3Smrg 247ec681f3Smrg#ifndef INTEL_PERF_QUERY_H 257ec681f3Smrg#define INTEL_PERF_QUERY_H 267ec681f3Smrg 277ec681f3Smrg#include <stdint.h> 287ec681f3Smrg 297ec681f3Smrg#ifdef __cplusplus 307ec681f3Smrgextern "C" { 317ec681f3Smrg#endif 327ec681f3Smrg 337ec681f3Smrgstruct intel_device_info; 347ec681f3Smrg 357ec681f3Smrgstruct intel_perf_config; 367ec681f3Smrgstruct intel_perf_context; 377ec681f3Smrgstruct intel_perf_query_object; 387ec681f3Smrg 397ec681f3Smrgbool 407ec681f3Smrgintel_perf_open(struct intel_perf_context *perf_ctx, 417ec681f3Smrg int metrics_set_id, 427ec681f3Smrg int report_format, 437ec681f3Smrg int period_exponent, 447ec681f3Smrg int drm_fd, 457ec681f3Smrg uint32_t ctx_id, 467ec681f3Smrg bool enable); 477ec681f3Smrg 487ec681f3Smrgvoid 497ec681f3Smrgintel_perf_close(struct intel_perf_context *perfquery, 507ec681f3Smrg const struct intel_perf_query_info *query); 517ec681f3Smrg 527ec681f3Smrgbool intel_perf_oa_stream_ready(struct intel_perf_context *perf_ctx); 537ec681f3Smrg 547ec681f3Smrgssize_t 557ec681f3Smrgintel_perf_read_oa_stream(struct intel_perf_context *perf_ctx, 567ec681f3Smrg void* buf, 577ec681f3Smrg size_t nbytes); 587ec681f3Smrg 597ec681f3Smrgstruct intel_perf_context *intel_perf_new_context(void *parent); 607ec681f3Smrg 617ec681f3Smrgvoid intel_perf_init_context(struct intel_perf_context *perf_ctx, 627ec681f3Smrg struct intel_perf_config *perf_cfg, 637ec681f3Smrg void * mem_ctx, /* ralloc context */ 647ec681f3Smrg void * ctx, /* driver context (eg, brw_context) */ 657ec681f3Smrg void * bufmgr, /* eg brw_bufmgr */ 667ec681f3Smrg const struct intel_device_info *devinfo, 677ec681f3Smrg uint32_t hw_ctx, 687ec681f3Smrg int drm_fd); 697ec681f3Smrg 707ec681f3Smrgconst struct intel_perf_query_info* intel_perf_query_info(const struct intel_perf_query_object *); 717ec681f3Smrg 727ec681f3Smrgstruct intel_perf_config *intel_perf_config(struct intel_perf_context *ctx); 737ec681f3Smrg 747ec681f3Smrgint intel_perf_active_queries(struct intel_perf_context *perf_ctx, 757ec681f3Smrg const struct intel_perf_query_info *query); 767ec681f3Smrg 777ec681f3Smrgstruct intel_perf_query_object * 787ec681f3Smrgintel_perf_new_query(struct intel_perf_context *, unsigned query_index); 797ec681f3Smrg 807ec681f3Smrg 817ec681f3Smrgbool intel_perf_begin_query(struct intel_perf_context *perf_ctx, 827ec681f3Smrg struct intel_perf_query_object *query); 837ec681f3Smrgvoid intel_perf_end_query(struct intel_perf_context *perf_ctx, 847ec681f3Smrg struct intel_perf_query_object *query); 857ec681f3Smrgvoid intel_perf_wait_query(struct intel_perf_context *perf_ctx, 867ec681f3Smrg struct intel_perf_query_object *query, 877ec681f3Smrg void *current_batch); 887ec681f3Smrgbool intel_perf_is_query_ready(struct intel_perf_context *perf_ctx, 897ec681f3Smrg struct intel_perf_query_object *query, 907ec681f3Smrg void *current_batch); 917ec681f3Smrgvoid intel_perf_delete_query(struct intel_perf_context *perf_ctx, 927ec681f3Smrg struct intel_perf_query_object *query); 937ec681f3Smrgvoid intel_perf_get_query_data(struct intel_perf_context *perf_ctx, 947ec681f3Smrg struct intel_perf_query_object *query, 957ec681f3Smrg void *current_batch, 967ec681f3Smrg int data_size, 977ec681f3Smrg unsigned *data, 987ec681f3Smrg unsigned *bytes_written); 997ec681f3Smrg 1007ec681f3Smrgvoid intel_perf_dump_query_count(struct intel_perf_context *perf_ctx); 1017ec681f3Smrgvoid intel_perf_dump_query(struct intel_perf_context *perf_ctx, 1027ec681f3Smrg struct intel_perf_query_object *obj, 1037ec681f3Smrg void *current_batch); 1047ec681f3Smrg 1057ec681f3Smrg#ifdef __cplusplus 1067ec681f3Smrg} // extern "C" 1077ec681f3Smrg#endif 1087ec681f3Smrg 1097ec681f3Smrg#endif /* INTEL_PERF_QUERY_H */ 110