Skip to contentSkip to conversation

tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane

PATCH In review Mamta Shukla 4 participants 5 messages Jan 9, 2019 – Jan 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane

Add test to check extreme alpha values i.e. fully opaque and fully transparent for cursor plane and verify by calculating hardware and software CRC.

---
changes in v2:
1.Remove unnecessary new line.
2.Add functions to clear screen in test_cursor_alpha function.

 tests/kms_cursor_crc.c | 80 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 73 insertions(+), 7 deletions(-)
tests/kms_cursor_crc.c +73 -7
index 1514e7f2..8c1ecc2b 100644
@@ -65,7 +65,7 @@ typedef struct {
 #define TEST_DPMS (1<<0)
 #define TEST_SUSPEND (1<<1)
 
-static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
+static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
 {
 	int wl, wr, ht, hb;
 
@@ -80,10 +80,10 @@ static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
 		return;
 	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
 	/* 4 color rectangles in the corners, RGBY */
-	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, 1.0);
-	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, 1.0);
-	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, 1.0);
-	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, 1.0);
+	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
+	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
+	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
+	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, a);
 }
 
 static void cursor_enable(data_t *data)
@@ -200,7 +200,7 @@ static void do_single_test(data_t *data, int x, int y)
 
 	/* Now render the same in software and collect crc */
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
-	draw_cursor(cr, x, y, data->curw, data->curh);
+	draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
 	igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
 	igt_display_commit(display);
 
@@ -404,6 +404,64 @@ static void cleanup_crtc(data_t *data, igt_output_t *output)
 	igt_display_commit(display);
 }
 
+static void test_cursor_alpha(data_t *data, double a)
+{
+	igt_display_t *display = &data->display;
+	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
+	igt_crc_t crc, ref_crc;
+	cairo_t *cr;
+	uint32_t fb_id;
+	int curw=data->curw;
+	int curh=data->curh;
+
+	/*alpha cursor fb*/
+	fb_id = igt_create_color_fb(data->drm_fd, curw, curh,
+				    DRM_FORMAT_ARGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    1.0, 1.0, 1.0,
+				    &data->fb);
+	igt_assert(fb_id);
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
+	draw_cursor(cr, 0, 0, curw, curh, a);
+	igt_put_cairo_ctx(data->drm_fd, &data->fb, cr);
+
+	/*Hardware Test*/
+	cursor_enable(data);
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &crc);
+	cursor_disable(data);
+
+	/*Software Test*/
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
+	igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
+	igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
+
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
+	igt_assert_crc_equal(&crc, &ref_crc);
+	
+	/*Clear Screen*/
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
+	igt_paint_color(cr, 0, 0, data->screenw, data->screenh,
+			0.0, 0.0, 0.0);
+	igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
+	igt_remove_fb(data->drm_fd, &data->fb);
+}
+
+static void test_cursor_transparent(data_t *data)
+{
+	test_cursor_alpha(data, 0.0);
+
+}
+
+static void test_cursor_opaque(data_t *data)
+{
+	test_cursor_alpha(data, 1.0);
+}
+
+
 static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int cursor_h)
 {
 	igt_display_t *display = &data->display;
@@ -461,7 +519,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
-	draw_cursor(cr, 0, 0, cur_w, cur_h);
+	draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
 	igt_put_cairo_ctx(data->drm_fd, &data->fb, cr);
 }
 
@@ -684,6 +742,14 @@ igt_main
 	igt_subtest_f("cursor-size-change")
 		run_test(&data, test_cursor_size, cursor_width, cursor_height);
 
