From patchwork Mon Aug 26 15:26:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 11114885 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 392F41800 for ; Mon, 26 Aug 2019 15:27:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21C56217F5 for ; Mon, 26 Aug 2019 15:27:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21C56217F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D9F26E235; Mon, 26 Aug 2019 15:27:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49A076E229 for ; Mon, 26 Aug 2019 15:27:09 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 40FD428BD9F; Mon, 26 Aug 2019 16:27:07 +0100 (BST) From: Boris Brezillon To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 19/21] drm/bridge: panel: Propage bus format/flags Date: Mon, 26 Aug 2019 17:26:47 +0200 Message-Id: <20190826152649.13820-20-boris.brezillon@collabora.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190826152649.13820-1-boris.brezillon@collabora.com> References: <20190826152649.13820-1-boris.brezillon@collabora.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nikita Yushchenko , Jernej Skrabec , Laurent Pinchart , Neil Armstrong , Andrey Smirnov , Jonas Karlman , Seung-Woo Kim , Kyungmin Park , Thierry Reding , Chris Healy , Boris Brezillon , kernel@collabora.com, Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" So that the previous bridge element in the chain knows which input format the panel bridge expects. Signed-off-by: Boris Brezillon --- Laurent, I intentionally left your comments unaddressed in this patch as I'm more interested in discussing the preparation patches. Once we've settled on something regarding the bus-format negotiation stuff I'll rework the binding/driver to support the data-mapping DT prop. Regards, Boris Changes in v2: * Adjust things to match the new bus-format negotiation approach --- drivers/gpu/drm/bridge/panel.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 6cffeb4a42f2..3eeb40d37a89 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -120,6 +120,34 @@ static void panel_bridge_post_disable(struct drm_bridge *bridge) drm_panel_unprepare(panel_bridge->panel); } +static void +panel_bridge_atomic_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, + u32 *input_fmts) +{ + *num_input_fmts = 1; + if (!input_fmts) + return; + + input_fmts[0] = output_fmt; +} + +static int panel_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + if (bridge_state->input_bus_cfg.fmt != bridge_state->output_bus_cfg.fmt) + return -EINVAL; + + bridge_state->input_bus_cfg.flags = bridge_state->output_bus_cfg.flags; + return 0; +} + static const struct drm_bridge_funcs panel_bridge_bridge_funcs = { .attach = panel_bridge_attach, .detach = panel_bridge_detach, @@ -127,6 +155,8 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = { .enable = panel_bridge_enable, .disable = panel_bridge_disable, .post_disable = panel_bridge_post_disable, + .atomic_check = panel_bridge_atomic_check, + .atomic_get_input_bus_fmts = panel_bridge_atomic_get_input_bus_fmts, }; /**