dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/2] Attach and Set vrr_enabled property
@ 2022-04-22  7:55 Bhanuprakash Modem
  2022-04-22  7:55 ` [RFC 1/2] drm/vrr: Attach vrr_enabled property to the drm crtc Bhanuprakash Modem
  2022-04-22  7:55 ` [RFC 2/2] drm/i915/vrr: Attach and set drm crtc vrr_enabled property Bhanuprakash Modem
  0 siblings, 2 replies; 3+ messages in thread
From: Bhanuprakash Modem @ 2022-04-22  7:55 UTC (permalink / raw)
  To: intel-gfx, dri-devel, ville.syrjala, manasi.d.navare; +Cc: Bhanuprakash Modem

This series will add a support to attach & set the vrr_enabled property
for crtc based on the platform support and the request from userspace.
And userspace can also query to get the status of "vrr_enabled".

Test-with: 20220422075223.2792586-2-bhanuprakash.modem@intel.com

Bhanuprakash Modem (2):
  drm/vrr: Attach vrr_enabled property to the drm crtc
  drm/i915/vrr: Attach and set drm crtc vrr_enabled property

 drivers/gpu/drm/drm_crtc.c                | 44 +++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_crtc.c |  3 ++
 drivers/gpu/drm/i915/display/intel_vrr.c  |  7 +++-
 include/drm/drm_crtc.h                    |  4 +++
 4 files changed, 57 insertions(+), 1 deletion(-)

--
2.35.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [RFC 1/2] drm/vrr: Attach vrr_enabled property to the drm crtc
  2022-04-22  7:55 [RFC 0/2] Attach and Set vrr_enabled property Bhanuprakash Modem
@ 2022-04-22  7:55 ` Bhanuprakash Modem
  2022-04-22  7:55 ` [RFC 2/2] drm/i915/vrr: Attach and set drm crtc vrr_enabled property Bhanuprakash Modem
  1 sibling, 0 replies; 3+ messages in thread
From: Bhanuprakash Modem @ 2022-04-22  7:55 UTC (permalink / raw)
  To: intel-gfx, dri-devel, ville.syrjala, manasi.d.navare
  Cc: Nicholas Kazlauskas, Bhanuprakash Modem

Modern display hardware is capable of supporting variable refresh rates.
This patch introduces helpers to attach and set "vrr_enabled" property
on the crtc to allow userspace to query VRR enabled status on that crtc.

Atomic drivers should attach this property to crtcs those are capable of
driving variable refresh rates using
drm_mode_crtc_attach_vrr_enabled_property().

The value should be updated based on driver and hardware capability
by using drm_mode_crtc_set_vrr_enabled_property().

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 drivers/gpu/drm/drm_crtc.c | 44 ++++++++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |  4 ++++
 2 files changed, 48 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 26a77a735905..95b4a0c7ecb3 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -883,3 +883,47 @@ int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
 	return 0;
 }
 EXPORT_SYMBOL(drm_crtc_create_scaling_filter_property);
+
+/**
+ * drm_mode_crtc_attach_vrr_enabled_property - attaches the vrr_enabled property
+ * @crtc: drm CRTC to attach the vrr_enabled property on.
+ *
+ * This is used by atomic drivers to add support for querying
+ * VRR enabled status for a crtc.
+ */
+void drm_mode_crtc_attach_vrr_enabled_property(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_mode_config *config = &dev->mode_config;
+
+	if (!config->prop_vrr_enabled)
+		return;
+
+	drm_object_attach_property(&crtc->base,
+				   config->prop_vrr_enabled,
+				   0);
+}
+EXPORT_SYMBOL(drm_mode_crtc_attach_vrr_enabled_property);
+
+/**
+ * drm_mode_crtc_set_vrr_enabled_property - sets the vrr enabled property for
+ * a crtc.
+ * @crtc: drm CRTC
+ * @vrr_enabled: True to enable the VRR on CRTC
+ *
+ * Should be used by atomic drivers to update the VRR enabled status on a CRTC
+ */
+void drm_mode_crtc_set_vrr_enabled_property(struct drm_crtc *crtc,
+					    bool vrr_enabled)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_mode_config *config = &dev->mode_config;
+
+	if (!config->prop_vrr_enabled)
+		return;
+
+	drm_object_property_set_value(&crtc->base,
+				      config->prop_vrr_enabled,
+				      vrr_enabled);
+}
+EXPORT_SYMBOL(drm_mode_crtc_set_vrr_enabled_property);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index a70baea0636c..bde657cb0f9e 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1333,4 +1333,8 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
 int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
 					    unsigned int supported_filters);
 
+void drm_mode_crtc_attach_vrr_enabled_property(struct drm_crtc *crtc);
+void drm_mode_crtc_set_vrr_enabled_property(struct drm_crtc *crtc,
+					    bool vrr_enabled);
+
 #endif /* __DRM_CRTC_H__ */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [RFC 2/2] drm/i915/vrr: Attach and set drm crtc vrr_enabled property
  2022-04-22  7:55 [RFC 0/2] Attach and Set vrr_enabled property Bhanuprakash Modem
  2022-04-22  7:55 ` [RFC 1/2] drm/vrr: Attach vrr_enabled property to the drm crtc Bhanuprakash Modem
@ 2022-04-22  7:55 ` Bhanuprakash Modem
  1 sibling, 0 replies; 3+ messages in thread
From: Bhanuprakash Modem @ 2022-04-22  7:55 UTC (permalink / raw)
  To: intel-gfx, dri-devel, ville.syrjala, manasi.d.navare; +Cc: Bhanuprakash Modem

This function attaches & sets the vrr_enabled property for crtc
based on the platform support and the request from userspace.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 drivers/gpu/drm/i915/display/intel_crtc.c | 3 +++
 drivers/gpu/drm/i915/display/intel_vrr.c  | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
index 4442aa355f86..36deaca9af66 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc.c
@@ -366,6 +366,9 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 						BIT(DRM_SCALING_FILTER_DEFAULT) |
 						BIT(DRM_SCALING_FILTER_NEAREST_NEIGHBOR));
 
+	if (HAS_VRR(dev_priv))
+		drm_mode_crtc_attach_vrr_enabled_property(&crtc->base);
+
 	intel_color_init(crtc);
 
 	intel_crtc_drrs_init(crtc);
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 396f2f994fa0..6cb8410bd4a0 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -160,8 +160,11 @@ void intel_vrr_enable(struct intel_encoder *encoder,
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
 	u32 trans_vrr_ctl;
 
-	if (!crtc_state->vrr.enable)
+	if (!crtc_state->vrr.enable) {
+		drm_mode_crtc_set_vrr_enabled_property(crtc_state->uapi.crtc, false);
 		return;
+	}
+	drm_mode_crtc_set_vrr_enabled_property(crtc_state->uapi.crtc, true);
 
 	if (DISPLAY_VER(dev_priv) >= 13)
 		trans_vrr_ctl = VRR_CTL_VRR_ENABLE |
@@ -211,6 +214,8 @@ void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;
 
+	drm_mode_crtc_set_vrr_enabled_property(old_crtc_state->uapi.crtc, false);
+
 	if (!old_crtc_state->vrr.enable)
 		return;
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-22  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22  7:55 [RFC 0/2] Attach and Set vrr_enabled property Bhanuprakash Modem
2022-04-22  7:55 ` [RFC 1/2] drm/vrr: Attach vrr_enabled property to the drm crtc Bhanuprakash Modem
2022-04-22  7:55 ` [RFC 2/2] drm/i915/vrr: Attach and set drm crtc vrr_enabled property Bhanuprakash Modem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).