+	igt_subtest_f("cursor-alpha-opaque") {
+		run_test(&data, test_cursor_opaque, cursor_width, cursor_height);
+	 }
+
+	igt_subtest_f("cursor-alpha-transparent") {
+		run_test(&data, test_cursor_transparent, cursor_width, cursor_height);
+	 }
+
 	run_test_generic(&data);
 
 	igt_fixture {
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane (rev2)

== Series Details ==

== Series Details ==

Series: tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane (rev2)
URL : https://patchwork.freedesktop.org/series/54465/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5385 -> IGTPW_2209
====================================================

Summary
-------

**WARNING**

Minor unknown changes coming with IGTPW_2209 need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_2209, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/54465/revisions/2/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_2209:

### IGT changes ###

#### Warnings ####

* igt@pm_rpm@basic-pci-d3-state:
- fi-byt-j1900: PASS -> SKIP

Known issues
------------

Here are the changes found in IGTPW_2209 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@pm_rpm@basic-rte:
- fi-byt-j1900: PASS -> FAIL [fdo#108800]

#### Possible fixes ####

* igt@i915_selftest@live_hangcheck:
- fi-skl-gvtdvm: INCOMPLETE [fdo#105600] / [fdo#108744] -> PASS

* igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: FAIL [fdo#103167] -> PASS

* igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS +1

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#105600]: https://bugs.freedesktop.org/show_bug.cgi?id=105600
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744
[fdo#108800]: https://bugs.freedesktop.org/show_bug.cgi?id=108800
[fdo#108915]: https://bugs.freedesktop.org/show_bug.cgi?id=108915
[fdo#109241]: https://bugs.freedesktop.org/show_bug.cgi?id=109241

Participating hosts (50 -> 44)
------------------------------

Additional (1): fi-icl-y
Missing (7): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-pnv-d510 fi-bdw-samus

Build changes
-------------

* IGT: IGT_4757 -> IGTPW_2209

CI_DRM_5385: 346fc3a4144b7c1517135142e3a949f20103a896 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2209: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2209/
IGT_4757: 738f43a54d626f08e250c926a5aeec53458fbd3c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Testlist changes ==

+igt@kms_cursor_crc@cursor-alpha-opaque
+igt@kms_cursor_crc@cursor-alpha-transparent

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2209/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane (rev2)

In reply to Mamta Shukla
== Series Details ==

== Series Details ==

Series: tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane (rev2)
URL : https://patchwork.freedesktop.org/series/54465/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5385_full -> IGTPW_2209_full
====================================================

Summary
-------

**WARNING**

Minor unknown changes coming with IGTPW_2209_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_2209_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/54465/revisions/2/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_2209_full:

### IGT changes ###

#### Warnings ####

* igt@pm_rc6_residency@rc6-accuracy:
- shard-snb: PASS -> SKIP

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* {igt@kms_cursor_crc@cursor-alpha-opaque}:

    - shard-kbl:          NOTRUN -> FAIL +1
    - shard-apl:          NOTRUN -> FAIL +1
    - shard-snb:          NOTRUN -> FAIL +1

* {igt@kms_cursor_crc@cursor-alpha-transparent}:
- shard-hsw: NOTRUN -> FAIL +1
- shard-glk: NOTRUN -> FAIL +1

Known issues
------------

Here are the changes found in IGTPW_2209_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_busy@extended-modeset-hang-newfb-render-b:
- shard-glk: PASS -> DMESG-WARN [fdo#107956]

* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
- shard-kbl: PASS -> DMESG-WARN [fdo#107956]

* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a:
- shard-apl: PASS -> DMESG-WARN [fdo#107956]

* igt@kms_color@pipe-b-ctm-max:
- shard-apl: PASS -> FAIL [fdo#108147]
- shard-kbl: PASS -> FAIL [fdo#108147]

* igt@kms_content_protection@atomic:
- shard-kbl: NOTRUN -> FAIL [fdo#108597]

* igt@kms_cursor_crc@cursor-64x21-sliding:
- shard-apl: PASS -> FAIL [fdo#103232] +4

* igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-glk: PASS -> FAIL [fdo#103232] +3

* igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
- shard-hsw: PASS -> INCOMPLETE [fdo#103540]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-apl: PASS -> FAIL [fdo#103167] +4

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
- shard-glk: PASS -> FAIL [fdo#103167] +12

* igt@kms_plane@plane-position-covered-pipe-b-planes:
- shard-kbl: PASS -> FAIL [fdo#103166]

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-apl: PASS -> FAIL [fdo#108145] +1

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max:
- shard-glk: PASS -> FAIL [fdo#108145] +1
- shard-kbl: PASS -> FAIL [fdo#108145]

* igt@kms_plane_multiple@atomic-pipe-c-tiling-none:
- shard-glk: PASS -> FAIL [fdo#103166] +4

* igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
- shard-apl: PASS -> FAIL [fdo#103166] +5

* igt@kms_setmode@basic:
- shard-kbl: PASS -> FAIL [fdo#99912]

* igt@kms_sysfs_edid_timing:
- shard-kbl: NOTRUN -> FAIL [fdo#100047]

#### Possible fixes ####

* igt@gem_persistent_relocs@forked-interruptible-thrashing:
- shard-snb: INCOMPLETE [fdo#105411] -> PASS

* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-apl: FAIL [fdo#106641] -> PASS

* igt@kms_color@pipe-b-legacy-gamma:
- shard-apl: FAIL [fdo#104782] -> PASS

* igt@kms_cursor_crc@cursor-128x128-dpms:
- shard-apl: FAIL [fdo#103232] -> PASS

* igt@kms_cursor_crc@cursor-256x256-random:
- shard-glk: FAIL [fdo#103232] -> PASS +1

* igt@kms_cursor_crc@cursor-256x256-suspend:
- shard-apl: FAIL [fdo#103191] / [fdo#103232] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite:
- shard-apl: FAIL [fdo#103167] -> PASS +1

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-move:
- shard-kbl: FAIL [fdo#103167] -> PASS

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-blt:
- shard-glk: FAIL [fdo#103167] -> PASS

* igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
- shard-glk: FAIL [fdo#108145] -> PASS

* igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
- shard-apl: FAIL [fdo#103166] -> PASS +1
- shard-kbl: FAIL [fdo#103166] -> PASS

* igt@kms_plane_multiple@atomic-pipe-b-tiling-x:
- shard-glk: FAIL [fdo#103166] -> PASS +1

#### Warnings ####

* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-kbl: DMESG-FAIL [fdo#108950] -> DMESG-WARN [fdo#105604]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
[fdo#105604]: https://bugs.freedesktop.org/show_bug.cgi?id=105604
[fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108147]: https://bugs.freedesktop.org/show_bug.cgi?id=108147
[fdo#108597]: https://bugs.freedesktop.org/show_bug.cgi?id=108597
[fdo#108950]: https://bugs.freedesktop.org/show_bug.cgi?id=108950
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (7 -> 5)
------------------------------

Missing (2): shard-skl shard-iclb

Build changes
-------------

* IGT: IGT_4757 -> IGTPW_2209
* Piglit: piglit_4509 -> None

CI_DRM_5385: 346fc3a4144b7c1517135142e3a949f20103a896 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2209: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2209/
IGT_4757: 738f43a54d626f08e250c926a5aeec53458fbd3c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2209/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Reviewed-by on v2 1/1
#3 lore raw
In reply to Mamta Shukla
Quoted 4 lines · Mamta Shukla

Add test to check extreme alpha values i.e. fully opaque and fully transparent for cursor plane and verify by calculating hardware and software CRC.

Harry

Quoted 126 lines

---
changes in v2:
1.Remove unnecessary new line.
2.Add functions to clear screen in test_cursor_alpha function.

 tests/kms_cursor_crc.c | 80 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 73 insertions(+), 7 deletions(-)
tests/kms_cursor_crc.c +66 -7
index 1514e7f2..8c1ecc2b 100644
@@ -65,7 +65,7 @@ typedef struct {
 #define TEST_DPMS (1<<0)
 #define TEST_SUSPEND (1<<1)
 
-static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
+static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
 {
 	int wl, wr, ht, hb;
 
@@ -80,10 +80,10 @@ static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
 		return;
 	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
 	/* 4 color rectangles in the corners, RGBY */
-	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, 1.0);
-	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, 1.0);
-	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, 1.0);
-	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, 1.0);
+	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
+	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
+	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
+	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, a);
 }
 
 static void cursor_enable(data_t *data)
@@ -200,7 +200,7 @@ static void do_single_test(data_t *data, int x, int y)
 
 	/* Now render the same in software and collect crc */
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
-	draw_cursor(cr, x, y, data->curw, data->curh);
+	draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
 	igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
 	igt_display_commit(display);
 
@@ -404,6 +404,64 @@ static void cleanup_crtc(data_t *data, igt_output_t *output)
 	igt_display_commit(display);
 }
 
+static void test_cursor_alpha(data_t *data, double a)
+{
+	igt_display_t *display = &data->display;
+	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
+	igt_crc_t crc, ref_crc;
+	cairo_t *cr;
+	uint32_t fb_id;
+	int curw=data->curw;
+	int curh=data->curh;
+
+	/*alpha cursor fb*/
+	fb_id = igt_create_color_fb(data->drm_fd, curw, curh,
+				    DRM_FORMAT_ARGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    1.0, 1.0, 1.0,
+				    &data->fb);
+	igt_assert(fb_id);
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
+	draw_cursor(cr, 0, 0, curw, curh, a);
+	igt_put_cairo_ctx(data->drm_fd, &data->fb, cr);
+
+	/*Hardware Test*/
+	cursor_enable(data);
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &crc);
+	cursor_disable(data);
+
+	/*Software Test*/
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
+	igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
+	igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
+
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
+	igt_assert_crc_equal(&crc, &ref_crc);
+	
+	/*Clear Screen*/
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
+	igt_paint_color(cr, 0, 0, data->screenw, data->screenh,
+			0.0, 0.0, 0.0);
+	igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
+	igt_remove_fb(data->drm_fd, &data->fb);
+}
+
+static void test_cursor_transparent(data_t *data)
+{
+	test_cursor_alpha(data, 0.0);
+
+}
+
+static void test_cursor_opaque(data_t *data)
+{
+	test_cursor_alpha(data, 1.0);
+}
+
+
 static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int cursor_h)
 {
 	igt_display_t *display = &data->display;
@@ -461,7 +519,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
-	draw_cursor(cr, 0, 0, cur_w, cur_h);
+	draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
 	igt_put_cairo_ctx(data->drm_fd, &data->fb, cr);
 }
 
@@ -684,6 +742,14 @@ igt_main
 	igt_subtest_f("cursor-size-change")
 		run_test(&data, test_cursor_size, cursor_width, cursor_height);
 
+	igt_subtest_f("cursor-alpha-opaque") {

tests/kms_cursor_crc.c igt_main · line 755

Quoted 10 lines
tests/kms_cursor_crc.c +7 -0
+		run_test(&data, test_cursor_opaque, cursor_width, cursor_height);
+	 }
+
+	igt_subtest_f("cursor-alpha-transparent") {
+		run_test(&data, test_cursor_transparent, cursor_width, cursor_height);
+	 }
+
 	run_test_generic(&data);
 
 	igt_fixture {

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Reviewed-by on v2 1/1
#4 lore raw
In reply to Mamta Shukla
Quoted 4 lines · Mamta Shukla

Add test to check extreme alpha values i.e. fully opaque and fully transparent for cursor plane and verify by calculating hardware and software CRC.

The RB from my gmail seems to still be stuck in transit so once more from my AMD account:

I'll also merge it.

Harry

Quoted 126 lines

---
changes in v2:
1.Remove unnecessary new line.
2.Add functions to clear screen in test_cursor_alpha function.

 tests/kms_cursor_crc.c | 80 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 73 insertions(+), 7 deletions(-)
tests/kms_cursor_crc.c +66 -7
index 1514e7f2..8c1ecc2b 100644
@@ -65,7 +65,7 @@ typedef struct {
 #define TEST_DPMS (1<<0)
 #define TEST_SUSPEND (1<<1)
 
-static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
+static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
 {
 	int wl, wr, ht, hb;
 
@@ -80,10 +80,10 @@ static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
 		return;
 	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
 	/* 4 color rectangles in the corners, RGBY */
-	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, 1.0);
-	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, 1.0);
-	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, 1.0);
-	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, 1.0);
+	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
+	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
+	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
+	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, a);
 }
 
 static void cursor_enable(data_t *data)
@@ -200,7 +200,7 @@ static void do_single_test(data_t *data, int x, int y)
 
 	/* Now render the same in software and collect crc */
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
-	draw_cursor(cr, x, y, data->curw, data->curh);
+	draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
 	igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
 	igt_display_commit(display);
 
@@ -404,6 +404,64 @@ static void cleanup_crtc(data_t *data, igt_output_t *output)
 	igt_display_commit(display);
 }
 
+static void test_cursor_alpha(data_t *data, double a)
+{
+	igt_display_t *display = &data->display;
+	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
+	igt_crc_t crc, ref_crc;
+	cairo_t *cr;
+	uint32_t fb_id;
+	int curw=data->curw;
+	int curh=data->curh;
+
+	/*alpha cursor fb*/
+	fb_id = igt_create_color_fb(data->drm_fd, curw, curh,
+				    DRM_FORMAT_ARGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    1.0, 1.0, 1.0,
+				    &data->fb);
+	igt_assert(fb_id);
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
+	draw_cursor(cr, 0, 0, curw, curh, a);
+	igt_put_cairo_ctx(data->drm_fd, &data->fb, cr);
+
+	/*Hardware Test*/
+	cursor_enable(data);
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &crc);
+	cursor_disable(data);
+
+	/*Software Test*/
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
+	igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
+	igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
+
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
+	igt_assert_crc_equal(&crc, &ref_crc);
+	
+	/*Clear Screen*/
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
+	igt_paint_color(cr, 0, 0, data->screenw, data->screenh,
+			0.0, 0.0, 0.0);
+	igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
+	igt_remove_fb(data->drm_fd, &data->fb);
+}
+
+static void test_cursor_transparent(data_t *data)
+{
+	test_cursor_alpha(data, 0.0);
+
+}
+
+static void test_cursor_opaque(data_t *data)
+{
+	test_cursor_alpha(data, 1.0);
+}
+
+
 static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int cursor_h)
 {
 	igt_display_t *display = &data->display;
@@ -461,7 +519,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
-	draw_cursor(cr, 0, 0, cur_w, cur_h);
+	draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
 	igt_put_cairo_ctx(data->drm_fd, &data->fb, cr);
 }
 
@@ -684,6 +742,14 @@ igt_main
 	igt_subtest_f("cursor-size-change")
 		run_test(&data, test_cursor_size, cursor_width, cursor_height);
 
+	igt_subtest_f("cursor-alpha-opaque") {

tests/kms_cursor_crc.c igt_main · line 755

Quoted 10 lines
tests/kms_cursor_crc.c +7 -0
+		run_test(&data, test_cursor_opaque, cursor_width, cursor_height);
+	 }
+
+	igt_subtest_f("cursor-alpha-transparent") {
+		run_test(&data, test_cursor_transparent, cursor_width, cursor_height);
+	 }
+
 	run_test_generic(&data);
 
 	igt_fixture {

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev