drm: Fill in default values for plane properties
Subsystems (20)
v2 cover drm: Fill in default values for plane properties
Hi,
We have a bunch of functions that create planes properties that will take a default value, but it isn't actually enforced in the plane state.
This leads to drivers having multiple strategies to work around that issue, most of them being a variation of forcing a value at plane state reset time. Others work fine by luck, or have entirely ignored the issue.
This series aims at making sure the default value set by the call to the function isn't ignored, and then making sure all drivers behave consistently.
Let me know what you think,
Maxime
Changes from v1:
- Collected tags
- Squashed some patches
Dave Stevenson (3):
drm/object: Add drm_object_property_get_default_value() function drm/object: Add default zpos value at reset drm/object: Add default color encoding and range value at reset
Maxime Ripard (19):
drm/komeda: plane: switch to plane reset helper drm/tegra: plane: switch to plane reset helper drm/tegra: hub: Fix zpos initial value mismatch drm/omap: plane: Fix zpos initial value mismatch drm/amd/display: Fix color encoding mismatch drm/tegra: plane: Remove redundant zpos initialisation drm/komeda: plane: Remove redundant zpos initialisation drm/exynos: plane: Remove redundant zpos initialisation drm/imx: ipuv3-plane: Remove redundant zpos initialisation drm/msm/mdp5: Remove redundant zpos initialisation drm/nouveau/kms: Remove redundant zpos initialisation drm/omap: plane: Remove redundant zpos initialisation drm/rcar: plane: Remove redundant zpos initialisation drm/sti: plane: Remove redundant zpos initialisation drm/sun4i: layer: Remove redundant zpos initialisation drm/komeda: plane: Remove redundant color encoding and range
initialisation
drm/armada: overlay: Remove redundant color encoding and range
initialisation
drm/imx: ipuv3-plane: Remove redundant color encoding and range
initialisation
drm/omap: plane: Remove redundant color encoding and range
initialisation
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- .../gpu/drm/arm/display/komeda/komeda_plane.c | 13 +---- drivers/gpu/drm/armada/armada_overlay.c | 2 - drivers/gpu/drm/drm_atomic_state_helper.c | 25 +++++++++ drivers/gpu/drm/drm_mode_object.c | 53 +++++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_plane.c | 5 +- drivers/gpu/drm/imx/ipuv3-plane.c | 8 +-- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 16 +++--- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 - drivers/gpu/drm/omapdrm/omap_plane.c | 22 ++++---- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 1 - drivers/gpu/drm/sti/sti_cursor.c | 2 +- drivers/gpu/drm/sti/sti_gdp.c | 2 +- drivers/gpu/drm/sti/sti_hqvdp.c | 2 +- drivers/gpu/drm/sti/sti_plane.c | 6 --- drivers/gpu/drm/sti/sti_plane.h | 1 - drivers/gpu/drm/sun4i/sun4i_layer.c | 16 +++--- drivers/gpu/drm/tegra/hub.c | 2 +- drivers/gpu/drm/tegra/plane.c | 6 +-- include/drm/drm_mode_object.h | 7 +++ 21 files changed, 111 insertions(+), 83 deletions(-)
Signature · 1 line
2.35.1
PATCH v2 1/22 drm/komeda: plane: switch to plane reset helper
komeda_plane_reset() does the state initialisation by copying a lot of the code found in the __drm_atomic_helper_plane_reset(). Let's switch to that helper and reduce the boilerplate.
--- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_plane.c +1 -5
@@ -145,14 +145,10 @@ static void komeda_plane_reset(struct drm_plane *plane) state =kzalloc (sizeof (*state),GFP_KERNEL );if (state) { - state->base.rotation =DRM_MODE_ROTATE_0 ; - state->base.pixel_blend_mode =DRM_MODE_BLEND_PREMULTI ; - state->base.alpha =DRM_BLEND_ALPHA_OPAQUE ; +__drm_atomic_helper_plane_reset (plane, &state->base); state->base.zpos = kplane->layer->base.id; state->base.color_encoding =DRM_COLOR_YCBCR_BT601 ; state->base.color_range =DRM_COLOR_YCBCR_LIMITED_RANGE ; - plane->state = &state->base; - plane->state->plane = plane; } }
Signature · 1 line
2.35.1
Re: [PATCH v2 01/22] drm/komeda: plane: switch to plane reset helper
Quoted 9 lines · Maxime Ripard
komeda_plane_reset()does the state initialisation by copying a lot of the code found in the__drm_atomic_helper_plane_reset(). Let's switch to that helper and reduce the boilerplate.Cc Brian Starkey <[email protected]>Cc "James (Qian) Wang" <[email protected]>Cc Liviu Dudau <[email protected]>Cc Mihail Atanassov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
Best regards,
Liviu
Quoted 27 lines
--- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)drivers/gpu/drm/arm/display/komeda/komeda_plane.c +1
-5@@ -145,14 +145,10 @@ static void komeda_plane_reset(struct drm_plane *plane) state =kzalloc (sizeof (*state),GFP_KERNEL );if (state) { - state->base.rotation =DRM_MODE_ROTATE_0 ; - state->base.pixel_blend_mode =DRM_MODE_BLEND_PREMULTI ; - state->base.alpha =DRM_BLEND_ALPHA_OPAQUE ; +__drm_atomic_helper_plane_reset (plane, &state->base); state->base.zpos = kplane->layer->base.id; state->base.color_encoding =DRM_COLOR_YCBCR_BT601 ; state->base.color_range =DRM_COLOR_YCBCR_LIMITED_RANGE ; - plane->state = &state->base; - plane->state->plane = plane; } }Signature · 1 line
2.35.1
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Maxime Ripard
AppliedRe: (subset) [PATCH v2 01/22] drm/komeda: plane: switch to plane reset helper
In reply to Maxime RipardQuoted 5 lines · Maxime Ripard
komeda_plane_reset()does the state initialisation by copying a lot of the code found in the__drm_atomic_helper_plane_reset(). Let's switch to that helper and reduce the boilerplate.
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 2/22 drm/tegra: plane: switch to plane reset helper
In reply to Maxime Ripardtegra_plane_reset() does the state initialisation by copying a lot of the code found in the __drm_atomic_helper_plane_reset(). Let's switch to that helper and reduce the boilerplate.
--- drivers/gpu/drm/tegra/plane.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/tegra/plane.c +1 -2
@@ -37,8 +37,7 @@ static void tegra_plane_reset(struct drm_plane *plane) state =kzalloc (sizeof (*state),GFP_KERNEL );if (state) { - plane->state = &state->base; - plane->state->plane = plane; +__drm_atomic_helper_plane_reset (plane, &state->base); plane->state->zpos = p->index; plane->state->normalized_zpos = p->index;
Signature · 1 line
2.35.1
PATCH v2 3/22 drm/tegra: hub: Fix zpos initial value mismatch
In reply to Maxime RipardWhile the tegra_shared_plane_create() function calls drm_plane_create_zpos_property() with an initial value of 0, tegra_plane_reset() will force it to the plane index.
Fix the discrepancy by setting the initial zpos value to the plane index in the function call.
--- drivers/gpu/drm/tegra/hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tegra/hub.c +1 -1
@@ -788,7 +788,7 @@ struct drm_plane *tegra_shared_plane_create(struct drm_device *drm, }drm_plane_helper_add (p, &tegra_shared_plane_helper_funcs); -drm_plane_create_zpos_property (p,0 ,0 ,255 ); +drm_plane_create_zpos_property (p, index,0 ,255 );return p; }
Signature · 1 line
2.35.1
PATCH v2 4/22 drm/omap: plane: Fix zpos initial value mismatch
In reply to Maxime RipardWhile the omap_plane_init() function calls drm_plane_create_zpos_property() with an initial value of 0, omap_plane_reset() will force it to another value depending on the plane type.
Fix the discrepancy by setting the initial zpos value to the same value in the drm_plane_create_zpos_property() call.
--- drivers/gpu/drm/omapdrm/omap_plane.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_plane.c +11 -1
@@ -533,6 +533,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,unsigned int num_planes =dispc_get_num_ovls (priv->dispc);struct drm_plane *plane;struct omap_plane *omap_plane; +unsigned int zpos;int ret;u32 nformats;const u32 *formats;
@@ -564,7 +565,16 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,drm_plane_helper_add (plane, &omap_plane_helper_funcs);omap_plane_install_properties (plane, &plane->base); -drm_plane_create_zpos_property (plane,0 ,0 , num_planes -1 ); + +/* +* Set the zpos default depending on whether we are a primary or overlay +* plane. +*/ +if (plane->type ==DRM_PLANE_TYPE_PRIMARY ) + zpos =0 ; +else + zpos = omap_plane->id; +drm_plane_create_zpos_property (plane, zpos,0 , num_planes -1 );drm_plane_create_alpha_property (plane);drm_plane_create_blend_mode_property (plane,BIT (DRM_MODE_BLEND_PREMULTI ) |BIT (DRM_MODE_BLEND_COVERAGE ));
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 04/22] drm/omap: plane: Fix zpos initial value mismatch
Quoted 9 lines · Maxime Ripard
While the
omap_plane_init()function callsdrm_plane_create_zpos_property()with an initial value of 0,omap_plane_reset()will force it to another value depending on the plane type.Fix the discrepancy by setting the initial zpos value to the same value in the
drm_plane_create_zpos_property()call.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 5/22 drm/amd/display: Fix color encoding mismatch
In reply to Maxime RipardThe amdgpu KMS driver calls drm_plane_create_color_properties() with a default encoding set to BT709.
However, the core will ignore it and the driver doesn't force it in its plane state reset hook, so the initial value will be 0, which represents BT601.
Fix the mismatch by using an initial value of BT601 in drm_plane_create_color_properties().
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -7914,7 +7914,7 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,BIT (DRM_COLOR_YCBCR_BT2020 ),BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ) |BIT (DRM_COLOR_YCBCR_FULL_RANGE ), - DRM_COLOR_YCBCR_BT709, DRM_COLOR_YCBCR_LIMITED_RANGE); + DRM_COLOR_YCBCR_BT601, DRM_COLOR_YCBCR_LIMITED_RANGE); } supported_rotations =
Signature · 1 line
2.35.1
PATCH v2 6/22 drm/object: Add drm_object_property_get_default_value() function
In reply to Maxime RipardFrom: Dave Stevenson <[email protected]>
Some functions to create properties (drm_plane_create_zpos_property or drm_plane_create_color_properties for example) will ask for a range of acceptable value and an initial one.
This initial value is then stored in the values array for that property.
Let's provide an helper to access this property.
--- drivers/gpu/drm/drm_mode_object.c | 53 +++++++++++++++++++++++++------ include/drm/drm_mode_object.h | 7 ++++ 2 files changed, 50 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_mode_object.c +43 -10
@@ -297,11 +297,26 @@ int drm_object_property_set_value(struct drm_mode_object *obj, }EXPORT_SYMBOL (drm_object_property_set_value); +static int __drm_object_property_get_prop_value (struct drm_mode_object *obj, +struct drm_property *property, +uint64_t *val) +{ +int i; + +for (i =0 ; i < obj->properties->count; i++) { +if (obj->properties->properties[i] == property) { + *val = obj->properties->values[i]; +return 0 ; + } + } + +return -EINVAL ; +} +static int __drm_object_property_get_value (struct drm_mode_object *obj,struct drm_property *property,uint64_t *val) { -int i;/* read-only properties bypass atomic mechanism and still store * their value in obj->properties->values[].. mostly to avoid
@@ -311,15 +326,7 @@ static int __drm_object_property_get_value(struct drm_mode_object *obj, !(property->flags & DRM_MODE_PROP_IMMUTABLE))return drm_atomic_get_property (obj, property, val); -for (i =0 ; i < obj->properties->count; i++) { -if (obj->properties->properties[i] == property) { - *val = obj->properties->values[i]; -return 0 ; - } - - } - -return -EINVAL ; +return __drm_object_property_get_prop_value (obj, property, val); }/**
@@ -348,6 +355,32 @@ int drm_object_property_get_value(struct drm_mode_object *obj, }EXPORT_SYMBOL (drm_object_property_get_value); +/** +* drm_object_property_get_default_value - retrieve the default value of a +* property when in atomic mode. +* @obj: drm mode object to get property value from +* @property: property to retrieve +* @val: storage for the property value +* +* This function retrieves the default state of the given property as passed in +* to drm_object_attach_property +* +* Only atomic drivers should call this function directly, as for non-atomic +* drivers it will return the current value. +* +* Returns: +* Zero on success, error code on failure. +*/ +int drm_object_property_get_default_value (struct drm_mode_object *obj, +struct drm_property *property, +uint64_t *val) +{ +WARN_ON (!drm_drv_uses_atomic_modeset (property->dev)); + +return __drm_object_property_get_prop_value (obj, property, val); +} +EXPORT_SYMBOL (drm_object_property_get_default_value); +/* helper for getconnector and getproperties ioctls */ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic, uint32_t __user *prop_ptr,
include/drm/drm_mode_object.h +7 -0
@@ -98,6 +98,10 @@ struct drm_object_properties {* Hence atomic drivers should not use drm_object_property_set_value() * and drm_object_property_get_value() on mutable objects, i.e. those * without the DRM_MODE_PROP_IMMUTABLE flag set. +* +* For atomic drivers the default value of properties is stored in this +* array, so drm_object_property_get_default_value can be used to +* retrieve it. */ uint64_t values[DRM_OBJECT_MAX_PROPERTY ]; };
@@ -126,6 +130,9 @@ int drm_object_property_set_value(struct drm_mode_object *obj,int drm_object_property_get_value (struct drm_mode_object *obj,struct drm_property *property,uint64_t *value); +int drm_object_property_get_default_value (struct drm_mode_object *obj, +struct drm_property *property, +uint64_t *val); void drm_object_attach_property(struct drm_mode_object *obj, struct drm_property *property,
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 06/22] drm/object: Add drm_object_property_get_default_value() function
Quoted 9 lines · Maxime Ripard
From: Dave Stevenson <[email protected]>
Some functions to create properties (
drm_plane_create_zpos_propertyordrm_plane_create_color_propertiesfor example) will ask for a range of acceptable value and an initial one.This initial value is then stored in the values array for that property.
[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 7/22 drm/object: Add default zpos value at reset
In reply to Maxime RipardFrom: Dave Stevenson <[email protected]>
The drm_plane_create_zpos_property() function asks for an initial value, and will set the associated plane state variable with that value if a state is present.
However, that function is usually called at a time where there's no state yet. Since the drm_plane_state reset helper doesn't take care of reading that value when it's called, it means that in most cases the initial value will be 0, or the drivers will have to work around it.
Let's add some code in __drm_atomic_helper_plane_state_reset() to get the initial zpos value if the property has been attached in order to fix this.
--- drivers/gpu/drm/drm_atomic_state_helper.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/drm_atomic_state_helper.c +11 -0
@@ -243,11 +243,22 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);void __drm_atomic_helper_plane_state_reset (struct drm_plane_state *plane_state,struct drm_plane *plane) { +u64 val; + plane_state->plane = plane; plane_state->rotation =DRM_MODE_ROTATE_0 ; plane_state->alpha =DRM_BLEND_ALPHA_OPAQUE ; plane_state->pixel_blend_mode =DRM_MODE_BLEND_PREMULTI ; + +if (plane->zpos_property) { +if (!drm_object_property_get_default_value (&plane->base, + plane->zpos_property, + &val)) { + plane_state->zpos = val; + plane_state->normalized_zpos = val; + } + } }EXPORT_SYMBOL (__drm_atomic_helper_plane_state_reset);
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 07/22] drm/object: Add default zpos value at reset
Quoted 6 lines · Maxime Ripard
From: Dave Stevenson <[email protected]>
The
drm_plane_create_zpos_property()function asks for an initial value, and will set the associated plane state variable with that value if a state is present.
Quoted 6 lines
However, that function is usually called at a time where there's no state yet. Since the
drm_plane_statereset helper doesn't take care of reading that value when it's called, it means that in most cases the initial value will be 0, or the drivers will have to work around it.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 8/22 drm/tegra: plane: Remove redundant zpos initialisation
In reply to Maxime RipardThe tegra KMS driver will call drm_plane_create_zpos_property() with an init value of the plane index.
Since the initial value wasn't carried over in the state, the driver had to set it again in tegra_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/tegra/plane.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/tegra/plane.c +0 -3
@@ -25,7 +25,6 @@ static void tegra_plane_destroy(struct drm_plane *plane)static void tegra_plane_reset (struct drm_plane *plane) { -struct tegra_plane *p =to_tegra_plane (plane);struct tegra_plane_state *state;unsigned int i;
@@ -38,8 +37,6 @@ static void tegra_plane_reset(struct drm_plane *plane) state =kzalloc (sizeof (*state),GFP_KERNEL );if (state) {__drm_atomic_helper_plane_reset (plane, &state->base); - plane->state->zpos = p->index; - plane->state->normalized_zpos = p->index;for (i =0 ; i <3 ; i++) state->iova[i] =DMA_MAPPING_ERROR ;
Signature · 1 line
2.35.1
PATCH v2 9/22 drm/komeda: plane: Remove redundant zpos initialisation
In reply to Maxime RipardThe komeda KMS driver will call drm_plane_create_zpos_property() with an init value of the plane index.
Since the initial value wasn't carried over in the state, the driver had to set it again in komeda_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_plane.c +0 -2
@@ -135,7 +135,6 @@ static void komeda_plane_destroy(struct drm_plane *plane)static void komeda_plane_reset (struct drm_plane *plane) {struct komeda_plane_state *state; -struct komeda_plane *kplane =to_kplane (plane);if (plane->state)__drm_atomic_helper_plane_destroy_state (plane->state);
@@ -146,7 +145,6 @@ static void komeda_plane_reset(struct drm_plane *plane) state =kzalloc (sizeof (*state),GFP_KERNEL );if (state) {__drm_atomic_helper_plane_reset (plane, &state->base); - state->base.zpos = kplane->layer->base.id; state->base.color_encoding =DRM_COLOR_YCBCR_BT601 ; state->base.color_range =DRM_COLOR_YCBCR_LIMITED_RANGE ; }
Signature · 1 line
2.35.1
Re: [PATCH v2 09/22] drm/komeda: plane: Remove redundant zpos initialisation
Quoted 7 lines · Maxime Ripard
The komeda KMS driver will call
drm_plane_create_zpos_property()with an init value of the plane index.Since the initial value wasn't carried over in the state, the driver had to set it again in
komeda_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
Quoted 5 lines
Cc Brian Starkey <[email protected]>Cc "James (Qian) Wang" <[email protected]>Cc Liviu Dudau <[email protected]>Cc Mihail Atanassov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
Best regards,
Liviu
Quoted 27 lines
--- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/arm/display/komeda/komeda_plane.c +0
-2@@ -135,7 +135,6 @@ static void komeda_plane_destroy(struct drm_plane *plane)static void komeda_plane_reset (struct drm_plane *plane) {struct komeda_plane_state *state; -struct komeda_plane *kplane =to_kplane (plane);if (plane->state)__drm_atomic_helper_plane_destroy_state (plane->state);@@ -146,7 +145,6 @@ static void komeda_plane_reset(struct drm_plane *plane) state =kzalloc (sizeof (*state),GFP_KERNEL );if (state) {__drm_atomic_helper_plane_reset (plane, &state->base); - state->base.zpos = kplane->layer->base.id; state->base.color_encoding =DRM_COLOR_YCBCR_BT601 ; state->base.color_range =DRM_COLOR_YCBCR_LIMITED_RANGE ; }Signature · 1 line
2.35.1
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Maxime Ripard
AppliedRe: (subset) [PATCH v2 09/22] drm/komeda: plane: Remove redundant zpos initialisation
In reply to Maxime RipardQuoted 8 lines · Maxime Ripard
The komeda KMS driver will call
drm_plane_create_zpos_property()with an init value of the plane index.Since the initial value wasn't carried over in the state, the driver had to set it again in
komeda_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 10/22 drm/exynos: plane: Remove redundant zpos initialisation
In reply to Maxime RipardThe exynos KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane purpose.
Since the initial value wasn't carried over in the state, the driver had to set it again in exynos_drm_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/exynos/exynos_drm_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_plane.c +1 -4
@@ -122,7 +122,6 @@ static void exynos_plane_mode_set(struct exynos_drm_plane_state *exynos_state)static void exynos_drm_plane_reset (struct drm_plane *plane) { -struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane);struct exynos_drm_plane_state *exynos_state;if (plane->state) {
@@ -133,10 +132,8 @@ static void exynos_drm_plane_reset(struct drm_plane *plane) } exynos_state =kzalloc (sizeof (*exynos_state),GFP_KERNEL ); -if (exynos_state) { +if (exynos_state)__drm_atomic_helper_plane_reset (plane, &exynos_state->base); - plane->state->zpos = exynos_plane->config->zpos; - } } static struct drm_plane_state *
Signature · 1 line
2.35.1
PATCH v2 11/22 drm/imx: ipuv3-plane: Remove redundant zpos initialisation
In reply to Maxime RipardThe imx KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane purpose.
Since the initial value wasn't carried over in the state, the driver had to set it again in ipu_plane_state_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/imx/ipuv3-plane.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/imx/ipuv3-plane.c +0 -3
@@ -297,7 +297,6 @@ void ipu_plane_disable_deferred(struct drm_plane *plane)static void ipu_plane_state_reset (struct drm_plane *plane) { -unsigned int zpos = (plane->type ==DRM_PLANE_TYPE_PRIMARY ) ?0 :1 ;struct ipu_plane_state *ipu_state;if (plane->state) {
@@ -311,8 +310,6 @@ static void ipu_plane_state_reset(struct drm_plane *plane)if (ipu_state) {__drm_atomic_helper_plane_reset (plane, &ipu_state->base); - ipu_state->base.zpos = zpos; - ipu_state->base.normalized_zpos = zpos; ipu_state->base.color_encoding =DRM_COLOR_YCBCR_BT601 ; ipu_state->base.color_range =DRM_COLOR_YCBCR_LIMITED_RANGE ; }
Signature · 1 line
2.35.1
PATCH v2 12/22 drm/msm/mdp5: Remove redundant zpos initialisation
In reply to Maxime RipardThe mdp KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane purpose.
Since the initial value wasn't carried over in the state, the driver had to set it again in mdp5_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +8 -8
@@ -48,6 +48,8 @@ static void mdp5_plane_destroy(struct drm_plane *plane)static void mdp5_plane_install_properties (struct drm_plane *plane,struct drm_mode_object *obj) { +unsigned int zpos; + drm_plane_create_rotation_property(plane, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 |
@@ -59,7 +61,12 @@ static void mdp5_plane_install_properties(struct drm_plane *plane,BIT (DRM_MODE_BLEND_PIXEL_NONE ) |BIT (DRM_MODE_BLEND_PREMULTI ) | BIT(DRM_MODE_BLEND_COVERAGE)); -drm_plane_create_zpos_property (plane,1 ,1 ,255 ); + +if (plane->type ==DRM_PLANE_TYPE_PRIMARY ) + zpos =STAGE_BASE ; +else + zpos =STAGE0 +drm_plane_index (plane); +drm_plane_create_zpos_property (plane, zpos,1 ,255 ); } static void
@@ -91,13 +98,6 @@ static void mdp5_plane_reset(struct drm_plane *plane)kfree (to_mdp5_plane_state (plane->state)); mdp5_state =kzalloc (sizeof (*mdp5_state),GFP_KERNEL ); - -if (plane->type ==DRM_PLANE_TYPE_PRIMARY ) - mdp5_state->base.zpos =STAGE_BASE ; -else - mdp5_state->base.zpos =STAGE0 +drm_plane_index (plane); - mdp5_state->base.normalized_zpos = mdp5_state->base.zpos; -__drm_atomic_helper_plane_reset (plane, &mdp5_state->base); }
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 12/22] drm/msm/mdp5: Remove redundant zpos initialisation
Quoted 8 lines · Maxime Ripard
The mdp KMS driver will call
drm_plane_create_zpos_property()with an init value depending on the plane purpose.Since the initial value wasn't carried over in the state, the driver had to set it again in
mdp5_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 13/22 drm/nouveau/kms: Remove redundant zpos initialisation
In reply to Maxime RipardThe nouveau KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane purpose.
Since the initial value wasn't carried over in the state, the driver had to set it again in nv50_wndw_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/wndw.c +0 -2
@@ -635,8 +635,6 @@ nv50_wndw_reset(struct drm_plane *plane) plane->funcs->atomic_destroy_state (plane, plane->state);__drm_atomic_helper_plane_reset (plane, &asyw->state); - plane->state->zpos =nv50_wndw_zpos_default (plane); - plane->state->normalized_zpos =nv50_wndw_zpos_default (plane); } static void
Signature · 1 line
2.35.1
Re: [PATCH v2 13/22] drm/nouveau/kms: Remove redundant zpos initialisation
Quoted 22 lines · Maxime Ripard
The nouveau KMS driver will call
drm_plane_create_zpos_property()with an init value depending on the plane purpose.Since the initial value wasn't carried over in the state, the driver had to set it again in
nv50_wndw_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.Cc Ben Skeggs <[email protected]>Cc Karol Herbst <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/nouveau/dispnv50/wndw.c +0
-0
drivers/gpu/drm/nouveau/dispnv50/wndw.c nv50_wndw_reset(struct drm_plane *plane) · line 639
Quoted 5 lines
drivers/gpu/drm/nouveau/dispnv50/wndw.c +0
-2@@ -635,8 +635,6 @@ nv50_wndw_reset(struct drm_plane *plane) plane->funcs->atomic_destroy_state (plane, plane->state);__drm_atomic_helper_plane_reset (plane, &asyw->state); - plane->state->zpos =nv50_wndw_zpos_default (plane); - plane->state->normalized_zpos =nv50_wndw_zpos_default (plane);
so reading the surrounding code a little it feels like those assignments actually do something. If my understanding is correct plane->state points to &asyw->state, but asyw was just kzalloced in this function. __drm_atomic_helper_plane_reset doesn't set the zpos or normalized_zpos fields as long as zpos_property is 0, so those fields won't be set with that change anymore.
I just don't know if it's fine like that or if this function should set zpos_property instead or something. Anyway, the commit description makes it sound like that an unneeded assignment would be removed here, which doesn't seem to be the case. But I don't really know much about all the drm API interactions, so it might just be fine, mostly asking to get a better idea on how all those pieces fit together.
Quoted 9 lines
drivers/gpu/drm/nouveau/dispnv50/wndw.c +0
-1} static void --2.35.1
Re: [PATCH v2 13/22] drm/nouveau/kms: Remove redundant zpos initialisation
Hi,
Quoted 36 lines · Karol Herbst
Quoted 22 lines · Maxime Ripard
The nouveau KMS driver will call
drm_plane_create_zpos_property()with an init value depending on the plane purpose.Since the initial value wasn't carried over in the state, the driver had to set it again in
nv50_wndw_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.Cc Ben Skeggs <[email protected]>Cc Karol Herbst <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/nouveau/dispnv50/wndw.c +0
-0drivers/gpu/drm/nouveau/dispnv50/wndw.c nv50_wndw_reset(struct drm_plane *plane) · line 639
Quoted 5 lines
drivers/gpu/drm/nouveau/dispnv50/wndw.c +0
-2@@ -635,8 +635,6 @@ nv50_wndw_reset(struct drm_plane *plane) plane->funcs->atomic_destroy_state (plane, plane->state);__drm_atomic_helper_plane_reset (plane, &asyw->state); - plane->state->zpos =nv50_wndw_zpos_default (plane); - plane->state->normalized_zpos =nv50_wndw_zpos_default (plane);so reading the surrounding code a little it feels like those assignments actually do something. If my understanding is correct
plane->statepoints to&asyw->state, but asyw was just kzalloced in this function.__drm_atomic_helper_plane_resetdoesn't set the zpos ornormalized_zposfields as long aszpos_propertyis 0, so those fields won't be set with that change anymore.
Quoted 6 lines
I just don't know if it's fine like that or if this function should set
zpos_propertyinstead or something. Anyway, the commit description makes it sound like that an unneeded assignment would be removed here, which doesn't seem to be the case. But I don't really know much about all the drm API interactions, so it might just be fine, mostly asking to get a better idea on how all those pieces fit together.
If you're looking at the code without that patch series, you're right.
These patches change that however:
https://lore.kernel.org/dri-devel/[email protected]/
https://lore.kernel.org/dri-devel/[email protected]/
So, once they have been applied those assignments are made in __drm_atomic_helper_plane_reset and are no longer relevant here.
Maxime
Karol Herbst
Reviewed-byRe: [PATCH v2 13/22] drm/nouveau/kms: Remove redundant zpos initialisation
Quoted 47 lines · Maxime Ripard
Hi,
Quoted 36 lines · Karol Herbst
Quoted 22 lines · Maxime Ripard
The nouveau KMS driver will call
drm_plane_create_zpos_property()with an init value depending on the plane purpose.Since the initial value wasn't carried over in the state, the driver had to set it again in
nv50_wndw_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.Cc Ben Skeggs <[email protected]>Cc Karol Herbst <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/nouveau/dispnv50/wndw.c +0
-0drivers/gpu/drm/nouveau/dispnv50/wndw.c nv50_wndw_reset(struct drm_plane *plane) · line 639
Quoted 5 lines
drivers/gpu/drm/nouveau/dispnv50/wndw.c +0
-2@@ -635,8 +635,6 @@ nv50_wndw_reset(struct drm_plane *plane) plane->funcs->atomic_destroy_state (plane, plane->state);__drm_atomic_helper_plane_reset (plane, &asyw->state); - plane->state->zpos =nv50_wndw_zpos_default (plane); - plane->state->normalized_zpos =nv50_wndw_zpos_default (plane);so reading the surrounding code a little it feels like those assignments actually do something. If my understanding is correct
plane->statepoints to&asyw->state, but asyw was just kzalloced in this function.__drm_atomic_helper_plane_resetdoesn't set the zpos ornormalized_zposfields as long aszpos_propertyis 0, so those fields won't be set with that change anymore.Quoted 6 lines
I just don't know if it's fine like that or if this function should set
zpos_propertyinstead or something. Anyway, the commit description makes it sound like that an unneeded assignment would be removed here, which doesn't seem to be the case. But I don't really know much about all the drm API interactions, so it might just be fine, mostly asking to get a better idea on how all those pieces fit together.
Quoted 9 lines
If you're looking at the code without that patch series, you're right.
These patches change that however:
https://lore.kernel.org/dri-devel/[email protected]/
https://lore.kernel.org/dri-devel/[email protected]/So, once they have been applied those assignments are made in
__drm_atomic_helper_plane_resetand are no longer relevant here.
yeah, I saw those, but I see now where I got confused: the arguments of __drm_atomic_helper_plane_reset and __drm_atomic_helper_plane_state_reset are swapped, so I thought &asyw->state being all 0 was the second arg to __drm_atomic_helper_plane_state_reset. Yeah the code is alright then.
Quoted 1 line
Maxime
Re: [PATCH v2 13/22] drm/nouveau/kms: Remove redundant zpos initialisation
In reply to Maxime RipardI assume you'll handle pushing this yourself? (JFYI - using drm-misc for pushing this is fine by me)
Quoted 30 lines · Maxime Ripard
The nouveau KMS driver will call
drm_plane_create_zpos_property()with an init value depending on the plane purpose.Since the initial value wasn't carried over in the state, the driver had to set it again in
nv50_wndw_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.Cc Ben Skeggs <[email protected]>Cc Karol Herbst <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by Maxime Ripard <[email protected]>---
drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 --1 file changed, 2 deletions(-)drivers/gpu/drm/nouveau/dispnv50/wndw.c +0
-0@@ -635,8 +635,6 @@ nv50_wndw_reset(struct drm_plane *plane) plane->funcs->atomic_destroy_state(plane, plane->state);
__drm_atomic_helper_plane_reset(plane,&asyw->state); - plane->state->zpos =nv50_wndw_zpos_default(plane); - plane->state->normalized_zpos =nv50_wndw_zpos_default(plane); }
static void
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat
Maxime Ripard
AppliedRe: (subset) [Nouveau] [PATCH v2 13/22] drm/nouveau/kms: Remove redundant zpos initialisation
In reply to Maxime RipardQuoted 8 lines · Maxime Ripard
The nouveau KMS driver will call
drm_plane_create_zpos_property()with an init value depending on the plane purpose.Since the initial value wasn't carried over in the state, the driver had to set it again in
nv50_wndw_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 14/22 drm/omap: plane: Remove redundant zpos initialisation
In reply to Maxime RipardThe omap KMS driver will call drm_plane_create_zpos_property() with an init value of the plane index and the plane type.
Since the initial value wasn't carried over in the state, the driver had to set it again in omap_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/omapdrm/omap_plane.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/gpu/drm/omapdrm/omap_plane.c +0 -7
@@ -414,13 +414,6 @@ static void omap_plane_reset(struct drm_plane *plane)return ;__drm_atomic_helper_plane_reset (plane, &omap_state->base); - -/* -* Set the zpos default depending on whether we are a primary or overlay -* plane. -*/ - plane->state->zpos = plane->type ==DRM_PLANE_TYPE_PRIMARY - ?0 : omap_plane->id; plane->state->color_encoding =DRM_COLOR_YCBCR_BT601 ; plane->state->color_range =DRM_COLOR_YCBCR_FULL_RANGE ; }
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 14/22] drm/omap: plane: Remove redundant zpos initialisation
Quoted 8 lines · Maxime Ripard
The omap KMS driver will call
drm_plane_create_zpos_property()with an init value of the plane index and the plane type.Since the initial value wasn't carried over in the state, the driver had to set it again in
omap_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 15/22 drm/rcar: plane: Remove redundant zpos initialisation
In reply to Maxime RipardThe rcar-du KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane type.
Since the initial value wasn't carried over in the state, the driver had to set it again in rcar_du_plane_reset() and rcar_du_vsp_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 1 - 2 files changed, 2 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_plane.c +0 -1
@@ -696,7 +696,6 @@ static void rcar_du_plane_reset(struct drm_plane *plane) state->hwindex =-1 ; state->source =RCAR_DU_PLANE_MEMORY ; state->colorkey =RCAR_DU_COLORKEY_NONE ; - state->state.zpos = plane->type ==DRM_PLANE_TYPE_PRIMARY ?0 :1 ; } static int rcar_du_plane_atomic_set_property(struct drm_plane *plane,
drivers/gpu/drm/rcar-du/rcar_du_vsp.c +0 -1
@@ -362,7 +362,6 @@ static void rcar_du_vsp_plane_reset(struct drm_plane *plane)return ;__drm_atomic_helper_plane_reset (plane, &state->state); - state->state.zpos = plane->type ==DRM_PLANE_TYPE_PRIMARY ?0 :1 ; }static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = {
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 15/22] drm/rcar: plane: Remove redundant zpos initialisation
Quoted 9 lines · Maxime Ripard
The rcar-du KMS driver will call
drm_plane_create_zpos_property()with an init value depending on the plane type.Since the initial value wasn't carried over in the state, the driver had to set it again in
rcar_du_plane_reset()andrcar_du_vsp_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 16/22 drm/sti: plane: Remove redundant zpos initialisation
In reply to Maxime RipardThe sti KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane type.
Since the initial value wasn't carried over in the state, the driver had to set it again in sti_plane_reset().
However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/sti/sti_cursor.c | 2 +- drivers/gpu/drm/sti/sti_gdp.c | 2 +- drivers/gpu/drm/sti/sti_hqvdp.c | 2 +- drivers/gpu/drm/sti/sti_plane.c | 6 ------ drivers/gpu/drm/sti/sti_plane.h | 1 - 5 files changed, 3 insertions(+), 10 deletions(-)
drivers/gpu/drm/sti/sti_cursor.c +1 -1
@@ -351,7 +351,7 @@ static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = drm_plane_cleanup, - .reset = sti_plane_reset, + .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .late_register = sti_cursor_late_register,
drivers/gpu/drm/sti/sti_gdp.c +1 -1
@@ -905,7 +905,7 @@ static const struct drm_plane_funcs sti_gdp_plane_helpers_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = drm_plane_cleanup, - .reset = sti_plane_reset, + .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .late_register = sti_gdp_late_register,
drivers/gpu/drm/sti/sti_hqvdp.c +1 -1
@@ -1283,7 +1283,7 @@ static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = drm_plane_cleanup, - .reset = sti_plane_reset, + .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .late_register = sti_hqvdp_late_register,
drivers/gpu/drm/sti/sti_plane.c +0 -6
@@ -112,12 +112,6 @@ static int sti_plane_get_default_zpos(enum drm_plane_type type)return 0 ; } -void sti_plane_reset (struct drm_plane *plane) -{ -drm_atomic_helper_plane_reset (plane); - plane->state->zpos =sti_plane_get_default_zpos (plane->type); -} -static void sti_plane_attach_zorder_property (struct drm_plane *drm_plane,enum drm_plane_type type) {
drivers/gpu/drm/sti/sti_plane.h +0 -1
@@ -81,5 +81,4 @@ void sti_plane_update_fps(struct sti_plane *plane,void sti_plane_init_property (struct sti_plane *plane,enum drm_plane_type type); -void sti_plane_reset (struct drm_plane *plane);#endif
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 16/22] drm/sti: plane: Remove redundant zpos initialisation
Quoted 9 lines · Maxime Ripard
The sti KMS driver will call
drm_plane_create_zpos_property()with an init value depending on the plane type.Since the initial value wasn't carried over in the state, the driver had to set it again in
sti_plane_reset().
However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 17/22 drm/sun4i: layer: Remove redundant zpos initialisation
In reply to Maxime RipardThe sun4i KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane type.
Since the initial value wasn't carried over in the state, the driver had to set it again in sun4i_backend_layer_reset().
However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/sun4i/sun4i_layer.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/sun4i/sun4i_layer.c +7 -9
@@ -18,7 +18,6 @@static void sun4i_backend_layer_reset (struct drm_plane *plane) { -struct sun4i_layer *layer =plane_to_sun4i_layer (plane);struct sun4i_layer_state *state;if (plane->state) {
@@ -31,10 +30,8 @@ static void sun4i_backend_layer_reset(struct drm_plane *plane) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { +if (state)__drm_atomic_helper_plane_reset (plane, &state->state); - plane->state->zpos = layer->id; - } } static struct drm_plane_state *
@@ -192,7 +189,8 @@ static const uint64_t sun4i_layer_modifiers[] = {static struct sun4i_layer *sun4i_layer_init_one (struct drm_device *drm,struct sun4i_backend *backend, -enum drm_plane_type type) +enum drm_plane_type type, +unsigned int id) {const uint64_t *modifiers = sun4i_layer_modifiers;const uint32_t *formats = sun4i_layer_formats;
@@ -204,6 +202,7 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,if (!layer)return ERR_PTR (-ENOMEM ); + layer->id = id; layer->backend = backend;if (IS_ERR_OR_NULL (backend->frontend)) {
@@ -226,8 +225,8 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, &sun4i_backend_layer_helper_funcs);drm_plane_create_alpha_property (&layer->plane); -drm_plane_create_zpos_property (&layer->plane,0 ,0 , -SUN4I_BACKEND_NUM_LAYERS -1 ); +drm_plane_create_zpos_property (&layer->plane, layer->id, +0 ,SUN4I_BACKEND_NUM_LAYERS -1 );return layer; }
@@ -249,14 +248,13 @@ struct drm_plane **sun4i_layers_init(struct drm_device *drm,enum drm_plane_type type = i ?DRM_PLANE_TYPE_OVERLAY :DRM_PLANE_TYPE_PRIMARY ;struct sun4i_layer *layer; - layer =sun4i_layer_init_one (drm, backend, type); + layer =sun4i_layer_init_one (drm, backend, type, i);if (IS_ERR (layer)) {dev_err (drm->dev,"Couldn't initialize %s plane\n" , i ?"overlay" :"primary" );return ERR_CAST (layer); } - layer->id = i; planes[i] = &layer->plane; }
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 17/22] drm/sun4i: layer: Remove redundant zpos initialisation
Quoted 9 lines · Maxime Ripard
The sun4i KMS driver will call
drm_plane_create_zpos_property()with an init value depending on the plane type.Since the initial value wasn't carried over in the state, the driver had to set it again in
sun4i_backend_layer_reset().
However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 18/22 drm/object: Add default color encoding and range value at reset
In reply to Maxime RipardFrom: Dave Stevenson <[email protected]>
The drm_plane_create_color_properties() function asks for an initial value for the color encoding and range, and will set the associated plane state variable with that value if a state is present.
However, that function is usually called at a time where there's no state yet. Since the drm_plane_state reset helper doesn't take care of reading that value when it's called, it means that in most cases the initial value will be 0 (so DRM_COLOR_YCBCR_BT601 and DRM_COLOR_YCBCR_LIMITED_RANGE, respectively), or the drivers will have to work around it.
Let's add some code in __drm_atomic_helper_plane_state_reset() to get the initial encoding and range value if the property has been attached in order to fix this.
--- drivers/gpu/drm/drm_atomic_state_helper.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/drm_atomic_state_helper.c +14 -0
@@ -251,6 +251,20 @@ void __drm_atomic_helper_plane_state_reset(struct drm_plane_state *plane_state, plane_state->alpha =DRM_BLEND_ALPHA_OPAQUE ; plane_state->pixel_blend_mode =DRM_MODE_BLEND_PREMULTI ; +if (plane->color_encoding_property) { +if (!drm_object_property_get_default_value (&plane->base, + plane->color_encoding_property, + &val)) + plane_state->color_encoding = val; + } + +if (plane->color_range_property) { +if (!drm_object_property_get_default_value (&plane->base, + plane->color_range_property, + &val)) + plane_state->color_range = val; + } + if (plane->zpos_property) { if (!drm_object_property_get_default_value(&plane->base, plane->zpos_property,
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 18/22] drm/object: Add default color encoding and range value at reset
Quoted 6 lines · Maxime Ripard
From: Dave Stevenson <[email protected]>
The
drm_plane_create_color_properties()function asks for an initial value for the color encoding and range, and will set the associated plane state variable with that value if a state is present.
Quoted 8 lines
However, that function is usually called at a time where there's no state yet. Since the
drm_plane_statereset helper doesn't take care of reading that value when it's called, it means that in most cases the initial value will be 0 (soDRM_COLOR_YCBCR_BT601andDRM_COLOR_YCBCR_LIMITED_RANGE, respectively), or the drivers will have to work around it.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 19/22 drm/komeda: plane: Remove redundant color encoding and range initialisation
In reply to Maxime RipardThe komeda KMS driver will call drm_plane_create_color_properties() with a default encoding and range values of BT601 and Limited Range, respectively.
Since the initial value wasn't carried over in the state, the driver had to set it again in komeda_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_plane.c +1 -4
@@ -143,11 +143,8 @@ static void komeda_plane_reset(struct drm_plane *plane) plane->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { +if (state)__drm_atomic_helper_plane_reset (plane, &state->base); - state->base.color_encoding =DRM_COLOR_YCBCR_BT601 ; - state->base.color_range =DRM_COLOR_YCBCR_LIMITED_RANGE ; - } } static struct drm_plane_state *
Signature · 1 line
2.35.1
Re: [PATCH v2 19/22] drm/komeda: plane: Remove redundant color encoding and range initialisation
Quoted 8 lines · Maxime Ripard
The komeda KMS driver will call
drm_plane_create_color_properties()with a default encoding and range values of BT601 and Limited Range, respectively.Since the initial value wasn't carried over in the state, the driver had to set it again in
komeda_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
Quoted 5 lines
Cc Brian Starkey <[email protected]>Cc "James (Qian) Wang" <[email protected]>Cc Liviu Dudau <[email protected]>Cc Mihail Atanassov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
Neat splitting of changes even if the removed lines were consecutive, thanks!
Best regards,
Liviu
Quoted 24 lines
--- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/arm/display/komeda/komeda_plane.c +1
-4@@ -143,11 +143,8 @@ static void komeda_plane_reset(struct drm_plane *plane) plane->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { +if (state)__drm_atomic_helper_plane_reset (plane, &state->base); - state->base.color_encoding =DRM_COLOR_YCBCR_BT601 ; - state->base.color_range =DRM_COLOR_YCBCR_LIMITED_RANGE ; - } } static struct drm_plane_state *Signature · 1 line
2.35.1
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Maxime Ripard
AppliedRe: (subset) [PATCH v2 19/22] drm/komeda: plane: Remove redundant color encoding and range initialisation
In reply to Maxime RipardQuoted 9 lines · Maxime Ripard
The komeda KMS driver will call
drm_plane_create_color_properties()with a default encoding and range values of BT601 and Limited Range, respectively.Since the initial value wasn't carried over in the state, the driver had to set it again in
komeda_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
PATCH v2 20/22 drm/armada: overlay: Remove redundant color encoding and range initialisation
In reply to Maxime RipardThe armada KMS driver will call drm_plane_create_color_properties() with a default encoding and range values of BT601 and Limited Range, respectively.
Since the initial value wasn't carried over in the state, the driver had to set it again in armada_overlay_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/armada/armada_overlay.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/armada/armada_overlay.c +0 -2
@@ -325,8 +325,6 @@ static void armada_overlay_reset(struct drm_plane *plane) state->contrast =DEFAULT_CONTRAST ; state->saturation =DEFAULT_SATURATION ;__drm_atomic_helper_plane_reset (plane, &state->base.base); - state->base.base.color_encoding =DEFAULT_ENCODING ; - state->base.base.color_range =DRM_COLOR_YCBCR_LIMITED_RANGE ; } }
Signature · 1 line
2.35.1
PATCH v2 21/22 drm/imx: ipuv3-plane: Remove redundant color encoding and range initialisation
In reply to Maxime RipardThe imx KMS driver will call drm_plane_create_color_properties() with a default encoding and range values of BT601 and Limited Range, respectively.
Since the initial value wasn't carried over in the state, the driver had to set it again in ipu_plane_state_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/imx/ipuv3-plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/imx/ipuv3-plane.c +1 -4
@@ -308,11 +308,8 @@ static void ipu_plane_state_reset(struct drm_plane *plane) ipu_state =kzalloc (sizeof (*ipu_state),GFP_KERNEL ); -if (ipu_state) { +if (ipu_state)__drm_atomic_helper_plane_reset (plane, &ipu_state->base); - ipu_state->base.color_encoding =DRM_COLOR_YCBCR_BT601 ; - ipu_state->base.color_range =DRM_COLOR_YCBCR_LIMITED_RANGE ; - } } static struct drm_plane_state *
Signature · 1 line
2.35.1
PATCH v2 22/22 drm/omap: plane: Remove redundant color encoding and range initialisation
In reply to Maxime RipardThe omap KMS driver will call drm_plane_create_color_properties() with a default encoding and range values of BT601 and Full Range, respectively.
Since the initial value wasn't carried over in the state, the driver had to set it again in omap_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.
--- drivers/gpu/drm/omapdrm/omap_plane.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/omapdrm/omap_plane.c +0 -3
@@ -403,7 +403,6 @@ void omap_plane_install_properties(struct drm_plane *plane,static void omap_plane_reset (struct drm_plane *plane) { -struct omap_plane *omap_plane =to_omap_plane (plane);struct omap_plane_state *omap_state;if (plane->state)
@@ -414,8 +413,6 @@ static void omap_plane_reset(struct drm_plane *plane)return ;__drm_atomic_helper_plane_reset (plane, &omap_state->base); - plane->state->color_encoding =DRM_COLOR_YCBCR_BT601 ; - plane->state->color_range =DRM_COLOR_YCBCR_FULL_RANGE ; } static struct drm_plane_state *
Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH v2 22/22] drm/omap: plane: Remove redundant color encoding and range initialisation
Quoted 9 lines · Maxime Ripard
The omap KMS driver will call
drm_plane_create_color_properties()with a default encoding and range values of BT601 and Full Range, respectively.Since the initial value wasn't carried over in the state, the driver had to set it again in
omap_plane_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime