public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: intel-gfx@lists.freedesktop.org
Cc: Ben Widawsky <ben@bwidawsk.net>
Subject: Re: [PATCH] drm/i915: add register read IOCTL
Date: Thu, 12 Jul 2012 12:42:30 -0700	[thread overview]
Message-ID: <87zk74hil5.fsf@eliezer.anholt.net> (raw)
In-Reply-To: <1342051656-32481-1-git-send-email-ben@bwidawsk.net>


[-- Attachment #1.1: Type: text/plain, Size: 1355 bytes --]

Ben Widawsky <ben@bwidawsk.net> writes:

> The interface's immediate purpose is to do synchronous timestamp queries
> as required by GL_TIMESTAMP. The GPU has a register for reading the
> timestamp but because that would normally require root access, the
> IOCTL can provide this service.
>
> Currently the implementation whitelists only the render ring timestamp
> register, because that is the only thing we need to expose at this time.

Thanks. I was just writing this patch yesterday since it still hadn't
landed.  What I was doing was very similar, I was just not including a
size, since we're going to whitelist regs and the correct size is
implied by the register offset.

> +int i915_reg_read_ioctl(struct drm_device *dev,
> +			void *data, struct drm_file *file)
> +{
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct drm_i915_reg_read *reg = data;
> +
> +	/* Whitelisted for now */
> +	if (reg->offset != RING_TIMESTAMP(RENDER_RING_BASE))
> +		return -ENXIO;

Should this be conditional on the gen having the timestamp register?

> +struct drm_i915_reg_read {
> +	__u64 offset;
> +	__u32 size;
> +	__u64 val; /* Return value */
> +	__u32 pad;
> +};

Bad padding here.  On i386 you'll get a struct like:

{
        uint64_t offset
        uint32_t size
        uint32_t implicit_pad
        uint64_t val
        uint32_t pad
}

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

  parent reply	other threads:[~2012-07-12 19:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12  0:07 [PATCH] drm/i915: add register read IOCTL Ben Widawsky
2012-07-12  0:08 ` [PATCH] reg_read: basic register read ioctl test Ben Widawsky
2012-07-12  8:06   ` Daniel Vetter
2012-07-12  7:58 ` [PATCH] drm/i915: add register read IOCTL Daniel Vetter
2012-07-12  8:11   ` Chris Wilson
2012-07-12 18:01 ` [PATCH v2] " Ben Widawsky
2012-07-12 18:01   ` [PATCH] reg_read: basic register read ioctl test Ben Widawsky
2012-07-18 17:14   ` [PATCH v2] drm/i915: add register read IOCTL Eric Anholt
2012-07-18 17:22     ` Ben Widawsky
2012-07-18 18:12       ` Daniel Vetter
2012-07-12 19:42 ` Eric Anholt [this message]
2012-07-12 20:08   ` [PATCH] " Ben Widawsky

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=87zk74hil5.fsf@eliezer.anholt.net \
    --to=eric@anholt.net \
    --cc=ben@bwidawsk.net \
    --cc=intel-gfx@lists.freedesktop.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