Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp516785lqb; Wed, 17 Apr 2024 03:24:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVpCpI+Vmubk5OvpQLKsiCh6Bd+4geBTycswo+0k75GqaZcMowLCh+rzUq1mGUKFSQnB5JpQNUdqpoGhuuFMfMWhc4663Io2gnM9+iPvA== X-Google-Smtp-Source: AGHT+IHw5IBMujhzvfjFGzEfjcx6sQL74fIkJFMiMgLEqy4uHP4Ah2MgookuEo35dQ8wA7m2T8ih X-Received: by 2002:a05:6512:3125:b0:513:5af1:9d7b with SMTP id p5-20020a056512312500b005135af19d7bmr9174691lfd.47.1713349458146; Wed, 17 Apr 2024 03:24:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713349458; cv=pass; d=google.com; s=arc-20160816; b=gjcXX5AS7LbTu65KwhyBUBUTNFvjG89fgYFGS5gLT3TjB1iu5TMisD7fHvUnEJmozv SUwbbgSfn7wlU1Et88+mHf+cD+5T4GbkoL7Hhj66hop8UsLeaUtvbLQBddEqDHeoiBGb RbEeDVugxcr9Et/iTXJzY817ZXpF9pEN38E2CDzIdTnuRM0PWJ1QvUAi7Qkm+oAklawq XfpbfAqzPdCS1U8s9aBt1o4M++DGBJFa9m5alSlt7FtyRFeMKiDEXWYghfICkW8ToB4f VyEbjoSDvrTuPPCWN3HPuhjUwR56VGCp+0U3kfnnV4vV9neP9qIuNWR53UCKbQOA+AjK pRSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=u1+pWrmyleFCGVVHNBEYuey22M6Nv9oqlJpKOtGwamw=; fh=cue+2yBY2zemkCbDwlaSl0+O4SBBEdInRuLaOwa6Jdg=; b=XPjGsO7YdJEqg5uc954yEg1hNc55CN5yxGyxGB4wYTuS2JFlOJgX820aMgaNfQSu7g pdKgcpjXScHRiyo8tUuiIsWdVTY70xDHbKHSnBh/akNbKsSqg/FqJAcqexHKl3+GKXJD 3IyHWajyIqELDQupyXlKK23t9EYrk+YFPTnupilEqDezJs4Irbw13RYv1VXnykFWUaog nVnqpOku0U2HGadPsZqfc7BfDVueKKKNRZ6yyBTZg6f0y8sYvdDzn0MYXrYALNv08B7n LlJmf//PBpZPJJ+OKaI8K2o02i098b6NNzb1CVcyj6z9exZFYdgOdjGLeY5ckroQ1hQ0 OXBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=qPrdFKN8; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-148317-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148317-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 28-20020a50875c000000b0056c3602fb40si6571756edv.610.2024.04.17.03.24.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 03:24:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148317-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=qPrdFKN8; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-148317-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148317-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AD8A31F21296 for ; Wed, 17 Apr 2024 10:24:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C70D013C3E9; Wed, 17 Apr 2024 10:22:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qPrdFKN8" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DC4713B587; Wed, 17 Apr 2024 10:22:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349332; cv=none; b=aNKeFkIHROE1Avj7OMGvBxaD04dYOPV9pFzJdqxrlmsJFzaksACNFrVg4XxDNecD5e1itFZwIDkSVD99pw1qQbw0nntJrezfufaxt27+86kMeVWtYItprLnbzruP40agZPHX69pymlluKhhKDAz7Pe8e2Q/91j9EvTFFPgb8W8c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349332; c=relaxed/simple; bh=goFaj5UAtWDMEoSyouKWifUNXqkG/wVnMMSOTRFTJ0k=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=svAa0G59k9MsbbnKY04znRd7hl8N7QJoNPzt/jKe82W1cey5r8+qyDUxd+OfY3aCgL0nJnbuvYnIAkFHpTdTbT7ZEdwqObnNAgS67HLzHcvjVGFqdJ5MJ/2dJ4fKDw/aqMTRRUhLy85hTN1H8PSfDe2GJHzsXbFOB4o1Gb6hbO4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=qPrdFKN8; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from [192.168.88.20] (91-154-34-181.elisa-laajakaista.fi [91.154.34.181]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3B62916F9; Wed, 17 Apr 2024 12:21:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713349281; bh=goFaj5UAtWDMEoSyouKWifUNXqkG/wVnMMSOTRFTJ0k=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=qPrdFKN8/2o1XpUMfMlh3wWg2gp5d/xWUduGslMQAib/FbLtFbJzYPxsMvOdVIi80 jQBtJm5vaMLUh7VGMQDZsDJ8UPucNQm1EKGeOT03N2SiM9Mkw8eTJ7ESE/jX8b03IS fK+CqvkOsGZPVplacgOx4haC9ng51k/aFVODy4kI= Message-ID: Date: Wed, 17 Apr 2024 13:22:04 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 4/7] drm: xlnx: zynqmp_dpsub: Anounce supported input formats To: Anatoliy Klymenko Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-media@vger.kernel.org, Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Michal Simek , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mauro Carvalho Chehab References: <20240416-dp-live-fmt-v4-0-c7f379b7168e@amd.com> <20240416-dp-live-fmt-v4-4-c7f379b7168e@amd.com> From: Tomi Valkeinen Content-Language: en-US Autocrypt: addr=tomi.valkeinen@ideasonboard.com; keydata= xsFNBE6ms0cBEACyizowecZqXfMZtnBniOieTuFdErHAUyxVgtmr0f5ZfIi9Z4l+uUN4Zdw2 wCEZjx3o0Z34diXBaMRJ3rAk9yB90UJAnLtb8A97Oq64DskLF81GCYB2P1i0qrG7UjpASgCA Ru0lVvxsWyIwSfoYoLrazbT1wkWRs8YBkkXQFfL7Mn3ZMoGPcpfwYH9O7bV1NslbmyJzRCMO eYV258gjCcwYlrkyIratlHCek4GrwV8Z9NQcjD5iLzrONjfafrWPwj6yn2RlL0mQEwt1lOvn LnI7QRtB3zxA3yB+FLsT1hx0va6xCHpX3QO2gBsyHCyVafFMrg3c/7IIWkDLngJxFgz6DLiA G4ld1QK/jsYqfP2GIMH1mFdjY+iagG4DqOsjip479HCWAptpNxSOCL6z3qxCU8MCz8iNOtZk DYXQWVscM5qgYSn+fmMM2qN+eoWlnCGVURZZLDjg387S2E1jT/dNTOsM/IqQj+ZROUZuRcF7 0RTtuU5q1HnbRNwy+23xeoSGuwmLQ2UsUk7Q5CnrjYfiPo3wHze8avK95JBoSd+WIRmV3uoO rXCoYOIRlDhg9XJTrbnQ3Ot5zOa0Y9c4IpyAlut6mDtxtKXr4+8OzjSVFww7tIwadTK3wDQv Bus4jxHjS6dz1g2ypT65qnHen6mUUH63lhzewqO9peAHJ0SLrQARAQABzTBUb21pIFZhbGtl aW5lbiA8dG9taS52YWxrZWluZW5AaWRlYXNvbmJvYXJkLmNvbT7CwY4EEwEIADgWIQTEOAw+ ll79gQef86f6PaqMvJYe9QUCX/HruAIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCR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In-Reply-To: <20240416-dp-live-fmt-v4-4-c7f379b7168e@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 16/04/2024 23:31, Anatoliy Klymenko wrote: > DPSUB in bridge mode supports multiple input media bus formats. > > Announce the list of supported input media bus formats via > drm_bridge.atomic_get_input_bus_fmts callback. Introduce a set of live > input formats supported by DPSUB. Add safeguards to format list functions > to prevent their misuse in the different layer modes contexts. > > Reviewed-by: Laurent Pinchart > Signed-off-by: Anatoliy Klymenko > --- > drivers/gpu/drm/xlnx/zynqmp_disp.c | 110 +++++++++++++++++++++++++++++++++++-- > drivers/gpu/drm/xlnx/zynqmp_disp.h | 2 + > drivers/gpu/drm/xlnx/zynqmp_dp.c | 31 +++++++++++ > 3 files changed, 139 insertions(+), 4 deletions(-) > Reviewed-by: Tomi Valkeinen Tomi > diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c > index 891577475349..24f1f367b1d3 100644 > --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c > +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -77,12 +78,14 @@ enum zynqmp_dpsub_layer_mode { > /** > * struct zynqmp_disp_format - Display subsystem format information > * @drm_fmt: DRM format (4CC) > + * @bus_fmt: Media bus format > * @buf_fmt: AV buffer format > * @swap: Flag to swap R & B for RGB formats, and U & V for YUV formats > * @sf: Scaling factors for color components > */ > struct zynqmp_disp_format { > u32 drm_fmt; > + u32 bus_fmt; > u32 buf_fmt; > bool swap; > const u32 *sf; > @@ -182,6 +185,12 @@ static const u32 scaling_factors_565[] = { > ZYNQMP_DISP_AV_BUF_5BIT_SF, > }; > > +static const u32 scaling_factors_666[] = { > + ZYNQMP_DISP_AV_BUF_6BIT_SF, > + ZYNQMP_DISP_AV_BUF_6BIT_SF, > + ZYNQMP_DISP_AV_BUF_6BIT_SF, > +}; > + > static const u32 scaling_factors_888[] = { > ZYNQMP_DISP_AV_BUF_8BIT_SF, > ZYNQMP_DISP_AV_BUF_8BIT_SF, > @@ -364,6 +373,41 @@ static const struct zynqmp_disp_format avbuf_gfx_fmts[] = { > }, > }; > > +/* List of live video layer formats */ > +static const struct zynqmp_disp_format avbuf_live_fmts[] = { > + { > + .drm_fmt = DRM_FORMAT_RGB565, > + .bus_fmt = MEDIA_BUS_FMT_RGB666_1X18, > + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_6 | > + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_RGB, > + .sf = scaling_factors_666, > + }, { > + .drm_fmt = DRM_FORMAT_RGB888, > + .bus_fmt = MEDIA_BUS_FMT_RGB888_1X24, > + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_8 | > + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_RGB, > + .sf = scaling_factors_888, > + }, { > + .drm_fmt = DRM_FORMAT_YUV422, > + .bus_fmt = MEDIA_BUS_FMT_UYVY8_1X16, > + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_8 | > + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV422, > + .sf = scaling_factors_888, > + }, { > + .drm_fmt = DRM_FORMAT_YUV444, > + .bus_fmt = MEDIA_BUS_FMT_VUY8_1X24, > + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_8 | > + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV444, > + .sf = scaling_factors_888, > + }, { > + .drm_fmt = DRM_FORMAT_P210, > + .bus_fmt = MEDIA_BUS_FMT_UYVY10_1X20, > + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_10 | > + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV422, > + .sf = scaling_factors_101010, > + }, > +}; > + > static u32 zynqmp_disp_avbuf_read(struct zynqmp_disp *disp, int reg) > { > return readl(disp->avbuf.base + reg); > @@ -887,6 +931,11 @@ zynqmp_disp_layer_find_format(struct zynqmp_disp_layer *layer, > * @layer: The layer > * @num_formats: Pointer to the returned number of formats > * > + * NOTE: This function doesn't make sense for live video layers and will > + * always return an empty list in such cases. zynqmp_disp_live_layer_formats() > + * should be used to query a list of media bus formats supported by the live > + * video input layer. > + * > * Return: A newly allocated u32 array that stores all the DRM formats > * supported by the layer. The number of formats in the array is returned > * through the num_formats argument. > @@ -897,10 +946,17 @@ u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, > unsigned int i; > u32 *formats; > > + if (WARN_ON(!layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE)) { > + *num_formats = 0; > + return NULL; > + } > + > formats = kcalloc(layer->info->num_formats, sizeof(*formats), > GFP_KERNEL); > - if (!formats) > + if (!formats) { > + *num_formats = 0; > return NULL; > + } > > for (i = 0; i < layer->info->num_formats; ++i) > formats[i] = layer->info->formats[i].drm_fmt; > @@ -909,6 +965,43 @@ u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, > return formats; > } > > +/** > + * zynqmp_disp_live_layer_formats - Return the media bus formats supported by > + * the live video layer > + * @layer: The layer > + * @num_formats: Pointer to the returned number of formats > + * > + * NOTE: This function should be used only for live video input layers. > + * > + * Return: A newly allocated u32 array of media bus formats supported by the > + * layer. The number of formats in the array is returned through the > + * @num_formats argument. > + */ > +u32 *zynqmp_disp_live_layer_formats(struct zynqmp_disp_layer *layer, > + unsigned int *num_formats) > +{ > + unsigned int i; > + u32 *formats; > + > + if (WARN_ON(layer->mode != ZYNQMP_DPSUB_LAYER_LIVE)) { > + *num_formats = 0; > + return NULL; > + } > + > + formats = kcalloc(layer->info->num_formats, sizeof(*formats), > + GFP_KERNEL); > + if (!formats) { > + *num_formats = 0; > + return NULL; > + } > + > + for (i = 0; i < layer->info->num_formats; ++i) > + formats[i] = layer->info->formats[i].bus_fmt; > + > + *num_formats = layer->info->num_formats; > + return formats; > +} > + > /** > * zynqmp_disp_layer_enable - Enable a layer > * @layer: The layer > @@ -1131,6 +1224,11 @@ static int zynqmp_disp_create_layers(struct zynqmp_disp *disp) > .num_channels = 1, > }, > }; > + static const struct zynqmp_disp_layer_info live_layer_info = { > + .formats = avbuf_live_fmts, > + .num_formats = ARRAY_SIZE(avbuf_live_fmts), > + .num_channels = 0, > + }; > > unsigned int i; > int ret; > @@ -1140,13 +1238,17 @@ static int zynqmp_disp_create_layers(struct zynqmp_disp *disp) > > layer->id = i; > layer->disp = disp; > - layer->info = &layer_info[i]; > /* > * For now assume dpsub works in either live or non-live mode for both layers. > * Hybrid mode is not supported yet. > */ > - layer->mode = disp->dpsub->dma_enabled ? ZYNQMP_DPSUB_LAYER_NONLIVE > - : ZYNQMP_DPSUB_LAYER_LIVE; > + if (disp->dpsub->dma_enabled) { > + layer->mode = ZYNQMP_DPSUB_LAYER_NONLIVE; > + layer->info = &layer_info[i]; > + } else { > + layer->mode = ZYNQMP_DPSUB_LAYER_LIVE; > + layer->info = &live_layer_info; > + } > > ret = zynqmp_disp_layer_request_dma(disp, layer); > if (ret) > diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.h b/drivers/gpu/drm/xlnx/zynqmp_disp.h > index 9b8b202224d9..efd1c52c2916 100644 > --- a/drivers/gpu/drm/xlnx/zynqmp_disp.h > +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.h > @@ -52,6 +52,8 @@ void zynqmp_disp_blend_set_global_alpha(struct zynqmp_disp *disp, > > u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, > unsigned int *num_formats); > +u32 *zynqmp_disp_live_layer_formats(struct zynqmp_disp_layer *layer, > + unsigned int *num_formats); > void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer); > void zynqmp_disp_layer_disable(struct zynqmp_disp_layer *layer); > void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer, > diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c > index 7faeb010e1ae..faaeea526970 100644 > --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c > +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1577,6 +1578,35 @@ static const struct drm_edid *zynqmp_dp_bridge_edid_read(struct drm_bridge *brid > return drm_edid_read_ddc(connector, &dp->aux.ddc); > } > > +static u32 *zynqmp_dp_bridge_default_bus_fmts(unsigned int *num_input_fmts) > +{ > + u32 *formats = kzalloc(sizeof(*formats), GFP_KERNEL); > + > + if (formats) > + *formats = MEDIA_BUS_FMT_FIXED; > + *num_input_fmts = !!formats; > + > + return formats; > +} > + > +static u32 * > +zynqmp_dp_bridge_get_input_bus_fmts(struct drm_bridge *bridge, > + struct drm_bridge_state *bridge_state, > + struct drm_crtc_state *crtc_state, > + struct drm_connector_state *conn_state, > + u32 output_fmt, > + unsigned int *num_input_fmts) > +{ > + struct zynqmp_dp *dp = bridge_to_dp(bridge); > + struct zynqmp_disp_layer *layer; > + > + layer = zynqmp_dp_disp_connected_live_layer(dp); > + if (layer) > + return zynqmp_disp_live_layer_formats(layer, num_input_fmts); > + else > + return zynqmp_dp_bridge_default_bus_fmts(num_input_fmts); > +} > + > static const struct drm_bridge_funcs zynqmp_dp_bridge_funcs = { > .attach = zynqmp_dp_bridge_attach, > .detach = zynqmp_dp_bridge_detach, > @@ -1589,6 +1619,7 @@ static const struct drm_bridge_funcs zynqmp_dp_bridge_funcs = { > .atomic_check = zynqmp_dp_bridge_atomic_check, > .detect = zynqmp_dp_bridge_detect, > .edid_read = zynqmp_dp_bridge_edid_read, > + .atomic_get_input_bus_fmts = zynqmp_dp_bridge_get_input_bus_fmts, > }; > > /* ----------------------------------------------------------------------------- >