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 X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2931C3A5A0 for ; Mon, 20 Apr 2020 12:33:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEFCE206D4 for ; Mon, 20 Apr 2020 12:33:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=emersion.fr header.i=@emersion.fr header.b="REiQ0S97" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEFCE206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 468556E527; Mon, 20 Apr 2020 12:33:32 +0000 (UTC) Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D8986E527 for ; Mon, 20 Apr 2020 12:33:31 +0000 (UTC) Date: Mon, 20 Apr 2020 12:33:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1587386009; bh=2dNCrji2nfWSXbRntkLSr+YuZJaEchR72GQhOEhxMDo=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=REiQ0S97rHb4cGGLHTX/lpihgPEQyd/061QpgTLep0sRfn82mOwpuI7ucWH7T9MCL llZQnIXpa1sH0MAleCR9z2vAU5vbRkMohdHF9wZFAE71QmmSqHljtwzFdmmbSMsB+W tg/kRgZyGUxbTe15rqlEYf70J4jT7iW9wJq0kn78= To: Pekka Paalanen From: Simon Ser Subject: Re: Operating KMS UAPI (Re: RFC: Drm-connector properties managed by another driver / privacy screen support) Message-ID: In-Reply-To: <20200420152235.3473851f@eldfell.localdomain> References: <783240e9-e8d1-fc28-6c11-14c8f8e35cfa@redhat.com> <87tv1k4vl6.fsf@intel.com> <20200417120226.0cd6bc21@eldfell.localdomain> <20200420112704.68d02472@eldfell.localdomain> <20200420152235.3473851f@eldfell.localdomain> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Cc: Benjamin Berg , David Airlie , Thomas Zimmermann , Christian Kellner , Javier Martinez Canillas , "dri-devel@lists.freedesktop.org" , Hans de Goede , Mark Pearson , Rajat Jain , Nitin Joshi1 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Monday, April 20, 2020 2:22 PM, Pekka Paalanen wrote: > On Mon, 20 Apr 2020 10:15:39 +0000 > Simon Ser contact@emersion.fr wrote: > > > On Monday, April 20, 2020 10:27 AM, Pekka Paalanen ppaalanen@gmail.com wrote: > > > > > The only "random" KMS state is the properties the userspace KMS > > > program does not know that are set on start-up. I have been assuming > > > that as long as you had fbdev active before the KMS program started, > > > the unknown properties have "harmless" default values. And maybe even at > > > driver device init if fbdev does not exist? > > I meant fbcon, not fbdev above. > > > Note, this is not the case when using e.g. a display manager. In the > > past there have been cases of a display manager setting a hw cursor > > and launching a compositor not supporting hw cursors. This results in > > a stuck hw cursor. > > Indeed. So the display manager might get sensible defaults, but the > session compositor might not. Or maybe boot splash uses KMS already, so > even display manager doesn't get all-defaults state. > > It seems we really do need "sane defaults" from the kernel explicitly. > Writing a userspace tool to save it at boot time before any KMS program > runs would be awkward. Agreed. > > > Btw. I searched for all occurrences of link_status in > > > https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html and it seems it > > > only has two possible values, good and bad, and no mention whether it > > > is writable. Looks like it's writable. There does not seem to be a) an > > > explanation how exactly it needs to the handled (writing it does > > > something? what can you write?) or b) any way discern between kernel > > > and userspace set values like HDCP "Content Protection" has. > > > > User-space needs to reset the value to GOOD when recovering from a BAD > > value. > > What if userspace writes BAD? > > BAD cannot be default state, so getting default state from somewhere > would solve this property's restoring as well. Reading back the true > current value could accidentally return BAD. Interestingly, setting it to BAD is a no-op (BAD is silently discarded): /* Never downgrade from GOOD to BAD on userspace's request here, * only hw issues can do that. * * For an atomic property the userspace doesn't need to be able * to understand all the properties, but needs to be able to * restore the state it wants on VT switch. So if the userspace * tries to change the link_status from GOOD to BAD, driver * silently rejects it and returns a 0. This prevents userspace * from accidently breaking the display when it restores the * state. */ if (state->link_status != DRM_LINK_STATUS_GOOD) state->link_status = val; So restoring the "sane default" would be work, even if the link happens to be BAD when saving said "sane defaults". > Just to reiterate for everyone, the important thing here is to figure > out how userspace is supposed to reset unknown properties to sensible > defaults. Once we know how that should work, we can review whether new > properties support or break that. Yes, that's a good description of the problem. I see two main solutions here: either the kernel provides the default values in its property descriptions (e.g. drmModeGetProperty), either user-space can ask the kernel to reset properties to their default values. _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel