[Intel-gfx] [PATCH i-g-t 2/3] igt_kms: Allow kmstest_get_connector_config to take provided drmModeGetResources

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Thu Apr 28 09:05:11 UTC 2016


On 28/04/16 09:28, Daniel Vetter wrote:
> On Wed, Apr 27, 2016 at 04:12:35PM +0100, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>
>> This will enable the following patch to generate less dmesg spam.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>> ---
>>   lib/igt_kms.c       | 33 +++++++++++++++++++++++----------
>>   lib/igt_kms.h       |  3 ++-
>>   tests/kms_3d.c      |  2 +-
>>   tests/kms_flip.c    |  7 ++++---
>>   tests/kms_render.c  |  5 +++--
>>   tests/testdisplay.c |  2 +-
>>   6 files changed, 34 insertions(+), 18 deletions(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index 7557bdc20fa4..07f523e2c39b 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -749,6 +749,7 @@ bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
>>   /**
>>    * _kmstest_connector_config:
>>    * @drm_fd: DRM fd
>> + * @resources: pointer to drmModeRes or NULL
>>    * @connector_id: DRM connector id
>>    * @crtc_idx_mask: mask of allowed DRM CRTC indices
>>    * @config: structure filled with the possible configuration
>> @@ -757,17 +758,24 @@ bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
>>    * This tries to find a suitable configuration for the given connector and CRTC
>>    * constraint and fills it into @config.
>>    */
>> -static bool _kmstest_connector_config(int drm_fd, uint32_t connector_id,
>> +static bool _kmstest_connector_config(int drm_fd, drmModeRes *resources,
>> +				      uint32_t connector_id,
>>   				      unsigned long crtc_idx_mask,
>>   				      struct kmstest_connector_config *config,
>>   				      bool probe)
>>   {
>> -	drmModeRes *resources;
>>   	drmModeConnector *connector;
>>   	drmModeEncoder *encoder;
>> +	bool free_resources;
>>   	int i, j;
>>
>> -	resources = drmModeGetResources(drm_fd);
>> +	if (resources == NULL) {
>> +		resources = drmModeGetResources(drm_fd);
>> +		free_resources = true;
>> +	} else {
>> +		free_resources = false;
>> +	}
>
> Imo you should just cache this internally in the lib instead of forcing
> everyone to become more clever. We can just request resources once when
> initializing the kmstest library, and then maybe provide a function to
> force reprobing (for something like testdisplay, but that doesn't use
> kmstest yet).

If you merge the two drm core patches patches 2/3 and 3/3 are best 
abandoned. :)

Regards,

Tvrtko




More information about the Intel-gfx mailing list