-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release notes available [here](https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.22) Additional changes: - Brought back AMD HDR patches and added compile flag to enable them Signed-off-by: Reilly Brogan <reilly@reillybrogan.com>
- Loading branch information
1 parent
b3a3fc2
commit dc52187
Showing
36 changed files
with
39,628 additions
and
35,714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...tches/hardware/amd-hdr-v5/0001-drm-drm_mode_object-increase-max-objects-to-accommod.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Melissa Wen <mwen@igalia.com> | ||
Date: Thu, 16 Nov 2023 18:57:41 -0100 | ||
Subject: [PATCH 01/32] drm/drm_mode_object: increase max objects to | ||
accommodate new color props | ||
|
||
DRM_OBJECT_MAX_PROPERTY limits the number of properties to be attached | ||
and we are increasing that value all time we add a new property (generic | ||
or driver-specific). | ||
|
||
In this series, we are adding 13 new KMS driver-specific properties for | ||
AMD color manage: | ||
- CRTC Gamma enumerated Transfer Function | ||
- Plane: Degamma LUT+size+TF, HDR multiplier, shaper LUT+size+TF, 3D | ||
LUT+size, blend LUT+size+TF (12) | ||
|
||
Therefore, just increase DRM_OBJECT_MAX_PROPERTY to a number (64) that | ||
accomodates these new properties and gives some room for others, | ||
avoiding change this number everytime we add a new KMS property. | ||
|
||
Reviewed-by: Harry Wentland <harry.wentland@amd.com> | ||
Reviewed-by: Simon Ser <contact@emersion.fr> | ||
Signed-off-by: Melissa Wen <mwen@igalia.com> | ||
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> | ||
--- | ||
include/drm/drm_mode_object.h | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/include/drm/drm_mode_object.h b/include/drm/drm_mode_object.h | ||
index 912f1e415685..08d7a7f0188f 100644 | ||
--- a/include/drm/drm_mode_object.h | ||
+++ b/include/drm/drm_mode_object.h | ||
@@ -60,7 +60,7 @@ struct drm_mode_object { | ||
void (*free_cb)(struct kref *kref); | ||
}; | ||
|
||
-#define DRM_OBJECT_MAX_PROPERTY 24 | ||
+#define DRM_OBJECT_MAX_PROPERTY 64 | ||
/** | ||
* struct drm_object_properties - property tracking for &drm_mode_object | ||
*/ |
193 changes: 193 additions & 0 deletions
193
...tches/hardware/amd-hdr-v5/0002-drm-drm_property-make-replace_property_blob_from_id-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Melissa Wen <mwen@igalia.com> | ||
Date: Thu, 16 Nov 2023 18:57:42 -0100 | ||
Subject: [PATCH 02/32] drm/drm_property: make replace_property_blob_from_id a | ||
DRM helper | ||
|
||
Place it in drm_property where drm_property_replace_blob and | ||
drm_property_lookup_blob live. Then we can use the DRM helper for | ||
driver-specific KMS properties too. | ||
|
||
Reviewed-by: Harry Wentland <harry.wentland@amd.com> | ||
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> | ||
Signed-off-by: Melissa Wen <mwen@igalia.com> | ||
--- | ||
drivers/gpu/drm/drm_atomic_uapi.c | 51 +++---------------------------- | ||
drivers/gpu/drm/drm_property.c | 49 +++++++++++++++++++++++++++++ | ||
include/drm/drm_property.h | 6 ++++ | ||
3 files changed, 60 insertions(+), 46 deletions(-) | ||
|
||
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c | ||
index 98d3b10c08ae..9e3221854cbf 100644 | ||
--- a/drivers/gpu/drm/drm_atomic_uapi.c | ||
+++ b/drivers/gpu/drm/drm_atomic_uapi.c | ||
@@ -362,47 +362,6 @@ static s32 __user *get_out_fence_for_connector(struct drm_atomic_state *state, | ||
return fence_ptr; | ||
} | ||
|
||
-static int | ||
-drm_atomic_replace_property_blob_from_id(struct drm_device *dev, | ||
- struct drm_property_blob **blob, | ||
- uint64_t blob_id, | ||
- ssize_t expected_size, | ||
- ssize_t expected_elem_size, | ||
- bool *replaced) | ||
-{ | ||
- struct drm_property_blob *new_blob = NULL; | ||
- | ||
- if (blob_id != 0) { | ||
- new_blob = drm_property_lookup_blob(dev, blob_id); | ||
- if (new_blob == NULL) { | ||
- drm_dbg_atomic(dev, | ||
- "cannot find blob ID %llu\n", blob_id); | ||
- return -EINVAL; | ||
- } | ||
- | ||
- if (expected_size > 0 && | ||
- new_blob->length != expected_size) { | ||
- drm_dbg_atomic(dev, | ||
- "[BLOB:%d] length %zu different from expected %zu\n", | ||
- new_blob->base.id, new_blob->length, expected_size); | ||
- drm_property_blob_put(new_blob); | ||
- return -EINVAL; | ||
- } | ||
- if (expected_elem_size > 0 && | ||
- new_blob->length % expected_elem_size != 0) { | ||
- drm_dbg_atomic(dev, | ||
- "[BLOB:%d] length %zu not divisible by element size %zu\n", | ||
- new_blob->base.id, new_blob->length, expected_elem_size); | ||
- drm_property_blob_put(new_blob); | ||
- return -EINVAL; | ||
- } | ||
- } | ||
- | ||
- *replaced |= drm_property_replace_blob(blob, new_blob); | ||
- drm_property_blob_put(new_blob); | ||
- | ||
- return 0; | ||
-} | ||
|
||
static int drm_atomic_crtc_set_property(struct drm_crtc *crtc, | ||
struct drm_crtc_state *state, struct drm_property *property, | ||
@@ -424,7 +383,7 @@ 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) { | ||
- ret = drm_atomic_replace_property_blob_from_id(dev, | ||
+ ret = drm_property_replace_blob_from_id(dev, | ||
&state->degamma_lut, | ||
val, | ||
-1, sizeof(struct drm_color_lut), | ||
@@ -432,7 +391,7 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc, | ||
state->color_mgmt_changed |= replaced; | ||
return ret; | ||
} else if (property == config->ctm_property) { | ||
- ret = drm_atomic_replace_property_blob_from_id(dev, | ||
+ ret = drm_property_replace_blob_from_id(dev, | ||
&state->ctm, | ||
val, | ||
sizeof(struct drm_color_ctm), -1, | ||
@@ -440,7 +399,7 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc, | ||
state->color_mgmt_changed |= replaced; | ||
return ret; | ||
} else if (property == config->gamma_lut_property) { | ||
- ret = drm_atomic_replace_property_blob_from_id(dev, | ||
+ ret = drm_property_replace_blob_from_id(dev, | ||
&state->gamma_lut, | ||
val, | ||
-1, sizeof(struct drm_color_lut), | ||
@@ -581,7 +540,7 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, | ||
} else if (property == plane->color_range_property) { | ||
state->color_range = val; | ||
} else if (property == config->prop_fb_damage_clips) { | ||
- ret = drm_atomic_replace_property_blob_from_id(dev, | ||
+ ret = drm_property_replace_blob_from_id(dev, | ||
&state->fb_damage_clips, | ||
val, | ||
-1, | ||
@@ -758,7 +717,7 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, | ||
if (state->link_status != DRM_LINK_STATUS_GOOD) | ||
state->link_status = val; | ||
} else if (property == config->hdr_output_metadata_property) { | ||
- ret = drm_atomic_replace_property_blob_from_id(dev, | ||
+ ret = drm_property_replace_blob_from_id(dev, | ||
&state->hdr_output_metadata, | ||
val, | ||
sizeof(struct hdr_output_metadata), -1, | ||
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c | ||
index dfec479830e4..f72ef6493340 100644 | ||
--- a/drivers/gpu/drm/drm_property.c | ||
+++ b/drivers/gpu/drm/drm_property.c | ||
@@ -751,6 +751,55 @@ bool drm_property_replace_blob(struct drm_property_blob **blob, | ||
} | ||
EXPORT_SYMBOL(drm_property_replace_blob); | ||
|
||
+/** | ||
+ * drm_property_replace_blob_from_id - replace a blob property taking a reference | ||
+ * @dev: DRM device | ||
+ * @blob: a pointer to the member blob to be replaced | ||
+ * @blob_id: the id of the new blob to replace with | ||
+ * @expected_size: expected size of the blob property | ||
+ * @expected_elem_size: expected size of an element in the blob property | ||
+ * @replaced: if the blob was in fact replaced | ||
+ * | ||
+ * Look up the new blob from id, take its reference, check expected sizes of | ||
+ * the blob and its element and replace the old blob by the new one. Advertise | ||
+ * if the replacement operation was successful. | ||
+ * | ||
+ * Return: true if the blob was in fact replaced. -EINVAL if the new blob was | ||
+ * not found or sizes don't match. | ||
+ */ | ||
+int drm_property_replace_blob_from_id(struct drm_device *dev, | ||
+ struct drm_property_blob **blob, | ||
+ uint64_t blob_id, | ||
+ ssize_t expected_size, | ||
+ ssize_t expected_elem_size, | ||
+ bool *replaced) | ||
+{ | ||
+ struct drm_property_blob *new_blob = NULL; | ||
+ | ||
+ if (blob_id != 0) { | ||
+ new_blob = drm_property_lookup_blob(dev, blob_id); | ||
+ if (new_blob == NULL) | ||
+ return -EINVAL; | ||
+ | ||
+ if (expected_size > 0 && | ||
+ new_blob->length != expected_size) { | ||
+ drm_property_blob_put(new_blob); | ||
+ return -EINVAL; | ||
+ } | ||
+ if (expected_elem_size > 0 && | ||
+ new_blob->length % expected_elem_size != 0) { | ||
+ drm_property_blob_put(new_blob); | ||
+ return -EINVAL; | ||
+ } | ||
+ } | ||
+ | ||
+ *replaced |= drm_property_replace_blob(blob, new_blob); | ||
+ drm_property_blob_put(new_blob); | ||
+ | ||
+ return 0; | ||
+} | ||
+EXPORT_SYMBOL(drm_property_replace_blob_from_id); | ||
+ | ||
int drm_mode_getblob_ioctl(struct drm_device *dev, | ||
void *data, struct drm_file *file_priv) | ||
{ | ||
diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h | ||
index 65bc9710a470..0a33a1b0ea3e 100644 | ||
--- a/include/drm/drm_property.h | ||
+++ b/include/drm/drm_property.h | ||
@@ -279,6 +279,12 @@ struct drm_property_blob *drm_property_create_blob(struct drm_device *dev, | ||
const void *data); | ||
struct drm_property_blob *drm_property_lookup_blob(struct drm_device *dev, | ||
uint32_t id); | ||
+int drm_property_replace_blob_from_id(struct drm_device *dev, | ||
+ struct drm_property_blob **blob, | ||
+ uint64_t blob_id, | ||
+ ssize_t expected_size, | ||
+ ssize_t expected_elem_size, | ||
+ bool *replaced); | ||
int drm_property_replace_global_blob(struct drm_device *dev, | ||
struct drm_property_blob **replace, | ||
size_t length, |
60 changes: 60 additions & 0 deletions
60
...s/patches/hardware/amd-hdr-v5/0003-drm-drm_plane-track-color-mgmt-changes-per-plane.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Melissa Wen <mwen@igalia.com> | ||
Date: Thu, 16 Nov 2023 18:57:43 -0100 | ||
Subject: [PATCH 03/32] drm/drm_plane: track color mgmt changes per plane | ||
|
||
We will add color mgmt properties to DRM planes in the next patches and | ||
we want to track when one of this properties change to define atomic | ||
commit behaviors. Using a similar approach from CRTC color props, we set | ||
a color_mgmt_changed boolean whenever a plane color prop changes. | ||
|
||
Reviewed-by: Harry Wentland <harry.wentland@amd.com> | ||
Signed-off-by: Melissa Wen <mwen@igalia.com> | ||
--- | ||
drivers/gpu/drm/drm_atomic.c | 1 + | ||
drivers/gpu/drm/drm_atomic_state_helper.c | 1 + | ||
include/drm/drm_plane.h | 7 +++++++ | ||
3 files changed, 9 insertions(+) | ||
|
||
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c | ||
index c277b198fa3f..c3df45f90145 100644 | ||
--- a/drivers/gpu/drm/drm_atomic.c | ||
+++ b/drivers/gpu/drm/drm_atomic.c | ||
@@ -733,6 +733,7 @@ static void drm_atomic_plane_print_state(struct drm_printer *p, | ||
drm_get_color_encoding_name(state->color_encoding)); | ||
drm_printf(p, "\tcolor-range=%s\n", | ||
drm_get_color_range_name(state->color_range)); | ||
+ drm_printf(p, "\tcolor_mgmt_changed=%d\n", state->color_mgmt_changed); | ||
|
||
if (plane->funcs->atomic_print_state) | ||
plane->funcs->atomic_print_state(p, state); | ||
diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c | ||
index 784e63d70a42..25bb0859fda7 100644 | ||
--- a/drivers/gpu/drm/drm_atomic_state_helper.c | ||
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c | ||
@@ -338,6 +338,7 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, | ||
state->fence = NULL; | ||
state->commit = NULL; | ||
state->fb_damage_clips = NULL; | ||
+ state->color_mgmt_changed = false; | ||
} | ||
EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state); | ||
|
||
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h | ||
index fef775200a81..8dca89cba93c 100644 | ||
--- a/include/drm/drm_plane.h | ||
+++ b/include/drm/drm_plane.h | ||
@@ -247,6 +247,13 @@ struct drm_plane_state { | ||
|
||
/** @state: backpointer to global drm_atomic_state */ | ||
struct drm_atomic_state *state; | ||
+ | ||
+ /** | ||
+ * @color_mgmt_changed: Color management properties have changed. Used | ||
+ * by the atomic helpers and drivers to steer the atomic commit control | ||
+ * flow. | ||
+ */ | ||
+ bool color_mgmt_changed : 1; | ||
}; | ||
|
||
static inline struct drm_rect |
Oops, something went wrong.