[PATCH 05/10] INTEL_DII: drm: Add Client Cap for advance degamma mode
Borah, Chaitanya Kumar
chaitanya.kumar.borah at intel.com
Wed Sep 14 12:47:58 UTC 2022
A client cap advance degamma mode is introduced. Minimum requirement
for a client to set this capability is if it can use 64 bit LUT
values as defined by the structure drm_color_lut_ext on a supported
platform.
If not set driver will work in legacy mode.
Signed-off-by: Borah, Chaitanya Kumar <chaitanya.kumar.borah at intel.com>
---
drivers/gpu/drm/drm_atomic_uapi.c | 8 +++++++-
drivers/gpu/drm/drm_ioctl.c | 5 +++++
include/drm/drm_atomic.h | 1 +
include/drm/drm_crtc.h | 8 ++++++++
include/drm/drm_file.h | 8 ++++++++
include/uapi/drm/drm.h | 10 ++++++++++
6 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index e657eb860f0ace..daa39daa319d8d 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -451,10 +451,13 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
} else if (property == config->prop_vrr_enabled) {
state->vrr_enabled = val;
} else if (property == config->degamma_lut_property) {
+ ssize_t size = state->advance_degamma_mode_active ?
+ sizeof(struct drm_color_lut_ext) :
+ sizeof(struct drm_color_lut);
ret = drm_atomic_replace_property_blob_from_id(dev,
&state->degamma_lut,
val,
- -1, sizeof(struct drm_color_lut),
+ -1, size,
&replaced);
state->color_mgmt_changed |= replaced;
return ret;
@@ -1084,6 +1087,8 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
crtc_state->advance_gamma_mode_active =
state->advance_gamma_mode_active;
+ crtc_state->advance_degamma_mode_active =
+ state->advance_degamma_mode_active;
ret = drm_atomic_crtc_set_property(crtc,
crtc_state, prop, prop_value);
break;
@@ -1422,6 +1427,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
state->acquire_ctx = &ctx;
state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
state->advance_gamma_mode_active = file_priv->advance_gamma_mode_active;
+ state->advance_degamma_mode_active = file_priv->advance_degamma_mode_active;
retry:
copied_objs = 0;
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 034b2fa1552984..214d27ce545384 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -367,6 +367,11 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
return -EINVAL;
file_priv->advance_gamma_mode_active = req->value;
break;
+ case DRM_CLIENT_CAP_ADVANCE_DEGAMMA_MODES:
+ if (req->value > 1)
+ return -EINVAL;
+ file_priv->advance_degamma_mode_active = req->value;
+ break;
default:
return -EINVAL;
}
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 77400b7096c38f..fe7ba8a4243e35 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -380,6 +380,7 @@ struct drm_atomic_state {
*/
bool duplicated : 1;
bool advance_gamma_mode_active : 1;
+ bool advance_degamma_mode_active : 1;
struct __drm_planes_state *planes;
struct __drm_crtcs_state *crtcs;
int num_connector;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e20c4d396071d7..9ed728c2275f02 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -175,6 +175,11 @@ struct drm_crtc_state {
*/
bool advance_gamma_mode_active : 1;
+ /**
+ * This is to indicate advance degamma mode support
+ */
+ bool advance_degamma_mode_active : 1;
+
/**
* @no_vblank:
*
@@ -1072,6 +1077,9 @@ struct drm_crtc {
/** To handle advance gamma mode support */
bool advance_gamma_mode_active : 1;
+ /** To handle advance degamma mode support */
+ bool advance_degamma_mode_active : 1;
+
/**
* @mode:
*
diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
index bde582cacf339b..41a34d2bbe7b19 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -208,6 +208,14 @@ struct drm_file {
*/
bool advance_gamma_mode_active : 1;
+ /**
+ * This is to enable advance degamma modes using
+ * 64 bit LUT values
+ *
+ * True if client understands advance gamma
+ */
+ bool advance_degamma_mode_active : 1;
+
/**
* @was_master:
*
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 4e63495ad9cdee..8d6dfc9bfd1407 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -846,6 +846,16 @@ struct drm_get_cap {
*/
#define DRM_CLIENT_CAP_ADVANCE_GAMMA_MODES 6
+/**
+ * DRM_CLIENT_CAP_ADVANCE_DEGAMMA_MODES
+ *
+ * Add support for advance degamma mode UAPI
+ * If set to 1, DRM will enable advance degamma mode
+ * UAPI to process degamma mode with 64 bit LUT
+ * values
+ */
+#define DRM_CLIENT_CAP_ADVANCE_DEGAMMA_MODES 7
+
/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
struct drm_set_client_cap {
__u64 capability;
--
2.25.1
More information about the Intel-gfx-trybot
mailing list