summaryrefslogtreecommitdiff
path: root/kmscube.c
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2020-03-07 10:23:44 -0800
committerRob Clark <robdclark@chromium.org>2020-03-07 15:16:15 -0800
commit28c3af8445a14b4920a190157e660f35d2e44368 (patch)
treef6e8dead9a3ef24b092fbd592aea34936cf14ca5 /kmscube.c
parentdaea3dd7d5727116025e0c18ba97ff104dcd546d (diff)
downloadkmscube-28c3af8445a14b4920a190157e660f35d2e44368.tar.gz
kmscube: add AMD_performance_monitor support
Only wired up for shadertoy mode, other modes aren't likely to be interesting.
Diffstat (limited to 'kmscube.c')
-rw-r--r--kmscube.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/kmscube.c b/kmscube.c
index 9244d15..28f2dcd 100644
--- a/kmscube.c
+++ b/kmscube.c
@@ -41,7 +41,7 @@ static const struct egl *egl;
static const struct gbm *gbm;
static const struct drm *drm;
-static const char *shortopts = "Ac:D:f:M:m:S:s:V:v:";
+static const char *shortopts = "Ac:D:f:M:m:p:S:s:V:v:";
static const struct option longopts[] = {
{"atomic", no_argument, 0, 'A'},
@@ -50,6 +50,7 @@ static const struct option longopts[] = {
{"format", required_argument, 0, 'f'},
{"mode", required_argument, 0, 'M'},
{"modifier", required_argument, 0, 'm'},
+ {"perfcntr", required_argument, 0, 'p'},
{"samples", required_argument, 0, 's'},
{"video", required_argument, 0, 'V'},
{"vmode", required_argument, 0, 'v'},
@@ -71,9 +72,12 @@ static void usage(const char *name)
" nv12-2img - yuv textured (color conversion in shader)\n"
" nv12-1img - yuv textured (single nv12 texture)\n"
" -m, --modifier=MODIFIER hardcode the selected modifier\n"
+ " -p, --perfcntr=LIST sample specified performance counters using\n"
+ " the AMD_performance_monitor extension (comma\n"
+ " separated list, shadertoy mode only)\n"
" -S, --shadertoy=FILE use specified shadertoy shader\n"
" -s, --samples=N use MSAA\n"
- " -V, --video=FILE video textured cube\n"
+ " -V, --video=FILE video textured cube (comma separated list)\n"
" -v, --vmode=VMODE specify the video mode in the format\n"
" <mode>[-<vrefresh>]\n",
name);
@@ -84,6 +88,7 @@ int main(int argc, char *argv[])
const char *device = NULL;
const char *video = NULL;
const char *shadertoy = NULL;
+ const char *perfcntr = NULL;
char mode_str[DRM_DISPLAY_MODE_LEN] = "";
char *p;
enum mode mode = SMOOTH;
@@ -145,6 +150,9 @@ int main(int argc, char *argv[])
case 'm':
modifier = strtoull(optarg, NULL, 0);
break;
+ case 'p':
+ perfcntr = optarg;
+ break;
case 'S':
mode = SHADERTOY;
shadertoy = optarg;
@@ -205,6 +213,14 @@ int main(int argc, char *argv[])
return -1;
}
+ if (perfcntr) {
+ if (mode != SHADERTOY) {
+ printf("performance counters only supported in shadertoy mode\n");
+ return -1;
+ }
+ init_perfcntrs(egl, perfcntr);
+ }
+
/* clear the color buffer */
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL_COLOR_BUFFER_BIT);