Re: [PATCH 01/15] drm/amdgpu: Add encoder atomic check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Haven't looked at these quite yet, but I just wanted to say ahead of time that
from a quick glance these look like a big step in the right direction :).
Awesome work!

I will review this ASAP 

On Wed, 2019-09-18 at 16:26 -0400, mikita.lipski@xxxxxxx wrote:
> From: Mikita Lipski <mikita.lipski@xxxxxxx>
> 
> [why]
> In order to comply with new MST atomic check
> we have to find and add VCPI slots to the state
> during atomic check whenever their is a change on
> mode or connector.
> [how]
> - Verify that it is a MST connection
> - Convert new stream's clock and bpp
> - Calculate PBN based on stream parameters
> - Find and add VCPI slots to the state
> 
> Cc: Lyude Paul <lyude@xxxxxxxxxx>
> Signed-off-by: Mikita Lipski <mikita.lipski@xxxxxxx>
> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 59 +++++++++++++++++++
>  1 file changed, 59 insertions(+)
> 
> 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 7b0ca2e1ed8b..d700b962d338 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4432,6 +4432,65 @@ static int dm_encoder_helper_atomic_check(struct
> drm_encoder *encoder,
>  					  struct drm_crtc_state *crtc_state,
>  					  struct drm_connector_state
> *conn_state)
>  {
> +	struct drm_atomic_state *state = crtc_state->state;
> +	struct drm_connector *connector = conn_state->connector;
> +	struct amdgpu_dm_connector *aconnector =
> to_amdgpu_dm_connector(connector);
> +	struct dm_crtc_state *dm_new_crtc_state =
> to_dm_crtc_state(crtc_state);
> +	const struct drm_display_mode *adjusted_mode = &crtc_state-
> >adjusted_mode;
> +	struct drm_dp_mst_topology_mgr *mst_mgr;
> +	struct drm_dp_mst_port *mst_port;
> +	int pbn, slots,clock, bpp = 0;
> +
> +	if (!dm_new_crtc_state)
> +		return 0;
> +
> +	if (!aconnector || !aconnector->port)
> +		return 0;
> +
> +	mst_port = aconnector->port;
> +	mst_mgr = &aconnector->mst_port->mst_mgr;
> +
> +	if (!mst_mgr->mst_state)
> +		return 0;
> +
> +	if (!crtc_state->connectors_changed && !crtc_state->mode_changed)
> +		return 0;
> +
> +	switch (convert_color_depth_from_display_info(connector, conn_state))
> {
> +	case COLOR_DEPTH_666:
> +		bpp = 6;
> +		break;
> +	case COLOR_DEPTH_888:
> +		bpp = 8;
> +		break;
> +	case COLOR_DEPTH_101010:
> +		bpp = 10;
> +		break;
> +	case COLOR_DEPTH_121212:
> +		bpp = 12;
> +		break;
> +	case COLOR_DEPTH_141414:
> +		bpp = 14;
> +		break;
> +	case COLOR_DEPTH_161616:
> +		bpp = 16;
> +		break;
> +	default:
> +		ASSERT(bpp != 0);
> +		break;
> +	}
> +
> +	bpp *= 3;
> +	clock = adjusted_mode->clock;
> +	pbn = drm_dp_calc_pbn_mode(clock, bpp);
> +	slots = drm_dp_atomic_find_vcpi_slots(state,
> +						mst_mgr,
> +						mst_port,
> +						pbn);
> +	if (slots < 0) {
> +		DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots);
> +		return slots;
> +	}
>  	return 0;
>  }
>  
-- 
Cheers,
	Lyude Paul

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux