From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8565FC433FE for ; Mon, 17 Oct 2022 10:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Fn/CVN1VqoDVesxfTLYIlaGxjMjPeWUY8b0vC4JB/48=; b=FSW9/GVZiFsm5Z xnqJP+Hl7vde1D4BqeHeh2GrpiynnJnGHyhjfCpN8Bpqy1PxT5i4Por+7ntWjOj2sKCU1Kk1x3I9v wN/8cPFOJ0rWF27bWMD0tTBj8M+QbXyTDnrVwudjsA4MGuk+CSxf9MgB20rxbT/TOgjpG5rUGd7wz OUrv33fNeyqnjOIlQY88pfElCaprBxiEPuyLeWE8po1scd4vR2Dz60gS4dwvUynr4mXxQ8ef646ar BNlE3RcsKpqs76/rx4bjIK0xBmkp8eh5s7Fm0fpk2qBN7WxNyObYCQu0/aPW7AjHatOVcml/T7PPw NSFDZwUzLAMwHpTeAFfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okNPI-00AI85-3E; Mon, 17 Oct 2022 10:31:40 +0000 Received: from smtp.domeneshop.no ([2a01:5b40:0:3005::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okNPF-00AI7U-QG for linux-arm-kernel@lists.infradead.org; Mon, 17 Oct 2022 10:31:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tronnes.org ; s=ds202112; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4stdZmnnjzcJfTIv6rX9y4Ktpwm0v2vziI9Ogexmn4M=; b=JTuh8gNnaSkR+5LHWdYqs3GbB1 ZHTKRsHYL2Hwd506N3u16pSrtZpDVzxuSO7U0YcYZMN/CHexTltSaNhqyFAtGAJCPUV4V0b8nZ3J0 MGXR+vIMKn64zMJYCMljgm7u5lRp0nf7NBcZ7zr7aV2s+jSrsEZgQCKC0dPn+Yw66geVhRH6bVeZc Gzdem6BNhYGvtZbsJI4bfYo5I/grPpluNd1h9zuwTo/xoj/QGbegYU3yW4i4KSEBhxB/sXpqu4h6p 9gJSysyAKSm1TQM1nSWpbf0JEhuGpMy0U86hC40/GYjpCPhyMJLKilWX9SIAKnUzU7Om4NhJmBb0J K0jnVmWA==; Received: from 211.81-166-168.customer.lyse.net ([81.166.168.211]:60899 helo=[192.168.10.61]) by smtp.domeneshop.no with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okNPD-0001a2-7h; Mon, 17 Oct 2022 12:31:35 +0200 Message-ID: <81936381-ae37-8c84-4681-9eff19f653b5@tronnes.org> Date: Mon, 17 Oct 2022 12:31:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v5 20/22] drm/vc4: vec: Convert to the new TV mode property To: kfyatek+publicgit@gmail.com, Maxime Ripard , Karol Herbst , Jani Nikula , Tvrtko Ursulin , Daniel Vetter , Maarten Lankhorst , David Airlie , Joonas Lahtinen , Lyude Paul , Maxime Ripard , Emma Anholt , Chen-Yu Tsai , Samuel Holland , Ben Skeggs , Thomas Zimmermann , Rodrigo Vivi , Jernej Skrabec Cc: Dom Cobley , linux-sunxi@lists.linux.dev, Dave Stevenson , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Hans de Goede , Phil Elwell , =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= References: <20220728-rpi-analog-tv-properties-v5-0-d841cc64fe4b@cerno.tech> <20220728-rpi-analog-tv-properties-v5-20-d841cc64fe4b@cerno.tech> From: =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221017_033137_884604_AD4BF889 X-CRM114-Status: GOOD ( 23.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Den 16.10.2022 20.52, skrev Mateusz Kwiatkowski: > Hi Maxime, > >> static int vc4_vec_connector_get_modes(struct drm_connector *connector) >> { >> - struct drm_connector_state *state = connector->state; >> struct drm_display_mode *mode; >> >> - mode = drm_mode_duplicate(connector->dev, >> - vc4_vec_tv_modes[state->tv.legacy_mode].mode); >> + mode = drm_mode_analog_ntsc_480i(connector->dev); >> if (!mode) { >> DRM_ERROR("Failed to create a new display mode\n"); >> return -ENOMEM; >> } >> >> + mode->type |= DRM_MODE_TYPE_PREFERRED; >> drm_mode_probed_add(connector, mode); >> >> - return 1; >> + mode = drm_mode_analog_pal_576i(connector->dev); >> + if (!mode) { >> + DRM_ERROR("Failed to create a new display mode\n"); >> + return -ENOMEM; >> + } >> + >> + drm_mode_probed_add(connector, mode); >> + >> + return 2; >> +} > > Referencing those previous discussions: > - https://lore.kernel.org/dri-devel/0255f7c6-0484-6456-350d-cf24f3fee5d6@tronnes.org/ > - https://lore.kernel.org/dri-devel/c8f8015a-75da-afa8-ca7f-b2b134cacd16@gmail.com/ > > Unconditionally setting the 480i mode as DRM_MODE_TYPE_PREFERRED causes Xorg > (at least on current Raspberry Pi OS) to display garbage when > video=Composite1:PAL is specified on the command line, so I'm afraid this won't > do. > > As I see it, there are three viable solutions for this issue: > > a) Somehow query the video= command line option from this function, and set > DRM_MODE_TYPE_PREFERRED appropriately. This would break the abstraction > provided by global DRM code, but should work fine. > > b) Modify drm_helper_probe_add_cmdline_mode() so that it sets > DRM_MODE_TYPE_PREFERRED in addition to DRM_MODE_TYPE_USERDEF. This seems > pretty robust, but affects the entire DRM subsystem, which may break > userspace in different ways. > > - Maybe this could be mitigated by adding some additional conditions, e.g. > setting the PREFERRED flag only if no modes are already flagged as such > and/or only if the cmdline mode is a named one (~= analog TV mode) > > c) Forcing userspace (Xorg / Raspberry Pi OS) to get fixed and honor the USERDEF > flag. > > Either way, hardcoding 480i as PREFERRED does not seem right. > My solution for this is to look at tv.mode to know which mode to mark as preferred. Maxime didn't like this since it changes things behind userspace's back. I don't see how that can cause any problems for userspace. If userspace uses atomic and sets tv_mode, it has to know which mode to use before hand, so it doesn't look at the preferreded flag. If it uses legacy and sets tv_mode, it can end up with a stale preferred flag, but no worse than not having the flag or that ntsc is always preferred. If it doesn't change tv_mode, there's no problem, the preferred flag doesn't change. Noralf. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel