Received: by 10.213.65.68 with SMTP id h4csp140896imn; Wed, 28 Mar 2018 00:09:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx48/dIGwxM9LME1WqP28iKcFJICAzMEMFj+EERntYum2cGyUpqcmyxo5Uz8Zc5qlL1Medjn4 X-Received: by 10.99.52.11 with SMTP id b11mr1675853pga.377.1522220979677; Wed, 28 Mar 2018 00:09:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522220979; cv=none; d=google.com; s=arc-20160816; b=PZF5uVfuaojiObmj8QT4eAQsT3SEUAatXTFCFxsACasD8dssHciYnNLO2ag9upvy/S hIZ3Qqof1DLTQH9nMBS3w/wRXvK9z5kfJ1qZTsk7R517HXop5UrGv3dNSM6Jrv0d9aQB F9pDxIcC4vCiDDO2ypbfWyGxxTD/UkAtViQh/kpNkRrnyfv9aFZxH0WAECRx+du66Y0N GAJq7656Kg+rPaAyn0Fz+yNkBxe3yfL+Tml7Iys+1dWeMmdBu3j6CkMJL+y2QygaNDpN dA4RX/MVJvhrZR6p28odS5PSdOC7iyDDqMeu2NLK1Mc7TiKhTsFTMRwAgmM7ippC3yv3 vynA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=2+W7YLmV30LByrhwvoQeck8/WgbuX1d1U/mfR8KdEcI=; b=n9zm9ezuOSkkbpy3BLQomY2iw7LmkEgw8h1MmFPiULENqXenXgnIHuEbATLUPCfyOJ wGt4NYzsMFbtesSlT/eNTUK4JXPHhab3e7YnXmD9Rh1m5CHGPI66AIwFv46rYMtNsuAe rc4YGo+L//Ojqk1zuSSSCPBAFFFbVQZtsDQOLBC2FCua4sJvx7gJWxXAUbF9xGijkgOb uWiFIzWLQlu/DzA55Q8UlFMa47LQHKSIzpnI72N3SkPIGq+sjLa7OoUuSUWTsoDRR8Tz tGOdc6YV/Wr5eh4L/atzTLJu3HQAei1ypa1j1q8G4GgW2QOUalkEhIpibQosRg6Qz+fH sr0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=Dc6FHuDA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12-v6si3192447pll.419.2018.03.28.00.09.24; Wed, 28 Mar 2018 00:09:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=Dc6FHuDA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752154AbeC1HId (ORCPT + 99 others); Wed, 28 Mar 2018 03:08:33 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38950 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbeC1HIa (ORCPT ); Wed, 28 Mar 2018 03:08:30 -0400 Received: by mail-wm0-f67.google.com with SMTP id f125so3070619wme.4 for ; Wed, 28 Mar 2018 00:08:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=2+W7YLmV30LByrhwvoQeck8/WgbuX1d1U/mfR8KdEcI=; b=Dc6FHuDAHtFItGtQcNTXfNyq2g0F6b135vEEsRXR+1FVcoE6GCFIEy1EDsD6wEVA6c BtgUqrrkDA9k8aPStCNeaztZoYHLuthHFCMMvQwHS7jwZ8QQXCSKpH6twtqFh0WDK9ip fetwPeLP8DFSkNOvIj95NR55xEpLmDfCB+8iA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=2+W7YLmV30LByrhwvoQeck8/WgbuX1d1U/mfR8KdEcI=; b=WLtBNS2E+eGiwQPKPeEBxiv+VBGUn1+Strwbc/BaSZfSj8axDW8+1Dd5+9+Iz6gV8/ veWxPAgOyE5a+FzyeCl7bqt7ui8EyBVm2YUEsPhHxvmuAO5GV8Jy+XAZAxQrkX/JfPeB iP0xGcVM/hJVwHNKvYtL2LBVYgL344WrEBzQECkU/U4h8GnpqB/+qzzUL9yIpu2ADRJl A45cR42LqvSSoenJ+88MECgNuREwbpsYJbw8jFWoyIeNr5wXPFAOvs2RQSti+F0SFerZ N4GBymkHXSSVwkoMBSy+cL22yGIPlIO8RXvBYWL510veJNjnQIltvFZZGDbQHI+yN0zv Hmvg== X-Gm-Message-State: AElRT7E8MOrRek6lYjRPm5bVug4AyceRIGYocyIyPe39GuEJrIyNYXhz 9XuAHOF8CEMFfUE4ZvWXSefPHeuI X-Received: by 10.80.222.205 with SMTP id d13mr2117900edl.76.1522220909546; Wed, 28 Mar 2018 00:08:29 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id x8sm1891467eda.58.2018.03.28.00.08.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Mar 2018 00:08:28 -0700 (PDT) Date: Wed, 28 Mar 2018 09:08:26 +0200 From: Daniel Vetter To: Peter Rosin Cc: linux-kernel@vger.kernel.org, Mark Rutland , Boris Brezillon , Alexandre Belloni , devicetree@vger.kernel.org, David Airlie , Nicolas Ferre , dri-devel@lists.freedesktop.org, Rob Herring , Laurent Pinchart , Jacopo Mondi , Daniel Vetter , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 0/5] allow override of bus format in bridges Message-ID: <20180328070826.GY14155@phenom.ffwll.local> Mail-Followup-To: Peter Rosin , linux-kernel@vger.kernel.org, Mark Rutland , Boris Brezillon , Alexandre Belloni , devicetree@vger.kernel.org, David Airlie , Nicolas Ferre , dri-devel@lists.freedesktop.org, Rob Herring , Laurent Pinchart , Jacopo Mondi , Daniel Vetter , linux-arm-kernel@lists.infradead.org References: <20180326212447.7380-1-peda@axentia.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180326212447.7380-1-peda@axentia.se> X-Operating-System: Linux phenom 4.15.0-1-amd64 User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 26, 2018 at 11:24:42PM +0200, Peter Rosin wrote: > Hi! > > [I got to v2 sooner than expected] > > I have an Atmel sama5d31 hooked up to an lvds encoder and then > on to an lvds panel. Which seems like something that has been > done one or two times before... > > The problem is that the bus_format of the SoC and the panel do > not agree. The SoC driver (atmel-hlcdc) can handle the > rgb444, rgb565, rgb666 and rgb888 bus formats. The hardware is > wired for the rgb565 case. The lvds encoder supports rgb888 on > its input side with the LSB wires for each color simply pulled > down internally in the encoder in my case which means that the > rgb565 bus_format is the format that works best. And the panel > is expecting lvds (vesa-24), which is what the encoder outputs. > > The reason I "blame" the bus_format of the drm_connector is that > with the below DT snippet, things do not work *exactly* due to > that. At least, it starts to work if I hack the panel-lvds driver > to report the rgb565 bus_format instead of vesa-24. > > panel: panel { > compatible = "panel-lvds"; > > width-mm = <304>; > height-mm = <228; > > data-mapping = "vesa-24"; > > panel-timing { > // 1024x768 @ 60Hz (typical) > clock-frequency = <52140000 65000000 71100000>; > hactive = <1024>; > vactive = <768>; > hfront-porch = <48 88 88>; > hback-porch = <96 168 168>; > hsync-len = <32 64 64>; > vfront-porch = <8 13 14>; > vback-porch = <8 13 14>; > vsync-len = <8 12 14>; > }; > > port { > panel_input: endpoint { > remote-endpoint = <&lvds_encoder_output>; > }; > }; > }; > > lvds-encoder { > compatible = "ti,ds90c185", "lvds-encoder"; > > ports { > #address-cells = <1>; > #size-cells = <0>; > > port@0 { > reg = <0>; > > lvds_encoder_input: endpoint { > remote-endpoint = <&hlcdc_output>; > }; > }; > > port@1 { > reg = <1>; > > lvds_encoder_output: endpoint { > remote-endpoint = <&panel_input>; > }; > }; > }; > }; > > But, instead of perverting the panel-lvds driver with support > for a totally fake non-lvds bus_format, I intruduce an API that allows > display controller drivers to query the required bus_format of any > intermediate bridges, and match up with that instead of the formats > given by the drm_connector. I trigger this with this addition to the > lvds-encoder DT node: > > interface-pix-fmt = "rgb565"; > > Naming is hard though, so I'm not sure if that's good? > > I threw in the first patch, since that is the actual lvds encoder > I have in this case. > > Suggestions welcome. Took a quick look, feels rather un-atomic. And there's beend discussing for other bridge related state that we might want to track (like the full adjusted_mode that might need to be adjusted at each stage in the chain). So here's my suggestions: - Add an optional per-bridge internal state struct using the support in https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#handling-driver-private-state Yes it says "driver private", but since bridge is just helper stuff that's all included. "driver private" == "not exposed as uapi" here. Include all the usual convenience wrappers to get at the state for a bridge. - Then stuff your bus_format into that new drm_bridge_state struct. - Add a new bridge callback atomic_check, which gets that bridge state as parameter (similar to all the other atomic_check functions). This way we can even handle the bus_format dynamically, through the atomic framework your bridge's atomic_check callback can look at the entire atomic state (both up and down the chain if needed), it all neatly fits into atomic overall and it's much easier to extend. Please also cc Laurent Pinchart on this. Cheers, Daniel > > Cheers, > Peter > > Changes since v1 https://lkml.org/lkml/2018/3/17/221 > - Add a proper bridge API to query the bus_format instead of abusing > the ->get_modes part of the code. This is cleaner but requires > changes to all display controller drivers wishing to participate. > - Add patch to adjust the atmel-hlcdc driver according to the above. > - Hook the new info into the bridge local to the lvds-encoder instead > of messing about with new interfaces for the panel-bridge driver. > - Add patch with a DT parsing function of bus_formats in a central place. > - Rephrase the addition of ti,ds90c185 to the lvds-transmitter binding. > > Peter Rosin (5): > dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 > drm: bridge: add API to query the expected input formats of bridges > drm: of: add display bus-format parser > drm: bridge: lvds-encoder: allow specifying the input bus format > drm/atmel-hlcdc: take bridges into account when selecting output > format > > .../bindings/display/bridge/lvds-transmitter.txt | 14 ++++- > .../devicetree/bindings/display/bus-format.txt | 35 +++++++++++++ > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 49 ++++++++++++++++-- > drivers/gpu/drm/bridge/lvds-encoder.c | 25 +++++++++ > drivers/gpu/drm/drm_bridge.c | 32 ++++++++++++ > drivers/gpu/drm/drm_of.c | 59 ++++++++++++++++++++++ > include/drm/drm_bridge.h | 18 +++++++ > include/drm/drm_of.h | 9 ++++ > 8 files changed, 237 insertions(+), 4 deletions(-) > create mode 100644 Documentation/devicetree/bindings/display/bus-format.txt > > -- > 2.11.0 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch