[Intel-gfx] [PATCH i-g-t] tests: Add kms_rmfb testcase

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Tue May 17 13:00:40 UTC 2016


Op 17-05-16 om 12:48 schreef Daniel Vetter:
> On Fri, May 13, 2016 at 12:46:12PM +0200, Maarten Lankhorst wrote:
>> This allows us to test that RMFB works as intended by the original abi.
>> We create a framebuffer and try to remove the framebuffer from a crtc
>> using fd closing or rmfb ioctl.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
>> ---
>> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
>> index b73f48d95568..c223c363e3e8 100644
>> --- a/tests/Makefile.sources
>> +++ b/tests/Makefile.sources
>> @@ -97,6 +97,7 @@ TESTS_progs_M = \
>>  	kms_plane \
>>  	kms_psr_sink_crc \
>>  	kms_render \
>> +	kms_rmfb \
>>  	kms_rotation_crc \
>>  	kms_setmode \
>>  	kms_universal_plane \
>> diff --git a/tests/kms_rmfb.c b/tests/kms_rmfb.c
>> new file mode 100644
>> index 000000000000..a3fde9f43788
>> --- /dev/null
>> +++ b/tests/kms_rmfb.c
>> @@ -0,0 +1,180 @@
>> +/*
>> + * Copyright © 2016 Intel Corporation
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the "Software"),
>> + * to deal in the Software without restriction, including without limitation
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including the next
>> + * paragraph) shall be included in all copies or substantial portions of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>> + * IN THE SOFTWARE.
>> + */
>> +
>> +#include "igt.h"
>> +#include "drmtest.h"
>> +#include <errno.h>
>> +#include <stdbool.h>
>> +#include <stdio.h>
>> +#include <string.h>
>> +#include <time.h>
>> +
>> +#ifndef DRM_CAP_CURSOR_WIDTH
>> +#define DRM_CAP_CURSOR_WIDTH 0x8
>> +#endif
>> +#ifndef DRM_CAP_CURSOR_HEIGHT
>> +#define DRM_CAP_CURSOR_HEIGHT 0x9
>> +#endif
>> +
>> +struct rmfb_data {
>> +	int drm_fd;
>> +	igt_display_t display;
>> +};
>> +
>> +/*
>> + * 1. Set primary plane to a known fb.
>> + * 2. Make sure getcrtc returns the correct fb id.
>> + * 3. Call rmfb on the fb.
>> + * 4. Make sure getcrtc returns 0 fb id.
> I think a 2nd functional test we want to do at step 4) is to make a vblank
> wait call and assert that it fails. Just to make sure that the kernel did
> indeed shut down everything. We can only do that for the rmfb case though,
> since when we close the last drm fd fbcon make take over and light stuff
> up again.
>
> Perhaps also add a vblank ioctl call to step 2 as a sanity check - just
> ask for the current vblank count to avoid stalling.
In case of atomic we may choose to leave the CRTC enabled for faster switching. I don't think we should check if vblank fails..

~Maarten


More information about the Intel-gfx mailing list