summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f84ef47)
raw | patch | inline | side by side (parent: f84ef47)
author | Vincent Stehlé <v-stehle@ti.com> | |
Mon, 13 Aug 2012 12:50:28 +0000 (14:50 +0200) | ||
committer | Vincent Stehlé <v-stehle@ti.com> | |
Fri, 17 Aug 2012 14:57:02 +0000 (16:57 +0200) |
We introduce a new DBG() macro for debug printing, which can be enabled or
disabled at runtime. This, to allow benchmarking.
Signed-off-by: Vincent Stehlé <v-stehle@ti.com>
disabled at runtime. This, to allow benchmarking.
Signed-off-by: Vincent Stehlé <v-stehle@ti.com>
util/display-x11.c | patch | blob | history | |
util/util.c | patch | blob | history | |
util/util.h | patch | blob | history | |
viddec3test.c | patch | blob | history |
diff --git a/util/display-x11.c b/util/display-x11.c
index a2619dc0a83e5819738b3c07a3da4d30862d78e1..0144612a909009b327e4090c36d1842150e5b3fa 100644 (file)
--- a/util/display-x11.c
+++ b/util/display-x11.c
DRI2SwapBuffersVid(disp_x11->dpy, disp_x11->win, 0, 0, 0, &count,
buf_x11->dri2buf->attachment, &b);
- MSG("DRI2SwapBuffersVid[%u]: count=%llu",
+ DBG("DRI2SwapBuffersVid[%u]: count=%llu",
buf_x11->dri2buf->attachment, count);
return 0;
case DRI2_BufferSwapComplete:
{
// xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
- MSG("BufferSwapComplete");
+ DBG("BufferSwapComplete");
return True;
}
default:
diff --git a/util/util.c b/util/util.c
index fde68a34620046300045cc96bf7db70b6d27ab0f..5e69cdf4c92219973c5252bd9ed9b8ef3fc0fca6 100644 (file)
--- a/util/util.c
+++ b/util/util.c
#include <drm.h>
+/* Dynamic debug. */
+int debug = 0;
+
void disp_kms_usage(void);
struct display * disp_kms_open(int argc, char **argv);
disp_usage(void)
{
MSG("Generic Display options:");
+ MSG("\t--debug\tTurn on debug messages.");
MSG("\t--fps <fps>\tforce playback rate (0 means \"do not force\")");
MSG("\t--no-post\tDo not post buffers (disables screen updates) for benchmarking. Rate can still be controlled.");
if (!argv[i]) {
continue;
}
- if (!strcmp("--fps", argv[i])) {
+ if (!strcmp("--debug", argv[i])) {
+ debug = 1;
+ MSG("Enabling dynamic debug.");
+ argv[i] = NULL;
+
+ } else if (!strcmp("--fps", argv[i])) {
argv[i++] = NULL;
if (sscanf(argv[i], "%d", &fps) != 1) {
usecs_between_frames = 1000000 / p->fps;
usecs_since_last_frame = mark(&p->last_frame_mark);
- MSG("fps: %.02f", 1000000.0 / usecs_since_last_frame);
+ DBG("fps: %.02f", 1000000.0 / usecs_since_last_frame);
usecs_to_sleep = usecs_between_frames - usecs_since_last_frame + p->usecs_to_sleep;
if (usecs_to_sleep < 0)
p->usecs_to_sleep = ((67 * p->usecs_to_sleep) + (33 * usecs_to_sleep)) / 100;
if (p->usecs_to_sleep >= 1) {
- MSG("sleeping %dus", p->usecs_to_sleep);
+ DBG("sleeping %dus", p->usecs_to_sleep);
usleep(p->usecs_to_sleep);
}
}
diff --git a/util/util.h b/util/util.h
index 505bdcb465561c8023184feeac40385df866d5b6..363ad72c1ecb7051d1a465aad7fdcc6b6cfb0115 100644 (file)
--- a/util/util.h
+++ b/util/util.h
/* Other utilities..
*/
+extern int debug;
int check_args(int argc, char **argv);
#define FOURCC(a, b, c, d) ((uint32_t)(uint8_t)(a) | ((uint32_t)(uint8_t)(b) << 8) | ((uint32_t)(uint8_t)(c) << 16) | ((uint32_t)(uint8_t)(d) << 24 ))
#define FOURCC_STR(str) FOURCC(str[0], str[1], str[2], str[3])
+/* Dynamic debug. */
+#define DBG(fmt, ...) \
+ do { if (debug) fprintf(stderr, fmt "\n", ##__VA_ARGS__); } while (0)
+
#define MSG(fmt, ...) \
do { fprintf(stderr, fmt "\n", ##__VA_ARGS__); } while (0)
#define ERROR(fmt, ...) \
diff --git a/viddec3test.c b/viddec3test.c
index 78a3548ebff3537b6f55a5f531ce5e67275c66a4..1355b02b1673e3f7c03c74593f6eeb64d1ddb9eb 100644 (file)
--- a/viddec3test.c
+++ b/viddec3test.c
if (n) {
inBufs->descs[0].bufSize.bytes = n;
inArgs->numBytes = n;
- MSG("%p: push: %d bytes (%p)", decoder, n, buf);
+ DBG("%p: push: %d bytes (%p)", decoder, n, buf);
} else {
/* end of input.. do we need to flush? */
MSG("%p: end of input", decoder);
tproc = mark(NULL);
err = VIDDEC3_process(decoder->codec, inBufs, outBufs, inArgs, outArgs);
- MSG("%p: processed returned in: %ldus", decoder, (long int)mark(&tproc));
+ DBG("%p: processed returned in: %ldus", decoder, (long int)mark(&tproc));
if (err) {
ERROR("%p: process returned error: %d", decoder, err);
ERROR("%p: extendedError: %08x", decoder, outArgs->extendedError);
/* get the output buffer and write it to file */
buf = (struct buffer *)outArgs->outputID[i];
- MSG("%p: post buffer: %p %d,%d %d,%d", decoder, buf,
+ DBG("%p: post buffer: %p %d,%d %d,%d", decoder, buf,
r->topLeft.x, r->topLeft.y,
r->bottomRight.x, r->bottomRight.y);
disp_post_vid_buffer(decoder->disp, buf,
r->topLeft.x, r->topLeft.y,
r->bottomRight.x - r->topLeft.x,
r->bottomRight.y - r->topLeft.y);
- MSG("%p: display in: %ldus", decoder, (long int)mark(&decoder->tdisp));
+ DBG("%p: display in: %ldus", decoder, (long int)mark(&decoder->tdisp));
}
for (i = 0; outArgs->freeBufID[i]; i++) {