diff mbox

[08/10] drm/uapi: Deprecate nonsense kms mode types

Message ID 20171114183258.16976-9-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Nov. 14, 2017, 6:32 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

BUILTIN, CRTC_C, CLOCK_C, and DEFULT mode types are unused. Let's
refuse to generate them or accept them from userspace either. A
cursory check didn't reveal any userspace code that would depend
on these.

Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Adam Jackson <ajax@redhat.com>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 include/drm/drm_modes.h     |  7 ++++---
 include/uapi/drm/drm_mode.h | 14 +++++---------
 2 files changed, 9 insertions(+), 12 deletions(-)

Comments

Alex Deucher Nov. 14, 2017, 7:19 p.m. UTC | #1
On Tue, Nov 14, 2017 at 1:32 PM, Ville Syrjala
<ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> BUILTIN, CRTC_C, CLOCK_C, and DEFULT mode types are unused. Let's
> refuse to generate them or accept them from userspace either. A
> cursory check didn't reveal any userspace code that would depend
> on these.
>
> Cc: Jose Abreu <Jose.Abreu@synopsys.com>
> Cc: Adam Jackson <ajax@redhat.com>
> Cc: Keith Packard <keithp@keithp.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  include/drm/drm_modes.h     |  7 ++++---
>  include/uapi/drm/drm_mode.h | 14 +++++---------
>  2 files changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
> index 99dd815269e9..7ac61858b54e 100644
> --- a/include/drm/drm_modes.h
> +++ b/include/drm/drm_modes.h
> @@ -242,8 +242,6 @@ struct drm_display_mode {
>          * A bitmask of flags, mostly about the source of a mode. Possible flags
>          * are:
>          *
> -        *  - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, effectively
> -        *    unused.
>          *  - DRM_MODE_TYPE_PREFERRED: Preferred mode, usually the native
>          *    resolution of an LCD panel. There should only be one preferred
>          *    mode per connector at any given time.
> @@ -253,8 +251,11 @@ struct drm_display_mode {
>          *  - DRM_MODE_TYPE_USERDEF: Mode defined via kernel command line
>          *
>          * Plus a big list of flags which shouldn't be used at all, but are
> -        * still around since these flags are also used in the userspace ABI:
> +        * still around since these flags are also used in the userspace ABI.
> +        * We no longer accept modes with these types though:
>          *
> +        *  - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, effectively
> +        *    unused.
>          *  - DRM_MODE_TYPE_DEFAULT: Again a leftover, use
>          *    DRM_MODE_TYPE_PREFERRED instead.
>          *  - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index a7cded1c43e8..eb9b68c7c218 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -38,19 +38,15 @@ extern "C" {
>  #define DRM_DISPLAY_MODE_LEN   32
>  #define DRM_PROP_NAME_LEN      32
>
> -#define DRM_MODE_TYPE_BUILTIN  (1<<0)
> -#define DRM_MODE_TYPE_CLOCK_C  ((1<<1) | DRM_MODE_TYPE_BUILTIN)
> -#define DRM_MODE_TYPE_CRTC_C   ((1<<2) | DRM_MODE_TYPE_BUILTIN)
> +#define DRM_MODE_TYPE_BUILTIN  (1<<0) /* deprecated */
> +#define DRM_MODE_TYPE_CLOCK_C  ((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
> +#define DRM_MODE_TYPE_CRTC_C   ((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
>  #define DRM_MODE_TYPE_PREFERRED        (1<<3)
> -#define DRM_MODE_TYPE_DEFAULT  (1<<4)
> +#define DRM_MODE_TYPE_DEFAULT  (1<<4) /* deprecated */
>  #define DRM_MODE_TYPE_USERDEF  (1<<5)
>  #define DRM_MODE_TYPE_DRIVER   (1<<6)
>
> -#define DRM_MODE_TYPE_ALL      (DRM_MODE_TYPE_BUILTIN |        \
> -                                DRM_MODE_TYPE_CLOCK_C |        \
> -                                DRM_MODE_TYPE_CRTC_C |         \
> -                                DRM_MODE_TYPE_PREFERRED |      \
> -                                DRM_MODE_TYPE_DEFAULT |        \
> +#define DRM_MODE_TYPE_ALL      (DRM_MODE_TYPE_PREFERRED |      \
>                                  DRM_MODE_TYPE_USERDEF |        \
>                                  DRM_MODE_TYPE_DRIVER)
>
> --
> 2.13.6
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Adam Jackson Nov. 14, 2017, 8:43 p.m. UTC | #2
On Tue, 2017-11-14 at 20:32 +0200, Ville Syrjala wrote:

> @@ -253,8 +251,11 @@ struct drm_display_mode {
>  	 *  - DRM_MODE_TYPE_USERDEF: Mode defined via kernel command line
>  	 *
>  	 * Plus a big list of flags which shouldn't be used at all, but are
> -	 * still around since these flags are also used in the userspace ABI:
> +	 * still around since these flags are also used in the userspace ABI.
> +	 * We no longer accept modes with these types though:
>  	 *
> +	 *  - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, effectively
> +	 *    unused.

This should suggest _TYPE_DRIVER, I think. The intent with the xfree86
mode type was that "built-in" modes were known quantities of the
hardware, either because the hardware only had one mode or due to
strapping pins or the like. These should be considered "supplied by the
driver" as with EDID-derived modes.

With or without that, patches 2 3 4 and 8 are:

Reviewed-by: Adam Jackson <ajax@redhat.com>

- ajax
Jose Abreu Nov. 15, 2017, 6:04 p.m. UTC | #3
On 15-11-2017 15:45, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> BUILTIN, CRTC_C, CLOCK_C, and DEFULT mode types are unused. Let's
> refuse to generate them or accept them from userspace either. A
> cursory check didn't reveal any userspace code that would depend
> on these.
>
> v2: Recommend DRIVER instead of BUILTIN (ajax)
>
> Cc: Jose Abreu <Jose.Abreu@synopsys.com>
> Cc: Adam Jackson <ajax@redhat.com>
> Cc: Keith Packard <keithp@keithp.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: Adam Jackson <ajax@redhat.com>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>

Reviewed-by: Jose Abreu <joabreu@synopsys.com>

Best Regards,
Jose Miguel Abreu
diff mbox

Patch

diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
index 99dd815269e9..7ac61858b54e 100644
--- a/include/drm/drm_modes.h
+++ b/include/drm/drm_modes.h
@@ -242,8 +242,6 @@  struct drm_display_mode {
 	 * A bitmask of flags, mostly about the source of a mode. Possible flags
 	 * are:
 	 *
-	 *  - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, effectively
-	 *    unused.
 	 *  - DRM_MODE_TYPE_PREFERRED: Preferred mode, usually the native
 	 *    resolution of an LCD panel. There should only be one preferred
 	 *    mode per connector at any given time.
@@ -253,8 +251,11 @@  struct drm_display_mode {
 	 *  - DRM_MODE_TYPE_USERDEF: Mode defined via kernel command line
 	 *
 	 * Plus a big list of flags which shouldn't be used at all, but are
-	 * still around since these flags are also used in the userspace ABI:
+	 * still around since these flags are also used in the userspace ABI.
+	 * We no longer accept modes with these types though:
 	 *
+	 *  - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, effectively
+	 *    unused.
 	 *  - DRM_MODE_TYPE_DEFAULT: Again a leftover, use
 	 *    DRM_MODE_TYPE_PREFERRED instead.
 	 *  - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index a7cded1c43e8..eb9b68c7c218 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -38,19 +38,15 @@  extern "C" {
 #define DRM_DISPLAY_MODE_LEN	32
 #define DRM_PROP_NAME_LEN	32
 
-#define DRM_MODE_TYPE_BUILTIN	(1<<0)
-#define DRM_MODE_TYPE_CLOCK_C	((1<<1) | DRM_MODE_TYPE_BUILTIN)
-#define DRM_MODE_TYPE_CRTC_C	((1<<2) | DRM_MODE_TYPE_BUILTIN)
+#define DRM_MODE_TYPE_BUILTIN	(1<<0) /* deprecated */
+#define DRM_MODE_TYPE_CLOCK_C	((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
+#define DRM_MODE_TYPE_CRTC_C	((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
 #define DRM_MODE_TYPE_PREFERRED	(1<<3)
-#define DRM_MODE_TYPE_DEFAULT	(1<<4)
+#define DRM_MODE_TYPE_DEFAULT	(1<<4) /* deprecated */
 #define DRM_MODE_TYPE_USERDEF	(1<<5)
 #define DRM_MODE_TYPE_DRIVER	(1<<6)
 
-#define DRM_MODE_TYPE_ALL	(DRM_MODE_TYPE_BUILTIN |	\
-				 DRM_MODE_TYPE_CLOCK_C |	\
-				 DRM_MODE_TYPE_CRTC_C |		\
-				 DRM_MODE_TYPE_PREFERRED |	\
-				 DRM_MODE_TYPE_DEFAULT |	\
+#define DRM_MODE_TYPE_ALL	(DRM_MODE_TYPE_PREFERRED |	\
 				 DRM_MODE_TYPE_USERDEF |	\
 				 DRM_MODE_TYPE_DRIVER)