Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arun R Murthy <arun.r.murthy@intel.com>
To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Subject: [PATCHv3 07/10] drm/i915/display: Handle drm-crtc histogram property updates
Date: Mon,  9 Dec 2024 21:55:01 +0530	[thread overview]
Message-ID: <20241209162504.2146697-8-arun.r.murthy@intel.com> (raw)
In-Reply-To: <20241209162504.2146697-1-arun.r.murthy@intel.com>

Check for any updates on drm_crtc property histogram_enable and
histogram_iet_updated and call/act accordingly to update histogram or
update the image enhancement LUT data API defined in i915 histogram.

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 drivers/gpu/drm/i915/display/intel_atomic.c     |  1 +
 drivers/gpu/drm/i915/display/intel_crtc.c       |  7 +++++++
 drivers/gpu/drm/i915/display/intel_display.c    | 17 +++++++++++++++++
 .../gpu/drm/i915/display/intel_display_types.h  |  2 ++
 4 files changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
index 03dc54c802d3..dff130b3565a 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic.c
@@ -278,6 +278,7 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
 	crtc_state->dsb_color_vblank = NULL;
 	crtc_state->dsb_commit = NULL;
 	crtc_state->use_dsb = false;
+	crtc_state->histogram_updated = false;
 
 	return &crtc_state->uapi;
 }
diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
index a2c528d707f4..0c8741ca9a71 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc.c
@@ -27,6 +27,7 @@
 #include "intel_drrs.h"
 #include "intel_dsi.h"
 #include "intel_fifo_underrun.h"
+#include "intel_histogram.h"
 #include "intel_pipe_crc.h"
 #include "intel_psr.h"
 #include "intel_sprite.h"
@@ -210,6 +211,7 @@ static struct intel_crtc *intel_crtc_alloc(void)
 static void intel_crtc_free(struct intel_crtc *crtc)
 {
 	intel_crtc_destroy_state(&crtc->base, crtc->base.state);
+	intel_histogram_finish(crtc);
 	kfree(crtc);
 }
 
@@ -380,10 +382,15 @@ 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 (drm_crtc_create_histogram_property(&crtc->base))
+		drm_err(&dev_priv->drm, "Failed to initialize histogram properties\n");
+
 	intel_color_crtc_init(crtc);
 	intel_drrs_crtc_init(crtc);
 	intel_crtc_crc_init(crtc);
 
+	intel_histogram_init(crtc);
+
 	cpu_latency_qos_add_request(&crtc->vblank_pm_qos, PM_QOS_DEFAULT_VALUE);
 
 	drm_WARN_ON(&dev_priv->drm, drm_crtc_index(&crtc->base) != crtc->pipe);
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 35c8904ecf44..fb393e5a4c84 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -93,6 +93,7 @@
 #include "intel_fifo_underrun.h"
 #include "intel_frontbuffer.h"
 #include "intel_hdmi.h"
+#include "intel_histogram.h"
 #include "intel_hotplug.h"
 #include "intel_link_bw.h"
 #include "intel_lvds.h"
@@ -4612,6 +4613,12 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
 	if (ret)
 		return ret;
 
+	if (crtc_state->histogram_updated) {
+		ret = intel_histogram_atomic_check(crtc);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 }
 
@@ -6832,6 +6839,10 @@ int intel_atomic_check(struct drm_device *dev,
 		if (new_crtc_state->uapi.scaling_filter !=
 		    old_crtc_state->uapi.scaling_filter)
 			new_crtc_state->uapi.mode_changed = true;
+
+		if (new_crtc_state->uapi.histogram_enable |=
+		    old_crtc_state->uapi.histogram_enable)
+			new_crtc_state->histogram_updated = true;
 	}
 
 	intel_vrr_check_modeset(state);
@@ -7900,6 +7911,12 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
 		 */
 		old_crtc_state->dsb_color_vblank = fetch_and_zero(&new_crtc_state->dsb_color_vblank);
 		old_crtc_state->dsb_commit = fetch_and_zero(&new_crtc_state->dsb_commit);
+
+		if (new_crtc_state->histogram_updated)
+			intel_histogram_update(crtc, crtc->base.state->histogram_enable);
+		if (new_crtc_state->uapi.histogram_iet_updated)
+			intel_histogram_set_iet_lut(crtc,
+						    new_crtc_state->uapi.histogram_iet);
 	}
 
 	/* Underruns don't always raise interrupts, so check manually */
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 0f50081b9957..15f4bd3ccc62 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1317,6 +1317,8 @@ struct intel_crtc_state {
 
 	/* LOBF flag */
 	bool has_lobf;
+
+	bool histogram_updated;
 };
 
 enum intel_pipe_crc_source {
-- 
2.25.1


  parent reply	other threads:[~2024-12-09 16:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 16:24 [PATCHv10 00/10] Display Global Histogram Arun R Murthy
2024-12-09 16:24 ` [PATCHv3 01/10] drm/crtc: Add histogram properties Arun R Murthy
2024-12-10  0:26   ` Dmitry Baryshkov
2024-12-10  8:42     ` Murthy, Arun R
2024-12-10 12:27       ` Dmitry Baryshkov
2024-12-10 17:52         ` Murthy, Arun R
2024-12-13 10:51           ` Dmitry Baryshkov
2025-01-06  6:05             ` Murthy, Arun R
2024-12-10  0:58   ` Dmitry Baryshkov
2024-12-09 16:24 ` [PATCHv3 02/10] drm/crtc: Expose API to create drm crtc property for histogram Arun R Murthy
2024-12-09 16:24 ` [PATCH 03/10] drm/i915/histogram: Define registers " Arun R Murthy
2024-12-09 16:24 ` [PATCH 04/10] drm/i915/histogram: Add support " Arun R Murthy
2024-12-09 16:24 ` [PATCH 05/10] drm/xe: Add histogram support to Xe builds Arun R Murthy
2024-12-09 16:25 ` [PATCH 06/10] drm/i915/histogram: histogram interrupt handling Arun R Murthy
2024-12-09 16:25 ` Arun R Murthy [this message]
2024-12-10 12:48   ` [PATCHv3 07/10] drm/i915/display: Handle drm-crtc histogram property updates Kandpal, Suraj
2024-12-09 16:25 ` [PATCH 08/10] drm/i915/histogram: histogram delay counter doesnt reset Arun R Murthy
2024-12-09 16:25 ` [PATCH 09/10] drm/i915/histogram: Histogram changes for Display 20+ Arun R Murthy
2024-12-09 16:25 ` [PATCHv2 10/10] drm/i915/histogram: Enable pipe dithering Arun R Murthy
2024-12-10 12:45   ` Kandpal, Suraj
2024-12-09 16:46 ` ✓ CI.Patch_applied: success for Display Global Histogram (rev6) Patchwork
2024-12-09 16:47 ` ✗ CI.checkpatch: warning " Patchwork
2024-12-09 16:48 ` ✓ CI.KUnit: success " Patchwork
2024-12-09 16:57 ` [PATCHv10 00/10] Display Global Histogram Matt Roper
2024-12-09 17:43   ` Raag Jadav
2024-12-09 18:18     ` Matt Roper
2024-12-09 18:57       ` Raag Jadav
2024-12-09 20:17       ` Raag Jadav
2024-12-10  8:43   ` Murthy, Arun R
2024-12-09 17:06 ` ✓ CI.Build: success for Display Global Histogram (rev6) Patchwork
2024-12-09 17:08 ` ✗ CI.Hooks: failure " Patchwork
2024-12-09 17:10 ` ✗ CI.checksparse: warning " Patchwork

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=20241209162504.2146697-8-arun.r.murthy@intel.com \
    --to=arun.r.murthy@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@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