All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Rob Clark <robdclark@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/8] drm: add object property type
Date: Fri, 30 May 2014 09:57:55 +0200	[thread overview]
Message-ID: <20140530075754.GB24748@ulmo> (raw)
In-Reply-To: <1401321445-31906-2-git-send-email-robdclark@gmail.com>


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

On Wed, May 28, 2014 at 07:57:18PM -0400, Rob Clark wrote:
[...]
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
[...]
> +struct drm_property *drm_property_create_object(struct drm_device *dev,
> +					 int flags, const char *name, uint32_t type)

Indentation here is inconsistent with other functions in this file.

> @@ -3294,14 +3316,16 @@ int drm_property_add_enum(struct drm_property *property, int index,
>  {
>  	struct drm_property_enum *prop_enum;
>  
> -	if (!(property->flags & (DRM_MODE_PROP_ENUM | DRM_MODE_PROP_BITMASK)))
> +	if (!(drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
> +			drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
>  		return -EINVAL;

The bulk of this patch seems to be this pattern of substituting explicit
flag checks with drm_property_type_is() and that kind of hides the real
purpose of this patch. Splitting that into a separate patch would make
the addition of drm_property_create_object() more concise.

> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
[...]
> @@ -964,6 +982,8 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
>  struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
>  					 const char *name,
>  					 uint64_t min, uint64_t max);
> +struct drm_property *drm_property_create_object(struct drm_device *dev,
> +					 int flags, const char *name, uint32_t type);
>  extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
>  extern int drm_property_add_enum(struct drm_property *property, int index,
>  				 uint64_t value, const char *name);
> @@ -980,6 +1000,13 @@ extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
>  					 int gamma_size);
>  extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
>  		uint32_t id, uint32_t type);
> +
> +static inline struct drm_mode_object *
> +drm_property_get_obj(struct drm_property *property, uint64_t value)

Perhaps for consistent naming with drm_property_create_object() this
would be better called drm_property_get_object()?

> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
[...]
> +/* non-extended types: legacy bitmask, one bit per type: */
> +#define DRM_MODE_PROP_LEGACY_TYPE  ( \
> +		DRM_MODE_PROP_RANGE | \
> +		DRM_MODE_PROP_ENUM | \
> +		DRM_MODE_PROP_BLOB | \
> +		DRM_MODE_PROP_BITMASK)
> +
> +/* extended-types: rather than continue to consume a bit per type,
> + * grab a chunk of the bits to use as integer type id.
> + */
> +#define DRM_MODE_PROP_EXTENDED_TYPE	0x0000ffc0
> +#define DRM_MODE_PROP_TYPE(n)		((n) << 6)
> +#define DRM_MODE_PROP_OBJECT		DRM_MODE_PROP_TYPE(1)

Ugh, that's an unfortunate bit of userspace ABI...

Could this perhaps be done in a more unified, yet backwards-compatible
way? For example if we define legacy properties like this:

#define DRM_MODE_PROP_TYPE(n)	((n) << 0)
#define DRM_MODE_PROP_RANGE	DRM_MODE_PROP_TYPE( 2)
#define DRM_MODE_PROP_ENUM	DRM_MODE_PROP_TYPE( 8)
#define DRM_MODE_PROP_RANGE	DRM_MODE_PROP_TYPE(16)
#define DRM_MODE_PROP_RANGE	DRM_MODE_PROP_TYPE(32)

And define the type mask to be:

#define DRM_MODE_PROP_TYPE 0x0000fffa

Leaving out only the two real flags (PENDING and IMMUTABLE). This should
allow things to be done without constantly having to special case legacy
vs. extended types. It leaves a bunch of wholes in the number space and
we need to be careful to introduce new types only in the upper range,
but it has the advantage of not requiring special handling.

Thierry

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

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

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

  parent reply	other threads:[~2014-05-30  8:00 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 [this message]
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 ` [PATCH 4/8] drm: Allow drm_mode_object_find() to look up an object of any type Rob Clark
2014-05-29 11:18   ` 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=20140530075754.GB24748@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=dri-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.