From: "G, Pallavi" <pallavi.g@intel.com>
To: "Roper, Matthew D" <matthew.d.roper@intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 5/6] drm/i915: Add intel_crtc_cursor_set_obj() to set cursor buffer (v2)
Date: Thu, 12 Jun 2014 09:44:24 +0000 [thread overview]
Message-ID: <1402566935.1130.12.camel@pg3-desktop> (raw)
In-Reply-To: <1402414093-13401-6-git-send-email-matthew.d.roper@intel.com>
On Tue, 2014-06-10 at 08:28 -0700, Matt Roper wrote:
> Refactor cursor buffer setting such that the code to actually update the
> cursor lives in a new function, intel_crtc_cursor_set_obj(), and takes
> a GEM object as a parameter. The existing legacy cursor ioctl handler,
> intel_crtc_cursor_set() will now perform the userspace handle lookup and
> then call this new function.
>
> This refactoring is in preparation for the universal plane cursor
> support where we'll want to update the cursor with an actual GEM buffer
> object (obtained via drm_framebuffer) rather than a userspace handle.
>
> v2: Drop obvious kerneldoc and replace with note about function's
> reference consumption
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 42 ++++++++++++++++++++++++++----------
> 1 file changed, 31 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b5cbb28..1beeb2a 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -8089,21 +8089,26 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
> intel_crtc->cursor_base = base;
> }
>
> -static int intel_crtc_cursor_set(struct drm_crtc *crtc,
> - struct drm_file *file,
> - uint32_t handle,
> - uint32_t width, uint32_t height)
> +/*
> + * intel_crtc_cursor_set_obj - Set cursor to specified GEM object
> + *
> + * Note that the object's reference will be consumed if the update fails. If
> + * the update succeeds, the reference of the old object (if any) will be
> + * consumed.
> + */
> +static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc,
> + struct drm_i915_gem_object *obj,
> + uint32_t width, uint32_t height)
> {
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> - struct drm_i915_gem_object *obj;
> unsigned old_width;
> uint32_t addr;
> int ret;
>
> /* if we want to turn off the cursor ignore width and height */
> - if (!handle) {
> + if (!obj) {
> DRM_DEBUG_KMS("cursor off\n");
> addr = 0;
> obj = NULL;
> @@ -8119,12 +8124,8 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
> return -EINVAL;
> }
>
> - obj = to_intel_bo(drm_gem_object_lookup(dev, file, handle));
> - if (&obj->base == NULL)
> - return -ENOENT;
> -
> if (obj->base.size < width * height * 4) {
> - DRM_DEBUG_KMS("buffer is to small\n");
> + DRM_DEBUG_KMS("buffer is too small\n");
> ret = -ENOMEM;
> goto fail;
> }
> @@ -8207,6 +8208,25 @@ fail:
> return ret;
> }
>
> +static int intel_crtc_cursor_set(struct drm_crtc *crtc,
> + struct drm_file *file,
> + uint32_t handle,
> + uint32_t width, uint32_t height)
> +{
> + struct drm_device *dev = crtc->dev;
> + struct drm_i915_gem_object *obj;
> +
> + if (handle) {
> + obj = to_intel_bo(drm_gem_object_lookup(dev, file, handle));
> + if (&obj->base == NULL)
> + return -ENOENT;
> + } else {
> + obj = NULL;
> + }
> +
> + return intel_crtc_cursor_set_obj(crtc, obj, width, height);
> +}
> +
> static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
> {
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
Reviewed-by: Pallavi G <pallavi.g@intel.com>
next prev parent reply other threads:[~2014-06-12 9:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 15:28 [PATCH 0/6] Cursor support with universal planes (v4) Matt Roper
2014-06-10 15:28 ` [PATCH 1/6] drm: Refactor framebuffer creation to allow internal use (v2) Matt Roper
2014-06-12 9:02 ` G, Pallavi
2014-06-10 15:28 ` [PATCH 2/6] drm: Refactor setplane to allow internal use (v3) Matt Roper
2014-06-12 9:05 ` G, Pallavi
2014-06-10 15:28 ` [PATCH 3/6] drm: Support legacy cursor ioctls via universal planes when possible (v4) Matt Roper
2014-06-12 9:06 ` G, Pallavi
2014-06-10 15:28 ` [PATCH 4/6] drm: Allow drivers to register cursor planes with crtc Matt Roper
2014-06-12 9:08 ` G, Pallavi
2014-06-10 15:28 ` [PATCH 5/6] drm/i915: Add intel_crtc_cursor_set_obj() to set cursor buffer (v2) Matt Roper
2014-06-12 9:44 ` G, Pallavi [this message]
2014-06-10 15:28 ` [PATCH 6/6] drm/i915: Switch to unified plane cursor handling (v4) Matt Roper
2014-06-12 11:47 ` G, Pallavi
2014-06-12 14:57 ` Matt Roper
2014-06-13 4:35 ` G, Pallavi
2014-06-13 6:46 ` Daniel Vetter
-- strict thread matches above, loose matches on Subject: below --
2014-05-19 23:58 [PATCH 0/6] Cursor support with universal planes (v3) Matt Roper
2014-05-19 23:58 ` [PATCH 5/6] drm/i915: Add intel_crtc_cursor_set_obj() to set cursor buffer (v2) Matt Roper
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=1402566935.1130.12.camel@pg3-desktop \
--to=pallavi.g@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.d.roper@intel.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