[igt-dev] [PATCH i-g-t v3] test/kms_plane_cursor: Honour max cursor size
Aurabindo Pillai
aurabindo.pillai at amd.com
Thu Oct 13 18:09:49 UTC 2022
On 2022-10-13 13:44, Juha-Pekka Heikkila wrote:
> On 13.10.2022 18.56, Aurabindo Pillai wrote:
>> Skip the tests for cursor sizes that are not supported by the hardware
>>
>> Changes in v2
>> =============
>>
>> * Remove the duplicate definitions for DRM cursor width capability
>> * Check for both cursor width and height when verifying the test
>> cursor size
>>
>> Changes in v3
>> =============
>>
>> * Add variables to hold max cursor size to the global data_t struct
>> * Remove stale comment from v1
>>
>> Signed-off-by: Aurabindo Pillai <aurabindo.pillai at amd.com>
>> ---
>> tests/kms_plane_cursor.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
>> index 43bcaaa4..96036213 100644
>> --- a/tests/kms_plane_cursor.c
>> +++ b/tests/kms_plane_cursor.c
>> @@ -30,6 +30,7 @@
>> * - DRM index indicates z-ordering, higher index = higher z-order
>> */
>> +
> ^^
> stray newline
>
>> enum {
>> TEST_PRIMARY = 0,
>> TEST_OVERLAY = 1 << 0,
>> @@ -64,6 +65,8 @@ typedef struct data {
>> enum pipe pipe_id;
>> int drm_fd;
>> rect_t or;
>> + uint64_t max_curw;
>> + uint64_t max_curh;
>> } data_t;
>> /* Common test setup. */
>> @@ -222,6 +225,8 @@ static void test_cursor(data_t *data, int size,
>> unsigned int flags)
>> int sw, sh;
>> int pad = 128;
>> + igt_skip_on((size > data->max_curw) || (size > data->max_curh));
> you could also remove unnecessary brackets.
>
>> +
>> sw = data->mode->hdisplay;
>> sh = data->mode->vdisplay;
>> @@ -270,8 +275,15 @@ igt_main
>> };
>> igt_fixture {
>> + int ret;
>> +
>> data.drm_fd = drm_open_driver_master(DRIVER_ANY);
>> + ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH,
>> &data.max_curw);
>> + igt_assert(ret == 0 || errno == EINVAL);
>> + ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_HEIGHT,
>> &data.max_curh);
>> + igt_assert(ret == 0 || errno == EINVAL);
>> +
>
> You'll still need to initialize those max_curw, max_curh to 64 like you
> were doing in previous version of your patch, now need something like
> this when setting up data
>
> data_t data = { .max_curw = 64, .max_curh = 64 };
>
> otherwise maximum cursor width/height will be zero if get EINVAL when
> this is ran on driver where these cursor drm capabilities are not defined.
Good point! Thanks for catching this. Will fix it.
>
> /Juha-Pekka
>
>> kmstest_set_vt_graphics_mode();
>> igt_display_require(&data.display, data.drm_fd);
>
More information about the igt-dev
mailing list