All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 2/3] igt_kms: Allow kmstest_get_connector_config to take provided drmModeGetResources
Date: Thu, 28 Apr 2016 10:05:11 +0100	[thread overview]
Message-ID: <5721D247.3080107@linux.intel.com> (raw)
In-Reply-To: <20160428082816.GR2558@phenom.ffwll.local>


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@intel.com>
>>
>> This will enable the following patch to generate less dmesg spam.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@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


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-04-28  9:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 15:12 [PATCH i-g-t 1/3] igt_kms: Fix use after free in kmstest_get_pipe_from_crtc_id Tvrtko Ursulin
2016-04-27 15:12 ` [PATCH i-g-t 2/3] igt_kms: Allow kmstest_get_connector_config to take provided drmModeGetResources Tvrtko Ursulin
2016-04-28  8:28   ` Daniel Vetter
2016-04-28  9:05     ` Tvrtko Ursulin [this message]
2016-04-27 15:12 ` [PATCH i-g-t 3/3] kms_flip: Reduce dmesg spam by not calling drmModeGetResources too much Tvrtko Ursulin
2016-04-28  9:14 ` [PATCH i-g-t 1/3] igt_kms: Fix use after free in kmstest_get_pipe_from_crtc_id Tvrtko Ursulin

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=5721D247.3080107@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=daniel@ffwll.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.