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=-8.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 ECF0DC4363D for ; Fri, 25 Sep 2020 11:40:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 27C4F206DB for ; Fri, 25 Sep 2020 11:40:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uI3Vawr6"; dkim=temperror (0-bit key) header.d=cerno.tech header.i=@cerno.tech header.b="rCLh3fkb"; dkim=temperror (0-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mBCnwSBb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27C4F206DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uXaeZQSg6mNDkPfWTPH9aOUwrgRsEnqP2X9UgKi2PF8=; b=uI3Vawr6UMdWZ1bAMHlIK8kgn L7NiWFbKAKy4XKDZCy5tJN6blosNV8lBMcjTuLPSvtwWuJCIJrcGM8GckCs1aKgGXjdsz3mxB+K8A gig9k5bdLow+dMsa/3OENZmqITOP3M40zund9SefVxARjSKJ+p4qk/uTF2yeUwtoEY5EML0q3SUr4 miC8fGixC7bqUTtl7ci3lsNtsAFQUnvud3MVqKFXYKqwX2wOrfzJ1odJGnuTfuFDMfQPO+CQnQMdJ jgx0xYl3LIpPHZ66rpp7lFGKp4RNJuWnmFf8/ifekRPv5g+6gbaOf52qesZIbQEOihyFEgFyBw/1U J7lixn6QA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLm3x-0006ho-CU; Fri, 25 Sep 2020 11:38:53 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLm3t-0006dn-6U; Fri, 25 Sep 2020 11:38:50 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CC32C5C024B; Fri, 25 Sep 2020 07:38:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 25 Sep 2020 07:38:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=fm3; bh=2 TJ0U0xCsiEyKFuaY9REmNmn7RYkEK4DVkQfyTbUUH0=; b=rCLh3fkbt18vaNLLv A/4x74NVZb6Gl06Z0Umm3uXsHRrsiXDUwHEW6RIIqfdNOFhF42oOPGA8P64lZeKW 7tugW9sL5cDyJVYKBOfIjuZ0ZB16TgoodcVX1A8qQ0wTROJfeyBdNAKdwlsTBnsC A9kGXdJSpirDfY4wloo+dHNjm3zwisdbD5yB+3xPdlrtL3zPmOepOiHfevAhEPSv 7ZS/4JfhLo6pmelTORBuvmsuRCXwQOCALWdxOnOGwXLvTfIw9vxmirVeHf+MK86w z0g9/Y2F2La6KS3lMDcRFRIPM09dP6v8A22rlXMB+f9G+c2aLHfnn/XGDDHTlTDh FAADg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=2TJ0U0xCsiEyKFuaY9REmNmn7RYkEK4DVkQfyTbUU H0=; b=mBCnwSBbYXpF47Al0v5raedvS6udbwwD5hwr7fbYytuxSYzNtesCiRzy8 Qdu6N40vpomQC5MvvD7cX/xZthzonfca7zp8OxDjM8kb31SbMy2oAXorm73dR5wo H0HNcGfYtSJ8SibNTzvyvmstFVJDqURJmHOb+ffJvbcJtQJhIGkmnBEQIXJVcCn6 mksQGNs4RrxZKTOR6q8nQO5vHajt/gZfFySt82hJarS6bMvyOUvo3KDdkxlD0DMy vJefK7QsOnlwC/mXvVaAxelN+not9Tg3oR/YzkVD1205y8JwgWDZNwDH1hkJd8nr /Zmf/HpjdikxJk2BvZwivb5KC1z5w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddtgdegvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggugfgjsehtqhertddttddvnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepgfejtedtjefggfffvdetuedthedtheegheeuteekfeeghfdtteejkeeludeg vddunecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 28B0D328005A; Fri, 25 Sep 2020 07:38:42 -0400 (EDT) Date: Fri, 25 Sep 2020 13:38:40 +0200 From: Maxime Ripard To: Dave Stevenson Subject: Re: [PATCH v2 1/2] drm/vc4: crtc: Rework a bit the CRTC state code Message-ID: <20200925113840.nemma2q7stujf57f@gilmour.lan> References: <20200923084032.218619-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200925_073849_470707_F00D9567 X-CRM114-Status: GOOD ( 21.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim Gover , DRI Development , Eric Anholt , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Phil Elwell , linux-arm-kernel@lists.infradead.org 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 Hi Dave, On Wed, Sep 23, 2020 at 03:59:04PM +0100, Dave Stevenson wrote: > Hi Maxime > > On Wed, 23 Sep 2020 at 09:40, Maxime Ripard wrote: > > > > The current CRTC state reset hook in vc4 allocates a vc4_crtc_state > > structure as a drm_crtc_state, and relies on the fact that vc4_crtc_state > > embeds drm_crtc_state as its first member, and therefore can be safely > > casted. > > s/casted/cast > > > However, this is pretty fragile especially since there's no check for this > > in place, and we're going to need to access vc4_crtc_state member at reset > > so this looks like a good occasion to make it more robust. > > > > Signed-off-by: Maxime Ripard > > Tested-by: Dave Stevenson > > Based on the issue I perceived with the previous patch, I'm happy. I > haven't thought about how the framework handles losing the state, but > that's not the driver's problem. > > There is still an implicit assumption that drm_crtc_state is the first > member from the implementation of to_vc4_crtc_state in vc4_drv.h. To > make it even more robust that could be a container_of instead. I > haven't checked for any other places that make the assumption though. Good catch, I'll send another patch to fix it > Reviewed-by: Dave Stevenson Does it apply to the second patch as well? Thanks! Maxime _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel