public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Arto Merilainen <amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/3] drm/tegra: Deliver syncpoint base to user space
Date: Fri, 11 Oct 2013 11:43:52 +0200	[thread overview]
Message-ID: <20131011094352.GB8659@ulmo.nvidia.com> (raw)
In-Reply-To: <1381319650-9799-3-git-send-email-amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2574 bytes --]

On Wed, Oct 09, 2013 at 02:54:09PM +0300, Arto Merilainen wrote:
> This patch makes the necessary additions to deliver syncpoint base
> to the user space.
> 
> This patch splits the index field in the drm_tegra_get_syncpt structure
> into three separate fields (index, support_base, base_id). This allows
> to keep compatibility over kernel versions:
> - The placing of index field stays constant and therefore the interface
>   should stay compatible with earlier userspace versions.
> - The old index field was input-only and it was not supposed to be read
>   afterwards. Delivering data back in the same field should not introduce
>   regressions to any old user space applications.
> - Old kernels left support_base and base_id fields intact (zero) and
>   hence the new user space applications get the correct response from
>   the kernel (=syncpoint does not have a base).
> 
> Signed-off-by: Arto Merilainen <amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/gpu/host1x/drm/drm.c | 2 ++
>  include/uapi/drm/tegra_drm.h | 4 +++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/host1x/drm/drm.c b/drivers/gpu/host1x/drm/drm.c
> index 8c61cee..4251563 100644
> --- a/drivers/gpu/host1x/drm/drm.c
> +++ b/drivers/gpu/host1x/drm/drm.c
> @@ -468,6 +468,8 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data,
>  
>  	syncpt = context->client->syncpts[args->index];
>  	args->id = host1x_syncpt_id(syncpt);
> +	args->support_base = syncpt->base ? 1 : 0;
> +	args->base_id = syncpt->base ? syncpt->base->id : 0;
>  
>  	return 0;
>  }
> diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
> index 73bde4e..7a79ca5 100644
> --- a/include/uapi/drm/tegra_drm.h
> +++ b/include/uapi/drm/tegra_drm.h
> @@ -61,7 +61,9 @@ struct drm_tegra_close_channel {
>  
>  struct drm_tegra_get_syncpt {
>  	__u64 context;
> -	__u32 index;
> +	__u16 index;
> +	__u8 support_base;
> +	__u8 base_id;
>  	__u32 id;

I don't like this. Can't we just add a separate IOCTL? Something like:

	struct drm_tegra_get_syncpt_base {
		__u64 context;
		__u32 syncpt;
		__u32 base;
	};

Which could be used somewhat like this:

	struct drm_tegra_get_syncpt_base args;

	memset(&args, 0, sizeof(args));
	args.context = context;
	args.syncpt = syncpt;

	err = ioctl(fd, DRM_IOCTL_TEGRA_GET_SYNCPT_BASE, &args);
	if (err < 0) {
		/*
		 * perhaps errno == ENOTSUP if the syncpoint has no
		 * associated base?
		 */
	}

	base = args.base;

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2013-10-11  9:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-09 11:54 [PATCH 0/3] gpu: host1x: Add syncpoint base support Arto Merilainen
2013-10-09 11:54 ` [PATCH 1/3] " Arto Merilainen
     [not found]   ` <1381319650-9799-2-git-send-email-amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-11  9:39     ` Thierry Reding
     [not found]       ` <20131011093905.GA8659-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-10-11 11:35         ` Arto Merilainen
2013-10-09 11:54 ` [PATCH 2/3] drm/tegra: Deliver syncpoint base to user space Arto Merilainen
     [not found]   ` <1381319650-9799-3-git-send-email-amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-11  9:43     ` Thierry Reding [this message]
2013-10-11 10:23       ` Arto Merilainen
2013-10-09 11:54 ` [PATCH 3/3] drm/tegra: Reserve base for gr2d Arto Merilainen
     [not found] ` <1381319650-9799-1-git-send-email-amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-11  9:45   ` [PATCH 0/3] gpu: host1x: Add syncpoint base support Thierry Reding

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=20131011094352.GB8659@ulmo.nvidia.com \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    /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