From: Daniel Vetter <daniel@ffwll.ch>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, sagar.a.kamble@intel.com
Subject: Re: [PATCH 1/1] kms_cursor_crc/Enabling this test for variable cursor width and heights
Date: Wed, 5 Mar 2014 15:05:45 +0100 [thread overview]
Message-ID: <20140305140545.GW17001@phenom.ffwll.local> (raw)
In-Reply-To: <20140224154816.GT3852@intel.com>
On Mon, Feb 24, 2014 at 05:48:16PM +0200, Ville Syrjälä wrote:
> On Mon, Feb 24, 2014 at 09:07:05PM +0530, sagar.a.kamble@intel.com wrote:
> > From: Sagar Kamble <sagar.a.kamble@intel.com>
> >
> > Signed-off-by: Sagar Kamble <sagar.a.kamble@intel.com>
> > ---
> > tests/kms_cursor_crc.c | 51 ++++++++++++++++++++++++++++++--------------------
> > 1 file changed, 31 insertions(+), 20 deletions(-)
> >
> > diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> > index 38aa1ab..4458248 100644
> > --- a/tests/kms_cursor_crc.c
> > +++ b/tests/kms_cursor_crc.c
> > @@ -34,6 +34,8 @@
> > #include "igt_debugfs.h"
> > #include "igt_kms.h"
> >
> > +int w = 0, h = 0;
> > +
> > enum cursor_type {
> > WHITE_VISIBLE,
> > WHITE_INVISIBLE,
> > @@ -170,7 +172,7 @@ static void test_crc(test_data_t *test_data, enum cursor_type cursor_type,
> >
> > /* enable cursor */
> > igt_assert(drmModeSetCursor(data->drm_fd, test_data->crtc_id,
> > - data->fb[cursor_type].gem_handle, 64, 64) == 0);
> > + data->fb[cursor_type].gem_handle, w, h) == 0);
> >
> > if (onscreen) {
> > /* cursor onscreen, crc should match, except when white visible cursor is used */
> > @@ -180,32 +182,32 @@ static void test_crc(test_data_t *test_data, enum cursor_type cursor_type,
> > do_test(test_data, left, right, top, bottom);
> >
> > /* 2 pixels inside */
> > - do_test(test_data, left - 62, right + 62, top , bottom );
> > - do_test(test_data, left , right , top - 62, bottom + 62);
> > - do_test(test_data, left - 62, right + 62, top - 62, bottom + 62);
> > + do_test(test_data, left - (w - 2), right + (w - 2), top , bottom );
> > + do_test(test_data, left , right , top - (w - 2), bottom + (w - 2));
> > + do_test(test_data, left - (w - 2), right + (w - 2), top - (w - 2), bottom + (w - 2));
> >
> > /* 1 pixel inside */
> > - do_test(test_data, left - 63, right + 63, top , bottom );
> > - do_test(test_data, left , right , top - 63, bottom + 63);
> > - do_test(test_data, left - 63, right + 63, top - 63, bottom + 63);
> > + do_test(test_data, left - (w - 1), right + (w - 1), top , bottom );
> > + do_test(test_data, left , right , top - (w - 1), bottom + (w - 1));
> > + do_test(test_data, left - (w - 1), right + (w - 1), top - (w - 1), bottom + (w - 1));
> > } else {
> > /* cursor offscreen, crc should always match */
> > test_data->crc_must_match = true;
> >
> > /* fully outside */
> > - do_test(test_data, left - 64, right + 64, top , bottom );
> > - do_test(test_data, left , right , top - 64, bottom + 64);
> > - do_test(test_data, left - 64, right + 64, top - 64, bottom + 64);
> > + do_test(test_data, left - w, right + w, top , bottom );
> > + do_test(test_data, left , right , top - w, bottom + w);
> > + do_test(test_data, left - w, right + w, top - w, bottom + w);
> >
> > /* fully outside by 1 extra pixels */
> > - do_test(test_data, left - 65, right + 65, top , bottom );
> > - do_test(test_data, left , right , top - 65, bottom + 65);
> > - do_test(test_data, left - 65, right + 65, top - 65, bottom + 65);
> > + do_test(test_data, left - (w + 1), right + (w + 1), top , bottom );
> > + do_test(test_data, left , right , top - (w + 1), bottom + (w + 1));
> > + do_test(test_data, left - (w + 1), right + (w + 1), top - (w + 1), bottom + (w + 1));
> >
> > /* fully outside by 2 extra pixels */
> > - do_test(test_data, left - 66, right + 66, top , bottom );
> > - do_test(test_data, left , right , top - 66, bottom + 66);
> > - do_test(test_data, left - 66, right + 66, top - 66, bottom + 66);
> > + do_test(test_data, left - (w + 2), right + (w + 2), top , bottom );
> > + do_test(test_data, left , right , top - (w + 2), bottom + (w + 2));
> > + do_test(test_data, left - (w + 2), right + (w + 2), top - (w + 2), bottom + (w + 2));
> >
> > /* fully outside by a lot of extra pixels */
> > do_test(test_data, left - 512, right + 512, top , bottom );
> > @@ -251,9 +253,9 @@ static bool prepare_crtc(test_data_t *test_data, uint32_t connector_id)
> >
> > /* x/y position where the cursor is still fully visible */
> > test_data->left = 0;
> > - test_data->right = connector.config.default_mode.hdisplay - 64;
> > + test_data->right = connector.config.default_mode.hdisplay - w;
> > test_data->top = 0;
> > - test_data->bottom = connector.config.default_mode.vdisplay - 64;
> > + test_data->bottom = connector.config.default_mode.vdisplay - h;
> >
> > /* make sure cursor is disabled */
> > igt_assert(drmModeSetCursor(data->drm_fd, test_data->crtc_id, 0, 0, 0) == 0);
> > @@ -314,20 +316,29 @@ static void create_cursor_fb(data_t *data,
> > {
> > cairo_t *cr;
> >
> > - data->fb_id[cursor_type] = kmstest_create_fb2(data->drm_fd, 64, 64,
> > + data->fb_id[cursor_type] = kmstest_create_fb2(data->drm_fd, w, h,
> > DRM_FORMAT_ARGB8888, false,
> > &data->fb[cursor_type]);
> > igt_assert(data->fb_id[cursor_type]);
> >
> > cr = kmstest_get_cairo_ctx(data->drm_fd,
> > &data->fb[cursor_type]);
> > - kmstest_paint_color_alpha(cr, 0, 0, 64, 64, r, g, b, a);
> > + kmstest_paint_color_alpha(cr, 0, 0, w, h, r, g, b, a);
> > igt_assert(cairo_status(cr) == 0);
> > }
> >
> > igt_main
> > {
> > data_t data = {};
> > + int c;
> > + char args[10];
> > +
> > + printf("\nEnter Width and Height of Cursor Plane (64x64, 128x128):");
> > + scanf("%s", args);
> > + if (sscanf(args, "%dx%d", &w, &h) != 2) {
> > + printf("\nInvalid arguments");
> > + return -1;
> > + }
>
> These tests are meant to run without user interaction, so reading from
> stdin isn't something we want to be doing.
>
> What you should do is add more subtests for the different cursors sizes.
> And you should make the 128x128 and 256x256 subtests skip if the kernel
> refuses the specific cursor size. By using igt_subtest_f() you can avoid
> a bunch of duplicated code for iterating the subtests.
Agree with Ville here, we want subtests for all the cursor sizes we
support and to correctly skip them if the kernel doesn't accept a cursor
of a given size. Once that's all ready your cursor sizes patch is imo good
to go.
Please don't forget to add a Testcase: tag to your kernel patch
referencing your new (sub)tests here.
Thanks, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2014-03-05 14:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-24 15:37 [PATCH 1/1] kms_cursor_crc/Enabling this test for variable cursor width and heights sagar.a.kamble
2014-02-24 15:48 ` Ville Syrjälä
2014-03-05 14:05 ` Daniel Vetter [this message]
2014-03-08 18:49 ` [PATCH v2 1/1] kms_cursor_crc: Enabling this test for 128x128 and 256x256 cursors sagar.a.kamble
2014-03-17 8:05 ` Daniel Vetter
2014-03-18 10:29 ` [PATCH v3 1/1] kms_cursor_crc: Enabling this test for all cursor sizes sagar.a.kamble
2014-03-20 16:18 ` Imre Deak
2014-03-20 16:33 ` Daniel Vetter
2014-03-20 17:04 ` Sagar Arun Kamble
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140305140545.GW17001@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=sagar.a.kamble@intel.com \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox