Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3264107imw; Mon, 11 Jul 2022 05:27:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tkC2grScjRE2CCPgwVrVoUj3AoHjtmNmmxTcdSihrzBxI+ikYzDfEuZv+fidKyFGzqppKY X-Received: by 2002:a05:6a00:1501:b0:525:79a7:aa4 with SMTP id q1-20020a056a00150100b0052579a70aa4mr18385224pfu.44.1657542474303; Mon, 11 Jul 2022 05:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657542474; cv=none; d=google.com; s=arc-20160816; b=dhIcAbGs3si5a9waK0zTuR6oYSKSyn56DV8CytXjBh9xk6ls6L+KGkjNR0fKb/3hlZ rD0gWK5//U3cEC0/GpC3N7n8bYSZUM9zeBHKJoLZie9iiBJAv6K/1f7wLO+85x4EEXbP PMseHWRH+Z3HMPirpr0XQFiBuYNd1FZD/EB+yS7eqJPWT4vPhEw6L2Ch+JshFp/muwLF LJTF4YPMYHAKa1DKJ+2WZ3dIcWVs07Zsi5KajWJoTRHxRexEoDHkxIJCkVV/NekkZQNh Ugi3szopkpL2+mS05bXv00+Bn7faqfTrnlDTU8y2lzOvnkZxnG4yDMLrIMThLwHpVg2O btKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=autvjFUd9BwlA5CMi8F4/VEnOxd5KyEX6z2vFI+rQes=; b=UfY2uYo093tT7y/dRscN4Sxi6c8lQRASYxnHIrzAHczmOQlxw6H7ZW3syRpZRZgXY3 2cmc4y2nzJWKA/qDAGzOFMWo0RFNNyn7lyaOe4ccZcvDB1nrY10TJaxXdm2uOVEyjTZQ 1i3Q9MHzyQ1OMc0+nN72Ojjx3HGUUBlxCaFBkD1toPaGqbgdZLBefip+J0aA7DR69Ewh SK1VgJoCu8+11HOWMjNGS5uODo6o1oeubJ9x1xBSvAyzTqU/5Dke1MYvkeUO10KOD7dV G6tusVIzEO7GkIAWL7snTbEhQrQQMIfLjtVGVaUgPL0rjKmBhxIZnnWDY4+ng0ewTL8g n7mQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020a170902c40500b0015d180d0710si12002893plk.26.2022.07.11.05.27.42; Mon, 11 Jul 2022 05:27:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231443AbiGKMI0 (ORCPT + 99 others); Mon, 11 Jul 2022 08:08:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231473AbiGKMIX (ORCPT ); Mon, 11 Jul 2022 08:08:23 -0400 Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E72A422DA; Mon, 11 Jul 2022 05:08:20 -0700 (PDT) Received: by mail-qv1-f45.google.com with SMTP id l2so195822qvt.2; Mon, 11 Jul 2022 05:08:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=autvjFUd9BwlA5CMi8F4/VEnOxd5KyEX6z2vFI+rQes=; b=oqI0iuaF2H2wGh4NeYKOXQJur/+z7Kurz6FeQt10e7AzhB6y5YDkhTdH5Pq6jqFp8z DjB/2Gue8X4XPKi0mY1cLspXoQhrCQScUynXJ67mrJ5Hl0qWsBbXQyJVXvyrDhy4jQza Jzhs31nCeQZBSPDn1t4GyiesWVUapN9/5gkcCsTxs2sTWwdqL03IhfDTe90wjAMoixId WXnOnKfk+eHnacx8ikS7WyJOLcoBGhf62HVLMc9ok2yVHG6FxAvaNhGPrprGgEfj7Tdq wLfRCDs6kgM0hebuUCZ1j22XeofETq62UXQDBJkFmi4NrJP65ViCD7dcd6YZR+oxTa0w r7/g== X-Gm-Message-State: AJIora8wcDxzAS2UmthzPHMu9+b0ky6Rfrl4l+gBdHKqRDUoGOExDXbS cRCCAKpCJ+o5ULPWdT0w8xrDlIUF05H7EA== X-Received: by 2002:a05:6214:e87:b0:473:129e:224a with SMTP id hf7-20020a0562140e8700b00473129e224amr13093540qvb.29.1657541298877; Mon, 11 Jul 2022 05:08:18 -0700 (PDT) Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com. [209.85.128.176]) by smtp.gmail.com with ESMTPSA id h129-20020a379e87000000b006b55df40976sm5911999qke.27.2022.07.11.05.08.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Jul 2022 05:08:18 -0700 (PDT) Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-31bf3656517so46180487b3.12; Mon, 11 Jul 2022 05:08:18 -0700 (PDT) X-Received: by 2002:a81:9209:0:b0:31c:b1b7:b063 with SMTP id j9-20020a819209000000b0031cb1b7b063mr19178774ywg.383.1657541298151; Mon, 11 Jul 2022 05:08:18 -0700 (PDT) MIME-Version: 1.0 References: <68923c8a129b6c2a70b570103679a1cf7876bbc2.1657301107.git.geert@linux-m68k.org> <20220711093513.wilv6e6aqcuyg52w@houat> <43d75dce-988a-0a95-cb0a-0d0a7c81ca63@suse.de> <20220711114206.sawqdl54ibuxsxp4@houat> <20220711120243.v6lwoynqigle2aot@houat> In-Reply-To: <20220711120243.v6lwoynqigle2aot@houat> From: Geert Uytterhoeven Date: Mon, 11 Jul 2022 14:08:06 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4/5] drm/modes: Add support for driver-specific named modes To: Maxime Ripard Cc: Thomas Zimmermann , Maarten Lankhorst , David Airlie , Daniel Vetter , Hans de Goede , DRI Development , Linux Fbdev development list , "Linux/m68k" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Maxime, On Mon, Jul 11, 2022 at 2:02 PM Maxime Ripard wrote: > On Mon, Jul 11, 2022 at 01:59:28PM +0200, Geert Uytterhoeven wrote: > > On Mon, Jul 11, 2022 at 1:42 PM Maxime Ripard wrote: > > > On Mon, Jul 11, 2022 at 01:11:14PM +0200, Thomas Zimmermann wrote: > > > > Am 11.07.22 um 11:35 schrieb Maxime Ripard: > > > > > On Mon, Jul 11, 2022 at 11:03:38AM +0200, Thomas Zimmermann wrote: > > > > > > Am 08.07.22 um 20:21 schrieb Geert Uytterhoeven: > > > > > > > The mode parsing code recognizes named modes only if they are explicitly > > > > > > > listed in the internal whitelist, which is currently limited to "NTSC" > > > > > > > and "PAL". > > > > > > > > > > > > > > Provide a mechanism for drivers to override this list to support custom > > > > > > > mode names. > > > > > > > > > > > > > > Ideally, this list should just come from the driver's actual list of > > > > > > > modes, but connector->probed_modes is not yet populated at the time of > > > > > > > parsing. > > > > > > > > > > > > I've looked for code that uses these names, couldn't find any. How is this > > > > > > being used in practice? For example, if I say "PAL" on the command line, is > > > > > > there DRM code that fills in the PAL mode parameters? > > > > > > > > > > We have some code to deal with this in sun4i: > > > > > https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/sun4i/sun4i_tv.c#L292 > > > > > > > > > > It's a bit off topic, but for TV standards, I'm still not sure what the > > > > > best course of action is. There's several interactions that make this a > > > > > bit troublesome: > > > > > > > > > > * Some TV standards differ by their mode (ie, PAL vs NSTC), but some > > > > > other differ by parameters that are not part of drm_display_mode > > > > > (NTSC vs NSTC-J where the only difference is the black and blanking > > > > > signal levels for example). > > > > > > > > > > * The mode names allow to provide a fairly convenient way to add that > > > > > extra information, but the userspace is free to create its own mode > > > > > and might omit the mode name entirely. > > > > > > > > > > So in the code above, if the name has been preserved we match by name, > > > > > but we fall back to matching by mode if it hasn't been, which in this > > > > > case means that we have no way to differentiate between NTSC, NTSC-J, > > > > > PAL-M in this case. > > > > > > > > > > We have some patches downstream for the RaspberryPi that has the TV > > > > > standard as a property. There's a few extra logic required for the > > > > > userspace (like setting the PAL property, with the NTSC mode) so I'm not > > > > > sure it's preferable. > > > > > > > > > > Or we could do something like a property to try that standard, and > > > > > another that reports the one we actually chose. > > > > > > > > > > > And another question I have is whether this whitelist belongs into the > > > > > > driver at all. Standard modes exist independent from drivers or hardware. > > > > > > Shouldn't there simply be a global list of all possible mode names? Drivers > > > > > > would filter out the unsupported modes anyway. > > > > > > > > > > We should totally do something like that, yeah > > > > > > > > That sun code already looks like sometihng the DRM core/helpers should be > > > > doing. And if we want to support named modes well, there's a long list of > > > > modes in Wikipedia. > > > > > > > > https://en.wikipedia.org/wiki/Video_Graphics_Array#/media/File:Vector_Video_Standards2.svg > > > > > > Yeah, and NTSC is missing :) > > > > And that diagram is about the "digital" variant of PAL. > > If you go the analog route, the only fixed parts are vfreq/hfreq, > > number of lines, and synchronization. Other parameters like overscan > > can vary. The actual dot clock can vary wildly: while there is an > > upper limit due to bandwidth limitations, you can come up with an > > almost infinite number of video modes that can be called PAL, which > > is one of the reasons why I don't want hardware-specific variants to > > end up in a global video mode database. > > Do you have an example of what that would look like? You mean a PAL mode that does not use 768x576? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/video/fbdev/amifb.c#n834 (TAG_HIRES is replaced by the actual dot clock at runtime, as it depends on the crystal present on the mainboard). Amifb also supports 320x256, by doubling the dot clock, but that mode is not part of the database. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds