mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 23:30:10 +01:00
intel/perf: Move some static blocks of C code out of the python script.
Now my editor can help me format code as I type.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
(cherry picked from commit 12e065ddec)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16405>
This commit is contained in:
parent
502823aef7
commit
f3500570be
2 changed files with 76 additions and 47 deletions
|
|
@ -686,53 +686,7 @@ def main():
|
|||
|
||||
c(textwrap.dedent("""\
|
||||
#include "perf/intel_perf.h"
|
||||
|
||||
|
||||
#define MIN(a, b) ((a < b) ? (a) : (b))
|
||||
#define MAX(a, b) ((a > b) ? (a) : (b))
|
||||
|
||||
static struct intel_perf_query_info *
|
||||
intel_query_alloc(struct intel_perf_config *perf, int ncounters)
|
||||
{
|
||||
struct intel_perf_query_info *query = rzalloc(perf, struct intel_perf_query_info);
|
||||
query->perf = perf;
|
||||
query->kind = INTEL_PERF_QUERY_TYPE_OA;
|
||||
query->n_counters = 0;
|
||||
query->oa_metrics_set_id = 0; /* determined at runtime, via sysfs */
|
||||
query->counters = rzalloc_array(query, struct intel_perf_query_counter, ncounters);
|
||||
return query;
|
||||
}
|
||||
|
||||
static struct intel_perf_query_info *
|
||||
hsw_query_alloc(struct intel_perf_config *perf, int ncounters)
|
||||
{
|
||||
struct intel_perf_query_info *query = intel_query_alloc(perf, ncounters);
|
||||
query->oa_format = I915_OA_FORMAT_A45_B8_C8;
|
||||
/* Accumulation buffer offsets... */
|
||||
query->gpu_time_offset = 0;
|
||||
query->a_offset = query->gpu_time_offset + 1;
|
||||
query->b_offset = query->a_offset + 45;
|
||||
query->c_offset = query->b_offset + 8;
|
||||
query->perfcnt_offset = query->c_offset + 8;
|
||||
query->rpstat_offset = query->perfcnt_offset + 2;
|
||||
return query;
|
||||
}
|
||||
|
||||
static struct intel_perf_query_info *
|
||||
bdw_query_alloc(struct intel_perf_config *perf, int ncounters)
|
||||
{
|
||||
struct intel_perf_query_info *query = intel_query_alloc(perf, ncounters);
|
||||
query->oa_format = I915_OA_FORMAT_A32u40_A4u32_B8_C8;
|
||||
/* Accumulation buffer offsets... */
|
||||
query->gpu_time_offset = 0;
|
||||
query->gpu_clock_offset = query->gpu_time_offset + 1;
|
||||
query->a_offset = query->gpu_clock_offset + 1;
|
||||
query->b_offset = query->a_offset + 36;
|
||||
query->c_offset = query->b_offset + 8;
|
||||
query->perfcnt_offset = query->c_offset + 8;
|
||||
query->rpstat_offset = query->perfcnt_offset + 2;
|
||||
return query;
|
||||
}
|
||||
#include "perf/intel_perf_setup.h"
|
||||
"""))
|
||||
|
||||
# Print out all equation functions.
|
||||
|
|
|
|||
75
src/intel/perf/intel_perf_setup.h
Normal file
75
src/intel/perf/intel_perf_setup.h
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright © 2018 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef INTEL_PERF_SETUP_H
|
||||
#define INTEL_PERF_SETUP_H
|
||||
|
||||
#include "perf/intel_perf.h"
|
||||
|
||||
#define MIN(a, b) ((a < b) ? (a) : (b))
|
||||
#define MAX(a, b) ((a > b) ? (a) : (b))
|
||||
|
||||
static struct intel_perf_query_info *
|
||||
intel_query_alloc(struct intel_perf_config *perf, int ncounters)
|
||||
{
|
||||
struct intel_perf_query_info *query = rzalloc(perf, struct intel_perf_query_info);
|
||||
query->perf = perf;
|
||||
query->kind = INTEL_PERF_QUERY_TYPE_OA;
|
||||
query->n_counters = 0;
|
||||
query->oa_metrics_set_id = 0; /* determined at runtime, via sysfs */
|
||||
query->counters = rzalloc_array(query, struct intel_perf_query_counter, ncounters);
|
||||
return query;
|
||||
}
|
||||
|
||||
static struct intel_perf_query_info *
|
||||
hsw_query_alloc(struct intel_perf_config *perf, int ncounters)
|
||||
{
|
||||
struct intel_perf_query_info *query = intel_query_alloc(perf, ncounters);
|
||||
query->oa_format = I915_OA_FORMAT_A45_B8_C8;
|
||||
/* Accumulation buffer offsets... */
|
||||
query->gpu_time_offset = 0;
|
||||
query->a_offset = query->gpu_time_offset + 1;
|
||||
query->b_offset = query->a_offset + 45;
|
||||
query->c_offset = query->b_offset + 8;
|
||||
query->perfcnt_offset = query->c_offset + 8;
|
||||
query->rpstat_offset = query->perfcnt_offset + 2;
|
||||
return query;
|
||||
}
|
||||
|
||||
static struct intel_perf_query_info *
|
||||
bdw_query_alloc(struct intel_perf_config *perf, int ncounters)
|
||||
{
|
||||
struct intel_perf_query_info *query = intel_query_alloc(perf, ncounters);
|
||||
query->oa_format = I915_OA_FORMAT_A32u40_A4u32_B8_C8;
|
||||
/* Accumulation buffer offsets... */
|
||||
query->gpu_time_offset = 0;
|
||||
query->gpu_clock_offset = query->gpu_time_offset + 1;
|
||||
query->a_offset = query->gpu_clock_offset + 1;
|
||||
query->b_offset = query->a_offset + 36;
|
||||
query->c_offset = query->b_offset + 8;
|
||||
query->perfcnt_offset = query->c_offset + 8;
|
||||
query->rpstat_offset = query->perfcnt_offset + 2;
|
||||
return query;
|
||||
}
|
||||
|
||||
#endif /* INTEL_PERF_SETUP_H */
|
||||
Loading…
Add table
Reference in a new issue