Skip to contentSkip to conversation

drm/i915: Move the code to populate ACPI device ID into intel_acpi

PATCH In review Rajat Jain 4 participants 12 messages Dec 20, 2019 – Jan 28, 2020

Subsystems (3)
lore
Share & tools
lore

Rajat Jain

author
#0 lore raw

PATCH v5 1/3 drm/i915: Move the code to populate ACPI device ID into intel_acpi

Move the code that populates the ACPI device ID for devices, into more appripriate intel_acpi.c. This is done in preparation for more users of this code (in next patch).

---
v5: same as v4
v4: Same as v3
v3: * Renamed the function to intel_acpi_*
* Used forward declaration for structure instead of header file inclusion.
* Fix a typo
v2: v1 doesn't exist. Found existing code in i915 driver to assign the ACPI ID
which is what I plan to re-use.

 drivers/gpu/drm/i915/display/intel_acpi.c     | 89 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_acpi.h     |  5 ++
 drivers/gpu/drm/i915/display/intel_opregion.c | 80 +----------------
 3 files changed, 98 insertions(+), 76 deletions(-)
drivers/gpu/drm/i915/display/intel_acpi.c +89 -0
index 3456d33feb46..e21fb14d5e07 100644
@@ -10,6 +10,7 @@
 
 #include "i915_drv.h"
 #include "intel_acpi.h"
+#include "intel_display_types.h"
 
 #define INTEL_DSM_REVISION_ID 1 /* For Calpella anyway... */
 #define INTEL_DSM_FN_PLATFORM_MUX_INFO 1 /* No args */
@@ -156,3 +157,91 @@ void intel_register_dsm_handler(void)
 void intel_unregister_dsm_handler(void)
 {
 }
+
+/*
+ * ACPI Specification, Revision 5.0, Appendix B.3.2 _DOD (Enumerate All Devices
+ * Attached to the Display Adapter).
+ */
+#define ACPI_DISPLAY_INDEX_SHIFT		0
+#define ACPI_DISPLAY_INDEX_MASK			(0xf << 0)
+#define ACPI_DISPLAY_PORT_ATTACHMENT_SHIFT	4
+#define ACPI_DISPLAY_PORT_ATTACHMENT_MASK	(0xf << 4)
+#define ACPI_DISPLAY_TYPE_SHIFT			8
+#define ACPI_DISPLAY_TYPE_MASK			(0xf << 8)
+#define ACPI_DISPLAY_TYPE_OTHER			(0 << 8)
+#define ACPI_DISPLAY_TYPE_VGA			(1 << 8)
+#define ACPI_DISPLAY_TYPE_TV			(2 << 8)
+#define ACPI_DISPLAY_TYPE_EXTERNAL_DIGITAL	(3 << 8)
+#define ACPI_DISPLAY_TYPE_INTERNAL_DIGITAL	(4 << 8)
+#define ACPI_VENDOR_SPECIFIC_SHIFT		12
+#define ACPI_VENDOR_SPECIFIC_MASK		(0xf << 12)
+#define ACPI_BIOS_CAN_DETECT			(1 << 16)
+#define ACPI_DEPENDS_ON_VGA			(1 << 17)
+#define ACPI_PIPE_ID_SHIFT			18
+#define ACPI_PIPE_ID_MASK			(7 << 18)
+#define ACPI_DEVICE_ID_SCHEME			(1ULL << 31)
+
+static u32 acpi_display_type(struct intel_connector *connector)
+{
+	u32 display_type;
+
+	switch (connector->base.connector_type) {
+	case DRM_MODE_CONNECTOR_VGA:
+	case DRM_MODE_CONNECTOR_DVIA:
+		display_type = ACPI_DISPLAY_TYPE_VGA;
+		break;
+	case DRM_MODE_CONNECTOR_Composite:
+	case DRM_MODE_CONNECTOR_SVIDEO:
+	case DRM_MODE_CONNECTOR_Component:
+	case DRM_MODE_CONNECTOR_9PinDIN:
+	case DRM_MODE_CONNECTOR_TV:
+		display_type = ACPI_DISPLAY_TYPE_TV;
+		break;
+	case DRM_MODE_CONNECTOR_DVII:
+	case DRM_MODE_CONNECTOR_DVID:
+	case DRM_MODE_CONNECTOR_DisplayPort:
+	case DRM_MODE_CONNECTOR_HDMIA:
+	case DRM_MODE_CONNECTOR_HDMIB:
+		display_type = ACPI_DISPLAY_TYPE_EXTERNAL_DIGITAL;
+		break;
+	case DRM_MODE_CONNECTOR_LVDS:
+	case DRM_MODE_CONNECTOR_eDP:
+	case DRM_MODE_CONNECTOR_DSI:
+		display_type = ACPI_DISPLAY_TYPE_INTERNAL_DIGITAL;
+		break;
+	case DRM_MODE_CONNECTOR_Unknown:
+	case DRM_MODE_CONNECTOR_VIRTUAL:
+		display_type = ACPI_DISPLAY_TYPE_OTHER;
+		break;
+	default:
+		MISSING_CASE(connector->base.connector_type);
+		display_type = ACPI_DISPLAY_TYPE_OTHER;
+		break;
+	}
+
+	return display_type;
+}
+
+void intel_acpi_device_id_update(struct drm_i915_private *dev_priv)
+{
+	struct drm_device *drm_dev = &dev_priv->drm;
+	struct intel_connector *connector;
+	struct drm_connector_list_iter conn_iter;
+	u8 display_index[16] = {};
+
+	/* Populate the ACPI IDs for all connectors for a given drm_device */
+	drm_connector_list_iter_begin(drm_dev, &conn_iter);
+	for_each_intel_connector_iter(connector, &conn_iter) {
+		u32 device_id, type;
+
+		device_id = acpi_display_type(connector);
+
+		/* Use display type specific display index. */
+		type = (device_id & ACPI_DISPLAY_TYPE_MASK)
+			>> ACPI_DISPLAY_TYPE_SHIFT;
+		device_id |= display_index[type]++ << ACPI_DISPLAY_INDEX_SHIFT;
+
+		connector->acpi_device_id = device_id;
+	}
+	drm_connector_list_iter_end(&conn_iter);
+}
drivers/gpu/drm/i915/display/intel_acpi.h +5 -0
index 1c576b3fb712..e8b068661d22 100644
@@ -6,12 +6,17 @@
 #ifndef __INTEL_ACPI_H__
 #define __INTEL_ACPI_H__
 
+struct drm_i915_private;
+
 #ifdef CONFIG_ACPI
 void intel_register_dsm_handler(void);
 void intel_unregister_dsm_handler(void);
+void intel_acpi_device_id_update(struct drm_i915_private *i915);
 #else
 static inline void intel_register_dsm_handler(void) { return; }
 static inline void intel_unregister_dsm_handler(void) { return; }
+static inline
+void intel_acpi_device_id_update(struct drm_i915_private *i915) { return; }
 #endif /* CONFIG_ACPI */
 
 #endif /* __INTEL_ACPI_H__ */
drivers/gpu/drm/i915/display/intel_opregion.c +4 -76

113 lines not on this page · raw message

Signature · 6 lines
2.24.1.735.g03f4e72817-goog

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

PATCH v5 2/3 drm/i915: Lookup and attach ACPI device node for connectors

Lookup and attach ACPI nodes for intel connectors. The lookup is done in compliance with ACPI Spec 6.3
https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf
(Ref: Pages 1119 - 1123).

This can be useful for any connector specific platform properties. (This will be used for privacy screen in next patch).

---
v5: same as v4
v4: Same as v3
v3: fold the code into existing acpi_device_id_update() function
v2: formed by splitting the original patch into ACPI lookup, and privacy
screen property. Also move it into i915 now that I found existing code in i915 that can be re-used.

 drivers/gpu/drm/i915/display/intel_acpi.c     | 24 +++++++++++++++++++
 .../drm/i915/display/intel_display_types.h    |  3 +++
 drivers/gpu/drm/i915/display/intel_dp.c       |  3 +++
 3 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_acpi.c +24 -0
index e21fb14d5e07..101a56c08996 100644
@@ -222,11 +222,23 @@ static u32 acpi_display_type(struct intel_connector *connector)
 	return display_type;
 }
 
+/*
+ * Ref: ACPI Spec 6.3
+ * https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf
+ * Pages 1119 - 1123 describe, what I believe, a standard way of
+ * identifying / addressing "display panels" in the ACPI. It provides
+ * a way for the ACPI to define devices for the display panels attached
+ * to the system. It thus provides a way for the BIOS to export any panel
+ * specific properties to the system via ACPI (like device trees).
+ */
 void intel_acpi_device_id_update(struct drm_i915_private *dev_priv)
 {
 	struct drm_device *drm_dev = &dev_priv->drm;
 	struct intel_connector *connector;
 	struct drm_connector_list_iter conn_iter;
+	struct device *dev = &drm_dev->pdev->dev;
+	struct acpi_device *conn_dev;
+	u64 conn_addr;
 	u8 display_index[16] = {};
 
 	/* Populate the ACPI IDs for all connectors for a given drm_device */
@@ -242,6 +254,18 @@ void intel_acpi_device_id_update(struct drm_i915_private *dev_priv)
 		device_id |= display_index[type]++ << ACPI_DISPLAY_INDEX_SHIFT;
 
 		connector->acpi_device_id = device_id;
+
+		/* Build the _ADR to look for */
+		conn_addr = device_id | ACPI_DEVICE_ID_SCHEME |
+				ACPI_BIOS_CAN_DETECT;
+
+		DRM_DEV_INFO(dev, "Checking connector ACPI node at _ADR=%llX\n",
+			     conn_addr);
+
+		/* Look up the connector device, under the PCI device */
+		conn_dev = acpi_find_child_device(ACPI_COMPANION(dev),
+						  conn_addr, false);
+		connector->acpi_handle = conn_dev ? conn_dev->handle : NULL;
 	}
 	drm_connector_list_iter_end(&conn_iter);
 }
drivers/gpu/drm/i915/display/intel_display_types.h +3 -0
index 1a7334dbe802..0a4a04116091 100644
@@ -407,6 +407,9 @@ struct intel_connector {
 	/* ACPI device id for ACPI and driver cooperation */
 	u32 acpi_device_id;
 
+	/* ACPI handle corresponding to this connector display, if found */
+	void *acpi_handle;
+
 	/* Reads out the current hw, returning true if the connector is enabled
 	 * and active (i.e. dpms ON state). */
 	bool (*get_hw_state)(struct intel_connector *);
drivers/gpu/drm/i915/display/intel_dp.c +3 -0
index b05b2191b919..93cece8e2516 100644
@@ -45,6 +45,7 @@
 #include "i915_debugfs.h"
 #include "i915_drv.h"
 #include "i915_trace.h"
+#include "intel_acpi.h"
 #include "intel_atomic.h"
 #include "intel_audio.h"
 #include "intel_connector.h"
@@ -6623,6 +6624,8 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
 		connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
 
+		/* Lookup the ACPI node corresponding to the connector */
+		intel_acpi_device_id_update(dev_priv);
 	}
 }
 
Signature · 6 lines
2.24.1.735.g03f4e72817-goog

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

Re: [PATCH v5 2/3] drm/i915: Lookup and attach ACPI device node for connectors

Quoted 35 lines · Rajat Jain

Lookup and attach ACPI nodes for intel connectors. The lookup is done in compliance with ACPI Spec 6.3
https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf
(Ref: Pages 1119 - 1123).

This can be useful for any connector specific platform properties. (This will be used for privacy screen in next patch).

---
v5: same as v4
v4: Same as v3
v3: fold the code into existing acpi_device_id_update() function
v2: formed by splitting the original patch into ACPI lookup, and privacy
screen property. Also move it into i915 now that I found existing code in i915 that can be re-used.

 drivers/gpu/drm/i915/display/intel_acpi.c     | 24 +++++++++++++++++++
 .../drm/i915/display/intel_display_types.h    |  3 +++
 drivers/gpu/drm/i915/display/intel_dp.c       |  3 +++
 3 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_acpi.c +5 -0
index e21fb14d5e07..101a56c08996 100644
@@ -222,11 +222,23 @@ static u32 acpi_display_type(struct intel_connector *connector)
 	return display_type;
 }
 
+/*
+ * Ref: ACPI Spec 6.3
+ * https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf
+ * Pages 1119 - 1123 describe, what I believe, a standard way of
+ * identifying / addressing "display panels" in the ACPI. It provides

drivers/gpu/drm/i915/display/intel_acpi.c static u32 acpi_display_type(struct intel_connector *connector) · line 239

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_acpi.c +5 -0
+ * a way for the ACPI to define devices for the display panels attached
+ * to the system. It thus provides a way for the BIOS to export any panel
+ * specific properties to the system via ACPI (like device trees).
+ */
 void intel_acpi_device_id_update(struct drm_i915_private *dev_priv)
 {
 	struct drm_device *drm_dev = &dev_priv->drm;
 	struct intel_connector *connector;
 	struct drm_connector_list_iter conn_iter;
+	struct device *dev = &drm_dev->pdev->dev;

Hmm, already pushed patch 1 with the unfortunate "drm_dev" local. We use "dev" for struct drm_device * and almost never use struct device.

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_acpi.c +2 -0
+	struct acpi_device *conn_dev;
+	u64 conn_addr;
 	u8 display_index[16] = {};
 
 	/* Populate the ACPI IDs for all connectors for a given drm_device */

drivers/gpu/drm/i915/display/intel_acpi.c void intel_acpi_device_id_update(struct drm_i915_private *dev_priv) · line 263

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_acpi.c +7 -0
@@ -242,6 +254,18 @@ void intel_acpi_device_id_update(struct drm_i915_private *dev_priv)
 		device_id |= display_index[type]++ << ACPI_DISPLAY_INDEX_SHIFT;
 
 		connector->acpi_device_id = device_id;
+
+		/* Build the _ADR to look for */
+		conn_addr = device_id | ACPI_DEVICE_ID_SCHEME |
+				ACPI_BIOS_CAN_DETECT;
+
+		DRM_DEV_INFO(dev, "Checking connector ACPI node at _ADR=%llX\n",
+			     conn_addr);

This is more than a little verbose. One line of INFO level dmesg for every connector at boot and at resume.

Please use the new drm_dbg_kms() macro for this.

drivers/gpu/drm/i915/display/intel_acpi.c void intel_acpi_device_id_update(struct drm_i915_private *dev_priv) · line 268

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_acpi.c +5 -0
+
+		/* Look up the connector device, under the PCI device */
+		conn_dev = acpi_find_child_device(ACPI_COMPANION(dev),
+						  conn_addr, false);
+		connector->acpi_handle = conn_dev ? conn_dev->handle : NULL;

acpi_device_handle(conn_dev)

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_acpi.c +0 -0
 	}
 	drm_connector_list_iter_end(&conn_iter);
 }
drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
index 1a7334dbe802..0a4a04116091 100644

drivers/gpu/drm/i915/display/intel_display_types.h struct intel_connector { · line 412

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_types.h +3 -0
@@ -407,6 +407,9 @@ struct intel_connector {
 	/* ACPI device id for ACPI and driver cooperation */
 	u32 acpi_device_id;
 
+	/* ACPI handle corresponding to this connector display, if found */
+	void *acpi_handle;
+

The type is acpi_handle. It's none of our business to know what the underlying type is.

Quoted 16 lines
drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
 	/* Reads out the current hw, returning true if the connector is enabled
 	 * and active (i.e. dpms ON state). */
 	bool (*get_hw_state)(struct intel_connector *);
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
index b05b2191b919..93cece8e2516 100644
@@ -45,6 +45,7 @@
 #include "i915_debugfs.h"
 #include "i915_drv.h"
 #include "i915_trace.h"
+#include "intel_acpi.h"
 #include "intel_atomic.h"
 #include "intel_audio.h"
 #include "intel_connector.h"

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect · line 6628

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dp.c +2 -0
@@ -6623,6 +6624,8 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
 		connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
 
+		/* Lookup the ACPI node corresponding to the connector */
+		intel_acpi_device_id_update(dev_priv);

Auch, this is problematic. It iterates all connectors, for every DP connector being added. In the middle of registering all connectors.

From the POV of this patch alone, this is also unnecessary. This gets called via intel_opregion_register() after all connectors have been registered.

I am aware it's not enough for your next patch, because it will need the acpi handle right here.

I'm wondering if we need to maintain display_index[] in struct drm_i915_private, and update that as connectors get added instead of all at once in the end. connector->acpi_device_id never changes, does it, even though we keep updating it?

BR,
Jani.

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_dp.c +0 -0
 	}
 }
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#3 lore raw

Re: [PATCH v5 2/3] drm/i915: Lookup and attach ACPI device node for connectors

Hi Jani,

Thank you for the review. Please see inline.

Quoted 42 lines · Jani Nikula
Quoted 40 lines · Rajat Jain

Lookup and attach ACPI nodes for intel connectors. The lookup is done in compliance with ACPI Spec 6.3
https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf
(Ref: Pages 1119 - 1123).

This can be useful for any connector specific platform properties. (This will be used for privacy screen in next patch).

---
v5: same as v4
v4: Same as v3
v3: fold the code into existing acpi_device_id_update() function
v2: formed by splitting the original patch into ACPI lookup, and privacy
screen property. Also move it into i915 now that I found existing code in i915 that can be re-used.

 drivers/gpu/drm/i915/display/intel_acpi.c     | 24 +++++++++++++++++++
 .../drm/i915/display/intel_display_types.h    |  3 +++
 drivers/gpu/drm/i915/display/intel_dp.c       |  3 +++
 3 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_acpi.c +9 -0
index e21fb14d5e07..101a56c08996 100644
@@ -222,11 +222,23 @@ static u32 acpi_display_type(struct intel_connector *connector)
      return display_type;
 }
 
+/*
+ * Ref: ACPI Spec 6.3
+ * https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf
+ * Pages 1119 - 1123 describe, what I believe, a standard way of
+ * identifying / addressing "display panels" in the ACPI. It provides
+ * a way for the ACPI to define devices for the display panels attached
+ * to the system. It thus provides a way for the BIOS to export any panel
+ * specific properties to the system via ACPI (like device trees).
+ */
 void intel_acpi_device_id_update(struct drm_i915_private *dev_priv)
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_acpi.c static u32 acpi_display_type(struct intel_connector *connector) · line 239

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_acpi.c +1 -0
 {
      struct drm_device *drm_dev = &dev_priv->drm;
      struct intel_connector *connector;
      struct drm_connector_list_iter conn_iter;
+     struct device *dev = &drm_dev->pdev->dev;

Hmm, already pushed patch 1 with the unfortunate "drm_dev" local. We use "dev" for struct drm_device * and almost never use struct device.

Sorry, I did not know. I'll send an independent fixup patch for patch 1 on top of drm-intel-next-queued (or let me know if you want to handle it). I will also change this patch to rename the variable.

Quoted 21 lines
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_acpi.c +2 -0
+     struct acpi_device *conn_dev;
+     u64 conn_addr;
      u8 display_index[16] = {};
 
      /* Populate the ACPI IDs for all connectors for a given drm_device */

drivers/gpu/drm/i915/display/intel_acpi.c void intel_acpi_device_id_update(struct drm_i915_private *dev_priv) · line 263

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_acpi.c +7 -0
@@ -242,6 +254,18 @@ void intel_acpi_device_id_update(struct drm_i915_private *dev_priv)
              device_id |= display_index[type]++ << ACPI_DISPLAY_INDEX_SHIFT;
 
              connector->acpi_device_id = device_id;
+
+             /* Build the _ADR to look for */
+             conn_addr = device_id | ACPI_DEVICE_ID_SCHEME |
+                             ACPI_BIOS_CAN_DETECT;
+
+             DRM_DEV_INFO(dev, "Checking connector ACPI node at _ADR=%llX\n",
+                          conn_addr);

This is more than a little verbose. One line of INFO level dmesg for every connector at boot and at resume.

Quoted 1 line

Please use the new drm_dbg_kms() macro for this.

Will do.

Quoted 9 lines

drivers/gpu/drm/i915/display/intel_acpi.c void intel_acpi_device_id_update(struct drm_i915_private *dev_priv) · line 268

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_acpi.c +5 -0
+
+             /* Look up the connector device, under the PCI device */
+             conn_dev = acpi_find_child_device(ACPI_COMPANION(dev),
+                                               conn_addr, false);
+             connector->acpi_handle = conn_dev ? conn_dev->handle : NULL;

acpi_device_handle(conn_dev)

Will do.

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_acpi.c +0 -0
      }
      drm_connector_list_iter_end(&conn_iter);
 }
drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
index 1a7334dbe802..0a4a04116091 100644
@@ -407,6 +407,9 @@ struct intel_connector {
      /* ACPI device id for ACPI and driver cooperation */
      u32 acpi_device_id;
 
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_display_types.h struct intel_connector { · line 412

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_display_types.h +3 -0
+     /* ACPI handle corresponding to this connector display, if found */
+     void *acpi_handle;
+

The type is acpi_handle. It's none of our business to know what the underlying type is.

Will do.

Quoted 30 lines
Quoted 17 lines
drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
      /* Reads out the current hw, returning true if the connector is enabled
       * and active (i.e. dpms ON state). */
      bool (*get_hw_state)(struct intel_connector *);
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
index b05b2191b919..93cece8e2516 100644
@@ -45,6 +45,7 @@
 #include "i915_debugfs.h"
 #include "i915_drv.h"
 #include "i915_trace.h"
+#include "intel_acpi.h"
 #include "intel_atomic.h"
 #include "intel_audio.h"
 #include "intel_connector.h"

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect · line 6628

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dp.c +2 -0
@@ -6623,6 +6624,8 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
              connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
 
+             /* Lookup the ACPI node corresponding to the connector */
+             intel_acpi_device_id_update(dev_priv);

Auch, this is problematic. It iterates all connectors, for every DP connector being added. In the middle of registering all connectors.

From the POV of this patch alone, this is also unnecessary. This gets called via intel_opregion_register() after all connectors have been registered.

Quoted 6 lines

I am aware it's not enough for your next patch, because it will need the acpi handle right here.

I'm wondering if we need to maintain display_index[] in struct drm_i915_private, and update that as connectors get added instead of all at once in the end.

Sure, I can do that.

Quoted 2 lines

connector->acpi_device_id never changes, does it,
even though we keep updating it?

This is the part I am not so sure about - I hypothesized that theory because of the current behavior in code (i.e. it is getting updated in intel_opregion_resume() path). May be it does not change, I was not sure, so I did not want to create any regression in the intel_opregion code that I did not understand. I tried on my system and as far as I could experiment, I did not see it changing. Please let me know if you would like me to change my code to:

1) Maintain drm_i915_private->display_index[] and update it as connectors are added.
2) Remove the code to update it on every resume and while registering the connector.

Thanks & Best Regards,

Rajat

Quoted 10 lines

BR,
Jani.

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect · line 6630

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_dp.c +0 -0
      }
 }

--
Jani Nikula, Intel Open Source Graphics Center

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

author
#4 lore raw

PATCH v5 3/3 drm/i915: Add support for integrated privacy screens

In reply to Rajat Jain

Certain laptops now come with panels that have integrated privacy screens on them. This patch adds support for such panels by adding a privacy-screen property to the intel_connector for the panel, that the userspace can then use to control and check the status.

Identifying the presence of privacy screen, and controlling it, is done via ACPI _DSM methods.

Currently, this is done only for the Intel display ports. But in future, this can be done for any other ports if the hardware becomes available (e.g. external monitors supporting integrated privacy screens?).

---
v5: fix a cosmetic checkpatch warning
v4: Fix a typo in intel_privacy_screen.h
v3: * Change license to GPL-2.0 OR MIT
* Move privacy screen enum from UAPI to intel_display_types.h
* Rename parameter name and some other minor changes.
v2: Formed by splitting the original patch into multiple patches.
- All code has been moved into i915 now.
- Privacy screen is a i915 property
- Have a local state variable to store the prvacy screen. Don't read it from hardware.

 drivers/gpu/drm/i915/Makefile                 |  3 +-
 drivers/gpu/drm/i915/display/intel_atomic.c   | 13 +++-
 .../gpu/drm/i915/display/intel_connector.c    | 35 +++++++++
 .../gpu/drm/i915/display/intel_connector.h    |  1 +
 .../drm/i915/display/intel_display_types.h    | 18 +++++
 drivers/gpu/drm/i915/display/intel_dp.c       |  6 ++
 .../drm/i915/display/intel_privacy_screen.c   | 72 +++++++++++++++++++
 .../drm/i915/display/intel_privacy_screen.h   | 27 +++++++
 8 files changed, 171 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.h
drivers/gpu/drm/i915/Makefile +2 -1
index 90dcf09f52cc..f7067c8f0407 100644
@@ -197,7 +197,8 @@ i915-y += \
 	display/intel_vga.o
 i915-$(CONFIG_ACPI) += \
 	display/intel_acpi.o \
-	display/intel_opregion.o
+	display/intel_opregion.o \
+	display/intel_privacy_screen.o
 i915-$(CONFIG_DRM_FBDEV_EMULATION) += \
 	display/intel_fbdev.o
 
drivers/gpu/drm/i915/display/intel_atomic.c +10 -3
index c2875b10adf9..c73b81c4c3f6 100644
@@ -37,6 +37,7 @@
 #include "intel_atomic.h"
 #include "intel_display_types.h"
 #include "intel_hdcp.h"
+#include "intel_privacy_screen.h"
 #include "intel_sprite.h"
 
 /**
@@ -57,11 +58,14 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_digital_connector_state *intel_conn_state =
 		to_intel_digital_connector_state(state);
+	struct intel_connector *intel_connector = to_intel_connector(connector);
 
 	if (property == dev_priv->force_audio_property)
 		*val = intel_conn_state->force_audio;
 	else if (property == dev_priv->broadcast_rgb_property)
 		*val = intel_conn_state->broadcast_rgb;
+	else if (property == intel_connector->privacy_screen_property)
+		*val = intel_conn_state->privacy_screen_status;
 	else {
 		DRM_DEBUG_ATOMIC("Unknown property [PROP:%d:%s]\n",
 				 property->base.id, property->name);
@@ -89,15 +93,18 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_digital_connector_state *intel_conn_state =
 		to_intel_digital_connector_state(state);
+	struct intel_connector *intel_connector = to_intel_connector(connector);
 
 	if (property == dev_priv->force_audio_property) {
 		intel_conn_state->force_audio = val;
 		return 0;
-	}
-
-	if (property == dev_priv->broadcast_rgb_property) {
+	} else if (property == dev_priv->broadcast_rgb_property) {
 		intel_conn_state->broadcast_rgb = val;
 		return 0;
+	} else if (property == intel_connector->privacy_screen_property) {
+		intel_privacy_screen_set_val(intel_connector, val);
+		intel_conn_state->privacy_screen_status = val;
+		return 0;
 	}
 
 	DRM_DEBUG_ATOMIC("Unknown property [PROP:%d:%s]\n",
drivers/gpu/drm/i915/display/intel_connector.c +35 -0
index 1133c4e97bb4..f3e041c737de 100644
@@ -296,3 +296,38 @@ intel_attach_colorspace_property(struct drm_connector *connector)
 	drm_object_attach_property(&connector->base,
 				   connector->colorspace_property, 0);
 }
+
+static const struct drm_prop_enum_list privacy_screen_enum[] = {
+	{ PRIVACY_SCREEN_DISABLED, "Disabled" },
+	{ PRIVACY_SCREEN_ENABLED, "Enabled" },
+};
+
+/**
+ * intel_attach_privacy_screen_property -
+ *     create and attach the connecter's privacy-screen property. *
+ * @connector: connector for which to init the privacy-screen property
+ *
+ * This function creates and attaches the "privacy-screen" property to the
+ * connector. Initial state of privacy-screen is set to disabled.
+ */
+void
+intel_attach_privacy_screen_property(struct drm_connector *connector)
+{
+	struct intel_connector *intel_connector = to_intel_connector(connector);
+	struct drm_property *prop;
+
+	if (!intel_connector->privacy_screen_property) {
+		prop = drm_property_create_enum(connector->dev,
+						DRM_MODE_PROP_ENUM,
+						"privacy-screen",
+						privacy_screen_enum,
+					    ARRAY_SIZE(privacy_screen_enum));
+		if (!prop)
+			return;
+
+		intel_connector->privacy_screen_property = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop,
+				   PRIVACY_SCREEN_DISABLED);
+}
drivers/gpu/drm/i915/display/intel_connector.h +1 -0
index 93a7375c8196..61005f37a338 100644
@@ -31,5 +31,6 @@ void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
 void intel_attach_aspect_ratio_property(struct drm_connector *connector);
 void intel_attach_colorspace_property(struct drm_connector *connector);
