public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Arun R Murthy <arun.r.murthy@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 5/6] drm/i915/display: crtc property for global hist selective fetch
Date: Thu, 18 May 2023 15:19:15 +0530	[thread overview]
Message-ID: <20230518094916.1142812-5-arun.r.murthy@intel.com> (raw)
In-Reply-To: <20230518094916.1142812-1-arun.r.murthy@intel.com>

User can provide the selective fetch co-ordinates for global histogram
using crtc blob property. This patch adds the crtc blob property.
The selective fetch can be done only on the y co-ordinate and cannot be
done on the x co-ordinate.

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 drivers/gpu/drm/i915/display/intel_crtc.c     | 45 +++++++++++++++++++
 .../drm/i915/display/intel_display_types.h    |  3 ++
 2 files changed, 48 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
index 501bcf732aba..2a9dcf3b1a19 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc.c
@@ -236,6 +236,9 @@ int intel_crtc_get_property(struct drm_crtc *crtc,
 	else if (property == intel_crtc->global_hist_property)
 		*val = (intel_crtc_state->global_hist) ?
 			intel_crtc_state->global_hist->base.id : 0;
+	else if (property == intel_crtc->global_hist_sf_clips_property)
+		*val = (intel_crtc_state->global_hist_sf_clips) ?
+			intel_crtc_state->global_hist_sf_clips->base.id : 0;
 	else {
 		drm_err(&i915->drm,
 			       "Unknown property [PROP:%d:%s]\n",
@@ -306,6 +309,18 @@ int intel_crtc_set_property(struct drm_crtc *crtc,
 		return 0;
 	}
 
+	if (property == intel_crtc->global_hist_sf_clips_property) {
+		intel_atomic_replace_property_blob_from_id(crtc->dev,
+					&intel_crtc_state->global_hist_sf_clips,
+					val,
+					-1,
+					sizeof(struct drm_rect),
+					&replaced);
+		if (replaced)
+			intel_crtc_state->global_hist_sf_clips_updates = true;
+		return 0;
+	}
+
 	drm_dbg_atomic(&i915->drm, "Unknown property [PROP:%d:%s]\n",
 		       property->base.id, property->name);
 	return -EINVAL;
@@ -903,11 +918,41 @@ void intel_attach_global_hist_property(struct intel_crtc *intel_crtc)
 	drm_object_attach_property(&crtc->base, prop, blob->base.id);
 }
 
+/**
+ * intel_attach_global_hist_sf_seg_property() - selective fetch segment property
+ * @intel_crtc: pointer to struct intel_crtc on which global histogram is enabled
+ *
+ * "Global Histogram SF CLIPS" is the crtc porperty used to provide the
+ * co-ordinates of the damage clips.
+ */
+void intel_attach_global_hist_sf_seg_property(struct intel_crtc * intel_crtc)
+{
+	struct drm_crtc *crtc = &intel_crtc->base;
+	struct drm_device *dev = crtc->dev;
+	struct drm_property *prop;
+	struct drm_property_blob *blob;
+
+	prop = intel_crtc->global_hist_sf_clips_property;
+	if (prop == NULL) {
+		prop = drm_property_create(dev,
+			DRM_MODE_PROP_ATOMIC | DRM_MODE_PROP_BLOB,
+			"Global Histogram SF CLIPS", 0);
+		if (prop == NULL)
+			return;
+		intel_crtc->global_hist_sf_clips_property = prop;
+	}
+	blob = drm_property_create_blob(dev, sizeof(struct drm_rect *), NULL);
+	intel_crtc->config->global_hist_sf_clips = blob;
+
+	drm_object_attach_property(&crtc->base, prop, blob->base.id);
+}
+
 int intel_crtc_add_property(struct intel_crtc *intel_crtc)
 {
 	intel_attach_global_hist_en_property(intel_crtc);
 	intel_attach_global_hist_property(intel_crtc);
 	intel_attach_global_iet_property(intel_crtc);
+	intel_attach_global_hist_sf_seg_property(intel_crtc);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 15d28e2305da..703593d4a52f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1371,8 +1371,10 @@ struct intel_crtc_state {
 	int global_hist_en;
 	struct drm_property_blob *global_iet;
 	struct drm_property_blob *global_hist;
+	struct drm_property_blob *global_hist_sf_clips;
 	bool global_iet_changed;
 	bool global_hist_en_changed;
+	bool global_hist_sf_clips_updates;
 };
 
 enum intel_pipe_crc_source {
@@ -1480,6 +1482,7 @@ struct intel_crtc {
 	struct drm_property *global_hist_en_property;
 	struct drm_property *global_iet_property;
 	struct drm_property *global_hist_property;
+	struct drm_property *global_hist_sf_clips_property;
 #ifdef CONFIG_DEBUG_FS
 	struct intel_pipe_crc pipe_crc;
 	u32 cpu_fifo_underrun_count;
-- 
2.25.1


  parent reply	other threads:[~2023-05-18  9:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18  9:49 [Intel-gfx] [PATCH 1/6] drm/i915/display: Add support for global histogram Arun R Murthy
2023-05-18  9:49 ` [Intel-gfx] [PATCH 2/6] drm/i915/display: global histogram irq handler Arun R Murthy
2023-05-23 10:10   ` Jani Nikula
2023-05-18  9:49 ` [Intel-gfx] [PATCH 3/6] drm/i915/display: global histogram restrictions Arun R Murthy
2023-05-23 10:12   ` Jani Nikula
2023-05-18  9:49 ` [Intel-gfx] [PATCH 4/6] drm/i915/display: Add crtc properties for global histogram Arun R Murthy
2023-05-18  9:49 ` Arun R Murthy [this message]
2023-05-18  9:49 ` [Intel-gfx] [PATCH 6/6] drm/i915/display: Enable global hist Selective fetch Arun R Murthy
2023-05-18 10:13 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [1/6] drm/i915/display: Add support for global histogram Patchwork
2023-05-23 10:09 ` [Intel-gfx] [PATCH 1/6] " Jani Nikula
2023-06-20  8:44   ` Murthy, Arun R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230518094916.1142812-5-arun.r.murthy@intel.com \
    --to=arun.r.murthy@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox