Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp971212rdd; Wed, 10 Jan 2024 05:09:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFaiF8P/Xp/xHibbuxublC6/muDKAiulnIV9hYSdxkVQAHitVg6z/B5FIDDT++kTO69qCXL X-Received: by 2002:a50:d74d:0:b0:558:72d2:eb5 with SMTP id i13-20020a50d74d000000b0055872d20eb5mr249249edj.7.1704892194456; Wed, 10 Jan 2024 05:09:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704892194; cv=none; d=google.com; s=arc-20160816; b=e6C1gY1HrDMzBEgouqTTSJhgFX2DA2s7r1AcsZ5ovjzpwGA7nYxBYbLGFNkoJM6lt1 PLflc9aok+qnGSAfnMAQWkkrEcURxSFhTKCZvAhcspt7QHdoarcI2xTUDSvqLoGgfc8W 3h2Bi2R0lqJvQklv1h0oalIRUf4+ybAumYY1qblPr7EOLLdM/hSvCtmSrrZC7doRr36C HdzykPmwJq15fV2/UxyJyb5wAunO6bEJ/x9BbZJn2MjhLSmq46P6p5MW3fD+6swr7L4E 2iSGLze239G449Z1h0DerCr48nw9cNAu2BAO8ojDmX3KJk6DbtbVL6Sn8bAXfSvOr6Ge 6cXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=axpQS9mt6EONwc4UHXjuYA8cIAmRvc0FbgaFcTL7424=; fh=J1XGcUqXQ9cVB8WYSocVJX6mbGmn6EpuxW66fQ+A5v4=; b=QoOPnA90VbTR4r7zJ2Swf42Z2Z8lq70P7fSQOEHSH2OssSlSdxmoZD8aVBjuj+VTxv yQe5/Pyi7f+SzvArCvbM9EHMEBnyAIOkGtNxmpipV5oinYjqzLZzQ9dcqz0egSZ/WpbL 7D1P3HVQ92DwfxQlPEZU8IweQrLMAjcvlpWe9UB4y8WGYFOeHwRNdwhraxoM/RumWYc6 Q6EkXD0FFg/t9/kJ2n6XftVL18bCXFuqAqBsz9yB3lCZLxLEst7NEDRAtKrEEgUOhKAw NNVDUkn0PULgsa7jY2xthozXXXqmAp/ZYSHsbFqO1J1L3G7EqcA7lnfiUicDeU4r8LVN YAlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=CZDHJCE8; spf=pass (google.com: domain of linux-kernel+bounces-22213-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22213-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i4-20020a05640242c400b00557b8ee828asi1808610edc.455.2024.01.10.05.09.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 05:09:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22213-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=CZDHJCE8; spf=pass (google.com: domain of linux-kernel+bounces-22213-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22213-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3A2731F243CD for ; Wed, 10 Jan 2024 13:09:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8334487A1; Wed, 10 Jan 2024 13:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="CZDHJCE8" Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11F464879C for ; Wed, 10 Jan 2024 13:09:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ffwll.ch Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3bbe78dbd1aso491458b6e.1 for ; Wed, 10 Jan 2024 05:09:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1704892184; x=1705496984; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=axpQS9mt6EONwc4UHXjuYA8cIAmRvc0FbgaFcTL7424=; b=CZDHJCE8ZB+AD/6LaUFMY0Mi0AX6ijQi+oiTxli9TXwIhBfsEOcl/sZ43uCi/hqxMi DKYMiVZN+40wH1B3p9SnOStpE3xlYuWD1H1m6xRHMyiWtGaeE8XPuXvbvC7yULZWOqYm dhI0U+FkhXnPOE/EKiC20K2/3wZAi6s2fZCUo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704892184; x=1705496984; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=axpQS9mt6EONwc4UHXjuYA8cIAmRvc0FbgaFcTL7424=; b=at7H/ySxP0n+bK6EM2DbAeEw0actS/4fQsO1nP5ACp41c7YzKIww4PXvTKbEGqn2+L u3EsKD+klXldYKBFNHg2laq9mo0vY50SY5bXLYlmSe0Bc6vZFH1lIPCMv4UECyWHrvAK Ii4xVhkenShDtnhChWyMrlwb/YuMpDAD40B/FuJn6crByCEceQ+GD2NkHYQlIjjefTJK marN160OBVPijB4EA2e3x8qpEcTF/DYG3QBkzUKIA54nv71FAxl8lpF3dW+Lodhhd7Vl Q7/LobhxdziYGykPgyGdtP2quOIa6EIZcniyp9oEx9lSHiD9+6oLJxICQY8QcsEpy78t xS8w== X-Gm-Message-State: AOJu0YxKL21nNhF7y8j9OktofhhFtATsVia1kiP07YpkGPqOqArxRAmO g0BYd4mFWi3pJgGV3MQJ08y+f55VSTrMyg/BQ6jZ/jQ7Ih7flA== X-Received: by 2002:a05:6870:4304:b0:206:7561:280a with SMTP id w4-20020a056870430400b002067561280amr1694852oah.4.1704892183803; Wed, 10 Jan 2024 05:09:43 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240109181104.1670304-1-andri@yngvason.is> <20240109181104.1670304-4-andri@yngvason.is> In-Reply-To: From: Daniel Vetter Date: Wed, 10 Jan 2024 14:09:32 +0100 Message-ID: Subject: Re: [PATCH 3/7] drm/amd/display: Add handling for new "active color format" property To: Andri Yngvason Cc: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, Simon Ser , Werner Sembach Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 10 Jan 2024 at 13:53, Andri Yngvason wrote: > > mi=C3=B0., 10. jan. 2024 kl. 11:10 skrifa=C3=B0i Daniel Vetter : > > > > On Tue, Jan 09, 2024 at 06:11:00PM +0000, Andri Yngvason wrote: > > > + /* Extract information from crtc to communicate it to userspace= as connector properties */ > > > + for_each_new_connector_in_state(state, connector, new_con_state= , i) { > > > + struct drm_crtc *crtc =3D new_con_state->crtc; > > > + struct dc_stream_state *stream; > > > + > > > + if (crtc) { > > > + new_crtc_state =3D drm_atomic_get_new_crtc_stat= e(state, crtc); > > > + dm_new_crtc_state =3D to_dm_crtc_state(new_crtc= _state); > > > + stream =3D dm_new_crtc_state->stream; > > > + > > > + if (stream) { > > > + drm_connector_set_active_color_format_p= roperty(connector, > > > + convert_dc_pixel_encoding_into_= drm_color_format( > > > + dm_new_crtc_state->stre= am->timing.pixel_encoding)); > > > + } > > > + } else { > > > + drm_connector_set_active_color_format_property(= connector, 0); > > > > Just realized an even bigger reason why your current design doesn't wor= k: > > You don't have locking here. > > > > And you cannot grab the required lock, which is > > drm_dev->mode_config.mutex, because that would result in deadlocks. So > > this really needs to use the atomic state based design I've described. > > > > Maybe we should just drop "actual color format" and instead fail the > modeset if the "preferred color format" property cannot be satisfied? > It seems like the simplest thing to do here, though it is perhaps less > convenient for userspace. In that case, the "preferred color format" > property should just be called "color format". Yeah that's more in line with how other atomic properties work. This way userspace can figure out what works with a TEST_ONLY commit too. And for this to work you probably want to have an "automatic" setting too. -Sima --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch