All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vishwakarma, Pratik" <Pratik.Vishwakarma-5C7GfCeVMHo@public.gmane.org>
To: "Lakha,
	Bhawanpreet" <Bhawanpreet.Lakha-5C7GfCeVMHo@public.gmane.org>,
	"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: "Kazlauskas,
	Nicholas" <Nicholas.Kazlauskas-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH 07/18] drm/amd/display: Create overlay planes
Date: Wed, 27 Feb 2019 04:03:45 +0000	[thread overview]
Message-ID: <390d83da-8de3-08df-4215-e9f2e4502ee8@amd.com> (raw)
In-Reply-To: <20190225224615.4507-8-Bhawanpreet.Lakha-5C7GfCeVMHo@public.gmane.org>


On 2/26/2019 4:16 AM, Bhawanpreet Lakha wrote:
> From: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
>
> [Why]
> Raven has support for combining pipes for DRM_PLANE_TYPE_OVERLAY use
> but no overlays are exposed to userspace.
>
> [How]
> Expose overlay planes based on DC plane caps.
>
> If all the pipes are in use then the atomic commits can fail, but this
> is expected behavior for userspace.
>
> Only support RGB on overlays for now.
>
> Change-Id: Idca78fafefd7ccb2bd5f1a05901d1c9da1a2decb
> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
> Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
> ---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 51 ++++++++++++++++---
>   1 file changed, 44 insertions(+), 7 deletions(-)
>
> 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 dc7124e60b27..25cd7970114d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1892,7 +1892,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
>   	struct amdgpu_encoder *aencoder = NULL;
>   	struct amdgpu_mode_info *mode_info = &adev->mode_info;
>   	uint32_t link_cnt;
> -	int32_t primary_planes;
> +	int32_t overlay_planes, primary_planes, total_planes;
>   	enum dc_connection_type new_connection_type = dc_connection_none;
>   
>   	link_cnt = dm->dc->caps.max_links;
> @@ -1901,9 +1901,29 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
>   		return -EINVAL;
>   	}
>   
> +	/*
> +	 * Determine the number of overlay planes supported.
> +	 * Only support DCN for now, and cap so we don't encourage
> +	 * userspace to use up all the planes.
> +	 */
> +	overlay_planes = 0;
> +
> +	for (i = 0; i < dm->dc->caps.max_planes; ++i) {
> +		struct dc_plane_cap *plane = &dm->dc->caps.planes[i];
> +
> +		if (plane->type == DC_PLANE_TYPE_DCN_UNIVERSAL &&
> +		    plane->blends_with_above && plane->blends_with_below &&
> +		    plane->supports_argb8888)
> +			overlay_planes += 1;
> +	}
> +
> +	overlay_planes = min(overlay_planes, 1);
> +
>   	/* There is one primary plane per CRTC */
>   	primary_planes = dm->dc->caps.max_streams;
> -	ASSERT(primary_planes < AMDGPU_MAX_PLANES);
> +
> +	total_planes = primary_planes + overlay_planes;
> +	ASSERT(total_planes < AMDGPU_MAX_PLANES);
>   
>   	/*
>   	 * Initialize primary planes, implicit planes for legacy IOCTLS.
> @@ -1917,6 +1937,20 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
>   		}
>   	}
>   
> +	/*
> +	 * Initialize overlay planes, index starting after primary planes.
> +	 * These planes have a higher DRM index than the primary planes since
> +	 * they should be considered as having a higher z-order.
> +	 * Order is reversed to match iteration order in atomic check.
> +	 */
> +	for (i = (overlay_planes - 1); i >= 0; i--) {
> +		if (initialize_plane(dm, mode_info, primary_planes + i,
> +				     DRM_PLANE_TYPE_OVERLAY)) {
> +			DRM_ERROR("KMS: Failed to initialize overlay plane\n");
> +			goto fail;
> +		}
> +	}
> +
Wouldn't the above change affect dm_update_planes_state which uses 
for_each_oldnew_plane_in_state_reverse to add planes in reverse order?
>   	for (i = 0; i < dm->dc->caps.max_streams; i++)
>   		if (amdgpu_dm_crtc_init(dm, mode_info->planes[i], i)) {
>   			DRM_ERROR("KMS: Failed to initialize crtc\n");
> @@ -3876,9 +3910,12 @@ static const uint32_t rgb_formats[] = {
>   	DRM_FORMAT_ABGR8888,
>   };
>   
> -static const uint32_t yuv_formats[] = {
> -	DRM_FORMAT_NV12,
> -	DRM_FORMAT_NV21,
> +static const uint32_t overlay_formats[] = {
> +	DRM_FORMAT_XRGB8888,
> +	DRM_FORMAT_ARGB8888,
> +	DRM_FORMAT_RGBA8888,
> +	DRM_FORMAT_XBGR8888,
> +	DRM_FORMAT_ABGR8888,
>   };
>   
>   static const u32 cursor_formats[] = {
> @@ -3908,8 +3945,8 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>   				plane,
>   				possible_crtcs,
>   				&dm_plane_funcs,
> -				yuv_formats,
> -				ARRAY_SIZE(yuv_formats),
> +				overlay_formats,
> +				ARRAY_SIZE(overlay_formats),
>   				NULL, plane->type, NULL);
>   		break;
>   	case DRM_PLANE_TYPE_CURSOR:
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-02-27  4:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-25 22:45 [PATCH 00/18] DC Patches 25 Feb 2019 Bhawanpreet Lakha
     [not found] ` <20190225224615.4507-1-Bhawanpreet.Lakha-5C7GfCeVMHo@public.gmane.org>
2019-02-25 22:45   ` [PATCH 01/18] drm/amd/display: add full update commit hint struct Bhawanpreet Lakha
2019-02-25 22:45   ` [PATCH 02/18] drm/amd/display: Add function to create 4d19 fixed point Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 03/18] drm/amd/display: Respect aux return values Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 04/18] drm/amd/display: Set stream->mode_changed when connectors change Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 05/18] drm/amd/display: Add plane capabilities to dc_caps Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 06/18] drm/amd/display: Drop underlay plane support Bhawanpreet Lakha
     [not found]     ` <20190225224615.4507-7-Bhawanpreet.Lakha-5C7GfCeVMHo@public.gmane.org>
2019-03-05 17:09       ` Michel Dänzer
     [not found]         ` <daf986ad-a939-05d2-8ee5-e103727d6b1d-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-03-05 17:15           ` Kazlauskas, Nicholas
2019-02-25 22:46   ` [PATCH 07/18] drm/amd/display: Create overlay planes Bhawanpreet Lakha
     [not found]     ` <20190225224615.4507-8-Bhawanpreet.Lakha-5C7GfCeVMHo@public.gmane.org>
2019-02-27  4:03       ` Vishwakarma, Pratik [this message]
     [not found]         ` <390d83da-8de3-08df-4215-e9f2e4502ee8-5C7GfCeVMHo@public.gmane.org>
2019-02-27 12:50           ` Nicholas Kazlauskas
2019-02-25 22:46   ` [PATCH 08/18] drm/amd/display: Allow pflips from a framebuffer to itself Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 09/18] drm/amd/display: Refactor pageflips plane commit Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 10/18] drm/amd/display: Keep clocks high before seamless boot done Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 11/18] drm/amd/display: half bandwidth for YCbCr420 during validation Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 12/18] Revert "drm/amd/display: dcn add check surface in_use" Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 13/18] drm/amd/display: Re-add custom degamma support Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 14/18] drm/amd/display: Update plane tiling attributes for stream updates Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 15/18] drm/amd/display: Fix soft hang issue when some DPCD data invalid Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 16/18] drm/amd/display: 3.2.20 Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 17/18] drm/amd/display: Add pp_smu null pointer check Bhawanpreet Lakha
2019-02-25 22:46   ` [PATCH 18/18] drm/amd/display: Fix Divide by 0 in memory calculations Bhawanpreet Lakha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=390d83da-8de3-08df-4215-e9f2e4502ee8@amd.com \
    --to=pratik.vishwakarma-5c7gfcevmho@public.gmane.org \
    --cc=Bhawanpreet.Lakha-5C7GfCeVMHo@public.gmane.org \
    --cc=Nicholas.Kazlauskas-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.