From: Ben Widawsky <ben@bwidawsk.net>
To: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] intel: Add a function for the new register read ioctl.
Date: Thu, 02 Aug 2012 17:55:06 -0700 [thread overview]
Message-ID: <af7d87b3a93026d35769987d52c1275f@bwidawsk.net> (raw)
In-Reply-To: <1343932193-27192-3-git-send-email-eric@anholt.net>
On 2012-08-02 11:29, Eric Anholt wrote:
> ---
> I'm not sure if this is the API we want or not. Getting your value
> back through an out parameter sucks. On the other hand, the 3d
> driver
> wants to be able to use the error value to detect a supported kernel.
>
> My other API thought would be for reg_read() to return the value and
> whine if an error occurs, and to have a separate can_reg_read() call.
I'd like reg_read to just do what we want. I think making ugly code for
backward compatibility is less than ideal. OTOH, mesa and whomever else
could just wrap this in a function that does what they want.
Furthermore,
we can just supplement a macro to also do what we want. So I think this
approach is appropriate.
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
>
> intel/intel_bufmgr.h | 3 +++
> intel/intel_bufmgr_gem.c | 18 ++++++++++++++++++
> 2 files changed, 21 insertions(+)
>
> diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
> index 2167e43..8d7f239 100644
> --- a/intel/intel_bufmgr.h
> +++ b/intel/intel_bufmgr.h
> @@ -241,6 +241,9 @@ void drm_intel_decode_set_head_tail(struct
> drm_intel_decode *ctx,
> void drm_intel_decode_set_output_file(struct drm_intel_decode *ctx,
> FILE *out);
> void drm_intel_decode(struct drm_intel_decode *ctx);
>
> +int drm_intel_reg_read(drm_intel_bufmgr *bufmgr,
> + uint32_t offset,
> + uint64_t *result);
>
> /** @{ Compatibility defines to keep old code building despite the
> symbol rename
> * from dri_* to drm_intel_*
> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
> index a484b12..a170813 100644
> --- a/intel/intel_bufmgr_gem.c
> +++ b/intel/intel_bufmgr_gem.c
> @@ -2947,6 +2947,24 @@
> drm_intel_gem_context_destroy(drm_intel_context *ctx)
> free(ctx);
> }
>
> +int
> +drm_intel_reg_read(drm_intel_bufmgr *bufmgr,
> + uint32_t offset,
> + uint64_t *result)
> +{
> + drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr;
> + struct drm_i915_reg_read reg_read;
> + int ret;
> +
> + VG_CLEAR(reg_read);
> + reg_read.offset = offset;
> +
> + ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_REG_READ, ®_read);
> +
> + *result = reg_read.val;
> + return ret;
> +}
> +
>
> /**
> * Annotate the given bo for use in aub dumping.
next prev parent reply other threads:[~2012-08-03 0:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-02 18:29 [PATCH 1/3] Drop "-Wunsafe-loop-optimizations" Eric Anholt
2012-08-02 18:29 ` [PATCH 2/3] intel: Import updated i915_drm.h Eric Anholt
2012-08-03 0:49 ` Ben Widawsky
2012-08-06 17:59 ` Eric Anholt
2012-08-02 18:29 ` [PATCH 3/3] intel: Add a function for the new register read ioctl Eric Anholt
2012-08-03 0:55 ` Ben Widawsky [this message]
2012-08-03 0:47 ` [PATCH 1/3] Drop "-Wunsafe-loop-optimizations" 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=af7d87b3a93026d35769987d52c1275f@bwidawsk.net \
--to=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