+void intel_attach_privacy_screen_property(struct drm_connector *connector);
 
 #endif /* __INTEL_CONNECTOR_H__ */
drivers/gpu/drm/i915/display/intel_display_types.h +18 -0
index 0a4a04116091..a0addd2c5376 100644
@@ -433,6 +433,23 @@ struct intel_connector {
 	struct work_struct modeset_retry_work;
 
 	struct intel_hdcp hdcp;
+
+	/* Optional "privacy-screen" property for the connector panel */
+	struct drm_property *privacy_screen_property;
+};
+
+/**
+ * enum intel_privacy_screen_status - privacy_screen status
+ *
+ * This enum is used to track and control the state of the integrated privacy
+ * screen present on some display panels, via the "privacy-screen" property.
+ *
+ * @PRIVACY_SCREEN_DISABLED: The privacy-screen on the panel is disabled
+ * @PRIVACY_SCREEN_ENABLED:  The privacy-screen on the panel is enabled
+ **/
+enum intel_privacy_screen_status {
+	PRIVACY_SCREEN_DISABLED = 0,
+	PRIVACY_SCREEN_ENABLED = 1,
 };
 
 struct intel_digital_connector_state {
@@ -440,6 +457,7 @@ struct intel_digital_connector_state {
 
 	enum hdmi_force_audio force_audio;
 	int broadcast_rgb;
+	enum intel_privacy_screen_status privacy_screen_status;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
drivers/gpu/drm/i915/display/intel_dp.c +6 -0
index 93cece8e2516..d5376d667929 100644
@@ -62,6 +62,7 @@
 #include "intel_lspcon.h"
 #include "intel_lvds.h"
 #include "intel_panel.h"
+#include "intel_privacy_screen.h"
 #include "intel_psr.h"
 #include "intel_sideband.h"
 #include "intel_tc.h"
@@ -6596,6 +6597,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
 	enum port port = dp_to_dig_port(intel_dp)->base.port;
+	struct intel_connector *intel_connector = to_intel_connector(connector);
 
 	if (!IS_G4X(dev_priv) && port != PORT_A)
 		intel_attach_force_audio_property(connector);
@@ -6626,6 +6628,10 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
 		/* Lookup the ACPI node corresponding to the connector */
 		intel_acpi_device_id_update(dev_priv);
+
+		/* Check for integrated Privacy screen support */
+		if (intel_privacy_screen_present(intel_connector))
+			intel_attach_privacy_screen_property(connector);
 	}
 }
 
drivers/gpu/drm/i915/display/intel_privacy_screen.c new file +72 -0

72 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_privacy_screen.h new file +27 -0
new file mode 100644
index 000000000000..74013a7885c7
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+/*
+ * Copyright © 2019 Google Inc.
+ */
+
+#ifndef __DRM_PRIVACY_SCREEN_H__
+#define __DRM_PRIVACY_SCREEN_H__
+
+#include "intel_display_types.h"
+
+#ifdef CONFIG_ACPI
+bool intel_privacy_screen_present(struct intel_connector *connector);
+void intel_privacy_screen_set_val(struct intel_connector *connector,
+				  enum intel_privacy_screen_status val);
+#else
+static bool intel_privacy_screen_present(struct intel_connector *connector)
+{
+	return false;
+}
+
+static void
+intel_privacy_screen_set_val(struct intel_connector *connector,
+			     enum intel_privacy_screen_status val)
+{ }
+#endif /* CONFIG_ACPI */
+
+#endif /* __DRM_PRIVACY_SCREEN_H__ */
Signature · 6 lines
2.24.1.735.g03f4e72817-goog

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

Re: [PATCH v5 3/3] drm/i915: Add support for integrated privacy screens

Hello Jani,

Quoted 6 lines · Rajat Jain

Certain laptops now come with panels that have integrated privacy screens on them. This patch adds support for such panels by adding a privacy-screen property to the intel_connector for the panel, that the userspace can then use to control and check the status.

Quoted 8 lines

Identifying the presence of privacy screen, and controlling it, is done via ACPI _DSM methods.

Currently, this is done only for the Intel display ports. But in future, this can be done for any other ports if the hardware becomes available (e.g. external monitors supporting integrated privacy screens?).

I was wondering if you got a chance to look at this patchset. I'd appreciate it if you could please take a look and provide your comments.

Thanks & Best Regards,

Rajat Jain

Quoted 320 lines

---
v5: fix a cosmetic checkpatch warning
v4: Fix a typo in intel_privacy_screen.h
v3: * Change license to GPL-2.0 OR MIT
* Move privacy screen enum from UAPI to intel_display_types.h
* Rename parameter name and some other minor changes.
v2: Formed by splitting the original patch into multiple patches.
- All code has been moved into i915 now.
- Privacy screen is a i915 property
- Have a local state variable to store the prvacy screen. Don't read it from hardware.

 drivers/gpu/drm/i915/Makefile                 |  3 +-
 drivers/gpu/drm/i915/display/intel_atomic.c   | 13 +++-
 .../gpu/drm/i915/display/intel_connector.c    | 35 +++++++++
 .../gpu/drm/i915/display/intel_connector.h    |  1 +
 .../drm/i915/display/intel_display_types.h    | 18 +++++
 drivers/gpu/drm/i915/display/intel_dp.c       |  6 ++
 .../drm/i915/display/intel_privacy_screen.c   | 72 +++++++++++++++++++
 .../drm/i915/display/intel_privacy_screen.h   | 27 +++++++
 8 files changed, 171 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.h
drivers/gpu/drm/i915/Makefile +2 -1
index 90dcf09f52cc..f7067c8f0407 100644
@@ -197,7 +197,8 @@ i915-y += \
        display/intel_vga.o
 i915-$(CONFIG_ACPI) += \
        display/intel_acpi.o \
-       display/intel_opregion.o
+       display/intel_opregion.o \
+       display/intel_privacy_screen.o
 i915-$(CONFIG_DRM_FBDEV_EMULATION) += \
        display/intel_fbdev.o
 
drivers/gpu/drm/i915/display/intel_atomic.c +10 -3
index c2875b10adf9..c73b81c4c3f6 100644
@@ -37,6 +37,7 @@
 #include "intel_atomic.h"
 #include "intel_display_types.h"
 #include "intel_hdcp.h"
+#include "intel_privacy_screen.h"
 #include "intel_sprite.h"
 
 /**
@@ -57,11 +58,14 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct intel_digital_connector_state *intel_conn_state =
                to_intel_digital_connector_state(state);
+       struct intel_connector *intel_connector = to_intel_connector(connector);
 
        if (property == dev_priv->force_audio_property)
                *val = intel_conn_state->force_audio;
        else if (property == dev_priv->broadcast_rgb_property)
                *val = intel_conn_state->broadcast_rgb;
+       else if (property == intel_connector->privacy_screen_property)
+               *val = intel_conn_state->privacy_screen_status;
        else {
                DRM_DEBUG_ATOMIC("Unknown property [PROP:%d:%s]\n",
                                 property->base.id, property->name);
@@ -89,15 +93,18 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct intel_digital_connector_state *intel_conn_state =
                to_intel_digital_connector_state(state);
+       struct intel_connector *intel_connector = to_intel_connector(connector);
 
        if (property == dev_priv->force_audio_property) {
                intel_conn_state->force_audio = val;
                return 0;
-       }
-
-       if (property == dev_priv->broadcast_rgb_property) {
+       } else if (property == dev_priv->broadcast_rgb_property) {
                intel_conn_state->broadcast_rgb = val;
                return 0;
+       } else if (property == intel_connector->privacy_screen_property) {
+               intel_privacy_screen_set_val(intel_connector, val);
+               intel_conn_state->privacy_screen_status = val;
+               return 0;
        }
 
        DRM_DEBUG_ATOMIC("Unknown property [PROP:%d:%s]\n",
drivers/gpu/drm/i915/display/intel_connector.c +35 -0
index 1133c4e97bb4..f3e041c737de 100644
@@ -296,3 +296,38 @@ intel_attach_colorspace_property(struct drm_connector *connector)
        drm_object_attach_property(&connector->base,
                                   connector->colorspace_property, 0);
 }
+
+static const struct drm_prop_enum_list privacy_screen_enum[] = {
+       { PRIVACY_SCREEN_DISABLED, "Disabled" },
+       { PRIVACY_SCREEN_ENABLED, "Enabled" },
+};
+
+/**
+ * intel_attach_privacy_screen_property -
+ *     create and attach the connecter's privacy-screen property. *
+ * @connector: connector for which to init the privacy-screen property
+ *
+ * This function creates and attaches the "privacy-screen" property to the
+ * connector. Initial state of privacy-screen is set to disabled.
+ */
+void
+intel_attach_privacy_screen_property(struct drm_connector *connector)
+{
+       struct intel_connector *intel_connector = to_intel_connector(connector);
+       struct drm_property *prop;
+
+       if (!intel_connector->privacy_screen_property) {
+               prop = drm_property_create_enum(connector->dev,
+                                               DRM_MODE_PROP_ENUM,
+                                               "privacy-screen",
+                                               privacy_screen_enum,
+                                           ARRAY_SIZE(privacy_screen_enum));
+               if (!prop)
+                       return;
+
+               intel_connector->privacy_screen_property = prop;
+       }
+
+       drm_object_attach_property(&connector->base, prop,
+                                  PRIVACY_SCREEN_DISABLED);
+}
drivers/gpu/drm/i915/display/intel_connector.h +1 -0
index 93a7375c8196..61005f37a338 100644
@@ -31,5 +31,6 @@ void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
 void intel_attach_aspect_ratio_property(struct drm_connector *connector);
 void intel_attach_colorspace_property(struct drm_connector *connector);
+void intel_attach_privacy_screen_property(struct drm_connector *connector);
 
 #endif /* __INTEL_CONNECTOR_H__ */
drivers/gpu/drm/i915/display/intel_display_types.h +18 -0
index 0a4a04116091..a0addd2c5376 100644
@@ -433,6 +433,23 @@ struct intel_connector {
        struct work_struct modeset_retry_work;
 
        struct intel_hdcp hdcp;
+
+       /* Optional "privacy-screen" property for the connector panel */
+       struct drm_property *privacy_screen_property;
+};
+
+/**
+ * enum intel_privacy_screen_status - privacy_screen status
+ *
+ * This enum is used to track and control the state of the integrated privacy
+ * screen present on some display panels, via the "privacy-screen" property.
+ *
+ * @PRIVACY_SCREEN_DISABLED: The privacy-screen on the panel is disabled
+ * @PRIVACY_SCREEN_ENABLED:  The privacy-screen on the panel is enabled
+ **/
+enum intel_privacy_screen_status {
+       PRIVACY_SCREEN_DISABLED = 0,
+       PRIVACY_SCREEN_ENABLED = 1,
 };
 
 struct intel_digital_connector_state {
@@ -440,6 +457,7 @@ struct intel_digital_connector_state {
 
        enum hdmi_force_audio force_audio;
        int broadcast_rgb;
+       enum intel_privacy_screen_status privacy_screen_status;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
drivers/gpu/drm/i915/display/intel_dp.c +6 -0
index 93cece8e2516..d5376d667929 100644
@@ -62,6 +62,7 @@
 #include "intel_lspcon.h"
 #include "intel_lvds.h"
 #include "intel_panel.h"
+#include "intel_privacy_screen.h"
 #include "intel_psr.h"
 #include "intel_sideband.h"
 #include "intel_tc.h"
@@ -6596,6 +6597,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 {
        struct drm_i915_private *dev_priv = to_i915(connector->dev);
        enum port port = dp_to_dig_port(intel_dp)->base.port;
+       struct intel_connector *intel_connector = to_intel_connector(connector);
 
        if (!IS_G4X(dev_priv) && port != PORT_A)
                intel_attach_force_audio_property(connector);
@@ -6626,6 +6628,10 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
                /* Lookup the ACPI node corresponding to the connector */
                intel_acpi_device_id_update(dev_priv);
+
+               /* Check for integrated Privacy screen support */
+               if (intel_privacy_screen_present(intel_connector))
+                       intel_attach_privacy_screen_property(connector);
        }
 }
 
drivers/gpu/drm/i915/display/intel_privacy_screen.c new file +72 -0
new file mode 100644
index 000000000000..c8a5b64f94fb
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/*
+ * Intel ACPI privacy screen code
+ *
+ * Copyright © 2019 Google Inc.
+ */
+
+#include <linux/acpi.h>
+
+#include "intel_privacy_screen.h"
+
+#define CONNECTOR_DSM_REVID 1
+
+#define CONNECTOR_DSM_FN_PRIVACY_ENABLE                2
+#define CONNECTOR_DSM_FN_PRIVACY_DISABLE               3
+
+static const guid_t drm_conn_dsm_guid =
+       GUID_INIT(0xC7033113, 0x8720, 0x4CEB,
+                 0x90, 0x90, 0x9D, 0x52, 0xB3, 0xE5, 0x2D, 0x73);
+
+/* Makes _DSM call to set privacy screen status */
+static void acpi_privacy_screen_call_dsm(acpi_handle conn_handle, u64 func)
+{
+       union acpi_object *obj;
+
+       obj = acpi_evaluate_dsm(conn_handle, &drm_conn_dsm_guid,
+                               CONNECTOR_DSM_REVID, func, NULL);
+       if (!obj) {
+               DRM_DEBUG_DRIVER("failed to evaluate _DSM for fn %llx\n", func);
+               return;
+       }
+
+       ACPI_FREE(obj);
+}
+
+void intel_privacy_screen_set_val(struct intel_connector *connector,
+                                 enum intel_privacy_screen_status val)
+{
+       acpi_handle acpi_handle = connector->acpi_handle;
+
+       if (!acpi_handle)
+               return;
+
+       if (val == PRIVACY_SCREEN_DISABLED)
+               acpi_privacy_screen_call_dsm(acpi_handle,
+                                            CONNECTOR_DSM_FN_PRIVACY_DISABLE);
+       else if (val == PRIVACY_SCREEN_ENABLED)
+               acpi_privacy_screen_call_dsm(acpi_handle,
+                                            CONNECTOR_DSM_FN_PRIVACY_ENABLE);
+       else
+               DRM_WARN("%s: Cannot set privacy screen to invalid val %u\n",
+                        dev_name(connector->base.dev->dev), val);
+}
+
+bool intel_privacy_screen_present(struct intel_connector *connector)
+{
+       acpi_handle handle = connector->acpi_handle;
+
+       if (!handle)
+               return false;
+
+       if (!acpi_check_dsm(handle, &drm_conn_dsm_guid,
+                           CONNECTOR_DSM_REVID,
+                           1 << CONNECTOR_DSM_FN_PRIVACY_ENABLE |
+                           1 << CONNECTOR_DSM_FN_PRIVACY_DISABLE)) {
+               DRM_WARN("%s: Odd, connector ACPI node but no privacy scrn?\n",
+                        dev_name(connector->base.dev->dev));
+               return false;
+       }
+       DRM_DEV_INFO(connector->base.dev->dev, "supports privacy screen\n");
+       return true;
+}
drivers/gpu/drm/i915/display/intel_privacy_screen.h new file +27 -1
new file mode 100644
index 000000000000..74013a7885c7
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+/*
+ * Copyright © 2019 Google Inc.
+ */
+
+#ifndef __DRM_PRIVACY_SCREEN_H__
+#define __DRM_PRIVACY_SCREEN_H__
+
+#include "intel_display_types.h"
+
+#ifdef CONFIG_ACPI
+bool intel_privacy_screen_present(struct intel_connector *connector);
+void intel_privacy_screen_set_val(struct intel_connector *connector,
+                                 enum intel_privacy_screen_status val);
+#else
+static bool intel_privacy_screen_present(struct intel_connector *connector)
+{
+       return false;
+}
+
+static void
+intel_privacy_screen_set_val(struct intel_connector *connector,
+                            enum intel_privacy_screen_status val)
+{ }
+#endif /* CONFIG_ACPI */
+
+#endif /* __DRM_PRIVACY_SCREEN_H__ */
--
Quoted 2 lines

2.24.1.735.g03f4e72817-goog

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

#6 lore raw

Re: [v5,3/3] drm/i915: Add support for integrated privacy screens

In reply to Rajat Jain
Quoted 132 lines · Rajat Jain

Certain laptops now come with panels that have integrated privacy screens on them. This patch adds support for such panels by adding a privacy-screen property to the intel_connector for the panel, that the userspace can then use to control and check the status.

Identifying the presence of privacy screen, and controlling it, is done via ACPI _DSM methods.

Currently, this is done only for the Intel display ports. But in future, this can be done for any other ports if the hardware becomes available (e.g. external monitors supporting integrated privacy screens?).

---
v5: fix a cosmetic checkpatch warning
v4: Fix a typo in intel_privacy_screen.h
v3: * Change license to GPL-2.0 OR MIT
* Move privacy screen enum from UAPI to intel_display_types.h
* Rename parameter name and some other minor changes.
v2: Formed by splitting the original patch into multiple patches.
- All code has been moved into i915 now.
- Privacy screen is a i915 property
- Have a local state variable to store the prvacy screen. Don't read it from hardware.

 drivers/gpu/drm/i915/Makefile                 |  3 +-
 drivers/gpu/drm/i915/display/intel_atomic.c   | 13 +++-
 .../gpu/drm/i915/display/intel_connector.c    | 35 +++++++++
 .../gpu/drm/i915/display/intel_connector.h    |  1 +
 .../drm/i915/display/intel_display_types.h    | 18 +++++
 drivers/gpu/drm/i915/display/intel_dp.c       |  6 ++
 .../drm/i915/display/intel_privacy_screen.c   | 72 +++++++++++++++++++
 .../drm/i915/display/intel_privacy_screen.h   | 27 +++++++
 8 files changed, 171 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.h
drivers/gpu/drm/i915/Makefile +2 -1
index 90dcf09f52cc..f7067c8f0407 100644
@@ -197,7 +197,8 @@ i915-y += \
 	display/intel_vga.o
 i915-$(CONFIG_ACPI) += \
 	display/intel_acpi.o \
-	display/intel_opregion.o
+	display/intel_opregion.o \
+	display/intel_privacy_screen.o
 i915-$(CONFIG_DRM_FBDEV_EMULATION) += \
 	display/intel_fbdev.o
 
drivers/gpu/drm/i915/display/intel_atomic.c +10 -3
index c2875b10adf9..c73b81c4c3f6 100644
@@ -37,6 +37,7 @@
 #include "intel_atomic.h"
 #include "intel_display_types.h"
 #include "intel_hdcp.h"
+#include "intel_privacy_screen.h"
 #include "intel_sprite.h"
 
 /**
@@ -57,11 +58,14 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_digital_connector_state *intel_conn_state =
 		to_intel_digital_connector_state(state);
+	struct intel_connector *intel_connector = to_intel_connector(connector);
 
 	if (property == dev_priv->force_audio_property)
 		*val = intel_conn_state->force_audio;
 	else if (property == dev_priv->broadcast_rgb_property)
 		*val = intel_conn_state->broadcast_rgb;
+	else if (property == intel_connector->privacy_screen_property)
+		*val = intel_conn_state->privacy_screen_status;
 	else {
 		DRM_DEBUG_ATOMIC("Unknown property [PROP:%d:%s]\n",
 				 property->base.id, property->name);
@@ -89,15 +93,18 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_digital_connector_state *intel_conn_state =
 		to_intel_digital_connector_state(state);
+	struct intel_connector *intel_connector = to_intel_connector(connector);
 
 	if (property == dev_priv->force_audio_property) {
 		intel_conn_state->force_audio = val;
 		return 0;
-	}
-
-	if (property == dev_priv->broadcast_rgb_property) {
+	} else if (property == dev_priv->broadcast_rgb_property) {
 		intel_conn_state->broadcast_rgb = val;
 		return 0;
+	} else if (property == intel_connector->privacy_screen_property) {
+		intel_privacy_screen_set_val(intel_connector, val);
+		intel_conn_state->privacy_screen_status = val;
+		return 0;
 	}
 
 	DRM_DEBUG_ATOMIC("Unknown property [PROP:%d:%s]\n",
drivers/gpu/drm/i915/display/intel_connector.c +24 -0
index 1133c4e97bb4..f3e041c737de 100644
@@ -296,3 +296,38 @@ intel_attach_colorspace_property(struct drm_connector *connector)
 	drm_object_attach_property(&connector->base,
 				   connector->colorspace_property, 0);
 }
+
+static const struct drm_prop_enum_list privacy_screen_enum[] = {
+	{ PRIVACY_SCREEN_DISABLED, "Disabled" },
+	{ PRIVACY_SCREEN_ENABLED, "Enabled" },
+};
+
+/**
+ * intel_attach_privacy_screen_property -
+ *     create and attach the connecter's privacy-screen property. *
+ * @connector: connector for which to init the privacy-screen property
+ *
+ * This function creates and attaches the "privacy-screen" property to the
+ * connector. Initial state of privacy-screen is set to disabled.
+ */
+void
+intel_attach_privacy_screen_property(struct drm_connector *connector)
+{
+	struct intel_connector *intel_connector = to_intel_connector(connector);
+	struct drm_property *prop;
+
+	if (!intel_connector->privacy_screen_property) {
+		prop = drm_property_create_enum(connector->dev,
+						DRM_MODE_PROP_ENUM,
+						"privacy-screen",

drivers/gpu/drm/i915/display/intel_connector.c intel_attach_colorspace_property(struct drm_connector *connector) · line 332

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_connector.c +10 -0
+						privacy_screen_enum,
+					    ARRAY_SIZE(privacy_screen_enum));
+		if (!prop)
+			return;
+
+		intel_connector->privacy_screen_property = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop,
+				   PRIVACY_SCREEN_DISABLED);

If intel_connector->privacy_screen_property is not NULL, prop will be undefined, causing all kinds of fun.

I would expect this to happen whenever this function is called for the second time.

Guenter

Quoted 190 lines
drivers/gpu/drm/i915/display/intel_connector.c +1 -0
+}
drivers/gpu/drm/i915/display/intel_connector.h +1 -0
index 93a7375c8196..61005f37a338 100644
@@ -31,5 +31,6 @@ void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
 void intel_attach_aspect_ratio_property(struct drm_connector *connector);
 void intel_attach_colorspace_property(struct drm_connector *connector);
+void intel_attach_privacy_screen_property(struct drm_connector *connector);
 
 #endif /* __INTEL_CONNECTOR_H__ */
drivers/gpu/drm/i915/display/intel_display_types.h +18 -0
index 0a4a04116091..a0addd2c5376 100644
@@ -433,6 +433,23 @@ struct intel_connector {
 	struct work_struct modeset_retry_work;
 
 	struct intel_hdcp hdcp;
+
+	/* Optional "privacy-screen" property for the connector panel */
+	struct drm_property *privacy_screen_property;
+};
+
+/**
+ * enum intel_privacy_screen_status - privacy_screen status
+ *
+ * This enum is used to track and control the state of the integrated privacy
+ * screen present on some display panels, via the "privacy-screen" property.
+ *
+ * @PRIVACY_SCREEN_DISABLED: The privacy-screen on the panel is disabled
+ * @PRIVACY_SCREEN_ENABLED:  The privacy-screen on the panel is enabled
+ **/
+enum intel_privacy_screen_status {
+	PRIVACY_SCREEN_DISABLED = 0,
+	PRIVACY_SCREEN_ENABLED = 1,
 };
 
 struct intel_digital_connector_state {
@@ -440,6 +457,7 @@ struct intel_digital_connector_state {
 
 	enum hdmi_force_audio force_audio;
 	int broadcast_rgb;
+	enum intel_privacy_screen_status privacy_screen_status;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
drivers/gpu/drm/i915/display/intel_dp.c +6 -0
index 93cece8e2516..d5376d667929 100644
@@ -62,6 +62,7 @@
 #include "intel_lspcon.h"
 #include "intel_lvds.h"
 #include "intel_panel.h"
+#include "intel_privacy_screen.h"
 #include "intel_psr.h"
 #include "intel_sideband.h"
 #include "intel_tc.h"
@@ -6596,6 +6597,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
 	enum port port = dp_to_dig_port(intel_dp)->base.port;
+	struct intel_connector *intel_connector = to_intel_connector(connector);
 
 	if (!IS_G4X(dev_priv) && port != PORT_A)
 		intel_attach_force_audio_property(connector);
@@ -6626,6 +6628,10 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
 		/* Lookup the ACPI node corresponding to the connector */
 		intel_acpi_device_id_update(dev_priv);
+
+		/* Check for integrated Privacy screen support */
+		if (intel_privacy_screen_present(intel_connector))
+			intel_attach_privacy_screen_property(connector);
 	}
 }
 
drivers/gpu/drm/i915/display/intel_privacy_screen.c new file +72 -0
new file mode 100644
index 000000000000..c8a5b64f94fb
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/*
+ * Intel ACPI privacy screen code
+ *
+ * Copyright © 2019 Google Inc.
+ */
+
+#include <linux/acpi.h>
+
+#include "intel_privacy_screen.h"
+
+#define CONNECTOR_DSM_REVID 1
+
+#define CONNECTOR_DSM_FN_PRIVACY_ENABLE		2
+#define CONNECTOR_DSM_FN_PRIVACY_DISABLE		3
+
+static const guid_t drm_conn_dsm_guid =
+	GUID_INIT(0xC7033113, 0x8720, 0x4CEB,
+		  0x90, 0x90, 0x9D, 0x52, 0xB3, 0xE5, 0x2D, 0x73);
+
+/* Makes _DSM call to set privacy screen status */
+static void acpi_privacy_screen_call_dsm(acpi_handle conn_handle, u64 func)
+{
+	union acpi_object *obj;
+
+	obj = acpi_evaluate_dsm(conn_handle, &drm_conn_dsm_guid,
+				CONNECTOR_DSM_REVID, func, NULL);
+	if (!obj) {
+		DRM_DEBUG_DRIVER("failed to evaluate _DSM for fn %llx\n", func);
+		return;
+	}
+
+	ACPI_FREE(obj);
+}
+
+void intel_privacy_screen_set_val(struct intel_connector *connector,
+				  enum intel_privacy_screen_status val)
+{
+	acpi_handle acpi_handle = connector->acpi_handle;
+
+	if (!acpi_handle)
+		return;
+
+	if (val == PRIVACY_SCREEN_DISABLED)
+		acpi_privacy_screen_call_dsm(acpi_handle,
+					     CONNECTOR_DSM_FN_PRIVACY_DISABLE);
+	else if (val == PRIVACY_SCREEN_ENABLED)
+		acpi_privacy_screen_call_dsm(acpi_handle,
+					     CONNECTOR_DSM_FN_PRIVACY_ENABLE);
+	else
+		DRM_WARN("%s: Cannot set privacy screen to invalid val %u\n",
+			 dev_name(connector->base.dev->dev), val);
+}
+
+bool intel_privacy_screen_present(struct intel_connector *connector)
+{
+	acpi_handle handle = connector->acpi_handle;
+
+	if (!handle)
+		return false;
+
+	if (!acpi_check_dsm(handle, &drm_conn_dsm_guid,
+			    CONNECTOR_DSM_REVID,
+			    1 << CONNECTOR_DSM_FN_PRIVACY_ENABLE |
+			    1 << CONNECTOR_DSM_FN_PRIVACY_DISABLE)) {
+		DRM_WARN("%s: Odd, connector ACPI node but no privacy scrn?\n",
+			 dev_name(connector->base.dev->dev));
+		return false;
+	}
+	DRM_DEV_INFO(connector->base.dev->dev, "supports privacy screen\n");
+	return true;
+}
drivers/gpu/drm/i915/display/intel_privacy_screen.h new file +27 -0
new file mode 100644
index 000000000000..74013a7885c7
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+/*
+ * Copyright © 2019 Google Inc.
+ */
+
+#ifndef __DRM_PRIVACY_SCREEN_H__
+#define __DRM_PRIVACY_SCREEN_H__
+
+#include "intel_display_types.h"
+
+#ifdef CONFIG_ACPI
+bool intel_privacy_screen_present(struct intel_connector *connector);
+void intel_privacy_screen_set_val(struct intel_connector *connector,
+				  enum intel_privacy_screen_status val);
+#else
+static bool intel_privacy_screen_present(struct intel_connector *connector)
+{
+	return false;
+}
+
+static void
+intel_privacy_screen_set_val(struct intel_connector *connector,
+			     enum intel_privacy_screen_status val)
+{ }
+#endif /* CONFIG_ACPI */
+
+#endif /* __DRM_PRIVACY_SCREEN_H__ */
author
#7 lore raw

Re: [v5,3/3] drm/i915: Add support for integrated privacy screens

Quoted 139 lines · Guenter Roeck
Quoted 137 lines · Rajat Jain

Certain laptops now come with panels that have integrated privacy screens on them. This patch adds support for such panels by adding a privacy-screen property to the intel_connector for the panel, that the userspace can then use to control and check the status.

Identifying the presence of privacy screen, and controlling it, is done via ACPI _DSM methods.

Currently, this is done only for the Intel display ports. But in future, this can be done for any other ports if the hardware becomes available (e.g. external monitors supporting integrated privacy screens?).

---
v5: fix a cosmetic checkpatch warning
v4: Fix a typo in intel_privacy_screen.h
v3: * Change license to GPL-2.0 OR MIT
* Move privacy screen enum from UAPI to intel_display_types.h
* Rename parameter name and some other minor changes.
v2: Formed by splitting the original patch into multiple patches.
- All code has been moved into i915 now.
- Privacy screen is a i915 property
- Have a local state variable to store the prvacy screen. Don't read it from hardware.

 drivers/gpu/drm/i915/Makefile                 |  3 +-
 drivers/gpu/drm/i915/display/intel_atomic.c   | 13 +++-
 .../gpu/drm/i915/display/intel_connector.c    | 35 +++++++++
 .../gpu/drm/i915/display/intel_connector.h    |  1 +
 .../drm/i915/display/intel_display_types.h    | 18 +++++
 drivers/gpu/drm/i915/display/intel_dp.c       |  6 ++
 .../drm/i915/display/intel_privacy_screen.c   | 72 +++++++++++++++++++
 .../drm/i915/display/intel_privacy_screen.h   | 27 +++++++
 8 files changed, 171 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.h
drivers/gpu/drm/i915/Makefile +2 -1
index 90dcf09f52cc..f7067c8f0407 100644
@@ -197,7 +197,8 @@ i915-y += \
      display/intel_vga.o
 i915-$(CONFIG_ACPI) += \
      display/intel_acpi.o \
-     display/intel_opregion.o
+     display/intel_opregion.o \
+     display/intel_privacy_screen.o
 i915-$(CONFIG_DRM_FBDEV_EMULATION) += \
      display/intel_fbdev.o
 
drivers/gpu/drm/i915/display/intel_atomic.c +10 -3
index c2875b10adf9..c73b81c4c3f6 100644
@@ -37,6 +37,7 @@
 #include "intel_atomic.h"
 #include "intel_display_types.h"
 #include "intel_hdcp.h"
+#include "intel_privacy_screen.h"
 #include "intel_sprite.h"
 
 /**
@@ -57,11 +58,14 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
      struct drm_i915_private *dev_priv = to_i915(dev);
      struct intel_digital_connector_state *intel_conn_state =
              to_intel_digital_connector_state(state);
+     struct intel_connector *intel_connector = to_intel_connector(connector);
 
      if (property == dev_priv->force_audio_property)
              *val = intel_conn_state->force_audio;
      else if (property == dev_priv->broadcast_rgb_property)
              *val = intel_conn_state->broadcast_rgb;
+     else if (property == intel_connector->privacy_screen_property)
+             *val = intel_conn_state->privacy_screen_status;
      else {
              DRM_DEBUG_ATOMIC("Unknown property [PROP:%d:%s]\n",
                               property->base.id, property->name);
@@ -89,15 +93,18 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
      struct drm_i915_private *dev_priv = to_i915(dev);
      struct intel_digital_connector_state *intel_conn_state =
              to_intel_digital_connector_state(state);
+     struct intel_connector *intel_connector = to_intel_connector(connector);
 
      if (property == dev_priv->force_audio_property) {
              intel_conn_state->force_audio = val;
              return 0;
-     }
-
-     if (property == dev_priv->broadcast_rgb_property) {
+     } else if (property == dev_priv->broadcast_rgb_property) {
              intel_conn_state->broadcast_rgb = val;
              return 0;
+     } else if (property == intel_connector->privacy_screen_property) {
+             intel_privacy_screen_set_val(intel_connector, val);
+             intel_conn_state->privacy_screen_status = val;
+             return 0;
      }
 
      DRM_DEBUG_ATOMIC("Unknown property [PROP:%d:%s]\n",
drivers/gpu/drm/i915/display/intel_connector.c +29 -0
index 1133c4e97bb4..f3e041c737de 100644
@@ -296,3 +296,38 @@ intel_attach_colorspace_property(struct drm_connector *connector)
      drm_object_attach_property(&connector->base,
                                 connector->colorspace_property, 0);
 }
+
+static const struct drm_prop_enum_list privacy_screen_enum[] = {
+     { PRIVACY_SCREEN_DISABLED, "Disabled" },
+     { PRIVACY_SCREEN_ENABLED, "Enabled" },
+};
+
+/**
+ * intel_attach_privacy_screen_property -
+ *     create and attach the connecter's privacy-screen property. *
+ * @connector: connector for which to init the privacy-screen property
+ *
+ * This function creates and attaches the "privacy-screen" property to the
+ * connector. Initial state of privacy-screen is set to disabled.
+ */
+void
+intel_attach_privacy_screen_property(struct drm_connector *connector)
+{
+     struct intel_connector *intel_connector = to_intel_connector(connector);
+     struct drm_property *prop;
+
+     if (!intel_connector->privacy_screen_property) {
+             prop = drm_property_create_enum(connector->dev,
+                                             DRM_MODE_PROP_ENUM,
+                                             "privacy-screen",
+                                             privacy_screen_enum,
+                                         ARRAY_SIZE(privacy_screen_enum));
+             if (!prop)
+                     return;
+
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_connector.c intel_attach_colorspace_property(struct drm_connector *connector) · line 332

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_connector.c +5 -0
+             intel_connector->privacy_screen_property = prop;
+     }
+
+     drm_object_attach_property(&connector->base, prop,
+                                PRIVACY_SCREEN_DISABLED);

If intel_connector->privacy_screen_property is not NULL, prop will be undefined, causing all kinds of fun.

Thank you for catching this. I will fix this in my next iteration.

Thanks,

Rajat

Quoted 188 lines

I would expect this to happen whenever this function is called for the second time.

Guenter

Quoted 182 lines
drivers/gpu/drm/i915/display/intel_connector.c +1 -0
+}
drivers/gpu/drm/i915/display/intel_connector.h +1 -0
index 93a7375c8196..61005f37a338 100644
@@ -31,5 +31,6 @@ void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
 void intel_attach_aspect_ratio_property(struct drm_connector *connector);
 void intel_attach_colorspace_property(struct drm_connector *connector);
+void intel_attach_privacy_screen_property(struct drm_connector *connector);
 
 #endif /* __INTEL_CONNECTOR_H__ */
drivers/gpu/drm/i915/display/intel_display_types.h +18 -0
index 0a4a04116091..a0addd2c5376 100644
@@ -433,6 +433,23 @@ struct intel_connector {
      struct work_struct modeset_retry_work;
 
      struct intel_hdcp hdcp;
+
+     /* Optional "privacy-screen" property for the connector panel */
+     struct drm_property *privacy_screen_property;
+};
+
+/**
+ * enum intel_privacy_screen_status - privacy_screen status
+ *
+ * This enum is used to track and control the state of the integrated privacy
+ * screen present on some display panels, via the "privacy-screen" property.
+ *
+ * @PRIVACY_SCREEN_DISABLED: The privacy-screen on the panel is disabled
+ * @PRIVACY_SCREEN_ENABLED:  The privacy-screen on the panel is enabled
+ **/
+enum intel_privacy_screen_status {
+     PRIVACY_SCREEN_DISABLED = 0,
+     PRIVACY_SCREEN_ENABLED = 1,
 };
 
 struct intel_digital_connector_state {
@@ -440,6 +457,7 @@ struct intel_digital_connector_state {
 
      enum hdmi_force_audio force_audio;
      int broadcast_rgb;
+     enum intel_privacy_screen_status privacy_screen_status;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
drivers/gpu/drm/i915/display/intel_dp.c +6 -0
index 93cece8e2516..d5376d667929 100644
@@ -62,6 +62,7 @@
 #include "intel_lspcon.h"
 #include "intel_lvds.h"
 #include "intel_panel.h"
+#include "intel_privacy_screen.h"
 #include "intel_psr.h"
 #include "intel_sideband.h"
 #include "intel_tc.h"
@@ -6596,6 +6597,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 {
      struct drm_i915_private *dev_priv = to_i915(connector->dev);
      enum port port = dp_to_dig_port(intel_dp)->base.port;
+     struct intel_connector *intel_connector = to_intel_connector(connector);
 
      if (!IS_G4X(dev_priv) && port != PORT_A)
              intel_attach_force_audio_property(connector);
@@ -6626,6 +6628,10 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
              /* Lookup the ACPI node corresponding to the connector */
              intel_acpi_device_id_update(dev_priv);
+
+             /* Check for integrated Privacy screen support */
+             if (intel_privacy_screen_present(intel_connector))
+                     intel_attach_privacy_screen_property(connector);
      }
 }
 
drivers/gpu/drm/i915/display/intel_privacy_screen.c new file +72 -0
new file mode 100644
index 000000000000..c8a5b64f94fb
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/*
+ * Intel ACPI privacy screen code
+ *
+ * Copyright © 2019 Google Inc.
+ */
+
+#include <linux/acpi.h>
+
+#include "intel_privacy_screen.h"
+
+#define CONNECTOR_DSM_REVID 1
+
+#define CONNECTOR_DSM_FN_PRIVACY_ENABLE              2
+#define CONNECTOR_DSM_FN_PRIVACY_DISABLE             3
+
+static const guid_t drm_conn_dsm_guid =
+     GUID_INIT(0xC7033113, 0x8720, 0x4CEB,
+               0x90, 0x90, 0x9D, 0x52, 0xB3, 0xE5, 0x2D, 0x73);
+
+/* Makes _DSM call to set privacy screen status */
+static void acpi_privacy_screen_call_dsm(acpi_handle conn_handle, u64 func)
+{
+     union acpi_object *obj;
+
+     obj = acpi_evaluate_dsm(conn_handle, &drm_conn_dsm_guid,
+                             CONNECTOR_DSM_REVID, func, NULL);
+     if (!obj) {
+             DRM_DEBUG_DRIVER("failed to evaluate _DSM for fn %llx\n", func);
+             return;
+     }
+
+     ACPI_FREE(obj);
+}
+
+void intel_privacy_screen_set_val(struct intel_connector *connector,
+                               enum intel_privacy_screen_status val)
+{
+     acpi_handle acpi_handle = connector->acpi_handle;
+
+     if (!acpi_handle)
+             return;
+
+     if (val == PRIVACY_SCREEN_DISABLED)
+             acpi_privacy_screen_call_dsm(acpi_handle,
+                                          CONNECTOR_DSM_FN_PRIVACY_DISABLE);
+     else if (val == PRIVACY_SCREEN_ENABLED)
+             acpi_privacy_screen_call_dsm(acpi_handle,
+                                          CONNECTOR_DSM_FN_PRIVACY_ENABLE);
+     else
+             DRM_WARN("%s: Cannot set privacy screen to invalid val %u\n",
+                      dev_name(connector->base.dev->dev), val);
+}
+
+bool intel_privacy_screen_present(struct intel_connector *connector)
+{
+     acpi_handle handle = connector->acpi_handle;
+
+     if (!handle)
+             return false;
+
+     if (!acpi_check_dsm(handle, &drm_conn_dsm_guid,
+                         CONNECTOR_DSM_REVID,
+                         1 << CONNECTOR_DSM_FN_PRIVACY_ENABLE |
+                         1 << CONNECTOR_DSM_FN_PRIVACY_DISABLE)) {
+             DRM_WARN("%s: Odd, connector ACPI node but no privacy scrn?\n",
+                      dev_name(connector->base.dev->dev));
+             return false;
+     }
+     DRM_DEV_INFO(connector->base.dev->dev, "supports privacy screen\n");
+     return true;
+}
drivers/gpu/drm/i915/display/intel_privacy_screen.h new file +19 -0
new file mode 100644
index 000000000000..74013a7885c7
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+/*
+ * Copyright © 2019 Google Inc.
+ */
+
+#ifndef __DRM_PRIVACY_SCREEN_H__
+#define __DRM_PRIVACY_SCREEN_H__
+
+#include "intel_display_types.h"
+
+#ifdef CONFIG_ACPI
+bool intel_privacy_screen_present(struct intel_connector *connector);
+void intel_privacy_screen_set_val(struct intel_connector *connector,
+                               enum intel_privacy_screen_status val);
+#else
+static bool intel_privacy_screen_present(struct intel_connector *connector)
+{
+     return false;
+}
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_privacy_screen.h line 27

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_privacy_screen.h new file +8 -0
+
+static void
+intel_privacy_screen_set_val(struct intel_connector *connector,
+                          enum intel_privacy_screen_status val)
+{ }
+#endif /* CONFIG_ACPI */
+
+#endif /* __DRM_PRIVACY_SCREEN_H__ */

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

#8 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [v5,1/3] drm/i915: Move the code to populate ACPI device ID into intel_acpi

In reply to Rajat Jain
== Series Details ==

== Series Details ==

Series: series starting with [v5,1/3] drm/i915: Move the code to populate ACPI device ID into intel_acpi
URL : https://patchwork.freedesktop.org/series/71226/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
a477c78c08a0 drm/i915: Move the code to populate ACPI device ID into intel_acpi
7158c90431ce drm/i915: Lookup and attach ACPI device node for connectors
4a5155ddb937 drm/i915: Add support for integrated privacy screens
-:205: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#205: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 248 lines checked

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

#9 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [v5,1/3] drm/i915: Move the code to populate ACPI device ID into intel_acpi

In reply to Rajat Jain
== Series Details ==

== Series Details ==

Series: series starting with [v5,1/3] drm/i915: Move the code to populate ACPI device ID into intel_acpi
URL : https://patchwork.freedesktop.org/series/71226/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7616 -> Patchwork_15864
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/index.html

Known issues
------------

Here are the changes found in Patchwork_15864 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live_blt:
- fi-hsw-4770: [PASS][1] -> [DMESG-FAIL][2] ([i915#553] / [i915#725])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/fi-hsw-4770/igt@i915_selftest@live_blt.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/fi-hsw-4770/igt@i915_selftest@live_blt.html

* igt@i915_selftest@live_gt_heartbeat:
- fi-kbl-7500u: [PASS][3] -> [DMESG-FAIL][4] ([fdo#112406])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/fi-kbl-7500u/igt@i915_selftest@live_gt_heartbeat.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/fi-kbl-7500u/igt@i915_selftest@live_gt_heartbeat.html

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [PASS][5] -> [FAIL][6] ([fdo#111096] / [i915#323])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/fi-kbl-7500u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/fi-kbl-7500u/igt@[email protected]

#### Possible fixes ####

* igt@gem_close_race@basic-threads:
- fi-byt-j1900: [TIMEOUT][7] ([i915#816]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/fi-byt-j1900/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/fi-byt-j1900/igt@[email protected]

#### Warnings ####

* igt@kms_busy@basic-flip-pipe-b:
- fi-kbl-x1275: [DMESG-WARN][9] ([i915#62] / [i915#92]) -> [DMESG-WARN][10] ([i915#62] / [i915#92] / [i915#95]) +4 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/fi-kbl-x1275/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/fi-kbl-x1275/igt@[email protected]

* igt@kms_flip@basic-flip-vs-modeset:
- fi-kbl-x1275: [DMESG-WARN][11] ([i915#62] / [i915#92] / [i915#95]) -> [DMESG-WARN][12] ([i915#62] / [i915#92]) +8 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/fi-kbl-x1275/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/fi-kbl-x1275/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#112406]: https://bugs.freedesktop.org/show_bug.cgi?id=112406
[i915#323]: https://gitlab.freedesktop.org/drm/intel/issues/323
[i915#476]: https://gitlab.freedesktop.org/drm/intel/issues/476
[i915#553]: https://gitlab.freedesktop.org/drm/intel/issues/553
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
[i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
[i915#816]: https://gitlab.freedesktop.org/drm/intel/issues/816
[i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95

Participating hosts (46 -> 37)
------------------------------

Additional (2): fi-hsw-peppy fi-bsw-nick
Missing (11): fi-hsw-4770r fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ilk-650 fi-ctg-p8600 fi-gdg-551 fi-bdw-samus fi-byt-clapper fi-skl-6600u fi-snb-2600

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_7616 -> Patchwork_15864

CI-20190529: 20190529
CI_DRM_7616: 81105b549355270c1d15073dc7f7b137cdc3d5c4 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5351: e7fdcef72d1d6b3bb9f3003bbc37571959e6e8bb @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_15864: 4a5155ddb937dc4bfffb067fb33e1654bcd27e4d @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

4a5155ddb937 drm/i915: Add support for integrated privacy screens 7158c90431ce drm/i915: Lookup and attach ACPI device node for connectors a477c78c08a0 drm/i915: Move the code to populate ACPI device ID into intel_acpi

== Logs ==

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

#10 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [v5,1/3] drm/i915: Move the code to populate ACPI device ID into intel_acpi

In reply to Rajat Jain
== Series Details ==

== Series Details ==

Series: series starting with [v5,1/3] drm/i915: Move the code to populate ACPI device ID into intel_acpi
URL : https://patchwork.freedesktop.org/series/71226/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7616_full -> Patchwork_15864_full
====================================================

Summary
-------

**WARNING**

Minor unknown changes coming with Patchwork_15864_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_15864_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_15864_full:

### IGT changes ###

#### Warnings ####

* igt@runner@aborted:
- shard-apl: ([FAIL][1], [FAIL][2]) ([i915#716]) -> [FAIL][3]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-apl3/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-apl4/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-apl2/igt@[email protected]

New tests
---------

New tests have been introduced between CI_DRM_7616_full and Patchwork_15864_full:

### New Piglit tests (98) ###

* shaders@glsl-fs-abs-02:
- Statuses : 1 fail(s)
- Exec time: [0.12] s

* spec@!opengl 1.1@depthstencil-default_fb-drawpixels-32f_24_8_rev samples=8:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@!opengl 1.2@getteximage-targets 3d:
- Statuses : 1 fail(s)
- Exec time: [0.13] s

* spec@!opengl 1.2@lodclamp-between:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* spec@!opengl 1.2@texwrap 3d proj:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@!opengl 1.4@draw-batch:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@!opengl 3.0@depth-cube-map:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* spec@!opengl 3.1@buffer-bindings:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* spec@!opengl 3.2@layered-rendering@clear-color-all-types cube_map_array mipmapped:
- Statuses : 1 fail(s)
- Exec time: [0.07] s

* spec@!opengl 3.2@pointsprite-origin:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* spec@arb_color_buffer_float@gl_rgba16f-render-sanity-fog:
- Statuses : 1 fail(s)
- Exec time: [0.18] s

* spec@arb_copy_image@arb_copy_image-targets gl_texture_2d 32 32 1 gl_texture_2d_array 32 16 15 11 12 0 5 7 12 14 8 1:
- Statuses : 1 fail(s)
- Exec time: [0.20] s

* spec@arb_copy_image@arb_copy_image-targets gl_texture_2d 32 32 1 gl_texture_rectangle 32 16 1 11 12 0 5 7 0 14 9 1:
- Statuses : 1 fail(s)
- Exec time: [0.16] s

* spec@arb_depth_buffer_float@depthstencil-render-miplevels 273 d=s=z32f_s8:
- Statuses : 1 fail(s)
- Exec time: [4.23] s

* spec@arb_depth_texture@depth-level-clamp:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* spec@arb_depth_texture@depthstencil-render-miplevels 585 d=z24:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* spec@arb_draw_buffers_blend@fbo-draw-buffers-blend:
- Statuses : 1 fail(s)
- Exec time: [0.12] s

* spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit depth gl_depth_component24:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* spec@arb_framebuffer_object@fbo-generatemipmap-cubemap:
- Statuses : 1 fail(s)
- Exec time: [0.15] s

* spec@arb_framebuffer_object@framebuffer-blit-levels read rgba:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@arb_gpu_shader5@execution@sampler_array_indexing@fs-struct-nonconst-sampler-nonconst:
- Statuses : 1 fail(s)
- Exec time: [0.13] s

* spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat3-mat3:
- Statuses : 1 fail(s)
- Exec time: [5.88] s

* spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-implicit-ivec4-dvec4:
- Statuses : 1 fail(s)
- Exec time: [5.94] s

* spec@arb_gpu_shader_fp64@execution@conversion@vert-conversion-explicit-dvec2-uvec2:
- Statuses : 1 fail(s)
- Exec time: [5.91] s

* spec@arb_gpu_shader_fp64@execution@conversion@vert-conversion-explicit-dvec4-bvec4:
- Statuses : 1 fail(s)
- Exec time: [5.86] s

* spec@arb_gpu_shader_fp64@execution@conversion@vert-conversion-implicit-uint-double:
- Statuses : 1 fail(s)
- Exec time: [5.86] s

* spec@arb_shader_texture_image_samples@texturesamples@vs-isampler2dms-4:
- Statuses : 1 fail(s)
- Exec time: [0.07] s

* spec@arb_tessellation_shader@execution@variable-indexing@tcs-output-array-float-index-wr-before-barrier:
- Statuses : 1 fail(s)
- Exec time: [0.17] s

* spec@arb_tessellation_shader@execution@variable-indexing@tcs-output-array-vec3-index-wr:
- Statuses : 1 fail(s)
- Exec time: [0.17] s

* spec@arb_tessellation_shader@execution@variable-indexing@tcs-output-array-vec4-index-rd-after-barrier:
- Statuses : 1 fail(s)
- Exec time: [0.18] s

* spec@arb_tessellation_shader@execution@variable-indexing@tcs-patch-output-array-vec2-index-wr:
- Statuses : 1 fail(s)
- Exec time: [0.20] s

* spec@arb_tessellation_shader@execution@variable-indexing@tcs-patch-output-array-vec4-index-wr:
- Statuses : 1 fail(s)
- Exec time: [0.18] s

* spec@arb_tessellation_shader@execution@variable-indexing@tes-input-array-vec4-index-rd:
- Statuses : 1 fail(s)
- Exec time: [0.16] s

* spec@arb_texture_barrier@arb_texture_barrier-blending-in-shader 512 42 1 8 7:
- Statuses : 1 fail(s)
- Exec time: [0.18] s

* spec@arb_texture_compression_bptc@bptc-float-modes:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@arb_texture_cube_map@getteximage-targets cube:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* spec@arb_texture_cube_map_array@texturesize@tes-texturesize-usamplercubearray:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@arb_texture_multisample@large-float-texture-array:
- Statuses : 1 fail(s)
- Exec time: [0.55] s

* spec@arb_texture_multisample@texelfetch@2-fs-sampler2dmsarray:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* spec@arb_texture_multisample@texelfetch@6-fs-usampler2dms:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* spec@arb_texture_multisample@texelfetch@6-gs-isampler2dms:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* spec@arb_texture_multisample@texelfetch@6-vs-usampler2dms:
- Statuses : 1 fail(s)
- Exec time: [0.07] s

* spec@arb_texture_multisample@texelfetch@8-fs-sampler2dms:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* spec@arb_texture_rectangle@tex-miplevel-selection gl2:texture() 2drectshadow:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drectshadow:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* spec@arb_texture_rg@fbo-generatemipmap-formats:
- Statuses : 1 fail(s)
- Exec time: [0.16] s

* spec@arb_vertex_attrib_64bit@execution@vs_in@vs-input-double_dmat2-position-uint_uvec4_array3:
- Statuses : 1 fail(s)
- Exec time: [6.48] s

* spec@arb_vertex_attrib_64bit@execution@vs_in@vs-input-double_dmat2x4-uint_uint-position:
- Statuses : 1 fail(s)
- Exec time: [6.39] s

* spec@arb_vertex_attrib_64bit@execution@vs_in@vs-input-double_dmat3-double_dvec4-position:
- Statuses : 1 fail(s)
- Exec time: [6.35] s

* spec@arb_vertex_attrib_64bit@execution@vs_in@vs-input-double_dmat3x4-float_vec3-position:
- Statuses : 1 fail(s)
- Exec time: [6.44] s

* spec@arb_vertex_attrib_64bit@execution@vs_in@vs-input-position-double_dvec2-float_float:
- Statuses : 1 fail(s)
- Exec time: [6.39] s

* spec@arb_vertex_attrib_64bit@execution@vs_in@vs-input-ubyte_uint-short_int-position-double_dmat4x2:
- Statuses : 1 fail(s)
- Exec time: [6.48] s

* spec@arb_vertex_type_10f_11f_11f_rev@arb_vertex_type_10f_11f_11f_rev-draw-vertices:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* spec@ext_framebuffer_multisample@alpha-to-one-dual-src-blend 2:
- Statuses : 1 fail(s)
- Exec time: [0.18] s

* spec@ext_framebuffer_multisample@blit-multiple-render-targets 6:
- Statuses : 1 fail(s)
- Exec time: [0.12] s

* spec@ext_framebuffer_multisample@draw-buffers-alpha-to-coverage 8:
- Statuses : 1 fail(s)
- Exec time: [0.26] s

* spec@ext_framebuffer_multisample@int-draw-buffers-alpha-to-coverage 8:
- Statuses : 1 fail(s)
- Exec time: [0.26] s

* spec@ext_framebuffer_multisample@int-draw-buffers-alpha-to-one 8:
- Statuses : 1 fail(s)
- Exec time: [0.26] s

* spec@ext_framebuffer_object@fbo-stencil-gl_stencil_index16-drawpixels:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* spec@ext_packed_depth_stencil@depthstencil-render-miplevels 273 d=s=z24_s8:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@ext_packed_depth_stencil@depthstencil-render-miplevels 273 d=z24_s8:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@ext_packed_depth_stencil@fbo-depthstencil-gl_depth24_stencil8-copypixels:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* spec@ext_packed_depth_stencil@fbo-depthstencil-gl_depth24_stencil8-drawpixels-32f_24_8_rev:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* spec@ext_packed_float@fbo-blending-formats:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* spec@ext_packed_float@fbo-fast-clear:
- Statuses : 1 fail(s)
- Exec time: [0.18] s

* spec@ext_packed_float@texwrap formats offset:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@ext_texture_compression_s3tc@getteximage-targets cube s3tc:
- Statuses : 1 fail(s)
- Exec time: [0.10] s

* spec@ext_transform_feedback@order elements lines:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* [email protected]@execution@interpolation@interpolation-none-gl_backcolor-smooth-none:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* [email protected]@execution@clipping@vs-clip-distance-enables:
- Statuses : 1 fail(s)
- Exec time: [0.20] s

* [email protected]@execution@interpolation@interpolation-flat-gl_frontcolor-smooth-vertex:
- Statuses : 1 fail(s)
- Exec time: [0.13] s

* [email protected]@execution@interpolation@interpolation-none-gl_backsecondarycolor-smooth-distance:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* [email protected]@execution@interpolation@interpolation-noperspective-gl_backsecondarycolor-smooth-none:
- Statuses : 1 fail(s)
- Exec time: [0.15] s

* [email protected]@execution@interpolation@interpolation-noperspective-gl_frontcolor-flat-distance:
- Statuses : 1 fail(s)
- Exec time: [0.17] s

* [email protected]@execution@interpolation@interpolation-noperspective-gl_frontsecondarycolor-smooth-distance:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* [email protected]@execution@interpolation@interpolation-smooth-gl_backsecondarycolor-smooth-distance:
- Statuses : 1 fail(s)
- Exec time: [0.15] s

* [email protected]@execution@interpolation@interpolation-smooth-gl_backsecondarycolor-smooth-none:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* [email protected]@execution@texelfetch fs sampler1darray 281x1-281x281:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* [email protected]@execution@texelfetch@fs-texelfetch-isampler2d:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* [email protected]@execution@texelfetch@vs-texelfetch-sampler1d:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* [email protected]@execution@texelfetch@vs-texelfetch-usampler2d:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* [email protected]@execution@texturesize@fs-texturesize-isampler2d:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* [email protected]@execution@texturesize@fs-texturesize-sampler3d:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* [email protected]@execution@texturesize@fs-texturesize-usampler2darray:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* [email protected]@execution@vs-texturelod-miplevels:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* [email protected]@execution@texturesize@fs-texturesize-sampler2darrayshadow:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* [email protected]@execution@texturesize@gs-texturesize-sampler2d:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* [email protected]@execution@texturesize@gs-texturesize-usampler1darray:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* [email protected]@execution@texturesize@tes-texturesize-sampler1d:
- Statuses : 1 fail(s)
- Exec time: [0.09] s

* [email protected]@execution@texturesize@tes-texturesize-sampler1dshadow:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* [email protected]@execution@texturesize@tes-texturesize-sampler2d:
- Statuses : 1 fail(s)
- Exec time: [0.07] s

* [email protected]@execution@texturesize@tes-texturesize-usamplercube:
- Statuses : 1 fail(s)
- Exec time: [0.08] s

* [email protected]@execution@variable-indexing@gs-input-array-vec4-index-rd:
- Statuses : 1 fail(s)
- Exec time: [0.22] s

* [email protected]@execution@built-in-functions@vs-equal-dvec2-dvec2:
- Statuses : 1 fail(s)
- Exec time: [0.14] s

* [email protected]@execution@built-in-functions@vs-greaterthan-dvec4-dvec4:
- Statuses : 1 fail(s)
- Exec time: [0.11] s

* [email protected]@execution@built-in-functions@cs-op-gt-int-int:
- Statuses : 1 fail(s)
- Exec time: [0.14] s

* [email protected]@execution@built-in-functions@cs-op-le-int-int:
- Statuses : 1 fail(s)
- Exec time: [0.16] s

* [email protected]@execution@built-in-functions@cs-op-lt-int-int-using-if:
- Statuses : 1 fail(s)
- Exec time: [0.15] s

Known issues
------------

Here are the changes found in Patchwork_15864_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_create@madvise:
- shard-tglb: [PASS][4] -> [INCOMPLETE][5] ([i915#435])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb7/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb6/igt@[email protected]

* igt@gem_exec_parallel@basic:
- shard-tglb: [PASS][6] -> [INCOMPLETE][7] ([i915#476])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb4/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb6/igt@[email protected]

* igt@gem_exec_parallel@vcs1:
- shard-tglb: [PASS][8] -> [INCOMPLETE][9] ([fdo#111593])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb5/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb1/igt@[email protected]

* igt@gem_exec_schedule@smoketest-bsd2:
- shard-tglb: [PASS][10] -> [INCOMPLETE][11] ([i915#707])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb5/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb6/igt@[email protected]

* igt@gem_exec_suspend@basic-s0:
- shard-tglb: [PASS][12] -> [INCOMPLETE][13] ([i915#456] / [i915#472])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb2/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb3/igt@[email protected]

* igt@gem_sync@basic-each:
- shard-tglb: [PASS][14] -> [INCOMPLETE][15] ([i915#472] / [i915#707])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb1/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb2/igt@[email protected]

* igt@gem_workarounds@suspend-resume-context:
- shard-apl: [PASS][16] -> [DMESG-WARN][17] ([i915#180]) +2 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-apl8/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-apl1/igt@[email protected]

* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-tglb: [PASS][18] -> [INCOMPLETE][19] ([i915#456] / [i915#460]) +2 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb3/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb3/igt@[email protected]

* igt@kms_color@pipe-a-ctm-0-25:
- shard-skl: [PASS][20] -> [DMESG-WARN][21] ([i915#109])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-skl5/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-skl5/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-64x64-sliding:
- shard-skl: [PASS][22] -> [FAIL][23] ([i915#54]) +1 similar issue
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-skl9/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-skl6/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-kbl: [PASS][24] -> [DMESG-WARN][25] ([i915#180]) +3 similar issues
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-kbl3/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-kbl1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-tglb: [PASS][26] -> [DMESG-WARN][27] ([i915#766])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb7/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
- shard-tglb: [PASS][28] -> [INCOMPLETE][29] ([i915#474] / [i915#667])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb6/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb4/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render.html

* igt@kms_frontbuffer_tracking@fbc-1p-rte:
- shard-tglb: [PASS][30] -> [FAIL][31] ([i915#49])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb7/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb3/igt@[email protected]

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-move:
- shard-iclb: [PASS][32] -> [INCOMPLETE][33] ([i915#123] / [i915#140]) +1 similar issue
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-iclb4/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-iclb4/igt@[email protected]

* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: [PASS][34] -> [SKIP][35] ([fdo#109441]) +4 similar issues
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-iclb2/igt@kms_psr@psr2_primary_mmap_cpu.html
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-iclb4/igt@kms_psr@psr2_primary_mmap_cpu.html

* igt@perf@short-reads:
- shard-apl: [PASS][36] -> [TIMEOUT][37] ([i915#51])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-apl4/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-apl2/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_nop@basic-series:
- shard-tglb: [INCOMPLETE][38] ([i915#435]) -> [PASS][39]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb9/igt@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb1/igt@[email protected]

* igt@gem_exec_parallel@vcs0:
- shard-tglb: [INCOMPLETE][40] ([fdo#111593]) -> [PASS][41]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb1/igt@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb4/igt@[email protected]

* igt@gem_exec_schedule@preempt-queue-chain-render:
- shard-tglb: [INCOMPLETE][42] ([fdo#111606] / [fdo#111677]) -> [PASS][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb6/igt@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb7/igt@[email protected]

* igt@gem_persistent_relocs@forked-thrashing:
- shard-tglb: [TIMEOUT][44] ([fdo#112126] / [i915#530]) -> [PASS][45]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb5/igt@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb6/igt@[email protected]

* igt@gem_softpin@noreloc-s3:
- shard-apl: [DMESG-WARN][46] ([i915#180]) -> [PASS][47] +4 similar issues
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-apl8/igt@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-apl8/igt@[email protected]

* igt@gem_sync@basic-many-each:
- shard-tglb: [INCOMPLETE][48] ([i915#472] / [i915#707]) -> [PASS][49]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb4/igt@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb4/igt@[email protected]

* igt@gem_sync@basic-store-each:
- shard-tglb: [INCOMPLETE][50] ([i915#435] / [i915#472]) -> [PASS][51]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb3/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb7/igt@[email protected]

* igt@gem_workarounds@suspend-resume:
- shard-tglb: [INCOMPLETE][52] ([i915#456] / [i915#460]) -> [PASS][53]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb1/igt@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb7/igt@[email protected]

* {igt@gen9_exec_parse@allowed-all}:
- shard-kbl: [DMESG-WARN][54] ([i915#716]) -> [PASS][55]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-kbl2/igt@[email protected]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-kbl6/igt@[email protected]

* {igt@gen9_exec_parse@allowed-single}:
- shard-apl: [DMESG-WARN][56] ([i915#716]) -> [PASS][57]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-apl3/igt@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-apl3/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-128x42-sliding:
- shard-hsw: [DMESG-WARN][58] ([IGT#6]) -> [PASS][59]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-hsw6/igt@[email protected]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-hsw1/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-256x85-sliding:
- shard-skl: [FAIL][60] ([i915#54]) -> [PASS][61] +2 similar issues
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-skl10/igt@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-skl8/igt@[email protected]

* igt@kms_cursor_legacy@2x-flip-vs-cursor-legacy:
- shard-glk: [FAIL][62] ([i915#72]) -> [PASS][63]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-glk4/igt@[email protected]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-glk4/igt@[email protected]

* igt@kms_draw_crc@draw-method-xrgb2101010-blt-untiled:
- shard-skl: [INCOMPLETE][64] ([i915#646]) -> [PASS][65]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-skl5/igt@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-skl9/igt@[email protected]

* igt@kms_draw_crc@draw-method-xrgb2101010-render-ytiled:
- shard-tglb: [INCOMPLETE][66] ([i915#667]) -> [PASS][67]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb2/igt@[email protected]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb2/igt@[email protected]

* igt@kms_draw_crc@draw-method-xrgb8888-render-untiled:
- shard-kbl: [INCOMPLETE][68] ([fdo#103665] / [i915#667]) -> [PASS][69]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-kbl4/igt@[email protected]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-kbl7/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-skl: [FAIL][70] ([i915#79]) -> [PASS][71]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-skl8/igt@[email protected]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-skl3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-shrfb-pgflip-blt:
- shard-tglb: [FAIL][72] ([i915#49]) -> [PASS][73]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb6/igt@[email protected]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-kbl: [DMESG-WARN][74] ([i915#180]) -> [PASS][75] +3 similar issues
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-kbl4/igt@[email protected]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-kbl6/igt@[email protected]

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-blt:
- shard-tglb: [INCOMPLETE][76] ([i915#435] / [i915#667]) -> [PASS][77]
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb7/igt@[email protected]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb9/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
- shard-kbl: [INCOMPLETE][78] ([fdo#103665]) -> [PASS][79]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-kbl3/igt@[email protected]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-kbl7/igt@[email protected]

* igt@kms_psr@psr2_sprite_blt:
- shard-iclb: [SKIP][80] ([fdo#109441]) -> [PASS][81]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-iclb4/igt@kms_psr@psr2_sprite_blt.html
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-iclb2/igt@kms_psr@psr2_sprite_blt.html

* igt@kms_vblank@pipe-d-ts-continuation-dpms-suspend:
- shard-tglb: [INCOMPLETE][82] ([i915#460]) -> [PASS][83]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb5/igt@[email protected]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb9/igt@[email protected]

#### Warnings ####

* igt@i915_pm_dc@dc5-dpms:
- shard-snb: [INCOMPLETE][84] ([i915#82]) -> [SKIP][85] ([fdo#109271])
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-snb1/igt@[email protected]
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-snb2/igt@[email protected]

* igt@i915_pm_dc@dc6-dpms:
- shard-tglb: [SKIP][86] ([i915#468]) -> [FAIL][87] ([i915#454])
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb6/igt@[email protected]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-tglb1/igt@[email protected]

* igt@i915_selftest@mock_requests:
- shard-skl: [INCOMPLETE][88] ([fdo#112156] / [i915#198] / [i915#873]) -> [INCOMPLETE][89] ([i915#198] / [i915#873])
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-skl10/igt@i915_selftest@mock_requests.html
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15864/shard-skl4/igt@i915_selftest@mock_requests.html
- shard-tglb: [DMESG-WARN][90] ([i915#873]) -> [INCOMPLETE][91] ([i915#873])
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7616/shard-tglb1/igt@i915_selftest@mock_requests.html
[91]: https://intel-gfx-ci.01.org/tre

== Logs ==

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

maintainer
#11 lore raw
In reply to Rajat Jain
Quoted 3 lines · Rajat Jain

Move the code that populates the ACPI device ID for devices, into more appripriate intel_acpi.c. This is done in preparation for more users of this code (in next patch).

Sorry for the delay, thanks for the patch, pushed to drm-intel-next-queued.

BR,
Jani.

Quoted 263 lines

---
v5: same as v4
v4: Same as v3
v3: * Renamed the function to intel_acpi_*
* Used forward declaration for structure instead of header file inclusion.
* Fix a typo
v2: v1 doesn't exist. Found existing code in i915 driver to assign the ACPI ID
which is what I plan to re-use.

 drivers/gpu/drm/i915/display/intel_acpi.c     | 89 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_acpi.h     |  5 ++
 drivers/gpu/drm/i915/display/intel_opregion.c | 80 +----------------
 3 files changed, 98 insertions(+), 76 deletions(-)
drivers/gpu/drm/i915/display/intel_acpi.c +89 -0
index 3456d33feb46..e21fb14d5e07 100644
@@ -10,6 +10,7 @@
 
 #include "i915_drv.h"
 #include "intel_acpi.h"
+#include "intel_display_types.h"
 
 #define INTEL_DSM_REVISION_ID 1 /* For Calpella anyway... */
 #define INTEL_DSM_FN_PLATFORM_MUX_INFO 1 /* No args */
@@ -156,3 +157,91 @@ void intel_register_dsm_handler(void)
 void intel_unregister_dsm_handler(void)
 {
 }
+
+/*
+ * ACPI Specification, Revision 5.0, Appendix B.3.2 _DOD (Enumerate All Devices
+ * Attached to the Display Adapter).
+ */
+#define ACPI_DISPLAY_INDEX_SHIFT		0
+#define ACPI_DISPLAY_INDEX_MASK			(0xf << 0)
+#define ACPI_DISPLAY_PORT_ATTACHMENT_SHIFT	4
+#define ACPI_DISPLAY_PORT_ATTACHMENT_MASK	(0xf << 4)
+#define ACPI_DISPLAY_TYPE_SHIFT			8
+#define ACPI_DISPLAY_TYPE_MASK			(0xf << 8)
+#define ACPI_DISPLAY_TYPE_OTHER			(0 << 8)
+#define ACPI_DISPLAY_TYPE_VGA			(1 << 8)
+#define ACPI_DISPLAY_TYPE_TV			(2 << 8)
+#define ACPI_DISPLAY_TYPE_EXTERNAL_DIGITAL	(3 << 8)
+#define ACPI_DISPLAY_TYPE_INTERNAL_DIGITAL	(4 << 8)
+#define ACPI_VENDOR_SPECIFIC_SHIFT		12
+#define ACPI_VENDOR_SPECIFIC_MASK		(0xf << 12)
+#define ACPI_BIOS_CAN_DETECT			(1 << 16)
+#define ACPI_DEPENDS_ON_VGA			(1 << 17)
+#define ACPI_PIPE_ID_SHIFT			18
+#define ACPI_PIPE_ID_MASK			(7 << 18)
+#define ACPI_DEVICE_ID_SCHEME			(1ULL << 31)
+
+static u32 acpi_display_type(struct intel_connector *connector)
+{
+	u32 display_type;
+
+	switch (connector->base.connector_type) {
+	case DRM_MODE_CONNECTOR_VGA:
+	case DRM_MODE_CONNECTOR_DVIA:
+		display_type = ACPI_DISPLAY_TYPE_VGA;
+		break;
+	case DRM_MODE_CONNECTOR_Composite:
+	case DRM_MODE_CONNECTOR_SVIDEO:
+	case DRM_MODE_CONNECTOR_Component:
+	case DRM_MODE_CONNECTOR_9PinDIN:
+	case DRM_MODE_CONNECTOR_TV:
+		display_type = ACPI_DISPLAY_TYPE_TV;
+		break;
+	case DRM_MODE_CONNECTOR_DVII:
+	case DRM_MODE_CONNECTOR_DVID:
+	case DRM_MODE_CONNECTOR_DisplayPort:
+	case DRM_MODE_CONNECTOR_HDMIA:
+	case DRM_MODE_CONNECTOR_HDMIB:
+		display_type = ACPI_DISPLAY_TYPE_EXTERNAL_DIGITAL;
+		break;
+	case DRM_MODE_CONNECTOR_LVDS:
+	case DRM_MODE_CONNECTOR_eDP:
+	case DRM_MODE_CONNECTOR_DSI:
+		display_type = ACPI_DISPLAY_TYPE_INTERNAL_DIGITAL;
+		break;
+	case DRM_MODE_CONNECTOR_Unknown:
+	case DRM_MODE_CONNECTOR_VIRTUAL:
+		display_type = ACPI_DISPLAY_TYPE_OTHER;
+		break;
+	default:
+		MISSING_CASE(connector->base.connector_type);
+		display_type = ACPI_DISPLAY_TYPE_OTHER;
+		break;
+	}
+
+	return display_type;
+}
+
+void intel_acpi_device_id_update(struct drm_i915_private *dev_priv)
+{
+	struct drm_device *drm_dev = &dev_priv->drm;
+	struct intel_connector *connector;
+	struct drm_connector_list_iter conn_iter;
+	u8 display_index[16] = {};
+
+	/* Populate the ACPI IDs for all connectors for a given drm_device */
+	drm_connector_list_iter_begin(drm_dev, &conn_iter);
+	for_each_intel_connector_iter(connector, &conn_iter) {
+		u32 device_id, type;
+
+		device_id = acpi_display_type(connector);
+
+		/* Use display type specific display index. */
+		type = (device_id & ACPI_DISPLAY_TYPE_MASK)
+			>> ACPI_DISPLAY_TYPE_SHIFT;
+		device_id |= display_index[type]++ << ACPI_DISPLAY_INDEX_SHIFT;
+
+		connector->acpi_device_id = device_id;
+	}
+	drm_connector_list_iter_end(&conn_iter);
+}
drivers/gpu/drm/i915/display/intel_acpi.h +5 -0
index 1c576b3fb712..e8b068661d22 100644
@@ -6,12 +6,17 @@
 #ifndef __INTEL_ACPI_H__
 #define __INTEL_ACPI_H__
 
+struct drm_i915_private;
+
 #ifdef CONFIG_ACPI
 void intel_register_dsm_handler(void);
 void intel_unregister_dsm_handler(void);
+void intel_acpi_device_id_update(struct drm_i915_private *i915);
 #else
 static inline void intel_register_dsm_handler(void) { return; }
 static inline void intel_unregister_dsm_handler(void) { return; }
+static inline
+void intel_acpi_device_id_update(struct drm_i915_private *i915) { return; }
 #endif /* CONFIG_ACPI */
 
 #endif /* __INTEL_ACPI_H__ */
drivers/gpu/drm/i915/display/intel_opregion.c +4 -76
index 969ade623691..6422384f199e 100644
@@ -35,6 +35,7 @@
 #include "display/intel_panel.h"
 
 #include "i915_drv.h"
+#include "intel_acpi.h"
 #include "intel_display_types.h"
 #include "intel_opregion.h"
 
@@ -242,29 +243,6 @@ struct opregion_asle_ext {
 #define SWSCI_SBCB_POST_VBE_PM		SWSCI_FUNCTION_CODE(SWSCI_SBCB, 19)
 #define SWSCI_SBCB_ENABLE_DISABLE_AUDIO	SWSCI_FUNCTION_CODE(SWSCI_SBCB, 21)
 
-/*
- * ACPI Specification, Revision 5.0, Appendix B.3.2 _DOD (Enumerate All Devices
- * Attached to the Display Adapter).
- */
-#define ACPI_DISPLAY_INDEX_SHIFT		0
-#define ACPI_DISPLAY_INDEX_MASK			(0xf << 0)
-#define ACPI_DISPLAY_PORT_ATTACHMENT_SHIFT	4
-#define ACPI_DISPLAY_PORT_ATTACHMENT_MASK	(0xf << 4)
-#define ACPI_DISPLAY_TYPE_SHIFT			8
-#define ACPI_DISPLAY_TYPE_MASK			(0xf << 8)
-#define ACPI_DISPLAY_TYPE_OTHER			(0 << 8)
-#define ACPI_DISPLAY_TYPE_VGA			(1 << 8)
-#define ACPI_DISPLAY_TYPE_TV			(2 << 8)
-#define ACPI_DISPLAY_TYPE_EXTERNAL_DIGITAL	(3 << 8)
-#define ACPI_DISPLAY_TYPE_INTERNAL_DIGITAL	(4 << 8)
-#define ACPI_VENDOR_SPECIFIC_SHIFT		12
-#define ACPI_VENDOR_SPECIFIC_MASK		(0xf << 12)
-#define ACPI_BIOS_CAN_DETECT			(1 << 16)
-#define ACPI_DEPENDS_ON_VGA			(1 << 17)
-#define ACPI_PIPE_ID_SHIFT			18
-#define ACPI_PIPE_ID_MASK			(7 << 18)
-#define ACPI_DEVICE_ID_SCHEME			(1 << 31)
-
 #define MAX_DSLP	1500
 
 static int swsci(struct drm_i915_private *dev_priv,
@@ -662,54 +640,12 @@ static void set_did(struct intel_opregion *opregion, int i, u32 val)
 	}
 }
 
-static u32 acpi_display_type(struct intel_connector *connector)
-{
-	u32 display_type;
-
-	switch (connector->base.connector_type) {
-	case DRM_MODE_CONNECTOR_VGA:
-	case DRM_MODE_CONNECTOR_DVIA:
-		display_type = ACPI_DISPLAY_TYPE_VGA;
-		break;
-	case DRM_MODE_CONNECTOR_Composite:
-	case DRM_MODE_CONNECTOR_SVIDEO:
-	case DRM_MODE_CONNECTOR_Component:
-	case DRM_MODE_CONNECTOR_9PinDIN:
-	case DRM_MODE_CONNECTOR_TV:
-		display_type = ACPI_DISPLAY_TYPE_TV;
-		break;
-	case DRM_MODE_CONNECTOR_DVII:
-	case DRM_MODE_CONNECTOR_DVID:
-	case DRM_MODE_CONNECTOR_DisplayPort:
-	case DRM_MODE_CONNECTOR_HDMIA:
-	case DRM_MODE_CONNECTOR_HDMIB:
-		display_type = ACPI_DISPLAY_TYPE_EXTERNAL_DIGITAL;
-		break;
-	case DRM_MODE_CONNECTOR_LVDS:
-	case DRM_MODE_CONNECTOR_eDP:
-	case DRM_MODE_CONNECTOR_DSI:
-		display_type = ACPI_DISPLAY_TYPE_INTERNAL_DIGITAL;
-		break;
-	case DRM_MODE_CONNECTOR_Unknown:
-	case DRM_MODE_CONNECTOR_VIRTUAL:
-		display_type = ACPI_DISPLAY_TYPE_OTHER;
-		break;
-	default:
-		MISSING_CASE(connector->base.connector_type);
-		display_type = ACPI_DISPLAY_TYPE_OTHER;
-		break;
-	}
-
-	return display_type;
-}
-
 static void intel_didl_outputs(struct drm_i915_private *dev_priv)
 {
 	struct intel_opregion *opregion = &dev_priv->opregion;
 	struct intel_connector *connector;
 	struct drm_connector_list_iter conn_iter;
 	int i = 0, max_outputs;
-	int display_index[16] = {};
 
 	/*
 	 * In theory, did2, the extended didl, gets added at opregion version
@@ -721,20 +657,12 @@ static void intel_didl_outputs(struct drm_i915_private *dev_priv)
 	max_outputs = ARRAY_SIZE(opregion->acpi->didl) +
 		ARRAY_SIZE(opregion->acpi->did2);
 
+	intel_acpi_device_id_update(dev_priv);
+
 	drm_connector_list_iter_begin(&dev_priv->drm, &conn_iter);
 	for_each_intel_connector_iter(connector, &conn_iter) {
-		u32 device_id, type;
-
-		device_id = acpi_display_type(connector);
-
-		/* Use display type specific display index. */
-		type = (device_id & ACPI_DISPLAY_TYPE_MASK)
-			>> ACPI_DISPLAY_TYPE_SHIFT;
-		device_id |= display_index[type]++ << ACPI_DISPLAY_INDEX_SHIFT;
-
-		connector->acpi_device_id = device_id;
 		if (i < max_outputs)
-			set_did(opregion, i, device_id);
+			set_did(opregion, i, connector->acpi_device_id);
 		i++;
 	}
 	drm_connector_list_iter_end(&conn_iter);
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel