diff options
author | Sean Callanan <spyffe@google.com> | 2019-12-05 18:05:14 -0800 |
---|---|---|
committer | Sean Callanan <spyffe@google.com> | 2019-12-06 16:47:39 -0800 |
commit | 684dc9227b078f0b0856770819f5766549fe2563 (patch) | |
tree | 506b651efaa4e7b0b9ef8933537c07f09107fb9c | |
parent | 2db11e1cbb37315375fd7cc70365f5297cd39580 (diff) | |
download | platform_external_igt-gpu-tools-684dc9227b078f0b0856770819f5766549fe2563.tar.gz platform_external_igt-gpu-tools-684dc9227b078f0b0856770819f5766549fe2563.tar.bz2 platform_external_igt-gpu-tools-684dc9227b078f0b0856770819f5766549fe2563.zip |
igt-gpu-tools: build kms_atomic test
kms_flip tests the legacy buffer flipping path, whereas kms_atomic
validates the modern atomic path. Build that, while extracting a
few unresolved Cairo dependencies.
Test: builds and runs (but fails) on a Pixel 4.
Bug: 145776589
Change-Id: I78c7bd9c661ef47b7633e1e2d905ec0b107e49d9
-rw-r--r-- | Android.bp | 8 | ||||
-rw-r--r-- | lib/igt_fb.c | 12 | ||||
-rw-r--r-- | lib/sw_sync.c | 2 | ||||
-rw-r--r-- | tests/kms_atomic.c | 19 |
4 files changed, 32 insertions, 9 deletions
@@ -22,6 +22,7 @@ cc_library_static { "lib/gem.c", "lib/gem_msm.c", "lib/igt_aux.c", + "lib/igt_color_encoding.c", "lib/igt_core.c", "lib/igt_debugfs.c", "lib/igt_device.c", @@ -33,6 +34,7 @@ cc_library_static { "lib/igt_sysfs.c", "lib/ion.c", "lib/ioctl_wrappers.c", + "lib/sw_sync.c", "lib/i915/gem_mman.c", "lib/uwildmat/uwildmat.c", ], @@ -63,6 +65,12 @@ cc_test { } cc_test { + name: "kms_atomic", + defaults: ["igt-gpu-tools-test-defaults"], + srcs: ["tests/kms_atomic.c"], +} + +cc_test { name: "ion_fb", defaults: ["igt-gpu-tools-test-defaults"], srcs: ["tests/ion_fb.c"], diff --git a/lib/igt_fb.c b/lib/igt_fb.c index f5a4e5f2..879211f7 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -1635,9 +1635,11 @@ unsigned int igt_create_color_fb(int fd, int width, int height, fb_id = igt_create_fb(fd, width, height, format, modifier, fb); igt_assert(fb_id); +#if defined(USE_CAIRO_PIXMAN) cr = igt_get_cairo_ctx(fd, fb); igt_paint_color(cr, 0, 0, width, height, r, g, b); igt_put_cairo_ctx(fd, fb, cr); +#endif return fb_id; } @@ -1672,9 +1674,11 @@ unsigned int igt_create_pattern_fb(int fd, int width, int height, fb_id = igt_create_fb(fd, width, height, format, modifier, fb); igt_assert(fb_id); +#if defined(USE_CAIRO_PIXMAN) cr = igt_get_cairo_ctx(fd, fb); igt_paint_test_pattern(cr, width, height); igt_put_cairo_ctx(fd, fb, cr); +#endif return fb_id; } @@ -1714,10 +1718,12 @@ unsigned int igt_create_color_pattern_fb(int fd, int width, int height, fb_id = igt_create_fb(fd, width, height, format, modifier, fb); igt_assert(fb_id); +#if defined(USE_CAIRO_PIXMAN) cr = igt_get_cairo_ctx(fd, fb); igt_paint_color(cr, 0, 0, width, height, r, g, b); igt_paint_test_pattern(cr, width, height); igt_put_cairo_ctx(fd, fb, cr); +#endif return fb_id; } @@ -3576,8 +3582,12 @@ bool igt_fb_supported_format(uint32_t drm_format) if (f->drm_id == drm_format) return (f->cairo_id != CAIRO_FORMAT_INVALID) || (f->pixman_id != PIXMAN_invalid); -#endif + return false; +#else + /* If we don't use Cairo/Pixman, all formats are equally good */ + return true; +#endif } /** diff --git a/lib/sw_sync.c b/lib/sw_sync.c index d671923c..9a3bd6cd 100644 --- a/lib/sw_sync.c +++ b/lib/sw_sync.c @@ -33,7 +33,7 @@ #include <stdint.h> #include <sys/ioctl.h> -#include "sync_file.h" +#include <linux/sync_file.h> #include "igt_debugfs.h" #include "igt_kmod.h" diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c index 8462d128..e34bee6c 100644 --- a/tests/kms_atomic.c +++ b/tests/kms_atomic.c @@ -302,6 +302,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output, format_overlay, I915_TILING_NONE, 0.2, 0.2, 0.2, &fb_overlay); +#if defined(USE_CAIRO_PIXMAN) /* Draw a hole in the overlay */ cr = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_overlay); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); @@ -310,6 +311,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output, 0.0, 0.0, 0.0, 0.0); cairo_set_operator(cr, CAIRO_OPERATOR_OVER); igt_put_cairo_ctx(pipe->display->drm_fd, &fb_overlay, cr); +#endif igt_plane_set_fb(primary, &fb_primary); igt_plane_set_fb(overlay, &fb_overlay); @@ -337,6 +339,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output, igt_assert_eq_u64(igt_plane_get_prop(overlay, IGT_PLANE_ZPOS), 0); /* Draw a hole in the primary exactly on top of the overlay plane */ +#if defined(USE_CAIRO_PIXMAN) cr = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_primary); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); igt_paint_color_alpha(cr, w_overlay / 2, h_overlay / 2, @@ -344,6 +347,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output, 0.0, 0.0, 0.0, 0.5); cairo_set_operator(cr, CAIRO_OPERATOR_OVER); igt_put_cairo_ctx(pipe->display->drm_fd, &fb_primary, cr); +#endif igt_info("Committing with a hole in the primary through "\ "which the underlay should be seen\n"); @@ -683,7 +687,8 @@ static void crtc_invalid_params_fence(igt_pipe_t *pipe, { int timeline, fence_fd; void *map; - const ptrdiff_t PAGE_SIZE = sysconf(_SC_PAGE_SIZE); + const ptrdiff_t page_size = sysconf(_SC_PAGE_SIZE); + uint64_t old_mode_id = pipe->values[IGT_CRTC_MODE_ID]; igt_require_sw_sync(); @@ -691,28 +696,28 @@ static void crtc_invalid_params_fence(igt_pipe_t *pipe, timeline = sw_sync_timeline_create(); /* invalid out_fence_ptr */ - map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + map = mmap(NULL, page_size, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); igt_assert(map != MAP_FAILED); igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map); crtc_commit_atomic_err(pipe, plane, ATOMIC_RELAX_NONE, EFAULT); - munmap(map, PAGE_SIZE); + munmap(map, page_size); /* invalid out_fence_ptr */ - map = mmap(NULL, PAGE_SIZE, PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + map = mmap(NULL, page_size, PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); igt_assert(map != MAP_FAILED); igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map); crtc_commit_atomic_err(pipe, plane, ATOMIC_RELAX_NONE, EFAULT); - munmap(map, PAGE_SIZE); + munmap(map, page_size); /* invalid out_fence_ptr */ - map = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + map = mmap(NULL, page_size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); igt_assert(map != MAP_FAILED); igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map); crtc_commit_atomic_err(pipe, plane, ATOMIC_RELAX_NONE, EFAULT); - munmap(map, PAGE_SIZE); + munmap(map, page_size); /* valid in fence but not allowed prop on crtc */ fence_fd = sw_sync_timeline_create_fence(timeline, 1); |