Skip to contentSkip to conversation

drm/uapi: Validate mode flags/type, and deprecate some of them

PATCH In review Ville Syrjala 8 participants 40 messages Nov 14, 2017 – Mar 21, 2018 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drm/uapi: Validate mode flags/type, and deprecate some of them

From: Ville Syrjälä <[email protected]>

I recently realized that we're not validating the mode flags/type passed in from userspace. Let's try to fix that.

I'd also like to entirely eliminate some of the more crazy mode flags. PIXMUX and BCAST look pretty easy, so I've targetted them first.

Ideally I'd like to kill DBLCLK, CLKDIV2, HSKEW, DBLSCAN, and vscan as well. IMO there's no good reason to expose any of that to userspace, and instead it should all be handled internally by the drivers. Unfortunately all of those seem to be used to some degree by a handful of drivers.

I also tried to nuke some of the crazy mode types.

Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>

Ville Syrjälä (10):
drm/modes: Move 3D stereo flag check into drm_mode_validate_basic() drm/uapi: Validate the mode flags/type
drm/uapi: Deprecate DRM_MODE_FLAG_PIXMUX
drm/uapi: Deprecate DRM_MODE_FLAG_BCAST
drm/modes: Fix description of DRM_MODE_TYPE_USERDEF drm/modes: Kill off the oddball DRM_MODE_TYPE_CRTC_C vs.
DRM_MODE_TYPE_BUILTIN handling
drm/modes: Kill DRM_MODE_TYPE_CLOCK_CRTC_C define drm/uapi: Deprecate nonsense kms mode types
drm/modes: Provide global mode_valid hook
drm/i915: Provide a device level .mode_valid() hook

 drivers/gpu/drm/drm_atomic.c         |  2 +-
 drivers/gpu/drm/drm_crtc.c           |  2 +-
 drivers/gpu/drm/drm_modes.c          | 60 +++++++++++++++++++++++++-----------
 drivers/gpu/drm/drm_probe_helper.c   |  2 +-
 drivers/gpu/drm/i915/intel_crt.c     |  3 --
 drivers/gpu/drm/i915/intel_display.c | 27 ++++++++++++++++
 drivers/gpu/drm/i915/intel_dsi.c     |  5 ---
 drivers/gpu/drm/i915/intel_dvo.c     |  3 --
 drivers/gpu/drm/i915/intel_fbc.c     |  3 +-
 drivers/gpu/drm/i915/intel_hdmi.c    |  3 --
 drivers/gpu/drm/i915/intel_sdvo.c    |  3 --
 include/drm/drm_mode_config.h        | 12 ++++++++
 include/drm/drm_modes.h              | 24 +++++++--------
 include/uapi/drm/drm_mode.h          | 30 ++++++++++++++----
 14 files changed, 120 insertions(+), 59 deletions(-)
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/10 drm/modes: Move 3D stereo flag check into drm_mode_validate_basic()

From: Ville Syrjälä <[email protected]>

Currently we don't sanity check the 3D stereo flags for modes filled out by the kernel. Move the check from drm_mode_convert_umode() into drm_mode_validate_basic() so that we get the same check going both ways.

---
 drivers/gpu/drm/drm_modes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_modes.c +3 -3
index 4a3f68a33844..1a72883b836e 100644
@@ -1036,6 +1036,9 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
 enum drm_mode_status
 drm_mode_validate_basic(const struct drm_display_mode *mode)
 {
+	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
+		return MODE_BAD;
+
 	if (mode->clock == 0)
 		return MODE_CLOCK_LOW;
 
@@ -1574,9 +1577,6 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
 		goto out;
 	}
 
-	if ((in->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
-		goto out;
-
 	out->clock = in->clock;
 	out->hdisplay = in->hdisplay;
 	out->hsync_start = in->hsync_start;
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/10
#2 lore raw

Re: [PATCH 01/10] drm/modes: Move 3D stereo flag check into drm_mode_validate_basic()

Quoted 7 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Currently we don't sanity check the 3D stereo flags for modes filled out by the kernel. Move the check from drm_mode_convert_umode() into drm_mode_validate_basic() so that we get the same check going both ways.

Quoted 31 lines
---
 drivers/gpu/drm/drm_modes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_modes.c +3 -4
index 4a3f68a33844..1a72883b836e 100644
@@ -1036,6 +1036,9 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
 enum drm_mode_status
 drm_mode_validate_basic(const struct drm_display_mode *mode)
 {
+       if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
+               return MODE_BAD;
+
        if (mode->clock == 0)
                return MODE_CLOCK_LOW;
 
@@ -1574,9 +1577,6 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
                goto out;
        }
 
-       if ((in->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
-               goto out;
-
        out->clock = in->clock;
        out->hdisplay = in->hdisplay;
        out->hsync_start = in->hsync_start;
--

2.13.6

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

PATCH 2/10 drm/uapi: Validate the mode flags/type

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Currently userspace is allowed to feed in any king of garbage in the high bits of the mode flags/type, as are drivers when probing modes. Reject any mode with bogus flags/type.

Hopefully this won't break any current userspace...

Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
---
 drivers/gpu/drm/drm_modes.c |  4 ++++
 include/uapi/drm/drm_mode.h | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
drivers/gpu/drm/drm_modes.c +4 -0
index 1a72883b836e..f99ba963fb3e 100644
@@ -1036,6 +1036,10 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
 enum drm_mode_status
 drm_mode_validate_basic(const struct drm_display_mode *mode)
 {
+	if (mode->type & ~DRM_MODE_TYPE_ALL ||
+	    mode->flags & ~DRM_MODE_FLAG_ALL)
+		return MODE_BAD;
+
 	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
 		return MODE_BAD;
 
include/uapi/drm/drm_mode.h +24 -0
index 5597a87154e5..004db470b477 100644
@@ -46,6 +46,14 @@ extern "C" {
 #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 |	\
+				 DRM_MODE_TYPE_USERDEF |	\
+				 DRM_MODE_TYPE_DRIVER)
+
 /* Video mode flags */
 /* bit compatible with the xrandr RR_ definitions (bits 0-13)
  *
@@ -99,6 +107,22 @@ extern "C" {
 #define  DRM_MODE_FLAG_PIC_AR_16_9 \
 			(DRM_MODE_PICTURE_ASPECT_16_9<<19)
 
+#define  DRM_MODE_FLAG_ALL	(DRM_MODE_FLAG_PHSYNC |		\
+				 DRM_MODE_FLAG_NHSYNC |		\
+				 DRM_MODE_FLAG_PVSYNC |		\
+				 DRM_MODE_FLAG_NVSYNC |		\
+				 DRM_MODE_FLAG_INTERLACE |	\
+				 DRM_MODE_FLAG_DBLSCAN |	\
+				 DRM_MODE_FLAG_CSYNC |		\
+				 DRM_MODE_FLAG_PCSYNC |		\
+				 DRM_MODE_FLAG_NCSYNC |		\
+				 DRM_MODE_FLAG_HSKEW |		\
+				 DRM_MODE_FLAG_BCAST |		\
+				 DRM_MODE_FLAG_PIXMUX |		\
+				 DRM_MODE_FLAG_DBLCLK |		\
+				 DRM_MODE_FLAG_CLKDIV2 |	\
+				 DRM_MODE_FLAG_3D_MASK)
+
 /* DPMS flags */
 /* bit compatible with the xorg definitions. */
 #define DRM_MODE_DPMS_ON	0
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [Intel-gfx] [PATCH 02/10] drm/uapi: Validate the mode flags/type

Quoting Ville Syrjala (2017-11-14 18:32:50)

Quoted 22 lines

From: Ville Syrjälä <[email protected]>

Currently userspace is allowed to feed in any king of garbage in the high bits of the mode flags/type, as are drivers when probing modes. Reject any mode with bogus flags/type.

Hopefully this won't break any current userspace...

Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
---
 drivers/gpu/drm/drm_modes.c |  4 ++++
 include/uapi/drm/drm_mode.h | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
drivers/gpu/drm/drm_modes.c +0 -0
index 1a72883b836e..f99ba963fb3e 100644

drivers/gpu/drm/drm_modes.c EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo); · line 1041

Quoted 6 lines
drivers/gpu/drm/drm_modes.c +3 -0
@@ -1036,6 +1036,10 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
 enum drm_mode_status
 drm_mode_validate_basic(const struct drm_display_mode *mode)
 {
+       if (mode->type & ~DRM_MODE_TYPE_ALL ||
+           mode->flags & ~DRM_MODE_FLAG_ALL)
+               return MODE_BAD;

I had to read this twice to realise they were different masks. (If the start and end of a word match expectations, the eye skips the middle.) Can we split this up into two separate ifs, so the reader doesn't fall into this trap :)
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Re: [PATCH 02/10] drm/uapi: Validate the mode flags/type

Quoted 18 lines · Chris Wilson

Quoting Ville Syrjala (2017-11-14 18:32:50)

Quoted 17 lines

From: Ville Syrjälä <[email protected]>

Currently userspace is allowed to feed in any king of garbage in the high bits of the mode flags/type, as are drivers when probing modes. Reject any mode with bogus flags/type.

Hopefully this won't break any current userspace...

Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
---
 drivers/gpu/drm/drm_modes.c |  4 ++++
 include/uapi/drm/drm_mode.h | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
Quoted 16 lines

drivers/gpu/drm/drm_modes.c EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo); · line 1041

Quoted 11 lines
drivers/gpu/drm/drm_modes.c +3 -0
index 1a72883b836e..f99ba963fb3e 100644
@@ -1036,6 +1036,10 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
 enum drm_mode_status
 drm_mode_validate_basic(const struct drm_display_mode *mode)
 {
+       if (mode->type & ~DRM_MODE_TYPE_ALL ||
+           mode->flags & ~DRM_MODE_FLAG_ALL)
+               return MODE_BAD;

I had to read this twice to realise they were different masks. (If the start and end of a word match expectations, the eye skips the middle.) Can we split this up into two separate ifs, so the reader doesn't fall into this trap :)

Sure, I can split that up.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH v2 2/10 drm/uapi: Validate the mode flags/type

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Currently userspace is allowed to feed in any king of garbage in the high bits of the mode flags/type, as are drivers when probing modes. Reject any mode with bogus flags/type.

Hopefully this won't break any current userspace...

v2: Split the type and flags checks to separates ifs (Chris)

Cc Chris Wilson <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
---
 drivers/gpu/drm/drm_modes.c |  6 ++++++
 include/uapi/drm/drm_mode.h | 24 ++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/drm_modes.c +6 -0
index 1a72883b836e..34b5123ebfc0 100644
@@ -1036,6 +1036,12 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
 enum drm_mode_status
 drm_mode_validate_basic(const struct drm_display_mode *mode)
 {
+	if (mode->type & ~DRM_MODE_TYPE_ALL)
+		return MODE_BAD;
+
+	if (mode->flags & ~DRM_MODE_FLAG_ALL)
+		return MODE_BAD;
+
 	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
 		return MODE_BAD;
 
include/uapi/drm/drm_mode.h +24 -0
index 5597a87154e5..004db470b477 100644
@@ -46,6 +46,14 @@ extern "C" {
 #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 |	\
+				 DRM_MODE_TYPE_USERDEF |	\
+				 DRM_MODE_TYPE_DRIVER)
+
 /* Video mode flags */
 /* bit compatible with the xrandr RR_ definitions (bits 0-13)
  *
@@ -99,6 +107,22 @@ extern "C" {
 #define  DRM_MODE_FLAG_PIC_AR_16_9 \
 			(DRM_MODE_PICTURE_ASPECT_16_9<<19)
 
+#define  DRM_MODE_FLAG_ALL	(DRM_MODE_FLAG_PHSYNC |		\
+				 DRM_MODE_FLAG_NHSYNC |		\
+				 DRM_MODE_FLAG_PVSYNC |		\
+				 DRM_MODE_FLAG_NVSYNC |		\
+				 DRM_MODE_FLAG_INTERLACE |	\
+				 DRM_MODE_FLAG_DBLSCAN |	\
+				 DRM_MODE_FLAG_CSYNC |		\
+				 DRM_MODE_FLAG_PCSYNC |		\
+				 DRM_MODE_FLAG_NCSYNC |		\
+				 DRM_MODE_FLAG_HSKEW |		\
+				 DRM_MODE_FLAG_BCAST |		\
+				 DRM_MODE_FLAG_PIXMUX |		\
+				 DRM_MODE_FLAG_DBLCLK |		\
+				 DRM_MODE_FLAG_CLKDIV2 |	\
+				 DRM_MODE_FLAG_3D_MASK)
+
 /* DPMS flags */
 /* bit compatible with the xorg definitions. */
 #define DRM_MODE_DPMS_ON	0
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 2/10
#7 lore raw

Re: [PATCH v2 02/10] drm/uapi: Validate the mode flags/type

Quoted 8 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Currently userspace is allowed to feed in any king of garbage in the high bits of the mode flags/type, as are drivers when probing modes. Reject any mode with bogus flags/type.

Hopefully this won't break any current userspace...

Quoted 8 lines

v2: Split the type and flags checks to separates ifs (Chris)

Cc Chris Wilson <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
Quoted 67 lines
---
 drivers/gpu/drm/drm_modes.c |  6 ++++++
 include/uapi/drm/drm_mode.h | 24 ++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/drm_modes.c +6 -0
index 1a72883b836e..34b5123ebfc0 100644
@@ -1036,6 +1036,12 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
 enum drm_mode_status
 drm_mode_validate_basic(const struct drm_display_mode *mode)
 {
+       if (mode->type & ~DRM_MODE_TYPE_ALL)
+               return MODE_BAD;
+
+       if (mode->flags & ~DRM_MODE_FLAG_ALL)
+               return MODE_BAD;
+
        if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
                return MODE_BAD;
 
include/uapi/drm/drm_mode.h +24 -1
index 5597a87154e5..004db470b477 100644
@@ -46,6 +46,14 @@ extern "C" {
 #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 |        \
+                                DRM_MODE_TYPE_USERDEF |        \
+                                DRM_MODE_TYPE_DRIVER)
+
 /* Video mode flags */
 /* bit compatible with the xrandr RR_ definitions (bits 0-13)
  *
@@ -99,6 +107,22 @@ extern "C" {
 #define  DRM_MODE_FLAG_PIC_AR_16_9 \
                        (DRM_MODE_PICTURE_ASPECT_16_9<<19)
 
+#define  DRM_MODE_FLAG_ALL     (DRM_MODE_FLAG_PHSYNC |         \
+                                DRM_MODE_FLAG_NHSYNC |         \
+                                DRM_MODE_FLAG_PVSYNC |         \
+                                DRM_MODE_FLAG_NVSYNC |         \
+                                DRM_MODE_FLAG_INTERLACE |      \
+                                DRM_MODE_FLAG_DBLSCAN |        \
+                                DRM_MODE_FLAG_CSYNC |          \
+                                DRM_MODE_FLAG_PCSYNC |         \
+                                DRM_MODE_FLAG_NCSYNC |         \
+                                DRM_MODE_FLAG_HSKEW |          \
+                                DRM_MODE_FLAG_BCAST |          \
+                                DRM_MODE_FLAG_PIXMUX |         \
+                                DRM_MODE_FLAG_DBLCLK |         \
+                                DRM_MODE_FLAG_CLKDIV2 |        \
+                                DRM_MODE_FLAG_3D_MASK)
+
 /* DPMS flags */
 /* bit compatible with the xorg definitions. */
 #define DRM_MODE_DPMS_ON       0
--

2.13.6

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [PATCH v2 02/10] drm/uapi: Validate the mode flags/type

In reply to Ville Syrjala

Hi Ville,

Quoted 8 lines · Ville Syrjala
include/uapi/drm/drm_mode.h +6 -0
+#define  DRM_MODE_FLAG_ALL	(DRM_MODE_FLAG_PHSYNC |		\
+				 DRM_MODE_FLAG_NHSYNC |		\
+				 DRM_MODE_FLAG_PVSYNC |		\
+				 DRM_MODE_FLAG_NVSYNC |		\
+				 DRM_MODE_FLAG_INTERLACE |	\
+				 DRM_MODE_FLAG_DBLSCAN |	\

include/uapi/drm/drm_mode.h extern "C" { · line 125

Quoted 10 lines
include/uapi/drm/drm_mode.h +10 -0
+				 DRM_MODE_FLAG_CSYNC |		\
+				 DRM_MODE_FLAG_PCSYNC |		\
+				 DRM_MODE_FLAG_NCSYNC |		\
+				 DRM_MODE_FLAG_HSKEW |		\
+				 DRM_MODE_FLAG_BCAST |		\
+				 DRM_MODE_FLAG_PIXMUX |		\
+				 DRM_MODE_FLAG_DBLCLK |		\
+				 DRM_MODE_FLAG_CLKDIV2 |	\
+				 DRM_MODE_FLAG_3D_MASK)
+

I see this doesn't include the picture aspect ratio flags. Shouldn't we add this now so that userspace can start using them?

Best Regards,
Jose Miguel Abreu
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw

Re: [PATCH v2 02/10] drm/uapi: Validate the mode flags/type

Quoted 16 lines · Jose Abreu

Hi Ville,

Quoted 13 lines · Ville Syrjala
include/uapi/drm/drm_mode.h +12 -0
+#define  DRM_MODE_FLAG_ALL	(DRM_MODE_FLAG_PHSYNC |		\
+				 DRM_MODE_FLAG_NHSYNC |		\
+				 DRM_MODE_FLAG_PVSYNC |		\
+				 DRM_MODE_FLAG_NVSYNC |		\
+				 DRM_MODE_FLAG_INTERLACE |	\
+				 DRM_MODE_FLAG_DBLSCAN |	\
+				 DRM_MODE_FLAG_CSYNC |		\
+				 DRM_MODE_FLAG_PCSYNC |		\
+				 DRM_MODE_FLAG_NCSYNC |		\
+				 DRM_MODE_FLAG_HSKEW |		\
+				 DRM_MODE_FLAG_BCAST |		\
+				 DRM_MODE_FLAG_PIXMUX |		\
Quoted 8 lines

include/uapi/drm/drm_mode.h extern "C" { · line 125

Quoted 5 lines
include/uapi/drm/drm_mode.h +4 -0
+				 DRM_MODE_FLAG_DBLCLK |		\
+				 DRM_MODE_FLAG_CLKDIV2 |	\
+				 DRM_MODE_FLAG_3D_MASK)
+

I see this doesn't include the picture aspect ratio flags. Shouldn't we add this now so that userspace can start using them?

Not until we have the client cap to keep them hidden from userspace that isn't prepared to see them.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

drm-next xf86-video-vmware breakage Was [PATCH 02/10] drm/uapi: Validate the mode flags/type

In reply to Ville Syrjala

Hi, Ville,

Quoted 7 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Currently userspace is allowed to feed in any king of garbage in the high bits of the mode flags/type, as are drivers when probing modes. Reject any mode with bogus flags/type.

Hopefully this won't break any current userspace...

Unfortunately this breaks xf86-video-vmware which currently leaves the mode->type uninitialized :(.
That code is inherited from the old gallium xorg state tracker. I don't know whether it has spread elsewhere but the symptoms are that the X server frequently dies failing to set screen resources, a very uninformative error.

I'll fix the xf86-video-vmware driver, but I guess we need to back out the mode->type check.

/Thomas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw

Re: drm-next xf86-video-vmware breakage Was [PATCH 02/10] drm/uapi: Validate the mode flags/type

Quoted 18 lines · Thomas Hellstrom

Hi, Ville,

Quoted 7 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Currently userspace is allowed to feed in any king of garbage in the high bits of the mode flags/type, as are drivers when probing modes. Reject any mode with bogus flags/type.

Hopefully this won't break any current userspace...

Unfortunately this breaks xf86-video-vmware which currently leaves the mode->type uninitialized :(.
That code is inherited from the old gallium xorg state tracker. I don't know whether it has spread elsewhere but the symptoms are that the X server frequently dies failing to set screen resources, a very uninformative error.

Quoted 2 lines

I'll fix the xf86-video-vmware driver, but I guess we need to back out the mode->type check.

Dang. So the flags check is fine but type check is not?

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

Re: drm-next xf86-video-vmware breakage Was [PATCH 02/10] drm/uapi: Validate the mode flags/type

Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Thomas Hellstrom

Hi, Ville,

Quoted 7 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Currently userspace is allowed to feed in any king of garbage in the high bits of the mode flags/type, as are drivers when probing modes. Reject any mode with bogus flags/type.

Hopefully this won't break any current userspace...

Unfortunately this breaks xf86-video-vmware which currently leaves the mode->type uninitialized :(.
That code is inherited from the old gallium xorg state tracker. I don't know whether it has spread elsewhere but the symptoms are that the X server frequently dies failing to set screen resources, a very uninformative error.

Quoted 4 lines
Quoted 2 lines

I'll fix the xf86-video-vmware driver, but I guess we need to back out the mode->type check.

Dang. So the flags check is fine but type check is not?

Yes, we copy the flags field untranslated from xorg's DisplayModePtr::Flags field which seems to be what xf86-video-modesetting does as well, so I guess we should be OK there.

/Thomas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#13 lore raw

PATCH 3/10 drm/uapi: Deprecate DRM_MODE_FLAG_PIXMUX

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Reject any mode with DRM_MODE_FLAG_PIXMUX. We have no code that even checks for this flag hence it can't possibly do any good.

Looks like this flag had something to do the the controller<->ramdac interface with some ancient S3 graphics adapters. Why someone though it would be a good idea to expose it directly to users I don't know. And later on it got copied into the randr protocol and kms uapi.

Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
---
 include/drm/drm_modes.h     | 2 +-
 include/uapi/drm/drm_mode.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
include/drm/drm_modes.h +1 -1
index 9f3421c8efcd..bce573375dd8 100644
@@ -300,7 +300,7 @@ struct drm_display_mode {
 	 *  - DRM_MODE_FLAG_NCSYNC: composite sync is active low.
 	 *  - DRM_MODE_FLAG_HSKEW: hskew provided (not used?).
 	 *  - DRM_MODE_FLAG_BCAST: not used?
-	 *  - DRM_MODE_FLAG_PIXMUX: not used?
+	 *  - DRM_MODE_FLAG_PIXMUX: <deprecated>
 	 *  - DRM_MODE_FLAG_DBLCLK: double-clocked mode.
 	 *  - DRM_MODE_FLAG_CLKDIV2: half-clocked mode.
 	 *
include/uapi/drm/drm_mode.h +1 -2
index 004db470b477..8d872e17223e 100644
@@ -75,7 +75,7 @@ extern "C" {
 #define DRM_MODE_FLAG_NCSYNC			(1<<8)
 #define DRM_MODE_FLAG_HSKEW			(1<<9) /* hskew provided */
 #define DRM_MODE_FLAG_BCAST			(1<<10)
-#define DRM_MODE_FLAG_PIXMUX			(1<<11)
+#define DRM_MODE_FLAG_PIXMUX			(1<<11) /* deprecated */
 #define DRM_MODE_FLAG_DBLCLK			(1<<12)
 #define DRM_MODE_FLAG_CLKDIV2			(1<<13)
  /*
@@ -118,7 +118,6 @@ extern "C" {
 				 DRM_MODE_FLAG_NCSYNC |		\
 				 DRM_MODE_FLAG_HSKEW |		\
 				 DRM_MODE_FLAG_BCAST |		\
-				 DRM_MODE_FLAG_PIXMUX |		\
 				 DRM_MODE_FLAG_DBLCLK |		\
 				 DRM_MODE_FLAG_CLKDIV2 |	\
 				 DRM_MODE_FLAG_3D_MASK)
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 3/10
#14 lore raw

Re: [PATCH 03/10] drm/uapi: Deprecate DRM_MODE_FLAG_PIXMUX

Quoted 10 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Reject any mode with DRM_MODE_FLAG_PIXMUX. We have no code that even checks for this flag hence it can't possibly do any good.

Looks like this flag had something to do the the controller<->ramdac interface with some ancient S3 graphics adapters. Why someone though it would be a good idea to expose it directly to users I don't know. And later on it got copied into the randr protocol and kms uapi.

Quoted 4 lines
Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
Quoted 42 lines
---
 include/drm/drm_modes.h     | 2 +-
 include/uapi/drm/drm_mode.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
include/drm/drm_modes.h +1 -1
index 9f3421c8efcd..bce573375dd8 100644
@@ -300,7 +300,7 @@ struct drm_display_mode {
         *  - DRM_MODE_FLAG_NCSYNC: composite sync is active low.
         *  - DRM_MODE_FLAG_HSKEW: hskew provided (not used?).
         *  - DRM_MODE_FLAG_BCAST: not used?
-        *  - DRM_MODE_FLAG_PIXMUX: not used?
+        *  - DRM_MODE_FLAG_PIXMUX: <deprecated>
         *  - DRM_MODE_FLAG_DBLCLK: double-clocked mode.
         *  - DRM_MODE_FLAG_CLKDIV2: half-clocked mode.
         *
include/uapi/drm/drm_mode.h +1 -3
index 004db470b477..8d872e17223e 100644
@@ -75,7 +75,7 @@ extern "C" {
 #define DRM_MODE_FLAG_NCSYNC                   (1<<8)
 #define DRM_MODE_FLAG_HSKEW                    (1<<9) /* hskew provided */
 #define DRM_MODE_FLAG_BCAST                    (1<<10)
-#define DRM_MODE_FLAG_PIXMUX                   (1<<11)
+#define DRM_MODE_FLAG_PIXMUX                   (1<<11) /* deprecated */
 #define DRM_MODE_FLAG_DBLCLK                   (1<<12)
 #define DRM_MODE_FLAG_CLKDIV2                  (1<<13)
  /*
@@ -118,7 +118,6 @@ extern "C" {
                                 DRM_MODE_FLAG_NCSYNC |         \
                                 DRM_MODE_FLAG_HSKEW |          \
                                 DRM_MODE_FLAG_BCAST |          \
-                                DRM_MODE_FLAG_PIXMUX |         \
                                 DRM_MODE_FLAG_DBLCLK |         \
                                 DRM_MODE_FLAG_CLKDIV2 |        \
                                 DRM_MODE_FLAG_3D_MASK)
--

2.13.6

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 3/10
#15 lore raw

Re: [PATCH 03/10] drm/uapi: Deprecate DRM_MODE_FLAG_PIXMUX

In reply to Ville Syrjala
Quoted 10 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Reject any mode with DRM_MODE_FLAG_PIXMUX. We have no code that even checks for this flag hence it can't possibly do any good.

Looks like this flag had something to do the the controller<->ramdac interface with some ancient S3 graphics adapters. Why someone though it would be a good idea to expose it directly to users I don't know. And later on it got copied into the randr protocol and kms uapi.

Quoted 5 lines
Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>

Best Regards,
Jose Miguel Abreu
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

PATCH 4/10 drm/uapi: Deprecate DRM_MODE_FLAG_BCAST

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Reject any mode with DRM_MODE_FLAG_BCAST. We have no code that even checks for this flag hence it can't possibly do any good.

I think this maybe originated from fbdev where it was supposed to indicate PAL/NTSC broadcast timings. I have no idea why those would have to be identified by a flag rather than by just the timings themselves. And then I assume it got copied into xfree86 for fbdevhw, and later on it leaked into the randr protocol and kms uapi.

Since kms fbdev emulation never uses the corresponding fbdev flag there should be no sane way for this to come back into kms via userspace either.

Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
---
 include/drm/drm_modes.h     | 2 +-
 include/uapi/drm/drm_mode.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
include/drm/drm_modes.h +1 -1
index bce573375dd8..09773e766e1f 100644
@@ -299,7 +299,7 @@ struct drm_display_mode {
 	 *  - DRM_MODE_FLAG_PCSYNC: composite sync is active high.
 	 *  - DRM_MODE_FLAG_NCSYNC: composite sync is active low.
 	 *  - DRM_MODE_FLAG_HSKEW: hskew provided (not used?).
-	 *  - DRM_MODE_FLAG_BCAST: not used?
+	 *  - DRM_MODE_FLAG_BCAST: <deprecated>
 	 *  - DRM_MODE_FLAG_PIXMUX: <deprecated>
 	 *  - DRM_MODE_FLAG_DBLCLK: double-clocked mode.
 	 *  - DRM_MODE_FLAG_CLKDIV2: half-clocked mode.
include/uapi/drm/drm_mode.h +1 -2
index 8d872e17223e..a7cded1c43e8 100644
@@ -74,7 +74,7 @@ extern "C" {
 #define DRM_MODE_FLAG_PCSYNC			(1<<7)
 #define DRM_MODE_FLAG_NCSYNC			(1<<8)
 #define DRM_MODE_FLAG_HSKEW			(1<<9) /* hskew provided */
-#define DRM_MODE_FLAG_BCAST			(1<<10)
+#define DRM_MODE_FLAG_BCAST			(1<<10) /* deprecated */
 #define DRM_MODE_FLAG_PIXMUX			(1<<11) /* deprecated */
 #define DRM_MODE_FLAG_DBLCLK			(1<<12)
 #define DRM_MODE_FLAG_CLKDIV2			(1<<13)
@@ -117,7 +117,6 @@ extern "C" {
 				 DRM_MODE_FLAG_PCSYNC |		\
 				 DRM_MODE_FLAG_NCSYNC |		\
 				 DRM_MODE_FLAG_HSKEW |		\
-				 DRM_MODE_FLAG_BCAST |		\
 				 DRM_MODE_FLAG_DBLCLK |		\
 				 DRM_MODE_FLAG_CLKDIV2 |	\
 				 DRM_MODE_FLAG_3D_MASK)
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 4/10
#17 lore raw

Re: [PATCH 04/10] drm/uapi: Deprecate DRM_MODE_FLAG_BCAST

Quoted 11 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Reject any mode with DRM_MODE_FLAG_BCAST. We have no code that even checks for this flag hence it can't possibly do any good.

I think this maybe originated from fbdev where it was supposed to indicate PAL/NTSC broadcast timings. I have no idea why those would have to be identified by a flag rather than by just the timings themselves. And then I assume it got copied into xfree86 for fbdevhw, and later on it leaked into the randr protocol and kms uapi.

Quoted 8 lines

Since kms fbdev emulation never uses the corresponding fbdev flag there should be no sane way for this to come back into kms via userspace either.

Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
Quoted 42 lines
---
 include/drm/drm_modes.h     | 2 +-
 include/uapi/drm/drm_mode.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
include/drm/drm_modes.h +1 -1
index bce573375dd8..09773e766e1f 100644
@@ -299,7 +299,7 @@ struct drm_display_mode {
         *  - DRM_MODE_FLAG_PCSYNC: composite sync is active high.
         *  - DRM_MODE_FLAG_NCSYNC: composite sync is active low.
         *  - DRM_MODE_FLAG_HSKEW: hskew provided (not used?).
-        *  - DRM_MODE_FLAG_BCAST: not used?
+        *  - DRM_MODE_FLAG_BCAST: <deprecated>
         *  - DRM_MODE_FLAG_PIXMUX: <deprecated>
         *  - DRM_MODE_FLAG_DBLCLK: double-clocked mode.
         *  - DRM_MODE_FLAG_CLKDIV2: half-clocked mode.
include/uapi/drm/drm_mode.h +1 -3
index 8d872e17223e..a7cded1c43e8 100644
@@ -74,7 +74,7 @@ extern "C" {
 #define DRM_MODE_FLAG_PCSYNC                   (1<<7)
 #define DRM_MODE_FLAG_NCSYNC                   (1<<8)
 #define DRM_MODE_FLAG_HSKEW                    (1<<9) /* hskew provided */
-#define DRM_MODE_FLAG_BCAST                    (1<<10)
+#define DRM_MODE_FLAG_BCAST                    (1<<10) /* deprecated */
 #define DRM_MODE_FLAG_PIXMUX                   (1<<11) /* deprecated */
 #define DRM_MODE_FLAG_DBLCLK                   (1<<12)
 #define DRM_MODE_FLAG_CLKDIV2                  (1<<13)
@@ -117,7 +117,6 @@ extern "C" {
                                 DRM_MODE_FLAG_PCSYNC |         \
                                 DRM_MODE_FLAG_NCSYNC |         \
                                 DRM_MODE_FLAG_HSKEW |          \
-                                DRM_MODE_FLAG_BCAST |          \
                                 DRM_MODE_FLAG_DBLCLK |         \
                                 DRM_MODE_FLAG_CLKDIV2 |        \
                                 DRM_MODE_FLAG_3D_MASK)
--

2.13.6

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 4/10
#18 lore raw

Re: [PATCH 04/10] drm/uapi: Deprecate DRM_MODE_FLAG_BCAST

In reply to Ville Syrjala
Quoted 11 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Reject any mode with DRM_MODE_FLAG_BCAST. We have no code that even checks for this flag hence it can't possibly do any good.

I think this maybe originated from fbdev where it was supposed to indicate PAL/NTSC broadcast timings. I have no idea why those would have to be identified by a flag rather than by just the timings themselves. And then I assume it got copied into xfree86 for fbdevhw, and later on it leaked into the randr protocol and kms uapi.

Quoted 9 lines

Since kms fbdev emulation never uses the corresponding fbdev flag there should be no sane way for this to come back into kms via userspace either.

Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>

Best Regards,
Jose Miguel Abreu
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw

PATCH 5/10 drm/modes: Fix description of DRM_MODE_TYPE_USERDEF

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

These days DRM_MODE_TYPE_USERDEF is used to flag modes defined via the kernel command line. Update the docs to reflect that fact.

---
 include/drm/drm_modes.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
include/drm/drm_modes.h +1 -3
index 09773e766e1f..8ddf7adb98df 100644
@@ -253,6 +253,7 @@ struct drm_display_mode {
 	 *  - DRM_MODE_TYPE_DRIVER: Mode created by the driver, which is all of
 	 *    them really. Drivers must set this bit for all modes they create
 	 *    and expose to userspace.
+	 *  - 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:
@@ -262,9 +263,6 @@ struct drm_display_mode {
 	 *  - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers
 	 *    which are stuck around for hysterical raisins only. No one has an
 	 *    idea what they were meant for. Don't use.
-	 *  - DRM_MODE_TYPE_USERDEF: Mode defined by userspace, again a vestige
-	 *    from older kms designs where userspace had to first add a custom
-	 *    mode to the kernel's mode list before it could use it. Don't use.
 	 */
 	unsigned int type;
 
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 5/10
#20 lore raw

Re: [PATCH 05/10] drm/modes: Fix description of DRM_MODE_TYPE_USERDEF

Quoted 6 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

These days DRM_MODE_TYPE_USERDEF is used to flag modes defined via the kernel command line. Update the docs to reflect that fact.

Quoted 29 lines
---
 include/drm/drm_modes.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
include/drm/drm_modes.h +1 -4
index 09773e766e1f..8ddf7adb98df 100644
@@ -253,6 +253,7 @@ struct drm_display_mode {
         *  - DRM_MODE_TYPE_DRIVER: Mode created by the driver, which is all of
         *    them really. Drivers must set this bit for all modes they create
         *    and expose to userspace.
+        *  - 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:
@@ -262,9 +263,6 @@ struct drm_display_mode {
         *  - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers
         *    which are stuck around for hysterical raisins only. No one has an
         *    idea what they were meant for. Don't use.
-        *  - DRM_MODE_TYPE_USERDEF: Mode defined by userspace, again a vestige
-        *    from older kms designs where userspace had to first add a custom
-        *    mode to the kernel's mode list before it could use it. Don't use.
         */
        unsigned int type;
 
--

2.13.6

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#21 lore raw

PATCH 6/10 drm/modes: Kill off the oddball DRM_MODE_TYPE_CRTC_C vs. DRM_MODE_TYPE_BUILTIN handling

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

For some reason drm_mode_set_crtcinfo() does nothing of the mode has the DRM_MODE_TYPE_BUILTIN flag set without the other bit from DRM_MODE_TYPE_CRTC_C also set. I have zero idea what that is supposed to achieve, but since we have no users for neither flag bit let's kill this nonsense off.

---
 drivers/gpu/drm/drm_modes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_modes.c +1 -1
index f99ba963fb3e..68a8ba4c2c38 100644
@@ -833,7 +833,7 @@ EXPORT_SYMBOL(drm_mode_get_hv_timing);
  */
 void drm_mode_set_crtcinfo(struct drm_display_mode *p, int adjust_flags)
 {
-	if ((p == NULL) || ((p->type & DRM_MODE_TYPE_CRTC_C) == DRM_MODE_TYPE_BUILTIN))
+	if (!p)
 		return;
 
 	p->crtc_clock = p->clock;
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

Re: [PATCH 06/10] drm/modes: Kill off the oddball DRM_MODE_TYPE_CRTC_C vs. DRM_MODE_TYPE_BUILTIN handling

Quoting Ville Syrjala (2017-11-14 18:32:54)

Quoted 3 lines

From: Ville Syrjälä <[email protected]>

For some reason drm_mode_set_crtcinfo() does nothing of the mode has

s/of/if/

Quoted 6 lines

the DRM_MODE_TYPE_BUILTIN flag set without the other bit from DRM_MODE_TYPE_CRTC_C also set. I have zero idea what that is supposed to achieve, but since we have no users for neither flag bit let's kill this nonsense off.

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by
#23 lore raw

Re: [PATCH 06/10] drm/modes: Kill off the oddball DRM_MODE_TYPE_CRTC_C vs. DRM_MODE_TYPE_BUILTIN handling

Quoted 5 lines · Chris Wilson

Quoting Ville Syrjala (2017-11-14 18:32:54)

Quoted 3 lines

From: Ville Syrjälä <[email protected]>

For some reason drm_mode_set_crtcinfo() does nothing of the mode has

s/of/if/

With the typo fixed:

Quoted 11 lines
Quoted 7 lines

the DRM_MODE_TYPE_BUILTIN flag set without the other bit from DRM_MODE_TYPE_CRTC_C also set. I have zero idea what that is supposed to achieve, but since we have no users for neither flag bit let's kill this nonsense off.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#24 lore raw

PATCH 7/10 drm/modes: Kill DRM_MODE_TYPE_CLOCK_CRTC_C define

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

No idea what the DRM_MODE_TYPE_CLOCK_CRTC_C define is supposed to achieve. Totally unused so kill if off.

---
 include/drm/drm_modes.h | 3 ---
 1 file changed, 3 deletions(-)
include/drm/drm_modes.h +0 -3
index 8ddf7adb98df..99dd815269e9 100644
@@ -131,9 +131,6 @@ enum drm_mode_status {
 	MODE_ERROR = -1
 };
 
-#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
-				    DRM_MODE_TYPE_CRTC_C)
-
 #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
 	.name = nm, .status = 0, .type = (t), .clock = (c), \
 	.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 7/10
#25 lore raw

Re: [PATCH 07/10] drm/modes: Kill DRM_MODE_TYPE_CLOCK_CRTC_C define

Quoted 6 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

No idea what the DRM_MODE_TYPE_CLOCK_CRTC_C define is supposed to achieve. Totally unused so kill if off.

Quoted 21 lines
---
 include/drm/drm_modes.h | 3 ---
 1 file changed, 3 deletions(-)
include/drm/drm_modes.h +0 -4
index 8ddf7adb98df..99dd815269e9 100644
@@ -131,9 +131,6 @@ enum drm_mode_status {
        MODE_ERROR = -1
 };
 
-#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
-                                   DRM_MODE_TYPE_CRTC_C)
-
 #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
        .name = nm, .status = 0, .type = (t), .clock = (c), \
        .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
--

2.13.6

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#26 lore raw

PATCH 8/10 drm/uapi: Deprecate nonsense kms mode types

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

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 <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
---
 include/drm/drm_modes.h     |  7 ++++---
 include/uapi/drm/drm_mode.h | 14 +++++---------
 2 files changed, 9 insertions(+), 12 deletions(-)
include/drm/drm_modes.h +4 -3
index 99dd815269e9..7ac61858b54e 100644
@@ -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
include/uapi/drm/drm_mode.h +5 -9
index a7cded1c43e8..eb9b68c7c218 100644
@@ -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)
 
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 8/10
#27 lore raw

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

Quoted 11 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

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 <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
Quoted 63 lines
---
 include/drm/drm_modes.h     |  7 ++++---
 include/uapi/drm/drm_mode.h | 14 +++++---------
 2 files changed, 9 insertions(+), 12 deletions(-)
include/drm/drm_modes.h +4 -3
index 99dd815269e9..7ac61858b54e 100644
@@ -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
include/uapi/drm/drm_mode.h +5 -10
index a7cded1c43e8..eb9b68c7c218 100644
@@ -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

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 8/10
#28 lore raw

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

In reply to Ville Syrjala

include/drm/drm_modes.h struct drm_display_mode { · line 258

Quoted 10 lines · Ville Syrjala
include/drm/drm_modes.h +4 -1
@@ -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:

- ajax
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#30 lore raw

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

Quoted 7 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

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.

Quoted 9 lines

v2: Recommend DRIVER instead of BUILTIN (ajax)

Best Regards,
Jose Miguel Abreu
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#31 lore raw

PATCH 9/10 drm/modes: Provide global mode_valid hook

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Allow drivers to provide a device wide .mode_valid() hook in addition to the already existing crtc/encoder/bridge/connector hooks. This can be used to validate device/driver wide constraings without having to add those to the other hooks. And since we call this hook also for user modes later on in the modeset we don't have to worry about anything the hook has already rejected.

I also have some further ideas for this hook. Eg. we could replace the drm_mode_set_crtcinfo(HALVE_V) call in drm_mode_convert_umode()/etc. with a driver specific variant via this hook. At least on i915 we would like to pass CRTC_STEREO_DOUBLE to that function instead, and then we could safely use the crtc_ timings in all our .mode_valid() hooks, which would allow us to reuse those hooks for validating the adjusted_mode during a modeset.

---
 drivers/gpu/drm/drm_atomic.c       |  2 +-
 drivers/gpu/drm/drm_crtc.c         |  2 +-
 drivers/gpu/drm/drm_modes.c        | 48 +++++++++++++++++++++++++++-----------
 drivers/gpu/drm/drm_probe_helper.c |  2 +-
 include/drm/drm_mode_config.h      | 12 ++++++++++
 include/drm/drm_modes.h            |  6 +++--
 6 files changed, 53 insertions(+), 19 deletions(-)
drivers/gpu/drm/drm_atomic.c +1 -1
index 37445d50816a..1df2a50c25d5 100644
@@ -387,7 +387,7 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
 
 	if (blob) {
 		if (blob->length != sizeof(struct drm_mode_modeinfo) ||
-		    drm_mode_convert_umode(&state->mode,
+		    drm_mode_convert_umode(state->crtc->dev, &state->mode,
 		                           (const struct drm_mode_modeinfo *)
 		                            blob->data))
 			return -EINVAL;
drivers/gpu/drm/drm_crtc.c +1 -1
index f0556e654116..7eaa3c87761e 100644
@@ -610,7 +610,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 			goto out;
 		}
 
-		ret = drm_mode_convert_umode(mode, &crtc_req->mode);
+		ret = drm_mode_convert_umode(dev, mode, &crtc_req->mode);
 		if (ret) {
 			DRM_DEBUG_KMS("Invalid mode\n");
 			goto out;
drivers/gpu/drm/drm_modes.c +34 -14

78 lines not on this page · raw message

drivers/gpu/drm/drm_probe_helper.c +1 -1
index 6dc2dde5b672..51303060898e 100644
@@ -500,7 +500,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 
 	list_for_each_entry(mode, &connector->modes, head) {
 		if (mode->status == MODE_OK)
-			mode->status = drm_mode_validate_basic(mode);
+			mode->status = drm_mode_validate_driver(dev, mode);
 
 		if (mode->status == MODE_OK)
 			mode->status = drm_mode_validate_size(mode, maxX, maxY);
include/drm/drm_mode_config.h +12 -0
index 0b4ac2ebc610..e134a0682395 100644
@@ -35,6 +35,7 @@ struct drm_device;
 struct drm_atomic_state;
 struct drm_mode_fb_cmd2;
 struct drm_format_info;
+struct drm_display_mode;
 
 /**
  * struct drm_mode_config_funcs - basic driver provided mode setting functions
@@ -101,6 +102,17 @@ struct drm_mode_config_funcs {
 	void (*output_poll_changed)(struct drm_device *dev);
 
 	/**
+	 * @mode_valid:
+	 *
+	 * Device specific validation of display modes. Can be used to reject
+	 * modes that can never be supports. Only device wide constraints can
+	 * be checked here. crtc/encoder/bridge/connector specific constraints
+	 * can be checked in the .mode_valid() hook for each specific object.
+	 */
+	enum drm_mode_status (*mode_valid)(struct drm_device *dev,
+					   const struct drm_display_mode *mode);
+
+	/**
 	 * @atomic_check:
 	 *
 	 * This is the only hook to validate an atomic modeset update. This
include/drm/drm_modes.h +4 -2
index 7ac61858b54e..f945afaf2313 100644
@@ -444,7 +444,8 @@ struct drm_display_mode *drm_mode_create(struct drm_device *dev);
 void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
 void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
 			       const struct drm_display_mode *in);
-int drm_mode_convert_umode(struct drm_display_mode *out,
+int drm_mode_convert_umode(struct drm_device *dev,
+			   struct drm_display_mode *out,
 			   const struct drm_mode_modeinfo *in);
 void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
 void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
@@ -497,7 +498,8 @@ bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
 					const struct drm_display_mode *mode2);
 
 /* for use by the crtc helper probe functions */
-enum drm_mode_status drm_mode_validate_basic(const struct drm_display_mode *mode);
+enum drm_mode_status drm_mode_validate_driver(struct drm_device *dev,
+					      const struct drm_display_mode *mode);
 enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *mode,
 					    int maxX, int maxY);
 enum drm_mode_status
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 9/10
#32 lore raw

Re: [PATCH 09/10] drm/modes: Provide global mode_valid hook

Quoted 166 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Allow drivers to provide a device wide .mode_valid() hook in addition to the already existing crtc/encoder/bridge/connector hooks. This can be used to validate device/driver wide constraings without having to add those to the other hooks. And since we call this hook also for user modes later on in the modeset we don't have to worry about anything the hook has already rejected.

I also have some further ideas for this hook. Eg. we could replace the drm_mode_set_crtcinfo(HALVE_V) call in drm_mode_convert_umode()/etc. with a driver specific variant via this hook. At least on i915 we would like to pass CRTC_STEREO_DOUBLE to that function instead, and then we could safely use the crtc_ timings in all our .mode_valid() hooks, which would allow us to reuse those hooks for validating the adjusted_mode during a modeset.

---
 drivers/gpu/drm/drm_atomic.c       |  2 +-
 drivers/gpu/drm/drm_crtc.c         |  2 +-
 drivers/gpu/drm/drm_modes.c        | 48 +++++++++++++++++++++++++++-----------
 drivers/gpu/drm/drm_probe_helper.c |  2 +-
 include/drm/drm_mode_config.h      | 12 ++++++++++
 include/drm/drm_modes.h            |  6 +++--
 6 files changed, 53 insertions(+), 19 deletions(-)
drivers/gpu/drm/drm_atomic.c +1 -1
index 37445d50816a..1df2a50c25d5 100644
@@ -387,7 +387,7 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
 
 	if (blob) {
 		if (blob->length != sizeof(struct drm_mode_modeinfo) ||
-		    drm_mode_convert_umode(&state->mode,
+		    drm_mode_convert_umode(state->crtc->dev, &state->mode,
 		                           (const struct drm_mode_modeinfo *)
 		                            blob->data))
 			return -EINVAL;
drivers/gpu/drm/drm_crtc.c +1 -1
index f0556e654116..7eaa3c87761e 100644
@@ -610,7 +610,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 			goto out;
 		}
 
-		ret = drm_mode_convert_umode(mode, &crtc_req->mode);
+		ret = drm_mode_convert_umode(dev, mode, &crtc_req->mode);
 		if (ret) {
 			DRM_DEBUG_KMS("Invalid mode\n");
 			goto out;
drivers/gpu/drm/drm_modes.c +34 -14
index 68a8ba4c2c38..4eb12ff4df17 100644
@@ -1023,17 +1023,7 @@ bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
 }
 EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
 
-/**
- * drm_mode_validate_basic - make sure the mode is somewhat sane
- * @mode: mode to check
- *
- * Check that the mode timings are at least somewhat reasonable.
- * Any hardware specific limits are left up for each driver to check.
- *
- * Returns:
- * The mode status
- */
-enum drm_mode_status
+static enum drm_mode_status
 drm_mode_validate_basic(const struct drm_display_mode *mode)
 {
 	if (mode->type & ~DRM_MODE_TYPE_ALL ||
@@ -1060,7 +1050,35 @@ drm_mode_validate_basic(const struct drm_display_mode *mode)
 
 	return MODE_OK;
 }
-EXPORT_SYMBOL(drm_mode_validate_basic);
+
+/**
+ * drm_mode_validate_driver - make sure the mode is somewhat sane
+ * @dev: drm device
+ * @mode: mode to check
+ *
+ * First do basic validation on the mode, and then allow the driver
+ * to check for device/driver specific limitations via the optional
+ * &drm_mode_config_helper_funcs.mode_valid hook.
+ *
+ * Returns:
+ * The mode status
+ */
+enum drm_mode_status
+drm_mode_validate_driver(struct drm_device *dev,
+			const struct drm_display_mode *mode)
+{
+	enum drm_mode_status status;
+
+	status = drm_mode_validate_basic(mode);
+	if (status != MODE_OK)
+		return status;
+
+	if (dev->mode_config.funcs->mode_valid)
+		return dev->mode_config.funcs->mode_valid(dev, mode);
+	else
+		return MODE_OK;
+}
+EXPORT_SYMBOL(drm_mode_validate_driver);
 
 /**
  * drm_mode_validate_size - make sure modes adhere to size constraints
@@ -1562,6 +1580,7 @@ void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
 
 /**
  * drm_crtc_convert_umode - convert a modeinfo into a drm_display_mode
+ * @dev: drm device
  * @out: drm_display_mode to return to the user
  * @in: drm_mode_modeinfo to use
  *
@@ -1571,7 +1590,8 @@ void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
  * Returns:
  * Zero on success, negative errno on failure.
  */
-int drm_mode_convert_umode(struct drm_display_mode *out,
+int drm_mode_convert_umode(struct drm_device *dev,
+			   struct drm_display_mode *out,
 			   const struct drm_mode_modeinfo *in)
 {
 	int ret = -EINVAL;
@@ -1598,7 +1618,7 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
 	strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
 	out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
 
-	out->status = drm_mode_validate_basic(out);
+	out->status = drm_mode_validate_driver(dev, out);
 	if (out->status != MODE_OK)
 		goto out;
 
drivers/gpu/drm/drm_probe_helper.c +1 -1
index 6dc2dde5b672..51303060898e 100644
@@ -500,7 +500,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 
 	list_for_each_entry(mode, &connector->modes, head) {
 		if (mode->status == MODE_OK)
-			mode->status = drm_mode_validate_basic(mode);
+			mode->status = drm_mode_validate_driver(dev, mode);
 
 		if (mode->status == MODE_OK)
 			mode->status = drm_mode_validate_size(mode, maxX, maxY);
include/drm/drm_mode_config.h +1 -0
index 0b4ac2ebc610..e134a0682395 100644
@@ -35,6 +35,7 @@ struct drm_device;
 struct drm_atomic_state;
 struct drm_mode_fb_cmd2;
 struct drm_format_info;
+struct drm_display_mode;
 
 /**
  * struct drm_mode_config_funcs - basic driver provided mode setting functions

include/drm/drm_mode_config.h struct drm_mode_config_funcs { · line 108

Quoted 7 lines
include/drm/drm_mode_config.h +4 -0
@@ -101,6 +102,17 @@ struct drm_mode_config_funcs {
 	void (*output_poll_changed)(struct drm_device *dev);
 
 	/**
+	 * @mode_valid:
+	 *
+	 * Device specific validation of display modes. Can be used to reject
+	 * modes that can never be supports. Only device wide constraints can

s/supports/supported/

include/drm/drm_mode_config.h struct drm_mode_config_funcs { · line 110

Quoted 2 lines
include/drm/drm_mode_config.h +2 -0
+	 * be checked here. crtc/encoder/bridge/connector specific constraints
+	 * can be checked in the .mode_valid() hook for each specific object.

s/can/should/ I think, for my understanding of English at least.

Some igts that throw bs modes at the kernel would be nice, to complement your work here (I didn't check for those patches, mail backlog and all). -Daniel

Quoted 39 lines
include/drm/drm_mode_config.h +5 -0
+	 */
+	enum drm_mode_status (*mode_valid)(struct drm_device *dev,
+					   const struct drm_display_mode *mode);
+
+	/**
 	 * @atomic_check:
 	 *
 	 * This is the only hook to validate an atomic modeset update. This
include/drm/drm_modes.h +4 -2
index 7ac61858b54e..f945afaf2313 100644
@@ -444,7 +444,8 @@ struct drm_display_mode *drm_mode_create(struct drm_device *dev);
 void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
 void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
 			       const struct drm_display_mode *in);
-int drm_mode_convert_umode(struct drm_display_mode *out,
+int drm_mode_convert_umode(struct drm_device *dev,
+			   struct drm_display_mode *out,
 			   const struct drm_mode_modeinfo *in);
 void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
 void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
@@ -497,7 +498,8 @@ bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
 					const struct drm_display_mode *mode2);
 
 /* for use by the crtc helper probe functions */
-enum drm_mode_status drm_mode_validate_basic(const struct drm_display_mode *mode);
+enum drm_mode_status drm_mode_validate_driver(struct drm_device *dev,
+					      const struct drm_display_mode *mode);
 enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *mode,
 					    int maxX, int maxY);
 enum drm_mode_status
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#33 lore raw

PATCH 10/10 drm/i915: Provide a device level .mode_valid() hook

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

We never support certain mode flags etc. Reject those early on in the mode_config.mode_valid() hook. That allows us to remove some duplicated checks from the connector .mode_valid() hooks, and it guarantees that we never see those flags even from user mode as the mode_config.mode_valid() hooks gets executed for those as well.

---
 drivers/gpu/drm/i915/intel_crt.c     |  3 ---
 drivers/gpu/drm/i915/intel_display.c | 27 +++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dsi.c     |  5 -----
 drivers/gpu/drm/i915/intel_dvo.c     |  3 ---
 drivers/gpu/drm/i915/intel_fbc.c     |  3 +--
 drivers/gpu/drm/i915/intel_hdmi.c    |  3 ---
 drivers/gpu/drm/i915/intel_sdvo.c    |  3 ---
 7 files changed, 28 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +0 -3
index 9f31aea51dff..1cd4a7c22bd5 100644
@@ -304,9 +304,6 @@ intel_crt_mode_valid(struct drm_connector *connector,
 	int max_dotclk = dev_priv->max_dotclk_freq;
 	int max_clock;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	if (mode->clock < 25000)
 		return MODE_CLOCK_LOW;
 
drivers/gpu/drm/i915/intel_display.c +27 -0
index ed6a4a8d9273..fec76147d8e5 100644
@@ -14151,10 +14151,37 @@ static void intel_atomic_state_free(struct drm_atomic_state *state)
 	kfree(state);
 }
 
+static enum drm_mode_status
+intel_mode_valid(struct drm_device *dev,
+		 const struct drm_display_mode *mode)
+{
+	if (mode->vscan > 1)
+		return MODE_NO_VSCAN;
+
+	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
+		return MODE_NO_DBLESCAN;
+
+	if (mode->flags & DRM_MODE_FLAG_HSKEW)
+		return MODE_H_ILLEGAL;
+
+	if (mode->flags & (DRM_MODE_FLAG_CSYNC |
+			   DRM_MODE_FLAG_NCSYNC |
+			   DRM_MODE_FLAG_PCSYNC))
+		return MODE_HSYNC;
+
+	if (mode->flags & (DRM_MODE_FLAG_BCAST |
+			   DRM_MODE_FLAG_PIXMUX |
+			   DRM_MODE_FLAG_CLKDIV2))
+		return MODE_BAD;
+
+	return MODE_OK;
+}
+
 static const struct drm_mode_config_funcs intel_mode_funcs = {
 	.fb_create = intel_user_framebuffer_create,
 	.get_format_info = intel_get_format_info,
 	.output_poll_changed = intel_fbdev_output_poll_changed,
+	.mode_valid = intel_mode_valid,
 	.atomic_check = intel_atomic_check,
 	.atomic_commit = intel_atomic_commit,
 	.atomic_state_alloc = intel_atomic_state_alloc,
drivers/gpu/drm/i915/intel_dsi.c +0 -5
index f09474b0c4d3..c9b5a956c30a 100644
@@ -1266,11 +1266,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
 
 	DRM_DEBUG_KMS("\n");
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN) {
-		DRM_DEBUG_KMS("MODE_NO_DBLESCAN\n");
-		return MODE_NO_DBLESCAN;
-	}
-
 	if (fixed_mode) {
 		if (mode->hdisplay > fixed_mode->hdisplay)
 			return MODE_PANEL;
drivers/gpu/drm/i915/intel_dvo.c +0 -3
index 754baa00bea9..59c066ca14e5 100644
@@ -219,9 +219,6 @@ intel_dvo_mode_valid(struct drm_connector *connector,
 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
 	int target_clock = mode->clock;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	/* XXX: Validate clock range */
 
 	if (fixed_mode) {
drivers/gpu/drm/i915/intel_fbc.c +1 -2
index 1a0f5e0c8d10..f0e74477c678 100644
@@ -789,8 +789,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
 		return false;
 	}
 
-	if ((cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) ||
-	    (cache->crtc.mode_flags & DRM_MODE_FLAG_DBLSCAN)) {
+	if (cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) {
 		fbc->no_fbc_reason = "incompatible mode";
 		return false;
 	}
drivers/gpu/drm/i915/intel_hdmi.c +0 -3
index 2d95db64cdf2..7ce3d14153b4 100644
@@ -1311,9 +1311,6 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
 	bool force_dvi =
 		READ_ONCE(to_intel_digital_connector_state(connector->state)->force_audio) == HDMI_AUDIO_OFF_DVI;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	clock = mode->clock;
 
 	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
drivers/gpu/drm/i915/intel_sdvo.c +0 -3
index 2b8764897d68..0bf97ed5ffac 100644
@@ -1607,9 +1607,6 @@ intel_sdvo_mode_valid(struct drm_connector *connector,
 	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	if (intel_sdvo->pixel_clock_min > mode->clock)
 		return MODE_CLOCK_LOW;
 
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 10/10
#34 lore raw

Re: [PATCH 10/10] drm/i915: Provide a device level .mode_valid() hook

Quoted 56 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

We never support certain mode flags etc. Reject those early on in the mode_config.mode_valid() hook. That allows us to remove some duplicated checks from the connector .mode_valid() hooks, and it guarantees that we never see those flags even from user mode as the mode_config.mode_valid() hooks gets executed for those as well.

---
 drivers/gpu/drm/i915/intel_crt.c     |  3 ---
 drivers/gpu/drm/i915/intel_display.c | 27 +++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dsi.c     |  5 -----
 drivers/gpu/drm/i915/intel_dvo.c     |  3 ---
 drivers/gpu/drm/i915/intel_fbc.c     |  3 +--
 drivers/gpu/drm/i915/intel_hdmi.c    |  3 ---
 drivers/gpu/drm/i915/intel_sdvo.c    |  3 ---
 7 files changed, 28 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +0 -3
index 9f31aea51dff..1cd4a7c22bd5 100644
@@ -304,9 +304,6 @@ intel_crt_mode_valid(struct drm_connector *connector,
 	int max_dotclk = dev_priv->max_dotclk_freq;
 	int max_clock;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	if (mode->clock < 25000)
 		return MODE_CLOCK_LOW;
 
drivers/gpu/drm/i915/intel_display.c +15 -0
index ed6a4a8d9273..fec76147d8e5 100644
@@ -14151,10 +14151,37 @@ static void intel_atomic_state_free(struct drm_atomic_state *state)
 	kfree(state);
 }
 
+static enum drm_mode_status
+intel_mode_valid(struct drm_device *dev,
+		 const struct drm_display_mode *mode)
+{
+	if (mode->vscan > 1)
+		return MODE_NO_VSCAN;
+
+	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
+		return MODE_NO_DBLESCAN;
+
+	if (mode->flags & DRM_MODE_FLAG_HSKEW)
+		return MODE_H_ILLEGAL;
+
+	if (mode->flags & (DRM_MODE_FLAG_CSYNC |
+			   DRM_MODE_FLAG_NCSYNC |

drivers/gpu/drm/i915/intel_display.c static void intel_atomic_state_free(struct drm_atomic_state *state) · line 14178

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+			   DRM_MODE_FLAG_PCSYNC))
+		return MODE_HSYNC;
+
+	if (mode->flags & (DRM_MODE_FLAG_BCAST |
+			   DRM_MODE_FLAG_PIXMUX |
+			   DRM_MODE_FLAG_CLKDIV2))
+		return MODE_BAD;
+
+	return MODE_OK;
+}
Quoted 88 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
+
 static const struct drm_mode_config_funcs intel_mode_funcs = {
 	.fb_create = intel_user_framebuffer_create,
 	.get_format_info = intel_get_format_info,
 	.output_poll_changed = intel_fbdev_output_poll_changed,
+	.mode_valid = intel_mode_valid,
 	.atomic_check = intel_atomic_check,
 	.atomic_commit = intel_atomic_commit,
 	.atomic_state_alloc = intel_atomic_state_alloc,
drivers/gpu/drm/i915/intel_dsi.c +0 -5
index f09474b0c4d3..c9b5a956c30a 100644
@@ -1266,11 +1266,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
 
 	DRM_DEBUG_KMS("\n");
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN) {
-		DRM_DEBUG_KMS("MODE_NO_DBLESCAN\n");
-		return MODE_NO_DBLESCAN;
-	}
-
 	if (fixed_mode) {
 		if (mode->hdisplay > fixed_mode->hdisplay)
 			return MODE_PANEL;
drivers/gpu/drm/i915/intel_dvo.c +0 -3
index 754baa00bea9..59c066ca14e5 100644
@@ -219,9 +219,6 @@ intel_dvo_mode_valid(struct drm_connector *connector,
 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
 	int target_clock = mode->clock;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	/* XXX: Validate clock range */
 
 	if (fixed_mode) {
drivers/gpu/drm/i915/intel_fbc.c +1 -2
index 1a0f5e0c8d10..f0e74477c678 100644
@@ -789,8 +789,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
 		return false;
 	}
 
-	if ((cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) ||
-	    (cache->crtc.mode_flags & DRM_MODE_FLAG_DBLSCAN)) {
+	if (cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) {
 		fbc->no_fbc_reason = "incompatible mode";
 		return false;
 	}
drivers/gpu/drm/i915/intel_hdmi.c +0 -3
index 2d95db64cdf2..7ce3d14153b4 100644
@@ -1311,9 +1311,6 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
 	bool force_dvi =
 		READ_ONCE(to_intel_digital_connector_state(connector->state)->force_audio) == HDMI_AUDIO_OFF_DVI;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	clock = mode->clock;
 
 	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
drivers/gpu/drm/i915/intel_sdvo.c +0 -3
index 2b8764897d68..0bf97ed5ffac 100644
@@ -1607,9 +1607,6 @@ intel_sdvo_mode_valid(struct drm_connector *connector,
 	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	if (intel_sdvo->pixel_clock_min > mode->clock)
 		return MODE_CLOCK_LOW;
 
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#35 lore raw

Re: [PATCH 10/10] drm/i915: Provide a device level .mode_valid() hook

Quoted 61 lines · Daniel Vetter
Quoted 60 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

We never support certain mode flags etc. Reject those early on in the mode_config.mode_valid() hook. That allows us to remove some duplicated checks from the connector .mode_valid() hooks, and it guarantees that we never see those flags even from user mode as the mode_config.mode_valid() hooks gets executed for those as well.

---
 drivers/gpu/drm/i915/intel_crt.c     |  3 ---
 drivers/gpu/drm/i915/intel_display.c | 27 +++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dsi.c     |  5 -----
 drivers/gpu/drm/i915/intel_dvo.c     |  3 ---
 drivers/gpu/drm/i915/intel_fbc.c     |  3 +--
 drivers/gpu/drm/i915/intel_hdmi.c    |  3 ---
 drivers/gpu/drm/i915/intel_sdvo.c    |  3 ---
 7 files changed, 28 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +0 -3
index 9f31aea51dff..1cd4a7c22bd5 100644
@@ -304,9 +304,6 @@ intel_crt_mode_valid(struct drm_connector *connector,
 	int max_dotclk = dev_priv->max_dotclk_freq;
 	int max_clock;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	if (mode->clock < 25000)
 		return MODE_CLOCK_LOW;
 
drivers/gpu/drm/i915/intel_display.c +19 -0
index ed6a4a8d9273..fec76147d8e5 100644
@@ -14151,10 +14151,37 @@ static void intel_atomic_state_free(struct drm_atomic_state *state)
 	kfree(state);
 }
 
+static enum drm_mode_status
+intel_mode_valid(struct drm_device *dev,
+		 const struct drm_display_mode *mode)
+{
+	if (mode->vscan > 1)
+		return MODE_NO_VSCAN;
+
+	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
+		return MODE_NO_DBLESCAN;
+
+	if (mode->flags & DRM_MODE_FLAG_HSKEW)
+		return MODE_H_ILLEGAL;
+
+	if (mode->flags & (DRM_MODE_FLAG_CSYNC |
+			   DRM_MODE_FLAG_NCSYNC |
+			   DRM_MODE_FLAG_PCSYNC))
+		return MODE_HSYNC;
+
+	if (mode->flags & (DRM_MODE_FLAG_BCAST |
Quoted 8 lines

drivers/gpu/drm/i915/intel_display.c static void intel_atomic_state_free(struct drm_atomic_state *state) · line 14178

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +6 -0
+			   DRM_MODE_FLAG_PIXMUX |
+			   DRM_MODE_FLAG_CLKDIV2))
+		return MODE_BAD;
+
+	return MODE_OK;
+}

And I'm kinda leaning towards moving the rejection of the old crud into the core, but that's a different thing.
-Daniel

Quoted 94 lines
Quoted 89 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
+
 static const struct drm_mode_config_funcs intel_mode_funcs = {
 	.fb_create = intel_user_framebuffer_create,
 	.get_format_info = intel_get_format_info,
 	.output_poll_changed = intel_fbdev_output_poll_changed,
+	.mode_valid = intel_mode_valid,
 	.atomic_check = intel_atomic_check,
 	.atomic_commit = intel_atomic_commit,
 	.atomic_state_alloc = intel_atomic_state_alloc,
drivers/gpu/drm/i915/intel_dsi.c +0 -5
index f09474b0c4d3..c9b5a956c30a 100644
@@ -1266,11 +1266,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
 
 	DRM_DEBUG_KMS("\n");
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN) {
-		DRM_DEBUG_KMS("MODE_NO_DBLESCAN\n");
-		return MODE_NO_DBLESCAN;
-	}
-
 	if (fixed_mode) {
 		if (mode->hdisplay > fixed_mode->hdisplay)
 			return MODE_PANEL;
drivers/gpu/drm/i915/intel_dvo.c +0 -3
index 754baa00bea9..59c066ca14e5 100644
@@ -219,9 +219,6 @@ intel_dvo_mode_valid(struct drm_connector *connector,
 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
 	int target_clock = mode->clock;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	/* XXX: Validate clock range */
 
 	if (fixed_mode) {
drivers/gpu/drm/i915/intel_fbc.c +1 -2
index 1a0f5e0c8d10..f0e74477c678 100644
@@ -789,8 +789,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
 		return false;
 	}
 
-	if ((cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) ||
-	    (cache->crtc.mode_flags & DRM_MODE_FLAG_DBLSCAN)) {
+	if (cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) {
 		fbc->no_fbc_reason = "incompatible mode";
 		return false;
 	}
drivers/gpu/drm/i915/intel_hdmi.c +0 -3
index 2d95db64cdf2..7ce3d14153b4 100644
@@ -1311,9 +1311,6 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
 	bool force_dvi =
 		READ_ONCE(to_intel_digital_connector_state(connector->state)->force_audio) == HDMI_AUDIO_OFF_DVI;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	clock = mode->clock;
 
 	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
drivers/gpu/drm/i915/intel_sdvo.c +0 -3
index 2b8764897d68..0bf97ed5ffac 100644
@@ -1607,9 +1607,6 @@ intel_sdvo_mode_valid(struct drm_connector *connector,
 	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return MODE_NO_DBLESCAN;
-
 	if (intel_sdvo->pixel_clock_min > mode->clock)
 		return MODE_CLOCK_LOW;
 
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#36 lore raw

✓ Fi.CI.BAT: success for drm/uapi: Validate mode flags/type, and deprecate some of them

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm/uapi: Validate mode flags/type, and deprecate some of them
URL : https://patchwork.freedesktop.org/series/33810/
State : success

== Summary ==

Series 33810v1 drm/uapi: Validate mode flags/type, and deprecate some of them
https://patchwork.freedesktop.org/api/1.0/series/33810/revisions/1/mbox/

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:444s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:451s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:379s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:536s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:274s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:504s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:502s
fi-byt-j1900     total:289  pass:254  dwarn:0   dfail:0   fail:0   skip:35  time:496s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:488s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:429s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:264s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:543s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:428s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:438s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:426s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:483s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:467s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:480s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:528s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:475s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:529s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:569s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:457s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:545s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:564s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:519s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:493s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:462s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:557s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:419s
Blacklisted hosts:
fi-cfl-s         total:289  pass:254  dwarn:3   dfail:0   fail:0   skip:32  time:535s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:559s
fi-glk-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:488s

c46476e24d6432b5792ef63596a985848d122d50 drm-tip: 2017y-11m-14d-17h-03m-32s UTC integration manifest c49fbaf4c826 drm/i915: Provide a device level .mode_valid() hook
58718fce7a9c drm/modes: Provide global mode_valid hook
86a44b462856 drm/uapi: Deprecate nonsense kms mode types
96e09203df32 drm/modes: Kill DRM_MODE_TYPE_CLOCK_CRTC_C define
5cfe7bbdd757 drm/modes: Kill off the oddball DRM_MODE_TYPE_CRTC_C vs. DRM_MODE_TYPE_BUILTIN handling b902fa8caaa7 drm/modes: Fix description of DRM_MODE_TYPE_USERDEF
51d53b1b26a8 drm/uapi: Deprecate DRM_MODE_FLAG_BCAST
6632fd6ce1c9 drm/uapi: Deprecate DRM_MODE_FLAG_PIXMUX
007aa8d5ff85 drm/uapi: Validate the mode flags/type
7ba984ac2279 drm/modes: Move 3D stereo flag check into drm_mode_validate_basic()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7123/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#37 lore raw

✗ Fi.CI.IGT: failure for drm/uapi: Validate mode flags/type, and deprecate some of them

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm/uapi: Validate mode flags/type, and deprecate some of them
URL : https://patchwork.freedesktop.org/series/33810/
State : failure

== Summary ==

Test kms_busy:

        Subgroup extended-modeset-hang-newfb-with-reset-render-c:
                pass       -> DMESG-WARN (shard-hsw) fdo#102249
Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252
Test kms_atomic_transition:
        Subgroup plane-all-modeset-transition-fencing:
                pass       -> FAIL       (shard-hsw) fdo#102614
        Subgroup plane-all-modeset-transition:
                pass       -> FAIL       (shard-hsw)
Test kms_cursor_legacy:
        Subgroup flip-vs-cursor-varying-size:
                fail       -> PASS       (shard-hsw)

fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614

shard-hsw total:2584 pass:1469 dwarn:3 dfail:1 fail:12 skip:1099 time:9480s
Blacklisted hosts:

shard-apl        total:2584 pass:1618 dwarn:2   dfail:1   fail:27  skip:936 time:13051s
shard-kbl        total:2565 pass:1611 dwarn:92  dfail:5   fail:27  skip:829 time:10598s
shard-snb        total:2584 pass:1208 dwarn:1   dfail:1   fail:15  skip:1359 time:7723s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7123/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#38 lore raw

✓ Fi.CI.BAT: success for drm/uapi: Validate mode flags/type, and deprecate some of them (rev2)

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm/uapi: Validate mode flags/type, and deprecate some of them (rev2)
URL : https://patchwork.freedesktop.org/series/33810/
State : success

== Summary ==

Series 33810v2 drm/uapi: Validate mode flags/type, and deprecate some of them
https://patchwork.freedesktop.org/api/1.0/series/33810/revisions/2/mbox/

Test chamelium:

        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514
Test gem_exec_reloc:
        Subgroup basic-cpu-read-active:
                pass       -> FAIL       (fi-gdg-551) fdo#102582 +1
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                pass       -> INCOMPLETE (fi-snb-2520m) fdo#103713

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:441s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:453s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:383s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:534s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:277s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:509s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:503s
fi-byt-j1900     total:289  pass:254  dwarn:0   dfail:0   fail:0   skip:35  time:498s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:487s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:431s
fi-gdg-551       total:289  pass:176  dwarn:1   dfail:0   fail:3   skip:109 time:265s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:541s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:430s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:439s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:430s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:485s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:459s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:469s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:537s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:467s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:542s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:580s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:453s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:548s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:564s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:519s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:494s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:468s
fi-snb-2520m     total:246  pass:212  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:428s

Blacklisted hosts:
fi-cfl-s total:289 pass:254 dwarn:3 dfail:0 fail:0 skip:32 time:536s

06718a287f282ad31264560c5dc18a38474cb562 drm-tip: 2017y-11m-15d-11h-36m-39s UTC integration manifest 0f0dd0f89b9b drm/i915: Provide a device level .mode_valid() hook
5013fc3e277d drm/modes: Provide global mode_valid hook
0207542b258d drm/uapi: Deprecate nonsense kms mode types
cc3bcc4cafa3 drm/modes: Kill DRM_MODE_TYPE_CLOCK_CRTC_C define
58c5f7a01c38 drm/modes: Kill off the oddball DRM_MODE_TYPE_CRTC_C vs. DRM_MODE_TYPE_BUILTIN handling 7af2fa4b9d45 drm/modes: Fix description of DRM_MODE_TYPE_USERDEF
309956649688 drm/uapi: Deprecate DRM_MODE_FLAG_BCAST
c3e3d06d8f93 drm/uapi: Deprecate DRM_MODE_FLAG_PIXMUX
c282a3aa6661 drm/uapi: Validate the mode flags/type
e401ceb629ba drm/modes: Move 3D stereo flag check into drm_mode_validate_basic()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7145/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#39 lore raw

✗ Fi.CI.IGT: failure for drm/uapi: Validate mode flags/type, and deprecate some of them (rev2)

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm/uapi: Validate mode flags/type, and deprecate some of them (rev2)
URL : https://patchwork.freedesktop.org/series/33810/
State : failure

== Summary ==

Test kms_atomic_transition:

        Subgroup plane-all-modeset-transition-fencing:
                dmesg-warn -> FAIL       (shard-hsw) fdo#102614
        Subgroup plane-all-modeset-transition:
                pass       -> FAIL       (shard-hsw)
Test kms_cursor_crc:
        Subgroup cursor-64x64-suspend:
                pass       -> SKIP       (shard-hsw)
Test drv_module_reload:
        Subgroup basic-reload-inject:
                pass       -> DMESG-WARN (shard-hsw) fdo#102707

fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707

shard-hsw total:2584 pass:1468 dwarn:3 dfail:1 fail:12 skip:1100 time:9409s
Blacklisted hosts:

shard-apl        total:2584 pass:1618 dwarn:3   dfail:2   fail:25  skip:936 time:13371s
shard-kbl        total:2357 pass:1551 dwarn:8   dfail:2   fail:24  skip:769 time:9699s
shard-snb        total:2584 pass:1203 dwarn:2   dfail:1   fail:13  skip:1365 time:7788s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7145/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#40 lore raw
In reply to Ville Syrjala
Quoted 20 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

I recently realized that we're not validating the mode flags/type passed in from userspace. Let's try to fix that.

I'd also like to entirely eliminate some of the more crazy mode flags. PIXMUX and BCAST look pretty easy, so I've targetted them first.

Ideally I'd like to kill DBLCLK, CLKDIV2, HSKEW, DBLSCAN, and vscan as well. IMO there's no good reason to expose any of that to userspace, and instead it should all be handled internally by the drivers. Unfortunately all of those seem to be used to some degree by a handful of drivers.

I also tried to nuke some of the crazy mode types.

Cc Jose Abreu <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Keith Packard <[email protected]>
Quoted 12 lines

Ville Syrjälä (10):
drm/modes: Move 3D stereo flag check into drm_mode_validate_basic() drm/uapi: Validate the mode flags/type
drm/uapi: Deprecate DRM_MODE_FLAG_PIXMUX
drm/uapi: Deprecate DRM_MODE_FLAG_BCAST
drm/modes: Fix description of DRM_MODE_TYPE_USERDEF drm/modes: Kill off the oddball DRM_MODE_TYPE_CRTC_C vs.
DRM_MODE_TYPE_BUILTIN handling
drm/modes: Kill DRM_MODE_TYPE_CLOCK_CRTC_C define drm/uapi: Deprecate nonsense kms mode types
drm/modes: Provide global mode_valid hook
drm/i915: Provide a device level .mode_valid() hook

Entire series pushed to drm-misc-next. Thanks for the reviews.

Quoted 19 lines
 drivers/gpu/drm/drm_atomic.c         |  2 +-
 drivers/gpu/drm/drm_crtc.c           |  2 +-
 drivers/gpu/drm/drm_modes.c          | 60 +++++++++++++++++++++++++-----------
 drivers/gpu/drm/drm_probe_helper.c   |  2 +-
 drivers/gpu/drm/i915/intel_crt.c     |  3 --
 drivers/gpu/drm/i915/intel_display.c | 27 ++++++++++++++++
 drivers/gpu/drm/i915/intel_dsi.c     |  5 ---
 drivers/gpu/drm/i915/intel_dvo.c     |  3 --
 drivers/gpu/drm/i915/intel_fbc.c     |  3 +-
 drivers/gpu/drm/i915/intel_hdmi.c    |  3 --
 drivers/gpu/drm/i915/intel_sdvo.c    |  3 --
 include/drm/drm_mode_config.h        | 12 ++++++++
 include/drm/drm_modes.h              | 24 +++++++--------
 include/uapi/drm/drm_mode.h          | 30 ++++++++++++++----
 14 files changed, 120 insertions(+), 59 deletions(-)
Signature · 1 line
2.13.6
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel