Removing unnecessary initialization of drm_plane struct type
Subsystems (3)
cover Removing unnecessary initialization of drm_plane struct type
From: Kevin Brace <[email protected]>
Patch 1 is to use uint32_t type for possible_crtcs. Patch 2 through 4 removes unnecessary write to type field of drm_plane struct. drm_universal_plane_init() initializes type field, so initializing it outside of DRM core is unnecessary. I have not tested the patches myself since I do not have the equipment set up to run AMDGPU DRM. I hope someone from AMD can test the patches. Patch 2 through 4 do depend on patch 1.
--
Kevin Brace (4):
drm/amdgpu: uint32_t for amdgpu_dm_plane_init() possible_crtcs
parameter
drm/amdgpu: Rename plane_type parameter of initialize_plane() to type drm/amdgpu: Add type parameter to amdgpu_dm_plane_init() drm/amdgpu: Remove unnecessary write to type field of drm_plane struct
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/4 drm/amdgpu: uint32_t for amdgpu_dm_plane_init() possible_crtcs parameter
From: Kevin Brace <[email protected]>
possible_crtcs parameter of amdgpu_dm_plane_init() is an unsigned long type, but the one drm_universal_plane_init() of DRM core has is a uint32_t type. possible_crtcs parameter is ultimately passed over to drm_universal_plane_init().
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -3
@@ -111,7 +111,7 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector);static int amdgpu_dm_plane_init (struct amdgpu_display_manager *dm,struct drm_plane *plane, -unsigned long possible_crtcs, +uint32_t possible_crtcs,const struct dc_plane_cap *plane_cap); static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, struct drm_plane *plane,
@@ -1989,7 +1989,7 @@ static int initialize_plane(struct amdgpu_display_manager *dm, const struct dc_plane_cap *plane_cap) {struct drm_plane *plane; -unsigned long possible_crtcs; +uint32_t possible_crtcs;int ret =0 ; plane =kzalloc (sizeof (struct drm_plane ),GFP_KERNEL );
@@ -4328,7 +4328,7 @@ static int get_plane_formats(const struct drm_plane *plane,static int amdgpu_dm_plane_init (struct amdgpu_display_manager *dm,struct drm_plane *plane, -unsigned long possible_crtcs, +uint32_t possible_crtcs,const struct dc_plane_cap *plane_cap) {uint32_t formats[32 ];
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/4 drm/amdgpu: Rename plane_type parameter of initialize_plane() to type
In reply to a message not in the archiveFrom: Kevin Brace <[email protected]>
Matching the type parameter of drm_universal_plane_init().
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -2
@@ -1985,7 +1985,7 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm)static int initialize_plane (struct amdgpu_display_manager *dm,struct amdgpu_mode_info *mode_info,int plane_id, -enum drm_plane_type plane_type, +enum drm_plane_type type,const struct dc_plane_cap *plane_cap) {struct drm_plane *plane;
@@ -1997,7 +1997,7 @@ static int initialize_plane(struct amdgpu_display_manager *dm,DRM_ERROR ("KMS: Failed to allocate plane\n" );return -ENOMEM ; } - plane->type = plane_type; + plane->type = type;/* * HACK: IGT tests expect that the primary plane for a CRTC
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amdgpu: Add type parameter to amdgpu_dm_plane_init()
In reply to a message not in the archiveFrom: Kevin Brace <[email protected]>
Ultimately, type parameter is consumed by drm_universal_plane_init().
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -3
@@ -112,6 +112,7 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector);static int amdgpu_dm_plane_init (struct amdgpu_display_manager *dm,struct drm_plane *plane,uint32_t possible_crtcs, +enum drm_plane_type type,const struct dc_plane_cap *plane_cap); static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, struct drm_plane *plane,
@@ -2009,7 +2010,8 @@ static int initialize_plane(struct amdgpu_display_manager *dm,if (plane_id >= dm->dc->caps.max_streams) possible_crtcs =0xff ; - ret =amdgpu_dm_plane_init (dm, plane, possible_crtcs, plane_cap); + ret =amdgpu_dm_plane_init (dm, plane, possible_crtcs, + type, plane_cap);if (ret) {DRM_ERROR ("KMS: Failed to initialize plane\n" );
@@ -4329,6 +4331,7 @@ static int get_plane_formats(const struct drm_plane *plane,static int amdgpu_dm_plane_init (struct amdgpu_display_manager *dm,struct drm_plane *plane,uint32_t possible_crtcs, +enum drm_plane_type type,const struct dc_plane_cap *plane_cap) {uint32_t formats[32 ];
@@ -4340,7 +4343,7 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, res =drm_universal_plane_init (dm->adev->ddev, plane, possible_crtcs, &dm_plane_funcs, formats, num_formats, -NULL , plane->type,NULL ); +NULL , type,NULL );if (res)return res;
@@ -4388,7 +4391,8 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, goto fail; cursor_plane->type =DRM_PLANE_TYPE_CURSOR ; - res =amdgpu_dm_plane_init (dm, cursor_plane,0 ,NULL ); + res =amdgpu_dm_plane_init (dm, cursor_plane,0 , +DRM_PLANE_TYPE_CURSOR ,NULL ); acrtc =kzalloc (sizeof (struct amdgpu_crtc ),GFP_KERNEL );if (!acrtc)
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amdgpu: Remove unnecessary write to type field of drm_plane struct
In reply to a message not in the archiveFrom: Kevin Brace <[email protected]>
drm_universal_plane_init() of DRM core sets type field of drm_plane struct. Hence, it is redundant to do so prior to calling drm_universal_plane_init().
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -2
@@ -1998,7 +1998,6 @@ static int initialize_plane(struct amdgpu_display_manager *dm,DRM_ERROR ("KMS: Failed to allocate plane\n" );return -ENOMEM ; } - plane->type = type;/* * HACK: IGT tests expect that the primary plane for a CRTC
@@ -4390,7 +4389,6 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,if (!cursor_plane) goto fail; - cursor_plane->type =DRM_PLANE_TYPE_CURSOR ; res =amdgpu_dm_plane_init (dm, cursor_plane,0 ,DRM_PLANE_TYPE_CURSOR ,NULL );
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx