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: [PATCH 02/10] drm/crtc: Expose API to create drm crtc property for histogram
Date: Tue, 3 Dec 2024 11:25:12 +0530 [thread overview]
Message-ID: <20241203055520.1704661-3-arun.r.murthy@intel.com> (raw)
In-Reply-To: <20241203055520.1704661-1-arun.r.murthy@intel.com>
Add drm-crtc property for histogram and for the properties added add
corresponding get/set_property.
Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
drivers/gpu/drm/drm_atomic_state_helper.c | 6 +++++
drivers/gpu/drm/drm_atomic_uapi.c | 17 +++++++++++++
drivers/gpu/drm/drm_crtc.c | 30 +++++++++++++++++++++++
include/drm/drm_crtc.h | 1 +
4 files changed, 54 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
index 519228eb1095..3b2b58e36a6d 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -143,6 +143,8 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,
drm_property_blob_get(state->ctm);
if (state->gamma_lut)
drm_property_blob_get(state->gamma_lut);
+ if (state->histogram_data)
+ drm_property_blob_get(state->histogram_data);
state->mode_changed = false;
state->active_changed = false;
state->planes_changed = false;
@@ -156,6 +158,8 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,
/* Self refresh should be canceled when a new update is available */
state->active = drm_atomic_crtc_effectively_active(state);
state->self_refresh_active = false;
+
+ state->histogram_iet_updated = false;
}
EXPORT_SYMBOL(__drm_atomic_helper_crtc_duplicate_state);
@@ -215,6 +219,8 @@ void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state)
drm_property_blob_put(state->degamma_lut);
drm_property_blob_put(state->ctm);
drm_property_blob_put(state->gamma_lut);
+ if (state->histogram_data)
+ drm_property_blob_put(state->histogram_data);
}
EXPORT_SYMBOL(__drm_atomic_helper_crtc_destroy_state);
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 370dc676e3aa..367f87afea92 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -415,6 +415,17 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
return -EFAULT;
set_out_fence_for_crtc(state->state, crtc, fence_ptr);
+ } else if (property == crtc->histogram_enable_property) {
+ state->histogram_enable = val;
+ } else if (property == crtc->histogram_iet_property) {
+ ret = drm_property_replace_blob_from_id(dev,
+ &state->histogram_iet,
+ val,
+ -1,
+ sizeof(struct drm_histogram),
+ &replaced);
+ state->histogram_iet_updated |= replaced;
+ return ret;
} else if (property == crtc->scaling_filter_property) {
state->scaling_filter = val;
} else if (crtc->funcs->atomic_set_property) {
@@ -452,6 +463,12 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
*val = (state->gamma_lut) ? state->gamma_lut->base.id : 0;
else if (property == config->prop_out_fence_ptr)
*val = 0;
+ else if (property == crtc->histogram_enable_property)
+ *val = state->histogram_enable;
+ else if (property == crtc->histogram_data_property)
+ *val = (state->histogram_data) ? state->histogram_data->base.id : 0;
+ else if (property == crtc->histogram_iet_property)
+ *val = (state->histogram_iet) ? state->histogram_iet->base.id : 0;
else if (property == crtc->scaling_filter_property)
*val = state->scaling_filter;
else if (crtc->funcs->atomic_get_property)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 3488ff067c69..ec169a5b35a2 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -939,3 +939,33 @@ int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
return 0;
}
EXPORT_SYMBOL(drm_crtc_create_scaling_filter_property);
+
+int drm_crtc_create_histogram_property(struct drm_crtc *crtc)
+{
+ struct drm_property *prop;
+
+ prop = drm_property_create_bool(crtc->dev, DRM_MODE_PROP_ATOMIC,
+ "HISTOGRAM_ENABLE");
+ if (!prop)
+ return -ENOMEM;
+ drm_object_attach_property(&crtc->base, prop, 0);
+ crtc->histogram_enable_property = prop;
+
+ prop = drm_property_create(crtc->dev, DRM_MODE_PROP_ATOMIC |
+ DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB,
+ "HISTOGRAM_DATA", 0);
+ if (!prop)
+ return -ENOMEM;
+ drm_object_attach_property(&crtc->base, prop, 0);
+ crtc->histogram_data_property = prop;
+
+ prop = drm_property_create(crtc->dev, DRM_MODE_PROP_ATOMIC |
+ DRM_MODE_PROP_BLOB, "HISTOGRAM_IET", 0);
+ if (!prop)
+ return -ENOMEM;
+ drm_object_attach_property(&crtc->base, prop, 0);
+ crtc->histogram_iet_property = prop;
+
+ return 0;
+}
+EXPORT_SYMBOL(drm_crtc_create_histogram_property);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3984cfa00cbf..d1b9fae5592d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1371,5 +1371,6 @@ 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);
+int drm_crtc_create_histogram_property(struct drm_crtc *crtc);
#endif /* __DRM_CRTC_H__ */
--
2.25.1
next prev parent reply other threads:[~2024-12-03 6:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 5:55 [PATCHv9 00/10] Display Global Histogram Arun R Murthy
2024-12-03 5:55 ` [PATCH 01/10] drm/crtc: Add histogram properties Arun R Murthy
2024-12-03 15:07 ` Dmitry Baryshkov
2024-12-04 5:00 ` Kandpal, Suraj
2024-12-03 5:55 ` Arun R Murthy [this message]
2024-12-03 5:55 ` [PATCHv2 03/10] drm/i915/histogram: Define registers for histogram Arun R Murthy
2024-12-03 5:55 ` [PATCHv5 04/10] drm/i915/histogram: Add support " Arun R Murthy
2024-12-03 5:55 ` [PATCH 05/10] drm/xe: Add histogram support to Xe builds Arun R Murthy
2024-12-03 5:55 ` [PATCHv5 06/10] drm/i915/histogram: histogram interrupt handling Arun R Murthy
2024-12-04 5:15 ` Kandpal, Suraj
2024-12-03 5:55 ` [PATCH 07/10] drm/i915/display: handle drm-crtc histogram property updates Arun R Murthy
2024-12-04 5:33 ` Kandpal, Suraj
2024-12-03 5:55 ` [PATCHv3 08/10] drm/i915/histogram: histogram delay counter doesnt reset Arun R Murthy
2024-12-04 4:53 ` Kandpal, Suraj
2024-12-03 5:55 ` [PATCHv6 09/10] drm/i915/histogram: Histogram changes for Display 20+ Arun R Murthy
2024-12-04 4:55 ` Kandpal, Suraj
2024-12-03 5:55 ` [PATCH 10/10] drm/i915/histogram: Enable pipe dithering Arun R Murthy
2024-12-03 6:11 ` ✓ CI.Patch_applied: success for Display Global Histogram (rev5) Patchwork
2024-12-03 6:12 ` ✗ CI.checkpatch: warning " Patchwork
2024-12-03 6:13 ` ✓ CI.KUnit: success " Patchwork
2024-12-03 6:20 ` ✗ CI.Build: failure " 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=20241203055520.1704661-3-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