dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 4/8] drm: Allow drm_mode_object_find() to look up an object of any type
Date: Wed, 28 May 2014 19:57:21 -0400	[thread overview]
Message-ID: <1401321445-31906-5-git-send-email-robdclark@gmail.com> (raw)
In-Reply-To: <1401321445-31906-1-git-send-email-robdclark@gmail.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

To avoid having to pass object types from userspace for atomic mode
setting ioctl, allow drm_mode_object_find() to look up an object of any
type. This will only work as long as the all object types share the ID
space.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 drivers/gpu/drm/drm_crtc.c | 3 ++-
 include/drm/drm_crtc.h     | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index c53ddc3..b975575 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -409,7 +409,8 @@ struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
 
 	mutex_lock(&dev->mode_config.idr_mutex);
 	obj = idr_find(&dev->mode_config.crtc_idr, id);
-	if (!obj || (obj->type != type) || (obj->id != id))
+	if (!obj || (type != DRM_MODE_OBJECT_ANY && obj->type != type) ||
+	    (obj->id != id))
 		obj = NULL;
 	mutex_unlock(&dev->mode_config.idr_mutex);
 
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index dbd7954..44d7964 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -50,6 +50,7 @@ struct drm_clip_rect;
 #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
 #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
 #define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd
+#define DRM_MODE_OBJECT_ANY 0
 
 struct drm_mode_object {
 	uint32_t id;
-- 
1.9.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2014-05-28 23:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28 23:57 [PATCH 0/8] prepare for preparing for atomic Rob Clark
2014-05-28 23:57 ` [PATCH 1/8] drm: add object property type Rob Clark
2014-05-29  8:01   ` David Herrmann
2014-05-29 11:45     ` Rob Clark
2014-05-30  7:57   ` Thierry Reding
2014-05-30 12:00     ` Rob Clark
2014-05-28 23:57 ` [PATCH 2/8] drm: add signed-range " Rob Clark
2014-05-29  8:29   ` David Herrmann
2014-05-29 11:51     ` Rob Clark
2014-05-28 23:57 ` [PATCH 3/8] drm: helpers to find mode objects Rob Clark
2014-05-28 23:57 ` Rob Clark [this message]
2014-05-29 11:18   ` [PATCH 4/8] drm: Allow drm_mode_object_find() to look up an object of any type Daniel Vetter
2014-05-29 12:01     ` Rob Clark
2014-05-29 12:17       ` Daniel Vetter
2014-05-28 23:57 ` [PATCH 5/8] drm: spiff out FB refcnting traces Rob Clark
2014-05-29  8:36   ` David Herrmann
2014-05-28 23:57 ` [PATCH 6/8] drm: push locking down into restore_fbdev_mode (v2) Rob Clark
2014-05-28 23:57 ` [PATCH 7/8] drm: Split connection_mutex out of mode_config.mutex (v2) Rob Clark
2014-05-28 23:57 ` [PATCH 8/8] drm: convert crtc and connection_mutex to ww_mutex Rob Clark
2014-05-29 11:22   ` Daniel Vetter
2014-05-29 12:07     ` Rob Clark
2014-05-29 12:59       ` [PATCH 1/2] v2 (Daniel): - Readd lost include. - Drop all the additional complexity which we only need later: The basic ww dance only requires the lock list and the contended pointer, nothing more. Some of the stuff also looks very suspicious. - Improve the contended checks a bit to make sure we only get an -EALREADY when we expect it. - Add an interruptible backoff function just to be complete (since otherwise the interruptible locking function makes 0 sense at all). - Inline the slowpath (due to the above). - Move ww_acquire_fini into drm_modeset_acquire_fini. I suspect this has been due to the confusion about the lifetime of the acquire ctx wrt the locking retry loop. - Drop uapi changes, they really shouldn't be in this patch. - s/!ret/ret == 0/ because I got confused - I tend to use !ret only for booleans or pointers, not for errno integer return values Daniel Vetter
2014-05-29 12:59         ` [PATCH 2/2] Revert "v2 (Daniel):" Daniel Vetter

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=1401321445-31906-5-git-send-email-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=dri-devel@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