1 /* 2 * Copyright © 2020 Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * on the rights to use, copy, modify, merge, publish, distribute, sub 8 * license, and/or sell copies of the Software, and to permit persons to whom 9 * the Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21 * USE OR OTHER DEALINGS IN THE SOFTWARE. 22 */ 23 24 #ifndef ANV_MEASURE_H 25 #define ANV_MEASURE_H 26 27 #include "anv_private.h" 28 #include "common/intel_measure.h" 29 30 void anv_measure_device_init(struct anv_physical_device *device); 31 void anv_measure_device_destroy(struct anv_physical_device *device); 32 33 void anv_measure_init(struct anv_cmd_buffer *cmd_buffer); 34 void anv_measure_destroy(struct anv_cmd_buffer *cmd_buffer); 35 void anv_measure_reset(struct anv_cmd_buffer *cmd_buffer); 36 37 void _anv_measure_snapshot(struct anv_cmd_buffer *cmd_buffer, 38 enum intel_measure_snapshot_type type, 39 const char *event_name, 40 uint32_t count); 41 42 /* ends snapshots before command buffer submission */ 43 void _anv_measure_endcommandbuffer(struct anv_cmd_buffer *cmd_buffer); 44 45 /* when measuring render passes, inserts a timestamp */ 46 void _anv_measure_beginrenderpass(struct anv_cmd_buffer *cmd_buffer); 47 48 /* tracks frame progression */ 49 void _anv_measure_acquire(struct anv_device *device); 50 51 /* should be combined with endcommandbuffer */ 52 void _anv_measure_submit(struct anv_cmd_buffer *cmd_buffer); 53 54 void 55 _anv_measure_add_secondary(struct anv_cmd_buffer *primary, 56 struct anv_cmd_buffer *secondary); 57 58 #define anv_measure_acquire(device) \ 59 if (unlikely(device->physical->measure_device.config)) \ 60 _anv_measure_acquire(device) 61 62 #define anv_measure_snapshot(cmd_buffer, type, event_name, count) \ 63 if (unlikely(cmd_buffer->measure)) \ 64 _anv_measure_snapshot(cmd_buffer, type, event_name, count) 65 66 #define anv_measure_endcommandbuffer(cmd_buffer) \ 67 if (unlikely(cmd_buffer->measure)) \ 68 _anv_measure_endcommandbuffer(cmd_buffer) 69 70 #define anv_measure_beginrenderpass(cmd_buffer) \ 71 if (unlikely(cmd_buffer->measure)) \ 72 _anv_measure_beginrenderpass(cmd_buffer) 73 74 #define anv_measure_submit(cmd_buffer) \ 75 if (unlikely(cmd_buffer->measure)) \ 76 _anv_measure_submit(cmd_buffer) 77 78 #define anv_measure_add_secondary(primary, secondary) \ 79 if (unlikely(primary->measure)) \ 80 _anv_measure_add_secondary(primary, secondary) 81 82 #endif /* ANV_MEASURE_H */ 83