tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane
PATCH 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.
--- tests/kms_cursor_crc.c | 77 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 7 deletions(-)
tests/kms_cursor_crc.c +70 -7
@@ -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,61 @@ 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); +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 +516,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 +739,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
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane
== Series Details ==
== Series Details ==
Series: tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane
URL : https://patchwork.freedesktop.org/series/54465/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5341 -> IGTPW_2178
====================================================
Summary
-------
**WARNING**
Minor unknown changes coming with IGTPW_2178 need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_2178, 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/1/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_2178:
### IGT changes ###
#### Warnings ####
* igt@pm_rpm@basic-pci-d3-state:
- fi-bsw-n3050: PASS -> SKIP
Known issues
------------
Here are the changes found in IGTPW_2178 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_ctx_create@basic-files:
- fi-bsw-n3050: PASS -> FAIL [fdo#108656]
* igt@gem_exec_suspend@basic-s4-devices:
- fi-kbl-7500u: PASS -> DMESG-WARN [fdo#105128] / [fdo#107139]
* igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: PASS -> FAIL [fdo#103167]
* igt@pm_rpm@basic-rte:
- fi-bsw-n3050: PASS -> FAIL [fdo#108800]
#### Possible fixes ####
* igt@gem_ctx_create@basic-files:
- fi-bsw-kefka: FAIL [fdo#108656] -> PASS
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: FAIL [fdo#108767] -> PASS
* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u3: FAIL [fdo#103167] -> PASS
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b-frame-sequence:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS
#### Warnings ####
* igt@i915_selftest@live_contexts:
- fi-icl-u3: INCOMPLETE [fdo#108315] -> DMESG-FAIL [fdo#108569]
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#105128]: https://bugs.freedesktop.org/show_bug.cgi?id=105128
[fdo#107139]: https://bugs.freedesktop.org/show_bug.cgi?id=107139
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#108315]: https://bugs.freedesktop.org/show_bug.cgi?id=108315
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#108656]: https://bugs.freedesktop.org/show_bug.cgi?id=108656
[fdo#108767]: https://bugs.freedesktop.org/show_bug.cgi?id=108767
[fdo#108800]: https://bugs.freedesktop.org/show_bug.cgi?id=108800
Participating hosts (49 -> 42)
------------------------------
Missing (7): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-icl-y
Build changes
-------------
* IGT: IGT_4753 -> IGTPW_2178
CI_DRM_5341: 35ab0477f054cebc4370691690f27fb0589aa2f8 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2178: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2178/
IGT_4753: 0bc683ea2dcf270b5287ffb4a6510fdff44e9390 @ 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_2178/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane
In reply to Mamta Shukla== Series Details ==
== Series Details ==
Series: tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane
URL : https://patchwork.freedesktop.org/series/54465/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5341_full -> IGTPW_2178_full
====================================================
Summary
-------
**WARNING**
Minor unknown changes coming with IGTPW_2178_full need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_2178_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/1/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_2178_full:
### IGT changes ###
#### Possible regressions ####
* {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
- shard-glk: NOTRUN -> FAIL +1
#### Warnings ####
* igt@pm_rc6_residency@rc6-accuracy:
- shard-snb: PASS -> SKIP
Known issues
------------
Here are the changes found in IGTPW_2178_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_fence@basic-await-default:
- shard-hsw: PASS -> FAIL [fdo#108888]
* igt@gem_tiled_swapping@non-threaded:
- shard-apl: PASS -> INCOMPLETE [fdo#103927] +1
* igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
- shard-apl: PASS -> FAIL [fdo#106510] / [fdo#108145]
* igt@kms_ccs@pipe-b-crc-sprite-planes-basic:
- shard-glk: PASS -> FAIL [fdo#108145]
* igt@kms_cursor_crc@cursor-128x128-suspend:
- shard-apl: PASS -> FAIL [fdo#103191] / [fdo#103232]
* igt@kms_cursor_crc@cursor-128x42-onscreen:
- shard-kbl: PASS -> FAIL [fdo#103232]
* igt@kms_cursor_crc@cursor-256x256-sliding:
- shard-glk: PASS -> FAIL [fdo#103232] +1
* igt@kms_cursor_crc@cursor-64x21-sliding:
- shard-apl: PASS -> FAIL [fdo#103232] +3
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-onoff:
- shard-apl: PASS -> FAIL [fdo#103167] +2
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
- shard-kbl: PASS -> FAIL [fdo#103167] +1
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
- shard-glk: PASS -> FAIL [fdo#103167] +9
* igt@kms_frontbuffer_tracking@fbc-2p-rte:
- shard-glk: PASS -> FAIL [fdo#103167] / [fdo#105682]
* igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-pri-indfb-draw-mmap-cpu:
- shard-snb: SKIP -> INCOMPLETE [fdo#105411]
* igt@kms_plane@pixel-format-pipe-b-planes-source-clamping:
- shard-glk: PASS -> FAIL [fdo#108948]
* igt@kms_plane@plane-position-covered-pipe-a-planes:
- shard-glk: PASS -> FAIL [fdo#103166] +8
* igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
- shard-apl: PASS -> FAIL [fdo#103166] +3
* igt@kms_universal_plane@universal-plane-pipe-b-functional:
- shard-kbl: PASS -> FAIL [fdo#103166] +1
#### Possible fixes ####
* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-apl: FAIL [fdo#106641] -> PASS
* igt@kms_busy@extended-pageflip-hang-newfb-render-c:
- shard-apl: DMESG-WARN [fdo#107956] -> PASS
* igt@kms_color@pipe-a-ctm-max:
- shard-apl: FAIL [fdo#108147] -> PASS
* igt@kms_cursor_crc@cursor-128x128-onscreen:
- shard-apl: FAIL [fdo#103232] -> PASS +3
- shard-glk: FAIL [fdo#103232] -> PASS +1
* igt@kms_cursor_crc@cursor-128x128-sliding:
- shard-kbl: FAIL [fdo#103232] -> PASS +1
* igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-apl: FAIL [fdo#103191] / [fdo#103232] -> PASS
* igt@kms_flip@2x-busy-flip:
- shard-hsw: DMESG-WARN [fdo#102614] -> 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-spr-indfb-fullscreen:
- shard-glk: FAIL [fdo#103167] -> PASS +1
* igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
- shard-apl: FAIL [fdo#108948] -> PASS
* igt@kms_plane@plane-position-covered-pipe-c-planes:
- shard-apl: FAIL [fdo#103166] -> PASS +1
* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-glk: FAIL [fdo#108145] -> PASS +2
* igt@kms_plane_multiple@atomic-pipe-b-tiling-x:
- shard-glk: FAIL [fdo#103166] -> PASS
- shard-kbl: FAIL [fdo#103166] -> PASS
* igt@kms_vblank@pipe-b-wait-forked-hang:
- shard-snb: INCOMPLETE [fdo#105411] -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[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#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
[fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
[fdo#106510]: https://bugs.freedesktop.org/show_bug.cgi?id=106510
[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#108888]: https://bugs.freedesktop.org/show_bug.cgi?id=108888
[fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
Participating hosts (7 -> 5)
------------------------------
Missing (2): shard-skl shard-iclb
Build changes
-------------
* IGT: IGT_4753 -> IGTPW_2178
* Piglit: piglit_4509 -> None
CI_DRM_5341: 35ab0477f054cebc4370691690f27fb0589aa2f8 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2178: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2178/
IGT_4753: 0bc683ea2dcf270b5287ffb4a6510fdff44e9390 @ 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_2178/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Overall the functionality looks good, just some minor coding style nits below:
Quoted 56 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.
Signed-off-by Mamta Shukla <[email protected]>--- tests/kms_cursor_crc.c | 77 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 7 deletions(-)tests/kms_cursor_crc.c +13
-6@@ -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,61 @@ 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;
tests/kms_cursor_crc.c static void cleanup_crtc(data_t *data, igt_output_t *output) · line 423
Quoted 10 lines
tests/kms_cursor_crc.c +10
-0+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); +
Unnecessary new line
Quoted 12 lines
tests/kms_cursor_crc.c +12
-0+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);
tests/kms_cursor_crc.c static void cleanup_crtc(data_t *data, igt_output_t *output) · line 445
Quoted 10 lines
tests/kms_cursor_crc.c +10
-0+ +/*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);
The other subtest test_cursor_size clears the screen at the end, may be you should consider doing that as well
tests/kms_cursor_crc.c static void cleanup_crtc(data_t *data, igt_output_t *output) · line 446
Quoted 1 line
tests/kms_cursor_crc.c +1
-0+igt_remove_fb (data->drm_fd, &data->fb);
I think the igt_remove_fb is probably not needed here since the run_test_generic calls this in igt_fixture at the end.
Please double check if you still need this call.
Apart from this everything else looks good to me.
Regards
Manasi
Quoted 45 lines
tests/kms_cursor_crc.c +24
-1+ +} + +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 +516,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 +739,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 · 1 line
2.17.1
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Thank you for the feedback.
Quoted 90 lines · Manasi Navare
Overall the functionality looks good, just some minor coding style nits below:
Quoted 56 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.
Signed-off-by Mamta Shukla <[email protected]>--- tests/kms_cursor_crc.c | 77 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 7 deletions(-)tests/kms_cursor_crc.c +13
-6@@ -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,61 @@ 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;tests/kms_cursor_crc.c static void cleanup_crtc(data_t *data, igt_output_t *output) · line 423
Quoted 10 lines
tests/kms_cursor_crc.c +10
-0+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); +Unnecessary new line
Quoted 17 lines
tests/kms_cursor_crc.c +17
-0+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);
Quoted 8 lines
tests/kms_cursor_crc.c static void cleanup_crtc(data_t *data, igt_output_t *output) · line 445
Quoted 5 lines
tests/kms_cursor_crc.c +5
-0+ +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);The other subtest
test_cursor_sizeclears the screen at the end, may be you should consider doing that as well
Added in the next revision.
Quoted 5 lines
tests/kms_cursor_crc.c static void cleanup_crtc(data_t *data, igt_output_t *output) · line 446
Quoted 1 line
tests/kms_cursor_crc.c +1
-0+igt_remove_fb (data->drm_fd, &data->fb);I think the
igt_remove_fbis probably not needed here since therun_test_genericcalls this inigt_fixtureat the end.
Please double check if you still need this call.
This is needed because I have called these tests from main using run_test call for a fixed size of cursor.
So I think for the framebuffer created explicitly in the function test_cursor_alpha , igt_remove_fb needed.
Quoted 46 lines
Apart from this everything else looks good to me.
Regards
ManasiQuoted 41 lines
tests/kms_cursor_crc.c +24
-1+ +} + +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 +516,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 +739,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);
Quoted 4 lines
Quoted 4 lines
tests/kms_cursor_crc.c +0
-1igt_fixture { --2.17.1
---
Mamta
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev