* [PATCH 1/2] drm/amdgpu: Drop amdgpu_plane
@ 2018-11-05 20:45 Harry Wentland
[not found] ` <20181105204509.19179-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Harry Wentland @ 2018-11-05 20:45 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Harry Wentland
It's unnecessarily duplicating drm_plane_type.
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 8 +---
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 38 +++++++++----------
2 files changed, 20 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index f91a9bdcd63c..1627dd3413c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -57,7 +57,6 @@ struct amdgpu_hpd;
#define to_amdgpu_connector(x) container_of(x, struct amdgpu_connector, base)
#define to_amdgpu_encoder(x) container_of(x, struct amdgpu_encoder, base)
#define to_amdgpu_framebuffer(x) container_of(x, struct amdgpu_framebuffer, base)
-#define to_amdgpu_plane(x) container_of(x, struct amdgpu_plane, base)
#define to_dm_plane_state(x) container_of(x, struct dm_plane_state, base);
@@ -325,7 +324,7 @@ struct amdgpu_mode_info {
struct card_info *atom_card_info;
bool mode_config_initialized;
struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS];
- struct amdgpu_plane *planes[AMDGPU_MAX_PLANES];
+ struct drm_plane *planes[AMDGPU_MAX_PLANES];
struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS];
/* DVI-I properties */
struct drm_property *coherent_mode_property;
@@ -438,11 +437,6 @@ struct amdgpu_crtc {
struct drm_pending_vblank_event *event;
};
-struct amdgpu_plane {
- struct drm_plane base;
- enum drm_plane_type plane_type;
-};
-
struct amdgpu_encoder_atom_dig {
bool linkb;
/* atom dig */
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index f8ec8a146663..595ed8a757d3 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -105,7 +105,7 @@ static void
amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector);
static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
- struct amdgpu_plane *aplane,
+ struct drm_plane *plane,
unsigned long possible_crtcs);
static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
struct drm_plane *plane,
@@ -1633,18 +1633,18 @@ static int initialize_plane(struct amdgpu_display_manager *dm,
struct amdgpu_mode_info *mode_info,
int plane_id)
{
- struct amdgpu_plane *plane;
+ struct drm_plane *plane;
unsigned long possible_crtcs;
int ret = 0;
- plane = kzalloc(sizeof(struct amdgpu_plane), GFP_KERNEL);
+ plane = kzalloc(sizeof(struct drm_plane), GFP_KERNEL);
mode_info->planes[plane_id] = plane;
if (!plane) {
DRM_ERROR("KMS: Failed to allocate plane\n");
return -ENOMEM;
}
- plane->base.type = mode_info->plane_type[plane_id];
+ plane->type = mode_info->plane_type[plane_id];
/*
* HACK: IGT tests expect that each plane can only have
@@ -1735,7 +1735,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
}
for (i = 0; i < dm->dc->caps.max_streams; i++)
- if (amdgpu_dm_crtc_init(dm, &mode_info->planes[i]->base, i)) {
+ if (amdgpu_dm_crtc_init(dm, mode_info->planes[i], i)) {
DRM_ERROR("KMS: Failed to initialize crtc\n");
goto fail;
}
@@ -3532,49 +3532,49 @@ static const u32 cursor_formats[] = {
};
static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
- struct amdgpu_plane *aplane,
+ struct drm_plane *plane,
unsigned long possible_crtcs)
{
int res = -EPERM;
- switch (aplane->base.type) {
+ switch (plane->type) {
case DRM_PLANE_TYPE_PRIMARY:
res = drm_universal_plane_init(
dm->adev->ddev,
- &aplane->base,
+ plane,
possible_crtcs,
&dm_plane_funcs,
rgb_formats,
ARRAY_SIZE(rgb_formats),
- NULL, aplane->base.type, NULL);
+ NULL, plane->type, NULL);
break;
case DRM_PLANE_TYPE_OVERLAY:
res = drm_universal_plane_init(
dm->adev->ddev,
- &aplane->base,
+ plane,
possible_crtcs,
&dm_plane_funcs,
yuv_formats,
ARRAY_SIZE(yuv_formats),
- NULL, aplane->base.type, NULL);
+ NULL, plane->type, NULL);
break;
case DRM_PLANE_TYPE_CURSOR:
res = drm_universal_plane_init(
dm->adev->ddev,
- &aplane->base,
+ plane,
possible_crtcs,
&dm_plane_funcs,
cursor_formats,
ARRAY_SIZE(cursor_formats),
- NULL, aplane->base.type, NULL);
+ NULL, plane->type, NULL);
break;
}
- drm_plane_helper_add(&aplane->base, &dm_plane_helper_funcs);
+ drm_plane_helper_add(plane, &dm_plane_helper_funcs);
/* Create (reset) the plane state */
- if (aplane->base.funcs->reset)
- aplane->base.funcs->reset(&aplane->base);
+ if (plane->funcs->reset)
+ plane->funcs->reset(plane);
return res;
@@ -3585,7 +3585,7 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
uint32_t crtc_index)
{
struct amdgpu_crtc *acrtc = NULL;
- struct amdgpu_plane *cursor_plane;
+ struct drm_plane *cursor_plane;
int res = -ENOMEM;
@@ -3593,7 +3593,7 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
if (!cursor_plane)
goto fail;
- cursor_plane->base.type = DRM_PLANE_TYPE_CURSOR;
+ cursor_plane->type = DRM_PLANE_TYPE_CURSOR;
res = amdgpu_dm_plane_init(dm, cursor_plane, 0);
acrtc = kzalloc(sizeof(struct amdgpu_crtc), GFP_KERNEL);
@@ -3604,7 +3604,7 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
dm->ddev,
&acrtc->base,
plane,
- &cursor_plane->base,
+ cursor_plane,
&amdgpu_dm_crtc_funcs, NULL);
if (res)
--
2.19.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/amd/display: Stop leaking planes
[not found] ` <20181105204509.19179-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
@ 2018-11-05 20:45 ` Harry Wentland
[not found] ` <20181105204509.19179-2-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2018-11-05 20:52 ` [PATCH 1/2] drm/amdgpu: Drop amdgpu_plane Deucher, Alexander
1 sibling, 1 reply; 4+ messages in thread
From: Harry Wentland @ 2018-11-05 20:45 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Harry Wentland
[Why]
drm_plane_cleanup does not free the plane.
[How]
Call drm_primary_helper_destroy which will also free the plane.
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 595ed8a757d3..2625cba27cda 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3371,7 +3371,7 @@ void dm_drm_plane_destroy_state(struct drm_plane *plane,
static const struct drm_plane_funcs dm_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
- .destroy = drm_plane_cleanup,
+ .destroy = drm_primary_helper_destroy,
.reset = dm_drm_plane_reset,
.atomic_duplicate_state = dm_drm_plane_duplicate_state,
.atomic_destroy_state = dm_drm_plane_destroy_state,
--
2.19.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH 2/2] drm/amd/display: Stop leaking planes
[not found] ` <20181105204509.19179-2-harry.wentland-5C7GfCeVMHo@public.gmane.org>
@ 2018-11-05 20:52 ` Deucher, Alexander
0 siblings, 0 replies; 4+ messages in thread
From: Deucher, Alexander @ 2018-11-05 20:52 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Wentland, Harry
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> Harry Wentland
> Sent: Monday, November 5, 2018 3:45 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Wentland, Harry <Harry.Wentland@amd.com>
> Subject: [PATCH 2/2] drm/amd/display: Stop leaking planes
>
> [Why]
> drm_plane_cleanup does not free the plane.
>
> [How]
> Call drm_primary_helper_destroy which will also free the plane.
>
> Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 595ed8a757d3..2625cba27cda 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3371,7 +3371,7 @@ void dm_drm_plane_destroy_state(struct
> drm_plane *plane, static const struct drm_plane_funcs dm_plane_funcs = {
> .update_plane = drm_atomic_helper_update_plane,
> .disable_plane = drm_atomic_helper_disable_plane,
> - .destroy = drm_plane_cleanup,
> + .destroy = drm_primary_helper_destroy,
> .reset = dm_drm_plane_reset,
> .atomic_duplicate_state = dm_drm_plane_duplicate_state,
> .atomic_destroy_state = dm_drm_plane_destroy_state,
> --
> 2.19.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 1/2] drm/amdgpu: Drop amdgpu_plane
[not found] ` <20181105204509.19179-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2018-11-05 20:45 ` [PATCH 2/2] drm/amd/display: Stop leaking planes Harry Wentland
@ 2018-11-05 20:52 ` Deucher, Alexander
1 sibling, 0 replies; 4+ messages in thread
From: Deucher, Alexander @ 2018-11-05 20:52 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Wentland, Harry
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> Harry Wentland
> Sent: Monday, November 5, 2018 3:45 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Wentland, Harry <Harry.Wentland@amd.com>
> Subject: [PATCH 1/2] drm/amdgpu: Drop amdgpu_plane
>
> It's unnecessarily duplicating drm_plane_type.
>
> Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 8 +---
> .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 38 +++++++++------
> ----
> 2 files changed, 20 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index f91a9bdcd63c..1627dd3413c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -57,7 +57,6 @@ struct amdgpu_hpd;
> #define to_amdgpu_connector(x) container_of(x, struct
> amdgpu_connector, base)
> #define to_amdgpu_encoder(x) container_of(x, struct amdgpu_encoder,
> base)
> #define to_amdgpu_framebuffer(x) container_of(x, struct
> amdgpu_framebuffer, base)
> -#define to_amdgpu_plane(x) container_of(x, struct amdgpu_plane, base)
>
> #define to_dm_plane_state(x) container_of(x, struct
> dm_plane_state, base);
>
> @@ -325,7 +324,7 @@ struct amdgpu_mode_info {
> struct card_info *atom_card_info;
> bool mode_config_initialized;
> struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS];
> - struct amdgpu_plane *planes[AMDGPU_MAX_PLANES];
> + struct drm_plane *planes[AMDGPU_MAX_PLANES];
> struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS];
> /* DVI-I properties */
> struct drm_property *coherent_mode_property;
> @@ -438,11 +437,6 @@ struct amdgpu_crtc {
> struct drm_pending_vblank_event *event;
> };
>
> -struct amdgpu_plane {
> - struct drm_plane base;
> - enum drm_plane_type plane_type;
> -};
> -
> struct amdgpu_encoder_atom_dig {
> bool linkb;
> /* atom dig */
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index f8ec8a146663..595ed8a757d3 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -105,7 +105,7 @@ static void
> amdgpu_dm_update_connector_after_detect(struct
> amdgpu_dm_connector *aconnector);
>
> static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
> - struct amdgpu_plane *aplane,
> + struct drm_plane *plane,
> unsigned long possible_crtcs);
> static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
> struct drm_plane *plane,
> @@ -1633,18 +1633,18 @@ static int initialize_plane(struct
> amdgpu_display_manager *dm,
> struct amdgpu_mode_info *mode_info,
> int plane_id)
> {
> - struct amdgpu_plane *plane;
> + struct drm_plane *plane;
> unsigned long possible_crtcs;
> int ret = 0;
>
> - plane = kzalloc(sizeof(struct amdgpu_plane), GFP_KERNEL);
> + plane = kzalloc(sizeof(struct drm_plane), GFP_KERNEL);
> mode_info->planes[plane_id] = plane;
>
> if (!plane) {
> DRM_ERROR("KMS: Failed to allocate plane\n");
> return -ENOMEM;
> }
> - plane->base.type = mode_info->plane_type[plane_id];
> + plane->type = mode_info->plane_type[plane_id];
>
> /*
> * HACK: IGT tests expect that each plane can only have
> @@ -1735,7 +1735,7 @@ static int amdgpu_dm_initialize_drm_device(struct
> amdgpu_device *adev)
> }
>
> for (i = 0; i < dm->dc->caps.max_streams; i++)
> - if (amdgpu_dm_crtc_init(dm, &mode_info->planes[i]->base,
> i)) {
> + if (amdgpu_dm_crtc_init(dm, mode_info->planes[i], i)) {
> DRM_ERROR("KMS: Failed to initialize crtc\n");
> goto fail;
> }
> @@ -3532,49 +3532,49 @@ static const u32 cursor_formats[] = {
> };
>
> static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
> - struct amdgpu_plane *aplane,
> + struct drm_plane *plane,
> unsigned long possible_crtcs)
> {
> int res = -EPERM;
>
> - switch (aplane->base.type) {
> + switch (plane->type) {
> case DRM_PLANE_TYPE_PRIMARY:
> res = drm_universal_plane_init(
> dm->adev->ddev,
> - &aplane->base,
> + plane,
> possible_crtcs,
> &dm_plane_funcs,
> rgb_formats,
> ARRAY_SIZE(rgb_formats),
> - NULL, aplane->base.type, NULL);
> + NULL, plane->type, NULL);
> break;
> case DRM_PLANE_TYPE_OVERLAY:
> res = drm_universal_plane_init(
> dm->adev->ddev,
> - &aplane->base,
> + plane,
> possible_crtcs,
> &dm_plane_funcs,
> yuv_formats,
> ARRAY_SIZE(yuv_formats),
> - NULL, aplane->base.type, NULL);
> + NULL, plane->type, NULL);
> break;
> case DRM_PLANE_TYPE_CURSOR:
> res = drm_universal_plane_init(
> dm->adev->ddev,
> - &aplane->base,
> + plane,
> possible_crtcs,
> &dm_plane_funcs,
> cursor_formats,
> ARRAY_SIZE(cursor_formats),
> - NULL, aplane->base.type, NULL);
> + NULL, plane->type, NULL);
> break;
> }
>
> - drm_plane_helper_add(&aplane->base, &dm_plane_helper_funcs);
> + drm_plane_helper_add(plane, &dm_plane_helper_funcs);
>
> /* Create (reset) the plane state */
> - if (aplane->base.funcs->reset)
> - aplane->base.funcs->reset(&aplane->base);
> + if (plane->funcs->reset)
> + plane->funcs->reset(plane);
>
>
> return res;
> @@ -3585,7 +3585,7 @@ static int amdgpu_dm_crtc_init(struct
> amdgpu_display_manager *dm,
> uint32_t crtc_index)
> {
> struct amdgpu_crtc *acrtc = NULL;
> - struct amdgpu_plane *cursor_plane;
> + struct drm_plane *cursor_plane;
>
> int res = -ENOMEM;
>
> @@ -3593,7 +3593,7 @@ static int amdgpu_dm_crtc_init(struct
> amdgpu_display_manager *dm,
> if (!cursor_plane)
> goto fail;
>
> - cursor_plane->base.type = DRM_PLANE_TYPE_CURSOR;
> + cursor_plane->type = DRM_PLANE_TYPE_CURSOR;
> res = amdgpu_dm_plane_init(dm, cursor_plane, 0);
>
> acrtc = kzalloc(sizeof(struct amdgpu_crtc), GFP_KERNEL);
> @@ -3604,7 +3604,7 @@ static int amdgpu_dm_crtc_init(struct
> amdgpu_display_manager *dm,
> dm->ddev,
> &acrtc->base,
> plane,
> - &cursor_plane->base,
> + cursor_plane,
> &amdgpu_dm_crtc_funcs, NULL);
>
> if (res)
> --
> 2.19.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-05 20:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 20:45 [PATCH 1/2] drm/amdgpu: Drop amdgpu_plane Harry Wentland
[not found] ` <20181105204509.19179-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2018-11-05 20:45 ` [PATCH 2/2] drm/amd/display: Stop leaking planes Harry Wentland
[not found] ` <20181105204509.19179-2-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2018-11-05 20:52 ` Deucher, Alexander
2018-11-05 20:52 ` [PATCH 1/2] drm/amdgpu: Drop amdgpu_plane Deucher, Alexander
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.