Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Daniel Stone <daniels@collabora.com>,
	Intel GFX discussion <intel-gfx@lists.freedesktop.org>,
	Micah Fedke <micah.fedke@collabora.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
	Emil Velikov <emil.velikov@collabora.com>
Subject: Re: [i-g-t PATCH v1 1/7] tests/drm_read: Drop DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID
Date: Wed, 20 Apr 2016 15:07:30 +0200	[thread overview]
Message-ID: <20160420130730.GC2510@phenom.ffwll.local> (raw)
In-Reply-To: <1460979775-21702-2-git-send-email-tomeu.vizoso@collabora.com>

On Mon, Apr 18, 2016 at 01:42:49PM +0200, Tomeu Vizoso wrote:
> So the test runs on other drivers, drop the usage of the i915-specific
> DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID ioctl.
> 
> Wait for a vblank event on pipe0 and if we get it, then the test can
> proceed (code copied from kms_vblank).
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>

As discussed on irc, this one and kms_vblank need more work to actually
bother setting up a real mode themselves, instead of trying to sidecar
ride on whatever fbcon might be doing.

But imo ok as an interim step.
-Daniel

> ---
> 
>  tests/drm_read.c | 44 +++++---------------------------------------
>  1 file changed, 5 insertions(+), 39 deletions(-)
> 
> diff --git a/tests/drm_read.c b/tests/drm_read.c
> index 3980bb0580c5..7df36e965c59 100644
> --- a/tests/drm_read.c
> +++ b/tests/drm_read.c
> @@ -175,46 +175,12 @@ static void test_short_buffer(int in, int nonblock)
>  	teardown(fd);
>  }
>  
> -static int pipe0_enabled(int fd)
> +static bool crtc0_active(int fd)
>  {
> -	struct drm_mode_card_res res;
> -	uint32_t crtcs[32];
> -	int i;
> +	union drm_wait_vblank vbl = {};
>  
> -	/* We assume we can generate events on pipe 0. So we have better
> -	 * make sure that is running!
> -	 */
> -
> -	memset(&res, 0, sizeof(res));
> -	res.count_crtcs = 32;
> -	res.crtc_id_ptr = (uintptr_t)crtcs;
> -
> -	if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res))
> -		return 0;
> -
> -	if (res.count_crtcs > 32)
> -		return 0;
> -
> -	for (i = 0; i < res.count_crtcs; i++) {
> -		struct drm_i915_get_pipe_from_crtc_id get_pipe;
> -		struct drm_mode_crtc mode;
> -
> -		memset(&get_pipe, 0, sizeof(get_pipe));
> -		memset(&mode, 0, sizeof(mode));
> -
> -		mode.crtc_id = crtcs[i];
> -
> -		get_pipe.pipe = -1;
> -		get_pipe.crtc_id = mode.crtc_id;
> -		drmIoctl(fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID, &get_pipe);
> -		if (get_pipe.pipe)
> -			continue;
> -
> -		drmIoctl(fd, DRM_IOCTL_MODE_GETCRTC, &mode);
> -		return mode.mode_valid && mode.mode.clock;
> -	}
> -
> -	return 0;
> +	vbl.request.type = DRM_VBLANK_RELATIVE;
> +	return drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl) == 0;
>  }
>  
>  igt_main
> @@ -226,7 +192,7 @@ igt_main
>  
>  	igt_fixture {
>  		fd = drm_open_driver_master(DRIVER_ANY);
> -		igt_require(pipe0_enabled(fd));
> +		igt_require(crtc0_active(fd));
>  	}
>  
>  	igt_subtest("invalid-buffer")
> -- 
> 2.5.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-04-20 13:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 11:42 [i-g-t PATCH v1 0/7] Make more tests generic Tomeu Vizoso
2016-04-18 11:42 ` [i-g-t PATCH v1 1/7] tests/drm_read: Drop DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID Tomeu Vizoso
2016-04-20 13:07   ` Daniel Vetter [this message]
2016-04-18 11:42 ` [i-g-t PATCH v1 2/7] tests/kms_render: Move dependency on i915 into subtest Tomeu Vizoso
2016-04-18 11:42 ` [i-g-t PATCH v1 3/7] tests/kms_flip: Create tiled BOs only when needed Tomeu Vizoso
2016-04-18 11:42 ` [i-g-t PATCH v1 4/7] tests/kms_flip: Move bufmgr requirement into subtests Tomeu Vizoso
2016-04-18 11:42 ` [i-g-t PATCH v1 5/7] tests/kms_flip: Open DRM device with DRIVER_ANY Tomeu Vizoso
2016-04-18 11:42 ` [i-g-t PATCH v1 6/7] tests/kms_flip_event_leak: Use non-tiled formats Tomeu Vizoso
2016-04-18 11:42 ` [i-g-t PATCH v1 7/7] tests/kms_flip_event_leak: Open DRM device with DRIVER_ANY Tomeu Vizoso
2016-04-20 13:10 ` [i-g-t PATCH v1 0/7] Make more tests generic Daniel Vetter
2016-04-20 13:57   ` Tomeu Vizoso
2016-04-20 14:12     ` Daniel Vetter
2016-04-25 13:13       ` Tomeu Vizoso
2016-04-25 13:17         ` Tomeu Vizoso

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=20160420130730.GC2510@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=daniels@collabora.com \
    --cc=emil.velikov@collabora.com \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=micah.fedke@collabora.com \
    --cc=tomeu.vizoso@collabora.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