aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Jakobi2015-02-24 08:20:48 -0600
committerEmil Velikov2015-03-10 14:21:52 -0500
commit734d13b13b2f6f02465bf51412e0c2be255eb8b5 (patch)
tree80eccf2671ccb5ff8c9be4467f9171ae40c1d373 /tests/exynos/exynos_fimg2d_test.c
parent74add49f1b829dd580aae1dfdce2a0ebbbba216c (diff)
downloadexternal-libgbm-734d13b13b2f6f02465bf51412e0c2be255eb8b5.tar.gz
external-libgbm-734d13b13b2f6f02465bf51412e0c2be255eb8b5.tar.xz
external-libgbm-734d13b13b2f6f02465bf51412e0c2be255eb8b5.zip
tests/exynos: improve error handling
Check for a useable connector and also if the resolution is sane (width and height are both non-zero). Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
Diffstat (limited to 'tests/exynos/exynos_fimg2d_test.c')
-rw-r--r--tests/exynos/exynos_fimg2d_test.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index d89fc231..14b38a9e 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -616,10 +616,22 @@ int main(int argc, char **argv)
616 connector_find_mode(dev->fd, &con, resources); 616 connector_find_mode(dev->fd, &con, resources);
617 drmModeFreeResources(resources); 617 drmModeFreeResources(resources);
618 618
619 if (!con.mode) {
620 fprintf(stderr, "failed to find usable connector\n");
621 ret = -EFAULT;
622 goto err_drm_close;
623 }
624
619 screen_width = con.mode->hdisplay; 625 screen_width = con.mode->hdisplay;
620 screen_height = con.mode->vdisplay; 626 screen_height = con.mode->vdisplay;
621 627
622 printf("screen width = %d, screen height = %d\n", screen_width, 628 if (screen_width == 0 || screen_height == 0) {
629 fprintf(stderr, "failed to find sane resolution on connector\n");
630 ret = -EFAULT;
631 goto err_drm_close;
632 }
633
634 printf("screen width = %d, screen height = %d\n", screen_width,
623 screen_height); 635 screen_height);
624 636
625 bo = exynos_create_buffer(dev, screen_width * screen_height * 4, 0); 637 bo = exynos_create_buffer(dev, screen_width * screen_height * 4, 0);