From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Rob Clark <robdclark@gmail.com>
Cc: David Airlie <airlied@linux.ie>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/4] drm/atomic: integrate modeset lock with private objects
Date: Wed, 21 Feb 2018 16:49:19 +0200 [thread overview]
Message-ID: <20180221144919.GN5453@intel.com> (raw)
In-Reply-To: <20180221143730.30285-2-robdclark@gmail.com>
On Wed, Feb 21, 2018 at 09:37:21AM -0500, Rob Clark wrote:
> Follow the same pattern of locking as with other state objects. This
> avoids boilerplate in the driver.
I'm not sure we really want to do this. What if the driver wants a
custom locking scheme for this state?
>
> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
> drivers/gpu/drm/drm_atomic.c | 9 ++++++++-
> include/drm/drm_atomic.h | 5 +++++
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index fc8c4da409ff..004e621ab307 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1078,6 +1078,8 @@ drm_atomic_private_obj_init(struct drm_private_obj *obj,
> {
> memset(obj, 0, sizeof(*obj));
>
> + drm_modeset_lock_init(&obj->lock);
> +
> obj->state = state;
> obj->funcs = funcs;
> }
> @@ -1093,6 +1095,7 @@ void
> drm_atomic_private_obj_fini(struct drm_private_obj *obj)
> {
> obj->funcs->atomic_destroy_state(obj, obj->state);
> + drm_modeset_lock_fini(&obj->lock);
> }
> EXPORT_SYMBOL(drm_atomic_private_obj_fini);
>
> @@ -1113,7 +1116,7 @@ struct drm_private_state *
> drm_atomic_get_private_obj_state(struct drm_atomic_state *state,
> struct drm_private_obj *obj)
> {
> - int index, num_objs, i;
> + int index, num_objs, i, ret;
> size_t size;
> struct __drm_private_objs_state *arr;
> struct drm_private_state *obj_state;
> @@ -1122,6 +1125,10 @@ drm_atomic_get_private_obj_state(struct drm_atomic_state *state,
> if (obj == state->private_objs[i].ptr)
> return state->private_objs[i].state;
>
> + ret = drm_modeset_lock(&obj->lock, state->acquire_ctx);
> + if (ret)
> + return ERR_PTR(ret);
> +
> num_objs = state->num_private_objs + 1;
> size = sizeof(*state->private_objs) * num_objs;
> arr = krealloc(state->private_objs, size, GFP_KERNEL);
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index 09076a625637..9ae53b73c9d2 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -218,6 +218,11 @@ struct drm_private_state_funcs {
> * &drm_modeset_lock is required to duplicate and update this object's state.
> */
> struct drm_private_obj {
> + /**
> + * @lock: Modeset lock to protect the state object.
> + */
> + struct drm_modeset_lock lock;
> +
> /**
> * @state: Current atomic state for this driver private object.
> */
> --
> 2.14.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-02-21 14:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 14:37 [PATCH 0/4] drm/msm: Avoid subclassing of drm_atomic_state Rob Clark
2018-02-21 14:37 ` [PATCH 1/4] drm/atomic: integrate modeset lock with private objects Rob Clark
2018-02-21 14:49 ` Ville Syrjälä [this message]
2018-02-21 14:54 ` Rob Clark
2018-02-21 15:07 ` Ville Syrjälä
2018-02-21 15:20 ` Rob Clark
2018-02-21 15:27 ` Ville Syrjälä
2018-02-21 15:36 ` Rob Clark
2018-02-21 15:54 ` Ville Syrjälä
2018-02-21 16:17 ` Rob Clark
2018-02-21 16:36 ` Ville Syrjälä
2018-02-21 17:33 ` Rob Clark
2018-03-06 7:37 ` Daniel Vetter
2018-02-21 15:19 ` Maarten Lankhorst
2018-03-06 7:29 ` Daniel Vetter
2018-03-06 7:40 ` Daniel Vetter
2018-03-06 7:33 ` Daniel Vetter
2018-02-21 14:37 ` [PATCH 2/4] drm/msm/mdp5: Add global state as a private atomic object Rob Clark
[not found] ` <20180221143730.30285-1-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-21 14:37 ` [PATCH 3/4] drm/msm/mdp5: Use the new private_obj state Rob Clark
2018-02-21 14:37 ` [PATCH 4/4] drm/msm: Don't subclass drm_atomic_state anymore Rob Clark
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=20180221144919.GN5453@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@gmail.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;
as well as URLs for NNTP newsgroup(s).