-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drm/etnaviv: add infrastructure to query perf counter
Make it possible that userspace can query all performance domains and its signals. This information is needed to sample those signals via submit ioctl. At the moment no performance domain is available. Changes from v1 -> v2: - use a 16 bit value for signals - fix padding issues - add id member to domain and signal struct Changes v4 -> v5 - provide for each pipe an own set of pm domains Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
- Loading branch information
Christian Gmeiner
authored and
Lucas Stach
committed
Oct 10, 2017
1 parent
95a428c
commit 9e2c2e2
Showing
5 changed files
with
209 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* Copyright (C) 2017 Etnaviv Project | ||
* Copyright (C) 2017 Zodiac Inflight Innovations | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 as published by | ||
* the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "etnaviv_gpu.h" | ||
|
||
struct etnaviv_pm_domain; | ||
|
||
struct etnaviv_pm_signal { | ||
char name[64]; | ||
u32 data; | ||
|
||
u32 (*sample)(struct etnaviv_gpu *gpu, | ||
const struct etnaviv_pm_domain *domain, | ||
const struct etnaviv_pm_signal *signal); | ||
}; | ||
|
||
struct etnaviv_pm_domain { | ||
char name[64]; | ||
u8 nr_signals; | ||
const struct etnaviv_pm_signal *signal; | ||
}; | ||
|
||
struct etnaviv_pm_domain_meta { | ||
const struct etnaviv_pm_domain *domains; | ||
u32 nr_domains; | ||
}; | ||
|
||
static const struct etnaviv_pm_domain doms_3d[] = { | ||
}; | ||
|
||
static const struct etnaviv_pm_domain doms_2d[] = { | ||
}; | ||
|
||
static const struct etnaviv_pm_domain doms_vg[] = { | ||
}; | ||
|
||
static const struct etnaviv_pm_domain_meta doms_meta[] = { | ||
{ | ||
.nr_domains = ARRAY_SIZE(doms_3d), | ||
.domains = &doms_3d[0] | ||
}, | ||
{ | ||
.nr_domains = ARRAY_SIZE(doms_2d), | ||
.domains = &doms_2d[0] | ||
}, | ||
{ | ||
.nr_domains = ARRAY_SIZE(doms_vg), | ||
.domains = &doms_vg[0] | ||
} | ||
}; | ||
|
||
int etnaviv_pm_query_dom(struct etnaviv_gpu *gpu, | ||
struct drm_etnaviv_pm_domain *domain) | ||
{ | ||
const struct etnaviv_pm_domain_meta *meta = &doms_meta[domain->pipe]; | ||
const struct etnaviv_pm_domain *dom; | ||
|
||
if (domain->iter >= meta->nr_domains) | ||
return -EINVAL; | ||
|
||
dom = meta->domains + domain->iter; | ||
|
||
domain->id = domain->iter; | ||
domain->nr_signals = dom->nr_signals; | ||
strncpy(domain->name, dom->name, sizeof(domain->name)); | ||
|
||
domain->iter++; | ||
if (domain->iter == meta->nr_domains) | ||
domain->iter = 0xff; | ||
|
||
return 0; | ||
} | ||
|
||
int etnaviv_pm_query_sig(struct etnaviv_gpu *gpu, | ||
struct drm_etnaviv_pm_signal *signal) | ||
{ | ||
const struct etnaviv_pm_domain_meta *meta = &doms_meta[signal->pipe]; | ||
const struct etnaviv_pm_domain *dom; | ||
const struct etnaviv_pm_signal *sig; | ||
|
||
if (signal->domain >= meta->nr_domains) | ||
return -EINVAL; | ||
|
||
dom = meta->domains + signal->domain; | ||
|
||
if (signal->iter > dom->nr_signals) | ||
return -EINVAL; | ||
|
||
sig = &dom->signal[signal->iter]; | ||
|
||
signal->id = signal->iter; | ||
strncpy(signal->name, sig->name, sizeof(signal->name)); | ||
|
||
signal->iter++; | ||
if (signal->iter == dom->nr_signals) | ||
signal->iter = 0xffff; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (C) 2017 Etnaviv Project | ||
* Copyright (C) 2017 Zodiac Inflight Innovations | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 as published by | ||
* the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef __ETNAVIV_PERFMON_H__ | ||
#define __ETNAVIV_PERFMON_H__ | ||
|
||
struct etnaviv_gpu; | ||
struct drm_etnaviv_pm_domain; | ||
struct drm_etnaviv_pm_signal; | ||
|
||
int etnaviv_pm_query_dom(struct etnaviv_gpu *gpu, | ||
struct drm_etnaviv_pm_domain *domain); | ||
|
||
int etnaviv_pm_query_sig(struct etnaviv_gpu *gpu, | ||
struct drm_etnaviv_pm_signal *signal); | ||
|
||
#endif /* __ETNAVIV_PERFMON_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters