From patchwork Fri Jan 20 17:30:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13110293 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2DF1AC05027 for ; Fri, 20 Jan 2023 17:31:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EBA2E10E0E0; Fri, 20 Jan 2023 17:31:11 +0000 (UTC) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4CBB810E04E for ; Fri, 20 Jan 2023 17:31:09 +0000 (UTC) Received: by mail-wm1-x32b.google.com with SMTP id l41-20020a05600c1d2900b003daf986faaeso4245765wms.3 for ; Fri, 20 Jan 2023 09:31:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D4HRh/xECMVrkAQ+rHzLh2y2hx0e7txexSDUMhaR4Ks=; b=KOAy7WqeTvP8+Sbxusk9elhvfXIfyG8QADBBoywCpEcBPcOP35aZ2eFIxNC8ba5J8S ejgpcz6IZhgQ9jtjJjsXnZV8qJ3lJwF/gXp3RXcD5Iw1lT+tDbvTzl1pEy1IdC7jjqks yrCtZnhYlBkJhI1HGOBOIu/IUvgeZdegsizv94t/ybFUOdb+mmXUSDb2bH5EWTiF1JzI 57P7OTdbT1iHUgcpQCsP8xnLFNOvrS4oIzSOG+/fb3avZa5o9MFFxqRWHjUjLDWYqSMu tscKRJ9ohqkJvPnS9tyfJBUYEd+eLXgcDKmf9/3Im+aZ6ONe0YLvaVpYyujNycdX2gXP EQNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D4HRh/xECMVrkAQ+rHzLh2y2hx0e7txexSDUMhaR4Ks=; b=GDQt7qh9iZn/d8duf+3LASMgbD63iUhDbTr8aoiKZ6fXOVNoIiA04XBOn5uKuYw5dt mhusjzcLAGm5UzfRnHUJAyNJA1Mz1k1MxUIdDk1g2ZPn/GIzbB0de55IRWb0BoKy8OCn uQ28HliLl4ufuIjaYtncIDxcxacpatx2k6yG0Zi8/67YoNGF7xUNm0jGlG3FoLLnRbRv d7G+H9s0BF7mMARM19+c75qEmwzrG1hJte4O/KNXPJ0S8Cw+rfGZprE/dRD0lK7iUhQx uQKeld1tqX4N7HuJmzGVbO5+ZGR1fAUEi0kbURp1ZvmOdrh928QF4R6+7kQUxvNIcLEf NHeg== X-Gm-Message-State: AFqh2kqt3PP9tvnF8ok1hpWUnPZUxvl/q40ElJXMu94CDI9BKxOGejK9 a5EIxlYooPd+8LoB7rVVgNE= X-Google-Smtp-Source: AMrXdXs++sNuHqUOoSyqqneB+mzWpppVn+a3j8F11wwCSMf5OEMNBjzUd4wpvTw9gp8LCE0jyfcYHA== X-Received: by 2002:a05:600c:1c23:b0:3db:b9f:f2e with SMTP id j35-20020a05600c1c2300b003db0b9f0f2emr13321794wms.14.1674235867778; Fri, 20 Jan 2023 09:31:07 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id p8-20020a5d4588000000b002bdfb97e029sm14413258wrq.19.2023.01.20.09.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 09:31:07 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v4 1/8] dt-bindings: display: simple-framebuffer: Support system memory framebuffers Date: Fri, 20 Jan 2023 18:30:56 +0100 Message-Id: <20230120173103.4002342-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120173103.4002342-1-thierry.reding@gmail.com> References: <20230120173103.4002342-1-thierry.reding@gmail.com> 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: , Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Jon Hunter , linux-tegra@vger.kernel.org, Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding In order to support framebuffers residing in system memory, allow the memory-region property to override the framebuffer memory specification in the "reg" property. Reviewed-by: Rob Herring Signed-off-by: Thierry Reding --- .../devicetree/bindings/display/simple-framebuffer.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml index dd64f70b5014..3e9857eb002e 100644 --- a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml +++ b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml @@ -63,6 +63,11 @@ properties: reg: description: Location and size of the framebuffer memory + memory-region: + maxItems: 1 + description: Phandle to a node describing the memory to be used for the + framebuffer. If present, overrides the "reg" property (if one exists). + clocks: description: List of clocks used by the framebuffer. From patchwork Fri Jan 20 17:30:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13110300 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 6042FC27C7C for ; Fri, 20 Jan 2023 17:31:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7078410E384; Fri, 20 Jan 2023 17:31:43 +0000 (UTC) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5B7BC10E04E for ; Fri, 20 Jan 2023 17:31:10 +0000 (UTC) Received: by mail-wm1-x32e.google.com with SMTP id q8so4628461wmo.5 for ; Fri, 20 Jan 2023 09:31:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GBbS1vR/mSuCPWTVaI9sYUbEGcKE+xDxJZ9yOEMjCrg=; b=qjJVGDJH0jKQ0b4gzTbkmZrDvUkl0cBq7dqS3DzmJkGXk0cUiGw8MiLlBytpyxXpe5 nPd0+VJ6zqdQsWok6dWwpaQBGSKGsvLc4gOrnwT1BVZvQK+0aLewi7lVVZHJUFxJPn06 g41pppSD132BYkYxl21lBvFQjz6pO66N66lmvbCaP3vkyAEGnAD2nlCuZ1R5vEuUmPxZ 2KTrzvHbb3+2zUKcoGlUfsJmTEiwjhSdt2OYDX1MXzRcV6vsbD50CYFwRnlVDpQNTUq2 QwOeJ4cLfmobuPYC8LGX27KOOZ0rqd+21etuwUqfegxoR29BVSHH88bVUIv61f2xTjHx edOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GBbS1vR/mSuCPWTVaI9sYUbEGcKE+xDxJZ9yOEMjCrg=; b=HxM8HTjuA6EGaO80Nhyf23rMyNtJ3/L+FOUYFguaqV5XfTc3HMJtr2mrdfVGfkCaW6 868PwUZ0kmpwrlKj03hiq1yzDZvy7ceSKDc2e3oks7GYwXCJzDzse12Habz/TaC6wDu2 W+BkDwXgpI4/PuH6G2lO/EzIwbBPPJlM4wEF7rKiebhp3N0KzGgOp5SS0K5ylJ4Gsx0P AUwxCWW3BgE8toTuMfmWHweJCP3CrzEDGQFYdInJ36MTRy97AZRjO/j8LBR9iOOVi2sm vAulQ2TKaBJ7aG6ylBlcL6A/s1dcfntWmjmBlVsZ6tqXQOpstp/5r/qWBNUZNW40mVDS dmWQ== X-Gm-Message-State: AFqh2koUjT9jHXVYDzS5sHKOv03YJDQVLPop2RHu7rCIAP32H0XrldsB l6rC/Om8aeaOncVInKG9684= X-Google-Smtp-Source: AMrXdXsbFPG+yPqtgN9BXP7pJsSnwZmnCuFETW1Ckv3V7VUiLfVY2ra6BoEUOfuxX5YKtYvRx/HBcg== X-Received: by 2002:a05:600c:6006:b0:3db:21b8:5f58 with SMTP id az6-20020a05600c600600b003db21b85f58mr7162938wmb.2.1674235868713; Fri, 20 Jan 2023 09:31:08 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id w4-20020adfee44000000b0029100e8dedasm36214943wro.28.2023.01.20.09.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 09:31:08 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v4 2/8] dt-bindings: display: simple-framebuffer: Document 32-bit BGR format Date: Fri, 20 Jan 2023 18:30:57 +0100 Message-Id: <20230120173103.4002342-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120173103.4002342-1-thierry.reding@gmail.com> References: <20230120173103.4002342-1-thierry.reding@gmail.com> 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: , Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Jon Hunter , linux-tegra@vger.kernel.org, Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding This is a variant of the 32-bit RGB format where the red and blue components are swapped. Reviewed-by: Rob Herring Signed-off-by: Thierry Reding --- .../devicetree/bindings/display/simple-framebuffer.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml index 3e9857eb002e..3c9f29e428a4 100644 --- a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml +++ b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml @@ -99,6 +99,7 @@ properties: * `x1r5g5b5` - 16-bit pixels, d[14:10]=r, d[9:5]=g, d[4:0]=b * `x2r10g10b10` - 32-bit pixels, d[29:20]=r, d[19:10]=g, d[9:0]=b * `x8r8g8b8` - 32-bit pixels, d[23:16]=r, d[15:8]=g, d[7:0]=b + * `x8b8g8r8` - 32-bit pixels, d[23:16]=b, d[15:8]=g, d[7:0]=r enum: - a1r5g5b5 - a2r10g10b10 @@ -110,6 +111,7 @@ properties: - x1r5g5b5 - x2r10g10b10 - x8r8g8b8 + - x8b8g8r8 display: $ref: /schemas/types.yaml#/definitions/phandle From patchwork Fri Jan 20 17:30:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13110299 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 98EC8C38159 for ; Fri, 20 Jan 2023 17:31:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BDDBB10E381; Fri, 20 Jan 2023 17:31:42 +0000 (UTC) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FE8210E04E for ; Fri, 20 Jan 2023 17:31:11 +0000 (UTC) Received: by mail-wm1-x332.google.com with SMTP id q8so4628491wmo.5 for ; Fri, 20 Jan 2023 09:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DdoQo1d/Fewt3gQuyYh4h+Gkl8pP1KOY6qOThytv+hI=; b=GNFViGqK9tTqpMZxDI3CBJeCm+MDtwGO3ieRWsOwQy6zL8z7EvKqrmid1acMPEBvIR in4jNFQkQoqort6U/nPqcaiKrfUyDdEPY4TKthYQ0p+pCDv/17zZGDoPs7CkjxJullPf 9Xkiq5p7aQpALvn9z9bwAp0Shg+fTP92laBL28OOj8DyWOa3kGJ0X3e9xDyuN61kv8iE fIptJO2I2rfSVo8tJv4sTWYekeKn7iozC4CM3Nf6ObF0tl89+zKA+LTcgHFznUQ8tQ40 AVPXJo85vEEB5LGBlsQsswxZjIFL2qC34FulqyYrkQZQ7N3tf7/FIjdysOtdA3rPS9kH naZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DdoQo1d/Fewt3gQuyYh4h+Gkl8pP1KOY6qOThytv+hI=; b=tvUyt9p0mHiXFoH1so/94iFeoQ8KHploYFMM5oB39NpC8pA+EyrrCL4gUZEvQOMVui u1vP0X/uflwOx25ym+4Tfk33JWg2SZRfCoQpLvArvtYakE23ChiWhT+Ig+sIXOxXeRc6 5ktt8btnwtBeWZhNZ+fr2lLpoK6lWZnYDsi7i1ua0rwymlXxbEu/AZVf7LJJZDNm/oE3 eo6YPslXkpx554Hk8KVULV7BBf9HYwZ84rvN045gBb+X4VqUaxHXXVPA1RBJ3nL6X6Yc ZuLwyrj3ZtGILDaev+JrTZQ7/+tlky0vpuratJIDIdBg3F26rnJTgclom5Df9DbPYm6r kgew== X-Gm-Message-State: AFqh2krcLgcHPmDQKk79lz449K5jAqtboGl0B6MjyccXp112bFeGt1yv EO5CqfEUbW6OKO29B42j+Pg= X-Google-Smtp-Source: AMrXdXtgdksTbxRuG65zLEjDS1QUbMxH8ikWgpCZ64qimjbW2UYEGnrJEg6MWlLS/MimjoSmAWPcaw== X-Received: by 2002:a05:600c:4e93:b0:3db:d3f:a91f with SMTP id f19-20020a05600c4e9300b003db0d3fa91fmr12757322wmq.23.1674235869712; Fri, 20 Jan 2023 09:31:09 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id l30-20020a05600c1d1e00b003c6b70a4d69sm3311363wms.42.2023.01.20.09.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 09:31:09 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v4 3/8] dt-bindings: reserved-memory: Support framebuffer reserved memory Date: Fri, 20 Jan 2023 18:30:58 +0100 Message-Id: <20230120173103.4002342-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120173103.4002342-1-thierry.reding@gmail.com> References: <20230120173103.4002342-1-thierry.reding@gmail.com> 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: , Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Jon Hunter , linux-tegra@vger.kernel.org, Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Document the "framebuffer" compatible string for reserved memory nodes to annotate reserved memory regions used for framebuffer carveouts. Reviewed-by: Rob Herring Signed-off-by: Thierry Reding --- Changes in v2: - use four spaces for indentation in example (as recommended elsewhere) - add explicit root node - drop unneeded quotes .../bindings/reserved-memory/framebuffer.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/reserved-memory/framebuffer.yaml diff --git a/Documentation/devicetree/bindings/reserved-memory/framebuffer.yaml b/Documentation/devicetree/bindings/reserved-memory/framebuffer.yaml new file mode 100644 index 000000000000..05b6648b3458 --- /dev/null +++ b/Documentation/devicetree/bindings/reserved-memory/framebuffer.yaml @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reserved-memory/framebuffer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: /reserved-memory framebuffer node bindings + +maintainers: + - devicetree-spec@vger.kernel.org + +allOf: + - $ref: reserved-memory.yaml + +properties: + compatible: + const: framebuffer + description: > + This indicates a region of memory meant to be used as a framebuffer for + a set of display devices. It can be used by an operating system to keep + the framebuffer from being overwritten and use it as the backing memory + for a display device (such as simple-framebuffer). + +unevaluatedProperties: false + +examples: + - | + / { + compatible = "foo"; + model = "foo"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + framebuffer { + compatible = "simple-framebuffer"; + memory-region = <&fb>; + }; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + fb: framebuffer@80000000 { + compatible = "framebuffer"; + reg = <0x80000000 0x007e9000>; + }; + }; + }; +... From patchwork Fri Jan 20 17:30:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13110301 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4D1BBC05027 for ; Fri, 20 Jan 2023 17:31:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF59C10E38A; Fri, 20 Jan 2023 17:31:44 +0000 (UTC) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 91EB210E10B for ; Fri, 20 Jan 2023 17:31:12 +0000 (UTC) Received: by mail-wr1-x42f.google.com with SMTP id n7so5483900wrx.5 for ; Fri, 20 Jan 2023 09:31:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SZNLi/l9wxy+mypxiXIZ6SYlQ5ADDjWtmD5zsC5Iu7U=; b=ekmCbRnQ3AKTSQE0uIHwanjK5e6WP9TSnmmjfarZxQgBhR/oiLwMIm/Zsd4JZ810NX /12FvuVLMlj3cBThnm4vG/SGhZDBu1ZwSGoeOc1QYfGVHmv2vLI1rKmYu3w2Qa6bcatW bihB3PpG/qNnfJ1XcPQw+mWakCZdhXFdABhR2Vx8o5xJCCvQjDdPoy3qbclJna8o6m+/ vooPj/OdMhGZupkhaDS6ttD+war33jtqb+hJCukHGDvgVn3Df5FeDPXpeC2ch0SZoNuH Hh7ONe2kRy1EHHoJ8YqG8/qzCZ/IGBFMKzm+aUF0ILgAdTAcd5nyMcGo3JF+6wBpWOFB CDCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SZNLi/l9wxy+mypxiXIZ6SYlQ5ADDjWtmD5zsC5Iu7U=; b=pwhmz+geR2fWk2qJsMHkS9DzrbgLCp+RIL56JD9s1jaPMezd+9aGWUooVL/r7Nn9PX MkcwFk3msuwjxGlyZNaJdVL/2zcsEUuFnOwEqGEYKnJdoRQAITTcT7Bsk+e8LfCKSrah BmzC1ILO4huui/dpqEVuixaqXaP8ab1eBtCcv2jWt+uTL8oaGygn792Xwl3mAuVVmsdb kKzLxdCaFNFEMLlwuZaHKRVLQZY7FBd8U3kxZmyyOs02/3I2qBgD31kA3cvDcy+UiWTN BndUSD03po5d6OuiD+gV+vHAu0ntkc+NSiLwAeSeKORjPsebXfWlHz3k/EnvwJOHjF/B iedA== X-Gm-Message-State: AFqh2kobOYqldB3zkvOflrjac5OisYc+GcJAr18j0NKXQN/kGKNXV/Jl BE9wKlqlC9+wv4VtAd6nOuI= X-Google-Smtp-Source: AMrXdXt7beT4QiPFE5mJktjpvop0RXCXl2JkSoxV5JPJmVDP+OojVEZhXyRjj+HLM0Q78WAZAizSiw== X-Received: by 2002:adf:a31e:0:b0:2be:5cff:5d00 with SMTP id c30-20020adfa31e000000b002be5cff5d00mr2463881wrb.70.1674235871083; Fri, 20 Jan 2023 09:31:11 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id l4-20020a05600012c400b002bbb2d43f65sm33297181wrx.14.2023.01.20.09.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 09:31:10 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v4 4/8] drm/simpledrm: Use struct iosys_map consistently Date: Fri, 20 Jan 2023 18:30:59 +0100 Message-Id: <20230120173103.4002342-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120173103.4002342-1-thierry.reding@gmail.com> References: <20230120173103.4002342-1-thierry.reding@gmail.com> 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: , Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, Robin Murphy , dri-devel@lists.freedesktop.org, Jon Hunter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding The majority of the driver already uses struct iosys_map to encapsulate accesses to I/O remapped vs. system memory. Accesses via the screen base pointer still use __iomem annotations, which can lead to inconsistencies and conflicts with subsequent patches. Convert the screen base to a struct iosys_map as well for consistency and to avoid these issues. Reviewed-by: Thomas Zimmermann Signed-off-by: Thierry Reding --- Changes in v4: - rename screen variable to dst for consistency with other drivers - add Reviewed-by from Thomas drivers/gpu/drm/tiny/simpledrm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index f658b99c796a..c1ed6dd426ec 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -208,7 +208,7 @@ struct simpledrm_device { unsigned int pitch; /* memory management */ - void __iomem *screen_base; + struct iosys_map screen_base; /* modesetting */ uint32_t formats[8]; @@ -473,15 +473,15 @@ static void simpledrm_primary_plane_helper_atomic_update(struct drm_plane *plane drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state); drm_atomic_for_each_plane_damage(&iter, &damage) { - struct iosys_map dst = IOSYS_MAP_INIT_VADDR(sdev->screen_base); struct drm_rect dst_clip = plane_state->dst; + struct iosys_map dst = sdev->screen_base; if (!drm_rect_intersect(&dst_clip, &damage)) continue; iosys_map_incr(&dst, drm_fb_clip_offset(sdev->pitch, sdev->format, &dst_clip)); - drm_fb_blit(&dst, &sdev->pitch, sdev->format->format, shadow_plane_state->data, fb, - &damage); + drm_fb_blit(&dst, &sdev->pitch, sdev->format->format, shadow_plane_state->data, + fb, &damage); } drm_dev_exit(idx); @@ -500,7 +500,7 @@ static void simpledrm_primary_plane_helper_atomic_disable(struct drm_plane *plan return; /* Clear screen to black if disabled */ - memset_io(sdev->screen_base, 0, sdev->pitch * sdev->mode.vdisplay); + iosys_map_memset(&sdev->screen_base, 0, 0, sdev->pitch * sdev->mode.vdisplay); drm_dev_exit(idx); } @@ -703,7 +703,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv, screen_base = devm_ioremap_wc(&pdev->dev, mem->start, resource_size(mem)); if (!screen_base) return ERR_PTR(-ENOMEM); - sdev->screen_base = screen_base; + + iosys_map_set_vaddr_iomem(&sdev->screen_base, screen_base); /* * Modesetting From patchwork Fri Jan 20 17:31:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13110295 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 75850C52D77 for ; Fri, 20 Jan 2023 17:31:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 359BC10E11F; Fri, 20 Jan 2023 17:31:23 +0000 (UTC) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 966BB10E11F for ; Fri, 20 Jan 2023 17:31:13 +0000 (UTC) Received: by mail-wr1-x42f.google.com with SMTP id h12so1480094wrv.10 for ; Fri, 20 Jan 2023 09:31:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YOqgdpqToWA5S18UMLkfS63Q0Xl2lO+o2375eUlRgI8=; b=Fn5m8NLD2sIpmyLtR/VrUuV3fgp+Xy4nvnxpCrxirKNblkgociu5lzX1mVT78Fg3Tp DfI+ajWMD53UpjZFoCDaYzZIwgwh7oPwgyvJ3gLcttwV2rwWbU2XWP0cIpVs24ha79z0 Bbz8rcK3zpt7EFQZS7Cx6gbM9d5uVT2hcHqSYbolDVqMPwworHPQtKgza+lqCqjUY49P sWYaP6sYWSLnJ8kxgoU8LR4rDmearyXrkPK1DnCIYPRZP32qWKOO1BO4aCA64GKz70t3 6vMCOccfxd7C0UDVdZ7r6yEde6m0zaWtESJ4ba9AnTmsWbZNkIdo4HSFU6DNDSQqJBaN uTYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YOqgdpqToWA5S18UMLkfS63Q0Xl2lO+o2375eUlRgI8=; b=zgHTrz2YJ4olCFautKHoZEcumCKVARk8Gl0KGwtNZdstJbKQQHKzCCsZCghKx+4NtG Eu8mCPxgL8dWHMLRWltxBIPBBTV4vysEse7dw+vyO4gnXROMimhJGgR+FwK2vfuFUySv j1HEiJ3MSv5oN25vzUcB4qXfCJMO6TbO0pq4eL2aYexlSx0IabBYCLw+ScnguoiL96PU 7GMxREHlK3nKOH0yJbKOiYn0fE5DaT448/0o1K0R8HS+TInsIdQdyDl/zSnT6+zCMBOe hmui9GNaYBfqfhxbhDjtailzNk/lTga7J6MRgZplIZ4AfdHxwqncyp7651mWsy0ym2La 1a4Q== X-Gm-Message-State: AFqh2kpKoRz4UT74lCHuM+k44Qjc0NkYg4ot55rwMapc0oGbm958arIF wR9A7BXtvm3qNHWc7TlLgx0= X-Google-Smtp-Source: AMrXdXuPyUil8dJ4H1vXqJh1dFD3RGgBy+Yg2OV3pzxReYLYgMKMw5l6i3wq1EvjMMzZ84xqKCoJgQ== X-Received: by 2002:a05:6000:16ce:b0:2be:d04:3667 with SMTP id h14-20020a05600016ce00b002be0d043667mr16249463wrf.26.1674235871963; Fri, 20 Jan 2023 09:31:11 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id b11-20020a05600018ab00b002be2279f100sm11342632wri.96.2023.01.20.09.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 09:31:11 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v4 5/8] drm/simpledrm: Add support for system memory framebuffers Date: Fri, 20 Jan 2023 18:31:00 +0100 Message-Id: <20230120173103.4002342-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120173103.4002342-1-thierry.reding@gmail.com> References: <20230120173103.4002342-1-thierry.reding@gmail.com> 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: , Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, Robin Murphy , dri-devel@lists.freedesktop.org, Jon Hunter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Simple framebuffers can be set up in system memory, which cannot be requested and/or I/O remapped using the I/O resource helpers. Add a separate code path that obtains system memory framebuffers from the reserved memory region referenced in the memory-region property. Reviewed-by: Thomas Zimmermann Signed-off-by: Thierry Reding --- Changes in v4: - rebase onto latest format helper changes - turn drm_info() into drm_dbg() - add Reviewed-by from Thomas Changes in v3: - simplify memory code and move back to simpledrm_device_create() - extract screen_base iosys_map fix into separate patch Changes in v2: - make screen base a struct iosys_map to avoid sparse warnings drivers/gpu/drm/tiny/simpledrm.c | 99 ++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index c1ed6dd426ec..2acc0eb32489 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -184,6 +185,31 @@ simplefb_get_format_of(struct drm_device *dev, struct device_node *of_node) return simplefb_get_validated_format(dev, format); } +static struct resource * +simplefb_get_memory_of(struct drm_device *dev, struct device_node *of_node) +{ + struct device_node *np; + struct resource *res; + int err; + + np = of_parse_phandle(of_node, "memory-region", 0); + if (!np) + return NULL; + + res = devm_kzalloc(dev->dev, sizeof(*res), GFP_KERNEL); + if (!res) + return ERR_PTR(-ENOMEM); + + err = of_address_to_resource(np, 0, res); + if (err) + return ERR_PTR(err); + + if (of_get_property(of_node, "reg", NULL)) + drm_warn(dev, "preferring \"memory-region\" over \"reg\" property\n"); + + return res; +} + /* * Simple Framebuffer device */ @@ -604,8 +630,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv, struct drm_device *dev; int width, height, stride; const struct drm_format_info *format; - struct resource *res, *mem; - void __iomem *screen_base; + struct resource *res, *mem = NULL; struct drm_plane *primary_plane; struct drm_crtc *crtc; struct drm_encoder *encoder; @@ -657,6 +682,9 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv, format = simplefb_get_format_of(dev, of_node); if (IS_ERR(format)) return ERR_CAST(format); + mem = simplefb_get_memory_of(dev, of_node); + if (IS_ERR(mem)) + return ERR_CAST(mem); } else { drm_err(dev, "no simplefb configuration found\n"); return ERR_PTR(-ENODEV); @@ -679,32 +707,55 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv, * Memory management */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return ERR_PTR(-EINVAL); + if (mem) { + void *screen_base; - ret = devm_aperture_acquire_from_firmware(dev, res->start, resource_size(res)); - if (ret) { - drm_err(dev, "could not acquire memory range %pr: error %d\n", res, ret); - return ERR_PTR(ret); - } + ret = devm_aperture_acquire_from_firmware(dev, mem->start, resource_size(mem)); + if (ret) { + drm_err(dev, "could not acquire memory range %pr: %d\n", mem, ret); + return ERR_PTR(ret); + } - mem = devm_request_mem_region(&pdev->dev, res->start, resource_size(res), drv->name); - if (!mem) { - /* - * We cannot make this fatal. Sometimes this comes from magic - * spaces our resource handlers simply don't know about. Use - * the I/O-memory resource as-is and try to map that instead. - */ - drm_warn(dev, "could not acquire memory region %pr\n", res); - mem = res; - } + drm_dbg(dev, "using system memory framebuffer at %pr\n", mem); - screen_base = devm_ioremap_wc(&pdev->dev, mem->start, resource_size(mem)); - if (!screen_base) - return ERR_PTR(-ENOMEM); + screen_base = devm_memremap(dev->dev, mem->start, resource_size(mem), MEMREMAP_WC); + if (!screen_base) + return ERR_PTR(-ENOMEM); + + iosys_map_set_vaddr(&sdev->screen_base, screen_base); + } else { + void __iomem *screen_base; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return ERR_PTR(-EINVAL); - iosys_map_set_vaddr_iomem(&sdev->screen_base, screen_base); + ret = devm_aperture_acquire_from_firmware(dev, res->start, resource_size(res)); + if (ret) { + drm_err(dev, "could not acquire memory range %pr: %d\n", &res, ret); + return ERR_PTR(ret); + } + + drm_dbg(dev, "using I/O memory framebuffer at %pr\n", res); + + mem = devm_request_mem_region(&pdev->dev, res->start, resource_size(res), + drv->name); + if (!mem) { + /* + * We cannot make this fatal. Sometimes this comes from magic + * spaces our resource handlers simply don't know about. Use + * the I/O-memory resource as-is and try to map that instead. + */ + drm_warn(dev, "could not acquire memory region %pr\n", res); + mem = res; + } + + screen_base = devm_ioremap_wc(&pdev->dev, mem->start, resource_size(mem)); + if (!screen_base) + return ERR_PTR(-ENOMEM); + + iosys_map_set_vaddr_iomem(&sdev->screen_base, screen_base); + } /* * Modesetting From patchwork Fri Jan 20 17:31:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13110296 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 40032C25B4E for ; Fri, 20 Jan 2023 17:31:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C44310E004; Fri, 20 Jan 2023 17:31:30 +0000 (UTC) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7F13510E10B for ; Fri, 20 Jan 2023 17:31:14 +0000 (UTC) Received: by mail-wm1-x32b.google.com with SMTP id o17-20020a05600c511100b003db021ef437so4234877wms.4 for ; Fri, 20 Jan 2023 09:31:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=78W7IXXHqgUZh6eEXtc3i7yBwKfecEIjh9aXPYe7GEA=; b=SEm/NiYw03IrJVONYxj8S6CudMwJbwnQfEfMv8WLW+xrm/hl+XwebXhF8UgZukrwEQ jEv1Rtvs+sMjog6lwpKrVMWAdjWu010pPjDx+WW4QkKGsTndKABZNJiJ+rvtclb6RMVN M1Sd0fFcCG00kXHifJF8Msn4iIDPEsq7nastKIeqsyv0hPcKNsJUj6I8Pc0PtlL9kLSV H0r0Ruqec02yVK5SNpbCM0LfHjQmulKCvAOHPRZrK5qjSfYMW3ZONTLefeEtpIivMyLe fmo36tXCle53zltWf++reGaIShW4IzLLaZjB0x77h/FLc4I1R7UI2hjG4VwdOEfRQ32u vAjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=78W7IXXHqgUZh6eEXtc3i7yBwKfecEIjh9aXPYe7GEA=; b=lmP4DL+2smL9sK+j+dS2OdZcGIUtsx20Cbz85ppdUOql6MBVCHdv3lZ4wme+C44I/n 1zGNEeCDeRs18HNlIWM+3FwFK4VncfzdU31a6/RqPNBdcIKk0J8uYgqjOJGywSlY8AWU HN6L59rUJMuyTKwsux3d5zeDsEf1g2PoTzvc3EeTXREJlO96gZSEci+ENj3r2lsY43dc lzVEWxVh6pb3wAIIxrPaD8bLAo7utWoxE3XSKpUUm7R0t/cuR3IV5Zh/aa9WtvTOD+hp DZSMwKdKErDMUN0kFzmnS8UlXJn7y0ba/0sJKQqZmi67kbg2fCp9ZeGe6OZWJulVuhkm JKdg== X-Gm-Message-State: AFqh2kp6s12P3XCdFDal65gedriNeysPH4Jje6U1ZamPWZbxGRXnPmwb NGizUm1ZQXZ95aw7s0Kul1I= X-Google-Smtp-Source: AMrXdXvzEgbI7Tp8Tw5Ds4T0d245b1GQLC4LVo8SfXduEZQri0QCyUWQpHLjGRzU3haJg1/JO1ieQA== X-Received: by 2002:a7b:cc14:0:b0:3da:50b0:e96a with SMTP id f20-20020a7bcc14000000b003da50b0e96amr15053406wmh.29.1674235872923; Fri, 20 Jan 2023 09:31:12 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id g10-20020a05600c310a00b003d99da8d30asm3193070wmo.46.2023.01.20.09.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 09:31:12 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v4 6/8] drm/format-helper: Support the AB24/XB24 formats Date: Fri, 20 Jan 2023 18:31:01 +0100 Message-Id: <20230120173103.4002342-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120173103.4002342-1-thierry.reding@gmail.com> References: <20230120173103.4002342-1-thierry.reding@gmail.com> 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: , Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, Robin Murphy , dri-devel@lists.freedesktop.org, Jon Hunter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Add a conversion helper for the AB24 and XB24 formats to use in drm_fb_blit(). Reviewed-by: Thomas Zimmermann Signed-off-by: Thierry Reding --- Changes in v4: - rebased on top of latest drm-format-helper rework, add back AB24 support - add Reviewed-by from Thomas Changes in v3: - rebase onto latest drm-next Changes in v2: - support XB24 format instead of AB24 drivers/gpu/drm/drm_format_helper.c | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c index 994f8fb71f45..f93a4efcee90 100644 --- a/drivers/gpu/drm/drm_format_helper.c +++ b/drivers/gpu/drm/drm_format_helper.c @@ -649,6 +649,66 @@ void drm_fb_xrgb8888_to_argb8888(struct iosys_map *dst, const unsigned int *dst_ } EXPORT_SYMBOL(drm_fb_xrgb8888_to_argb8888); +static void drm_fb_xrgb8888_to_abgr8888_line(void *dbuf, const void *sbuf, unsigned int pixels) +{ + __le32 *dbuf32 = dbuf; + const __le32 *sbuf32 = sbuf; + unsigned int x; + u32 pix; + + for (x = 0; x < pixels; x++) { + pix = le32_to_cpu(sbuf32[x]); + pix = ((pix & 0x00ff0000) >> 16) << 0 | + ((pix & 0x0000ff00) >> 8) << 8 | + ((pix & 0x000000ff) >> 0) << 16 | + GENMASK(31, 24); /* fill alpha bits */ + *dbuf32++ = cpu_to_le32(pix); + } +} + +static void drm_fb_xrgb8888_to_abgr8888(struct iosys_map *dst, const unsigned int *dst_pitch, + const struct iosys_map *src, + const struct drm_framebuffer *fb, + const struct drm_rect *clip) +{ + static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = { + 4, + }; + + drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false, + drm_fb_xrgb8888_to_abgr8888_line); +} + +static void drm_fb_xrgb8888_to_xbgr8888_line(void *dbuf, const void *sbuf, unsigned int pixels) +{ + __le32 *dbuf32 = dbuf; + const __le32 *sbuf32 = sbuf; + unsigned int x; + u32 pix; + + for (x = 0; x < pixels; x++) { + pix = le32_to_cpu(sbuf32[x]); + pix = ((pix & 0x00ff0000) >> 16) << 0 | + ((pix & 0x0000ff00) >> 8) << 8 | + ((pix & 0x000000ff) >> 0) << 16 | + ((pix & 0xff000000) >> 24) << 24; + *dbuf32++ = cpu_to_le32(pix); + } +} + +static void drm_fb_xrgb8888_to_xbgr8888(struct iosys_map *dst, const unsigned int *dst_pitch, + const struct iosys_map *src, + const struct drm_framebuffer *fb, + const struct drm_rect *clip) +{ + static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = { + 4, + }; + + drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false, + drm_fb_xrgb8888_to_xbgr8888_line); +} + static void drm_fb_xrgb8888_to_xrgb2101010_line(void *dbuf, const void *sbuf, unsigned int pixels) { __le32 *dbuf32 = dbuf; @@ -868,6 +928,12 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d } else if (dst_format == DRM_FORMAT_ARGB8888) { drm_fb_xrgb8888_to_argb8888(dst, dst_pitch, src, fb, clip); return 0; + } else if (dst_format == DRM_FORMAT_XBGR8888) { + drm_fb_xrgb8888_to_xbgr8888(dst, dst_pitch, src, fb, clip); + return 0; + } else if (dst_format == DRM_FORMAT_ABGR8888) { + drm_fb_xrgb8888_to_abgr8888(dst, dst_pitch, src, fb, clip); + return 0; } else if (dst_format == DRM_FORMAT_XRGB2101010) { drm_fb_xrgb8888_to_xrgb2101010(dst, dst_pitch, src, fb, clip); return 0; From patchwork Fri Jan 20 17:31:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13110298 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A112BC25B4E for ; Fri, 20 Jan 2023 17:31:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CEDF810E37F; Fri, 20 Jan 2023 17:31:34 +0000 (UTC) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F59410E10B for ; Fri, 20 Jan 2023 17:31:15 +0000 (UTC) Received: by mail-wr1-x42d.google.com with SMTP id t5so5498621wrq.1 for ; Fri, 20 Jan 2023 09:31:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nZwFqfU6/YlqXS0KBaaVZd4JCQGAwP0xqxEd37sKS24=; b=ZraDywh9d7ehyDd9uKX3TzphmkT+E5LNT1jeGuMQiAwElzDgSj32j/nA8VVs53vtxb DIs82zif+vzWKP7v+s/OuPziFrvvXXt5szsSjD4j8FsDTLrZ9AHKuRco4wHJCbA4+Bw3 S0b00m67OTdztpqXchCIY5nc5ds0HV7jYmvtNersWalRGSREGllMl9GGvvgboBCuXGg5 kWld85tqFRFu2sNSSKSG1wnTGsiDFSRSpivVwHyTkp1TLGxBbim8VlO/2ecc745x+bnu sBusHCcwNWB7nLCGGeS+nvF0ciOEfBkGaw+Vvxbgjy302bRCbIpJk/dEigJ2Y5zKCAIM z7Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nZwFqfU6/YlqXS0KBaaVZd4JCQGAwP0xqxEd37sKS24=; b=5b6/RdUcfEueTmnenf1fHFKTKlM0cd36/IDqbQpSsFfrKm11yjbiefFImolvCllabo rRQX9U4d7uu886M7F8CAxF2YFiraKteNuBWEOSxeGKH7CnCBgwOOmj082K7zq7YX0nW2 qU7jtD+DEfMlY/GFNoNxDaKQ5IOOzPhaaANQB/xZPrkmiqNfbBzJtHANERAezpGofALt hd7V6HIJ0gegA4YdghlDlipLcIQIwtcgMH8F0JbMDmT5/BECeUudZse5qByyS98A484g wDgakjMgGvzFwbquZa3eIm64VPbYQ55IGK906bbFNSa4fsrT8KnqFKq2iU82Ml1X+RtA jSNg== X-Gm-Message-State: AFqh2kpcFm116HRZA6gI2/XLUPI81jewkYIoSjaABDd6bS5enEYLXHs4 nh7JHz2/7cags6otUJ2c6Kk= X-Google-Smtp-Source: AMrXdXvjz/KDGIlKl769j7Os1enZRYBV2a7KiNGRFtoo8j34hnu9C0I3CKnEFtbtc2qSZ9NCcV11hg== X-Received: by 2002:adf:ec88:0:b0:256:ff7d:2346 with SMTP id z8-20020adfec88000000b00256ff7d2346mr13712276wrn.51.1674235873809; Fri, 20 Jan 2023 09:31:13 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id g11-20020a5d488b000000b002bc7e5a1171sm29510955wrq.116.2023.01.20.09.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 09:31:13 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v4 7/8] drm/simpledrm: Support the XB24/AB24 format Date: Fri, 20 Jan 2023 18:31:02 +0100 Message-Id: <20230120173103.4002342-8-thierry.reding@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120173103.4002342-1-thierry.reding@gmail.com> References: <20230120173103.4002342-1-thierry.reding@gmail.com> 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: , Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, Robin Murphy , dri-devel@lists.freedesktop.org, Jon Hunter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Add XB24 and AB24 to the list of supported formats. The format helpers support conversion to these formats and they are documented in the simple-framebuffer device tree bindings. Signed-off-by: Thierry Reding Reviewed-by: Thomas Zimmermann --- Changes in v4: - rebase on top of latest drm-format-helper rework Changes in v2: - treat AB24 as XB24 and support both at the same time include/linux/platform_data/simplefb.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/platform_data/simplefb.h b/include/linux/platform_data/simplefb.h index 27ea99af6e1d..4f94d52ac99f 100644 --- a/include/linux/platform_data/simplefb.h +++ b/include/linux/platform_data/simplefb.h @@ -22,6 +22,7 @@ { "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 }, \ { "x8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_XRGB8888 }, \ { "a8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {24, 8}, DRM_FORMAT_ARGB8888 }, \ + { "x8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {0, 0}, DRM_FORMAT_XBGR8888 }, \ { "a8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {24, 8}, DRM_FORMAT_ABGR8888 }, \ { "x2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {0, 0}, DRM_FORMAT_XRGB2101010 }, \ { "a2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {30, 2}, DRM_FORMAT_ARGB2101010 }, \ From patchwork Fri Jan 20 17:31:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13110297 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A0A6DC05027 for ; Fri, 20 Jan 2023 17:31:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA45210E10B; Fri, 20 Jan 2023 17:31:34 +0000 (UTC) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 63DC310E10B for ; Fri, 20 Jan 2023 17:31:16 +0000 (UTC) Received: by mail-wr1-x42f.google.com with SMTP id h16so5455111wrz.12 for ; Fri, 20 Jan 2023 09:31:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kXw2j+x/kse2yPakxaPEW51TbrZ6J1HBieALff4c+rE=; b=HxB+Fql78ZELN8ESqJE0nr2QjjtSelDWlhBG63jeCWznR746a2arSU5WR3Dewrng8J hpKPCB/+XGVCnjaTSb1hBPnnCks1ywfdHU+gPv3prNvf2m9uSypF49PArI3DIbh+dhY7 4nVMQ4nvctMibIveBehx3EiUs32eAwRfj6lK57zOYWSAtKFH4lWEpBYZGqeGbe9KSThS 04EFH383Mi+M8yIjSXIltHW3DxMU4XvnnpWXjQ0sSXERqs9JfRb2KWddyQcV84rKHvjs bMNZ0JF7OgQ40n613YIyLOzpeSBfnd7bwq5wCtQ1EbPLfPanVxxa+hjUM/JnY9bEAgX/ bhoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kXw2j+x/kse2yPakxaPEW51TbrZ6J1HBieALff4c+rE=; b=egy53gugyxnYDKn/6tnz9TBAK/AnsJnbpFB44bN1wRipmYU+qP+y4aL1i/3fqRo8Eu nKGFbHzowg51Mk0xjvmtKXYTGj0zB+7HF7mBCQVOYEVpHFYbWtE8kq1dJOILDHRunmUJ v756AR6TqHfwuk1BHZ4fKB6lBB2802VRWCp47Xxrs+Tge/IuUxEs9UI7IvmAFaY4KaFJ KGZ7EyVFhToQ/eBUSTdb72A1ICt3JEy56iDyafqH9yWkqlOMXZDlS1RpP2zfXAqQdwjY UCCS9KGL12bstoFaER2z99gHSgk2tzzFGNkIwdbqNgv57brhLH/TrKj8Q/4KTs2/sTb0 +IyQ== X-Gm-Message-State: AFqh2kqszVDYaVTo6DC+bfT/PnFH2rnPgNItE6hauaHuIge1f6dsq3Wx VNPRGMivI+eYiEQLwWUC/nw= X-Google-Smtp-Source: AMrXdXsb64RJIKDpmJTAga1GYyceTGETa/aMFyd6rGzsds7lxOLOWxwF53TLNJ7Cy29mMswL5rWqhA== X-Received: by 2002:adf:ce90:0:b0:2bb:edc7:504 with SMTP id r16-20020adfce90000000b002bbedc70504mr14353213wrn.26.1674235874883; Fri, 20 Jan 2023 09:31:14 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id z12-20020adfd0cc000000b002bdff778d87sm13470524wrh.34.2023.01.20.09.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 09:31:14 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v4 8/8] arm64: tegra: Add simple framebuffer on Jetson Xavier NX Date: Fri, 20 Jan 2023 18:31:03 +0100 Message-Id: <20230120173103.4002342-9-thierry.reding@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120173103.4002342-1-thierry.reding@gmail.com> References: <20230120173103.4002342-1-thierry.reding@gmail.com> 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: , Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, Robin Murphy , dri-devel@lists.freedesktop.org, Jon Hunter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Add the framebuffer carveout reserved memory node as well as a simple- framebuffer node that is used to bind to the framebuffer that the bootloader has set up. Signed-off-by: Thierry Reding --- Changes in v2: - clear out dynamic fields and leave it up to firmware to fill them in - mark simple-framebuffer node as disabled by default .../nvidia/tegra194-p3509-0000+p3668-0001.dts | 43 +++++++++++++++++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0001.dts b/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0001.dts index 238fd98e8e45..85b4aaa2ad4e 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0001.dts +++ b/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0001.dts @@ -7,4 +7,47 @@ / { model = "NVIDIA Jetson Xavier NX Developer Kit (eMMC)"; compatible = "nvidia,p3509-0000+p3668-0001", "nvidia,tegra194"; + + chosen { + framebuffer { + compatible = "simple-framebuffer"; + status = "disabled"; + memory-region = <&fb>; + power-domains = <&bpmp TEGRA194_POWER_DOMAIN_DISP>; + clocks = <&bpmp TEGRA194_CLK_SOR1_REF>, + <&bpmp TEGRA194_CLK_SOR1_OUT>, + <&bpmp TEGRA194_CLK_SOR1_PAD_CLKOUT>, + <&bpmp TEGRA194_CLK_PLLD2>, + <&bpmp TEGRA194_CLK_PLLDP>, + <&bpmp TEGRA194_CLK_NVDISPLAY_DISP>, + <&bpmp TEGRA194_CLK_NVDISPLAYHUB>, + <&bpmp TEGRA194_CLK_NVDISPLAY_P0>; + width = <0>; + height = <0>; + stride = <0>; + format = "x8b8g8r8"; + }; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + fb: framebuffer@0,0 { + compatible = "framebuffer"; + reg = <0x0 0x0 0x0 0x0>; + iommu-addresses = <&dc0 0x0 0x0 0x0 0x0>; + }; + }; + + bus@0 { + host1x@13e00000 { + display-hub@15200000 { + display@15200000 { + memory-region = <&fb>; + }; + }; + }; + }; }; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index 5ce2650128b1..e0ce54eae17d 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -1975,7 +1975,7 @@ display-hub@15200000 { #size-cells = <2>; ranges = <0x0 0x15200000 0x0 0x15200000 0x0 0x40000>; - display@15200000 { + dc0: display@15200000 { compatible = "nvidia,tegra194-dc"; reg = <0x0 0x15200000 0x0 0x10000>; interrupts = ;