aboutsummaryrefslogtreecommitdiffstats
path: root/exynos
diff options
context:
space:
mode:
authorTobias Jakobi2015-09-08 10:22:33 -0500
committerEmil Velikov2015-09-21 11:43:14 -0500
commitce4a4f6e21d4112f0b88c973283b586e1fccddd9 (patch)
tree8be8eccd2e08737e16e275c10380bc14f4092c85 /exynos
parentbf666b5e999236ec6406afd60ca35a465c6b3262 (diff)
downloadexternal-libdrm-ce4a4f6e21d4112f0b88c973283b586e1fccddd9.tar.gz
external-libdrm-ce4a4f6e21d4112f0b88c973283b586e1fccddd9.tar.xz
external-libdrm-ce4a4f6e21d4112f0b88c973283b586e1fccddd9.zip
exynos/fimg2d: add message prefix
Add a prefix to the messages printed to the console via printf() and fprintf() so that one can easily see where the message comes from. Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'exynos')
-rw-r--r--exynos/exynos_fimg2d.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 5873fe79..9746c213 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -42,6 +42,8 @@
42 42
43#define MIN(a, b) ((a) < (b) ? (a) : (b)) 43#define MIN(a, b) ((a) < (b) ? (a) : (b))
44 44
45#define MSG_PREFIX "exynos/fimg2d: "
46
45enum g2d_base_addr_reg { 47enum g2d_base_addr_reg {
46 g2d_dst = 0, 48 g2d_dst = 0,
47 g2d_src 49 g2d_src
@@ -255,7 +257,7 @@ static int g2d_flush(struct g2d_context *ctx)
255 return 0; 257 return 0;
256 258
257 if (ctx->cmdlist_nr >= G2D_MAX_CMD_LIST_NR) { 259 if (ctx->cmdlist_nr >= G2D_MAX_CMD_LIST_NR) {
258 fprintf(stderr, "Overflow cmdlist.\n"); 260 fprintf(stderr, MSG_PREFIX "command list overflow.\n");
259 return -EINVAL; 261 return -EINVAL;
260 } 262 }
261 263
@@ -271,7 +273,7 @@ static int g2d_flush(struct g2d_context *ctx)
271 273
272 ret = drmIoctl(ctx->fd, DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST, &cmdlist); 274 ret = drmIoctl(ctx->fd, DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST, &cmdlist);
273 if (ret < 0) { 275 if (ret < 0) {
274 fprintf(stderr, "failed to set cmdlist.\n"); 276 fprintf(stderr, MSG_PREFIX "failed to set cmdlist.\n");
275 return ret; 277 return ret;
276 } 278 }
277 279
@@ -293,7 +295,7 @@ struct g2d_context *g2d_init(int fd)
293 295
294 ctx = calloc(1, sizeof(*ctx)); 296 ctx = calloc(1, sizeof(*ctx));
295 if (!ctx) { 297 if (!ctx) {
296 fprintf(stderr, "failed to allocate context.\n"); 298 fprintf(stderr, MSG_PREFIX "failed to allocate context.\n");
297 return NULL; 299 return NULL;
298 } 300 }
299 301
@@ -301,7 +303,7 @@ struct g2d_context *g2d_init(int fd)
301 303
302 ret = drmIoctl(fd, DRM_IOCTL_EXYNOS_G2D_GET_VER, &ver); 304 ret = drmIoctl(fd, DRM_IOCTL_EXYNOS_G2D_GET_VER, &ver);
303 if (ret < 0) { 305 if (ret < 0) {
304 fprintf(stderr, "failed to get version.\n"); 306 fprintf(stderr, MSG_PREFIX "failed to get version.\n");
305 free(ctx); 307 free(ctx);
306 return NULL; 308 return NULL;
307 } 309 }
@@ -309,7 +311,7 @@ struct g2d_context *g2d_init(int fd)
309 ctx->major = ver.major; 311 ctx->major = ver.major;
310 ctx->minor = ver.minor; 312 ctx->minor = ver.minor;
311 313
312 printf("g2d version(%d.%d).\n", ctx->major, ctx->minor); 314 printf(MSG_PREFIX "G2D version (%d.%d).\n", ctx->major, ctx->minor);
313 return ctx; 315 return ctx;
314} 316}
315 317
@@ -335,7 +337,7 @@ int g2d_exec(struct g2d_context *ctx)
335 337
336 ret = drmIoctl(ctx->fd, DRM_IOCTL_EXYNOS_G2D_EXEC, &exec); 338 ret = drmIoctl(ctx->fd, DRM_IOCTL_EXYNOS_G2D_EXEC, &exec);
337 if (ret < 0) { 339 if (ret < 0) {
338 fprintf(stderr, "failed to execute.\n"); 340 fprintf(stderr, MSG_PREFIX "failed to execute.\n");
339 return ret; 341 return ret;
340 } 342 }
341 343
@@ -436,7 +438,7 @@ g2d_copy(struct g2d_context *ctx, struct g2d_image *src,
436 h = MIN(src_h, dst_h); 438 h = MIN(src_h, dst_h);
437 439
438 if (w <= 0 || h <= 0) { 440 if (w <= 0 || h <= 0) {
439 fprintf(stderr, "invalid width or height.\n"); 441 fprintf(stderr, MSG_PREFIX "invalid width or height.\n");
440 return -EINVAL; 442 return -EINVAL;
441 } 443 }
442 444
@@ -532,7 +534,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
532 dst_h = dst->height - dst_y; 534 dst_h = dst->height - dst_y;
533 535
534 if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) { 536 if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) {
535 fprintf(stderr, "invalid width or height.\n"); 537 fprintf(stderr, MSG_PREFIX "invalid width or height.\n");
536 return -EINVAL; 538 return -EINVAL;
537 } 539 }
538 540
@@ -633,17 +635,17 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
633 h = MIN(src_h, dst_h); 635 h = MIN(src_h, dst_h);
634 636
635 if (w <= 0 || h <= 0) { 637 if (w <= 0 || h <= 0) {
636 fprintf(stderr, "invalid width or height.\n"); 638 fprintf(stderr, MSG_PREFIX "invalid width or height.\n");
637 return -EINVAL; 639 return -EINVAL;
638 } 640 }
639 641
640 if (!g2d_validate_select_mode(src->select_mode)) { 642 if (!g2d_validate_select_mode(src->select_mode)) {
641 fprintf(stderr , "invalid select mode for source.\n"); 643 fprintf(stderr , MSG_PREFIX "invalid select mode for source.\n");
642 return -EINVAL; 644 return -EINVAL;
643 } 645 }
644 646
645 if (!g2d_validate_blending_op(op)) { 647 if (!g2d_validate_blending_op(op)) {
646 fprintf(stderr , "unsupported blending operation.\n"); 648 fprintf(stderr , MSG_PREFIX "unsupported blending operation.\n");
647 return -EINVAL; 649 return -EINVAL;
648 } 650 }
649 651
@@ -752,17 +754,17 @@ g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src,
752 dst_h = dst->height - dst_y; 754 dst_h = dst->height - dst_y;
753 755
754 if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) { 756 if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) {
755 fprintf(stderr, "invalid width or height.\n"); 757 fprintf(stderr, MSG_PREFIX "invalid width or height.\n");
756 return -EINVAL; 758 return -EINVAL;
757 } 759 }
758 760
759 if (!g2d_validate_select_mode(src->select_mode)) { 761 if (!g2d_validate_select_mode(src->select_mode)) {
760 fprintf(stderr , "invalid select mode for source.\n"); 762 fprintf(stderr , MSG_PREFIX "invalid select mode for source.\n");
761 return -EINVAL; 763 return -EINVAL;
762 } 764 }
763 765
764 if (!g2d_validate_blending_op(op)) { 766 if (!g2d_validate_blending_op(op)) {
765 fprintf(stderr , "unsupported blending operation.\n"); 767 fprintf(stderr , MSG_PREFIX "unsupported blending operation.\n");
766 return -EINVAL; 768 return -EINVAL;
767 } 769 }
768 770