Received: by 10.213.65.68 with SMTP id h4csp386279imn; Tue, 3 Apr 2018 23:36:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx486vFMzc0vctXp7ajGw2kT3NkkXj8ixvvAkQlgDF65D7apGxUVQ3GoUQVJp0gAUjCyAGigK X-Received: by 10.101.66.132 with SMTP id j4mr11380414pgp.47.1522823767561; Tue, 03 Apr 2018 23:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522823767; cv=none; d=google.com; s=arc-20160816; b=xTI5Z32JSntACwJkCQAvJodI8ped+5abtlDRdm9C007UeRs3p5+OxfeETXmVfHEzDl WXlYaMNSM6pvUmjHN3YMSpzqryae0fsVKnIK29UzFMsTZ9dh7OYaZd2+1lcbqbJaIfVO +MQQA8KXsjz7tjRofhMhmZt4Fwjsmi4xwezXxvF4GFdMvf4SrnhHsDxY0CJe4T0ofuvU rSogTSNxnRB5X/eln1wFEneAhS64BDXNuj+jAvit0+nxUHNUH/AQrb++riDahtcFiFs/ 0eN5ob+8EdvZmwt1TW+cck9grDKEiGMwcNuUD8AXUwPLESoDLNmoxmM21QHqarpJZzpX 0K+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Ge/Kai2qgXM4LFsR4VuFmNV5DW/ZMFcfVeIgm5d3030=; b=EFiwsobVXMoWDAUa2dCpZcP4e2Pj3esuwJhbxa5snBgjYbsUWsxPJh36lTRbMka3Ir GsX0q+EzS8+iPv5jfVNIJ+IM2SdyJfu1OpcKzejfAPSJEVq5K4RnGJEMDxgDjSYZSqe8 24Z7F1GN0QgJN471AGznBo2SpZKTkPGuli4fx/6hwNydAC+u4uF1e4RaW1dB1+EMxjQj 9z2qS6EnoP2FzrOKFe1SQWkZ7oG3sVOsvs0q+tQVlQIgpRDy2jfkS0QmVZHRYX6CXhhh JTg7vx1oO9N3w9hU7z428P9p3r8xD+RiUfBYU29+I8C9Gnl6bxbpSSRyA/AdVXT/19aQ 9T/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=cQz2pk8b; 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 i1-v6si2245369plt.5.2018.04.03.23.35.53; Tue, 03 Apr 2018 23:36:07 -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=cQz2pk8b; 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 S1751129AbeDDGep (ORCPT + 99 others); Wed, 4 Apr 2018 02:34:45 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:46882 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750736AbeDDGen (ORCPT ); Wed, 4 Apr 2018 02:34:43 -0400 Received: by mail-io0-f195.google.com with SMTP id q80so24929371ioi.13 for ; Tue, 03 Apr 2018 23:34:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Ge/Kai2qgXM4LFsR4VuFmNV5DW/ZMFcfVeIgm5d3030=; b=cQz2pk8biNLjLqlUW+OHgGxsrePvc+K1jg/zmjA0O605MMriGtWn6TfYd02mSRM8BZ Q5IdNI/AnugZaT1mweBI8YTAmJDF3EUL/xtCBonx+t8nMlOc5k7hSOrRRCoGG7Kkp0BB OzTIRGgmYk3JWTNv6TrC2vk+0Zsyr7HUp0Xvo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Ge/Kai2qgXM4LFsR4VuFmNV5DW/ZMFcfVeIgm5d3030=; b=BQsLt+PNZiAc/6+8CGhwxfSwfuHidb5k+3Kj7DSLCdBbLGOihPxBd3DmUvxh6rPdFB fvUd2Mun5ERM0bf2RnE1rgJMcmL5OrcYLZZ42sUIbFU7bXFuUwZORKHijGrFwvnNbyZd TivEW049FgQRVvIwxOX+fwuH7/smwf6+bkYhl9HAnE/yjFWy7VY2hrCjUx/g2dLC5Sld w6mfM0obqnnOCjdrI7HYHH9ITVhmv6vRQ/e8qE3DDNvh/c9mxkXm+nOUirepLquJnp68 dLw5/IvEFVDETDiLZklpfCOvAlJbA7wbs4ajwTkNofhTRoFIJFi1JdC/zMzJP77QeUVr 9CVA== X-Gm-Message-State: ALQs6tD3xOlH8LGq0VBe0E2cCLXUyKJYjj0xqr33itcGVj+6ZbuBiuyd 38Rvd+LPkI/MJZe5xLmYpSTBIbvKAFsMmNEsVsC+Eg== X-Received: by 10.107.164.199 with SMTP id d68mr15831485ioj.34.1522823682851; Tue, 03 Apr 2018 23:34:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.40.129 with HTTP; Tue, 3 Apr 2018 23:34:41 -0700 (PDT) X-Originating-IP: [212.51.149.109] In-Reply-To: <2233231.my6BbD3pcT@avalon> References: <20180326212447.7380-1-peda@axentia.se> <20180328070826.GY14155@phenom.ffwll.local> <2233231.my6BbD3pcT@avalon> From: Daniel Vetter Date: Wed, 4 Apr 2018 08:34:41 +0200 X-Google-Sender-Auth: 8uHBMjO_OHqRzpEgq3VC_tI1NjU Message-ID: Subject: Re: [PATCH v2 0/5] allow override of bus format in bridges To: Laurent Pinchart Cc: Peter Rosin , Linux Kernel Mailing List , Mark Rutland , Boris Brezillon , Alexandre Belloni , devicetree@vger.kernel.org, David Airlie , Nicolas Ferre , dri-devel , Rob Herring , Jacopo Mondi , Daniel Vetter , Linux ARM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 4, 2018 at 12:28 AM, Laurent Pinchart wrote: > Hi Daniel, > > On Wednesday, 28 March 2018 10:08:26 EEST Daniel Vetter wrote: >> 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-privat >> e-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. > > While I think we'll eventually need bridge states, I don't think that's need > yet. The bus formats reported by this patch series are static. We're not > talking about the currently configured format for a bridge, but about the list > of supported formats. This is similar to the bus_formats field present in the > drm_display_info structure. There is thus in my opinion no need to interface > this with atomic until we need to track the current format (and I think that > will indeed happen at some point, but I don't think Peter needs this feature > for now). That's why I've told Peter that I would like a bridge API to report > the information and haven't requested a state-based implementation. If it's static, why a dynamic callback? Just add it to struct drm_bridge, require it's filled out before registering the bridge, done. -Daniel > >> Please also cc Laurent Pinchart on this. >> >> > 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 > > -- > Regards, > > Laurent Pinchart > > > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch