From patchwork Thu Nov 17 18:40:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13047184 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 E6A4BC4321E for ; Thu, 17 Nov 2022 18:40:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 30C4F10E670; Thu, 17 Nov 2022 18:40:58 +0000 (UTC) Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 327E210E669 for ; Thu, 17 Nov 2022 18:40:48 +0000 (UTC) Received: by mail-ej1-x62a.google.com with SMTP id n12so7249449eja.11 for ; Thu, 17 Nov 2022 10:40:48 -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=C1Y534FPxsILKuYr941GBaBsx9fst1FUuLv6sIi19Vk=; b=VkGk+0U6cBBKtd2N73D6xUj20mWTYj9z2tO2H7ULxskuzctUAZqtq+JcJL2RtdlPsC lQ0ap0XqRcig/75B4gx/g7uWtUYLJbrMMa5+nJXa6AjOpVz1A1RDtSrEMRkKTP2KocYZ qhxM1BlzZuIjImn045YYAj7aTqzJ2KnQuGyhMx8UZxzLEP33xjzJP6Y7E8Mh5093BEMN dzYtBOd4EGkOgMofNN9JyHuBhAMVNgRJ523p57BbfezDEwibZxv7WvVc21VgMEFIXUyG HJj9KrknPq/JG0NRRhbJgG8rRKu5lOyFP3GfGaKI0uHa1fdZQHdtaAin1901+luOjktW 4H2Q== 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=C1Y534FPxsILKuYr941GBaBsx9fst1FUuLv6sIi19Vk=; b=yRfdVSKaMHP5kmLCjuXO+ljBaqeENdnUZO+l6xoGCnInaBnQ3XdoDLn4Mk9hLKHHZs 8LGt1cwkzIBulfeWtRwSf21ronOG7ZOiwmp0toE/enCd/e/CPsh+MMF20cyW/aPXk6Cv FpZAu01OsoVmti5jlW0QUgYiFgvRj0J447eYzXwRLE2n+ytXODXBOPh6TnCUEGoOivwm hF4HZsWQ4tiy50OhThXVtuoERENi8kEGUrX1OHKMQoWJuRxoLXkMLf3NHx4aF4G9FZeO 2TYsnb9RoCeWjsTzx71nsunbZD/5HZTbraJbgpJgpuh239MsJD7abPPLEf6fjjbG5cOF jnlA== X-Gm-Message-State: ANoB5pmktKX8eiCzzKR7No0FWzIw6Zh2rMRuOPCR4pNcBnwFCX8mf2CR o4B4w6O5c+T+Bhsl6R5ZbFk= X-Google-Smtp-Source: AA0mqf4gUTPwjVT7ASJewg8oNP3zMRDM6ATE7vRgNDo94NVRs0c0OcvNjf3/6CDgJqmkO5mUA7OA2w== X-Received: by 2002:a17:907:98ea:b0:7ae:c1af:89af with SMTP id ke10-20020a17090798ea00b007aec1af89afmr3133088ejc.550.1668710446390; Thu, 17 Nov 2022 10:40:46 -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 p9-20020a170906604900b007b2a58e31dasm700772ejj.145.2022.11.17.10.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:40:45 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v3 1/8] dt-bindings: display: simple-framebuffer: Support system memory framebuffers Date: Thu, 17 Nov 2022 19:40:32 +0100 Message-Id: <20221117184039.2291937-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117184039.2291937-1-thierry.reding@gmail.com> References: <20221117184039.2291937-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 Thu Nov 17 18:40:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13047186 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 50E2DC433FE for ; Thu, 17 Nov 2022 18:41:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EEC0210E12C; Thu, 17 Nov 2022 18:41:14 +0000 (UTC) Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by gabe.freedesktop.org (Postfix) with ESMTPS id F17F810E66A for ; Thu, 17 Nov 2022 18:40:49 +0000 (UTC) Received: by mail-ed1-x534.google.com with SMTP id e13so3863678edj.7 for ; Thu, 17 Nov 2022 10:40:49 -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=kGgALic+DS30S9ojwPdceibK9s2MAtsj8xO33zz+Z+0=; b=N7v2MmJAOX3Kmxwd0jdOood/vNl6v21crSGC2mYfyU1BFBOaMCdfIqjKeYPA3RE1+q uPu3PDYPkhadmdoQuUDlVvIw1eOFBirFTHLq2MsfL0JjxvusJNCc2dvn2174kPre+Uqb tJxUq9Ce0hqAR7fkDjEZGmUtfVLx3JUnzl8iI9PbDY7NcJ7dmtHlpmKXDjq0xcDvzENc QOtOTMpPccGzZ6ScUnyNMLls09dACDKTSEJjifFV8x3MPx6CJOPx3BX8OBnZwZ1E8fp1 YWHcB97GAXh9WAAWNCTpKl513LQkRJzatUZ+VTf+kPwb28BnexS72xWZkFgmPG0K6Iax tXBw== 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=kGgALic+DS30S9ojwPdceibK9s2MAtsj8xO33zz+Z+0=; b=ijQLQh/6FakuZSTArUGC0D3ELZs98WWeC8azt1GoqFTG4F6O/Kut+0/Z4khLs1g+ms fgPNLWSmIAQcLJooKZWbkZVILihSjlAIQUFe230UNZvx2+jY8kf81lLOF+K/aBLI3v+J oZF7DNsb9lBXe8Jrtkg32PVsW+wk/uGELC3LmwV/uANA321HnzL68+4ZjXQCe7dxT/F5 p2KKzM7ZGPw5reRj3H1sVoGHIp/yRZ4kVI0RdNieGXggFWiRIIhWWAxlkiGI9a8ANd8f bQXp46aqTRVOoAUxuNYqu2/kbjaojdhEiVXIQ8GgWRFYZ1zsTiXnP+eNgb9on4OnL1M5 f2sA== X-Gm-Message-State: ANoB5plxM03x6UP6v6htuKyf6hZ3f/oS6WuapcjZ/ypStBB6ipbSnl+9 JqfvXSq+5Y0MN97IMO5p4dA= X-Google-Smtp-Source: AA0mqf6T53dT7P1u6RpvE4BnHTqtPV7QDbZHfM/zbVoHXOKBSCvcYjV8zXOiBCE4ZTH8FiwEafnEBQ== X-Received: by 2002:a50:9fa7:0:b0:469:4e6:344f with SMTP id c36-20020a509fa7000000b0046904e6344fmr396962edf.226.1668710448409; Thu, 17 Nov 2022 10:40:48 -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 ew20-20020a170907951400b0073d84a321c8sm680132ejc.166.2022.11.17.10.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:40:47 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v3 2/8] dt-bindings: display: simple-framebuffer: Document 32-bit BGR format Date: Thu, 17 Nov 2022 19:40:33 +0100 Message-Id: <20221117184039.2291937-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117184039.2291937-1-thierry.reding@gmail.com> References: <20221117184039.2291937-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 Thu Nov 17 18:40:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13047191 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 F0227C433FE for ; Thu, 17 Nov 2022 18:42:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED6A410E677; Thu, 17 Nov 2022 18:42:07 +0000 (UTC) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by gabe.freedesktop.org (Postfix) with ESMTPS id 61AAA10E66F for ; Thu, 17 Nov 2022 18:40:51 +0000 (UTC) Received: by mail-ed1-x535.google.com with SMTP id x2so3889003edd.2 for ; Thu, 17 Nov 2022 10:40:51 -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=oWVJf0S9kqs87h9L8NvjpGJOac1XzRow1tUHd0R/FGA=; b=A71LMLctjhFiGB+nzlkmn8+VI54b2dfeC6yJdUT/jMVgQ9Bhm3+spI29djFRnYJG+t Jrs0YL7rFykG6AsiuJLGbVz0MCUVGrvxsgqH2CphFUZm1rzNZss7Fy6IrCK1749DnPhP cGD0aU4PCo0oYeMThSZw3FMjv3gQrIlSBEE2ehNkGJ3SDOcNW6EZqSepWQRi/lYlSxWW YviuzuzCw9pDq48d9B3bLNfLX6Q6+LsTAIKBYqi3D5Zy/1mxNJqIdqg3hcmh6ohpRL0X gdp1MXvzqoIhiY2i3GjweP6APYPTXVnQUuk+vopyhfIqSvoCNYRfrlq1FgNOddTjlaWD Oebg== 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=oWVJf0S9kqs87h9L8NvjpGJOac1XzRow1tUHd0R/FGA=; b=vCaBGA17PGaeLEUVXAz3NdX4Skg414Hhsd9CoGxo0TSMjZi5Iizl6rEH8B9ZaFAiA4 GNZwaN/1i8KNMjmo6fExwdUgPHhYL3gIe3G5YJisnVYwYpewOma3fZq+kJE5mPSHdQ38 Oi/eYUgQEJub7EFL2MxAvvH3UFZVFTg9qCX0a3ZMYa8tLVdyeC0kS0QDWs9HUANI3hB1 smIzm6Cj9nObVG1LuH2fC96E1TW/47cR9dxuFO21tF6u0VDCZskd05Oay1dHpcv1QcGB eGXDZTBzJ2CtFuxvpr5fTDpZtRkQLjtjIBLRjwnlHntZIRqUn852uHMmn3RAa5PTY5qN VbUQ== X-Gm-Message-State: ANoB5pluBovL3ky+spWwPoRpF+0/AIbUDtgdqwornKcYFhZKfFPzLuiu k+fU2cxWN545laDng0X8RNY= X-Google-Smtp-Source: AA0mqf4ZN5qTTfZsCmLUrTJuTNa2VWaQn9Ue2FfHJHLlMaOUGDKOLjB1jb8zyRCSe523ljqglGha9w== X-Received: by 2002:aa7:dd45:0:b0:45a:3c66:b0e4 with SMTP id o5-20020aa7dd45000000b0045a3c66b0e4mr3373267edw.33.1668710449770; Thu, 17 Nov 2022 10:40:49 -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 u22-20020aa7d896000000b00459f4974128sm874496edq.50.2022.11.17.10.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:40:49 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v3 3/8] dt-bindings: reserved-memory: Support framebuffer reserved memory Date: Thu, 17 Nov 2022 19:40:34 +0100 Message-Id: <20221117184039.2291937-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117184039.2291937-1-thierry.reding@gmail.com> References: <20221117184039.2291937-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 Thu Nov 17 18:40:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13047188 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 AE20FC4332F for ; Thu, 17 Nov 2022 18:41:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A57DD10E671; Thu, 17 Nov 2022 18:41:15 +0000 (UTC) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by gabe.freedesktop.org (Postfix) with ESMTPS id DCD0610E66A for ; Thu, 17 Nov 2022 18:40:52 +0000 (UTC) Received: by mail-ej1-x630.google.com with SMTP id bj12so7216016ejb.13 for ; Thu, 17 Nov 2022 10:40:52 -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=pUtZmWalnQKWM5ERQ4dIqTHxh9HaSKYh4Nk5lsYsOGo=; b=E90mIeGWkAHZT8kjF/dtZAkCNw1ExinoGrCn05GM8RvygqrPUsmI5MEkEHBqezbhGM TAw/4Tz0ucODj2MstSnfQfAsOYGcLWojIFb0rNvH5FTjqYFx5Y8nyJGgPWkDxmNP88fP xRZ2nofJ27QVOuaPgx2Z2WJuyHd3G1F9zeWGJB+AOyrC3RuV1d0wHgOKe46rbqP+dsGT DCTGF1z23v3J6bX2nbl8JL6r9pRANpgQSQngl4CPPNvdX7/sH26H1Vq/BhWNqzbL6I/s PMkVidGPc7LAkl7at8N9CktkJ/8IBbGK8d33ySrvC96vTBYWDqe/OYaeO5LZrzHh4GYd IpWA== 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=pUtZmWalnQKWM5ERQ4dIqTHxh9HaSKYh4Nk5lsYsOGo=; b=CofN0vUETqnXL28UeGniR1LzWT9u1R94tAKF3ACdadtl7W0gBlpVNCw4AqnNGDMF0Y nl5udzRz4rDTKv4YO4vf5MNl1Y3YRwBtZA2KH8DokK1/PKAa7ThSnGgzNJU5JBZLiz+E 1Xgd/fh6yY5U7Jl3dsYAzc5U2ciZ40BXfQUbp5K7KoA3FJCmx3OoPF1a2/jN42J5S6gF Fha9LfbGbuYLXZGb6F9iJ33r8CYTmPrlRPVGcI2ZBPQKEfgQMudFJFnlwpDlHEYin4+q epIFZJXVendNCgLgjfCo13Na7Bf7sbBtDM5KgTIBWnPSqc6M1SqQMG+mVa2jApwZXfJP soVQ== X-Gm-Message-State: ANoB5plduqRzLKU3dv3X9hn2CHO0vvuOqVdsDoHit+I/7Fa0g8vdjgdY MSxcLx8bl7FgxGbRvqFlKEQ= X-Google-Smtp-Source: AA0mqf5xwnlYcLA9SvYwuazA2YElRV37/cwpxPvOcWKJv7jhRNjkIHWvKvvQSEXIBAIBFpyaAn1mOQ== X-Received: by 2002:a17:906:a2d8:b0:7ad:fa6c:5e69 with SMTP id by24-20020a170906a2d800b007adfa6c5e69mr3179354ejb.199.1668710451323; Thu, 17 Nov 2022 10:40:51 -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 15-20020a170906310f00b0078cf8a743d6sm684681ejx.100.2022.11.17.10.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:40:50 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v3 4/8] drm/simpledrm: Use struct iosys_map consistently Date: Thu, 17 Nov 2022 19:40:35 +0100 Message-Id: <20221117184039.2291937-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117184039.2291937-1-thierry.reding@gmail.com> References: <20221117184039.2291937-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. Signed-off-by: Thierry Reding Reviewed-by: Thomas Zimmermann --- Changes in v3: - properly reinitialize struct iosys_map to avoid bogus increments drivers/gpu/drm/tiny/simpledrm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index 162eb44dcba8..3673a42e4bf4 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]; @@ -492,15 +492,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 screen = 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); + iosys_map_incr(&screen, drm_fb_clip_offset(sdev->pitch, sdev->format, &dst_clip)); + drm_fb_blit(&screen, &sdev->pitch, sdev->format->format, shadow_plane_state->data, + fb, &damage); } drm_dev_exit(idx); @@ -519,7 +519,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); } @@ -722,7 +722,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 Thu Nov 17 18:40:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13047185 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 BDD1FC43219 for ; Thu, 17 Nov 2022 18:41:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0221810E66F; Thu, 17 Nov 2022 18:40:58 +0000 (UTC) Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9A1010E66A for ; Thu, 17 Nov 2022 18:40:54 +0000 (UTC) Received: by mail-ed1-x52c.google.com with SMTP id s5so3821596edc.12 for ; Thu, 17 Nov 2022 10:40:54 -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=y9ybMF44ncbpQoXYyiY7lvPsBZDR1qvcdQC2snJ8L7M=; b=Z2oFSHjxMyTLeBJdW63lx3g14aObCExggZ2/c0n10fJznrPFxEocVHwSt6iy9bwPe8 S0wHqBzjKK+YGv3M1MJ3CHLOYxsHllNyMlkWRHEARhHGBgkLPsj1qJsUq9u7p+pmSmfR cp2wZS2Kqmvhw+DJtpHVpk98VTrwWpAmVN60Vr2nJiVE7cDzv1cww0whTYNYnXXuBfrZ aBT5j3Xj2e/Vq4RYmvOGJEbxvJEp46/tZbnLZ1giRz+1tL+H88YSrvnKZi5ReJriXDUR HctMRqVN6IYZcWvnKQZbHdlulc3RfpQ+gflyr2n1uet4IPkmHp6RWoyN49UXrKEVT9PV bW3Q== 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=y9ybMF44ncbpQoXYyiY7lvPsBZDR1qvcdQC2snJ8L7M=; b=idfz9ljBOfu0mRDp6UMbSNp1d0EKO5ERBPYqC7NWnXXVkTjY9JBJYT5IB6al7FqWif wuqr1syBL78JbOOV0VedqXSUn43P4nAjklOeP1/peciaAZ3QG9W2xdibhT87K+zZDywV pwto3KMQzAAqOhV+1R9EBEgfi9ePqQ8v6KnUeP7BMmeOMBp/2r71gvu25dcbHd7Djq1d 24zxvHtz7ohJz24SwktnlZstvp2GwO7M7QQ0wmpzNoE7MfyQ1Qr4XaZEnIoNrxVrMZ37 gFmS9NpL2J4ZGgyafTqRR03Z2o8BQ9po1o3D1MDG2bIiOZI8DpTvrUfIUvd3chbzoSp/ cFQQ== X-Gm-Message-State: ANoB5pmR/nqAMdAhtTHNVJaU9ftBtzHNZBt4yIj5JrzrJIkidlbJ/K8K n3KMVBmtNIH+Sm1IdrqgSgU= X-Google-Smtp-Source: AA0mqf4gKS6SyACL8go73wSupq8QD6MR3unyxjPLzc47n0ptJniRvbm/hsRn7J9GaGm2Uo5dOLADaw== X-Received: by 2002:aa7:cb8d:0:b0:467:bc1f:ca16 with SMTP id r13-20020aa7cb8d000000b00467bc1fca16mr3339753edt.269.1668710452922; Thu, 17 Nov 2022 10:40:52 -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 kw1-20020a170907770100b0078246b1360fsm700529ejc.131.2022.11.17.10.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:40:51 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v3 5/8] drm/simpledrm: Add support for system memory framebuffers Date: Thu, 17 Nov 2022 19:40:36 +0100 Message-Id: <20221117184039.2291937-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117184039.2291937-1-thierry.reding@gmail.com> References: <20221117184039.2291937-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. Signed-off-by: Thierry Reding Reviewed-by: Thomas Zimmermann --- 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 3673a42e4bf4..7f39bc58da52 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 */ @@ -623,8 +649,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; @@ -676,6 +701,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); @@ -698,32 +726,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_info(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_WB); + 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_info(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 Thu Nov 17 18:40:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13047190 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 23305C4332F for ; Thu, 17 Nov 2022 18:42:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6054210E675; Thu, 17 Nov 2022 18:42:07 +0000 (UTC) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by gabe.freedesktop.org (Postfix) with ESMTPS id 89C7E10E66A for ; Thu, 17 Nov 2022 18:40:56 +0000 (UTC) Received: by mail-ed1-x529.google.com with SMTP id f7so3857541edc.6 for ; Thu, 17 Nov 2022 10:40:56 -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=8GRAXf35/9spkghPeO95WIhuP6nXSVmFKXeRYmNMois=; b=VfM3fZj30J8Y3lxGELBmZekOwuOm+C85b2/WhmB+VL/comM5ERPj0Ss1oErFBEvW0m dmqF4IwE8Dh8o82/6yGHriLAVJN9ypue+ym9GLR9d0wyhNiuMDB0mZuXUNmWOndArJLM Z0e/j6uFBeXJNWuuOymbqFt5GGu7vWKsp95LrNwR7lxsHZy6nq9N/duc8kk6nfdgHdtJ mAo5hvE9gw3y7JHysNZEcgaM32/DfAfow8PpvVPSLeVN9YdjbSTnm9s5YsI4s10hX67S oTJn8WebkCb448knh7LId7+hM19J0yIvHLTY5GsEa1zjE9GZK4UhhfjW+hJKcInE63hA Oy8A== 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=8GRAXf35/9spkghPeO95WIhuP6nXSVmFKXeRYmNMois=; b=Fjjn1+KK0GTW5zR0KY4LIBLJQgkJ/RSV+Hdiaom3f6MhEfrRn70fzJyoiNSmgZlETI vd048bmqiX+5QBNovguo024FAwYerHOnZ6fr821FtgKGTwCUF6z4H3OVGif4//9OxVlI YJQI9PRY+X+329ah2XunneYiDiqbDIoHj+2qdxIYZogEml9rG11+rVY6Jc+6YVRHRM84 CVBDhymllle1NKsq0qPF0pFW+bUGoR/yHXgP2d/ER3q0DdlrKQNqCx75bd7NDKwm2gRN s+x4PGgVlUYnWjv+4pZFR4Se13L3XCWON8Fgm/4HatQB1EcW5yav3eAzsVhKvPpmITEo 2MCw== X-Gm-Message-State: ANoB5pmdedzHLyaoPzHgpqEo4sTGUNHgkpX/QAPZ62gUGrWIVA0dESWe 0R5tEhE8ZqvUfQcVhRAALao= X-Google-Smtp-Source: AA0mqf6F4ZxtEVFJDiBDlqw0CRtxE45eikuyc0FSJF9QizBo31wexjxks18m46tF2gcdPlzxpFnOgQ== X-Received: by 2002:aa7:d803:0:b0:467:f948:6df4 with SMTP id v3-20020aa7d803000000b00467f9486df4mr3213754edq.217.1668710454692; Thu, 17 Nov 2022 10:40:54 -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 10-20020a170906308a00b00782fbb7f5f7sm690526ejv.113.2022.11.17.10.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:40:53 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v3 6/8] drm/format-helper: Support the XB24 format Date: Thu, 17 Nov 2022 19:40:37 +0100 Message-Id: <20221117184039.2291937-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117184039.2291937-1-thierry.reding@gmail.com> References: <20221117184039.2291937-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 XB24 format to use in drm_fb_blit(). Signed-off-by: Thierry Reding Reviewed-by: Thomas Zimmermann --- Changes in v3: - rebase onto latest drm-next Changes in v2: - support XB24 format instead of AB24 drivers/gpu/drm/drm_format_helper.c | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c index 74ff33c2ddaa..c8764cc61e87 100644 --- a/drivers/gpu/drm/drm_format_helper.c +++ b/drivers/gpu/drm/drm_format_helper.c @@ -503,6 +503,36 @@ static void drm_fb_rgb888_to_xrgb8888(struct iosys_map *dst, const unsigned int drm_fb_rgb888_to_xrgb8888_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 | + 0xff << 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; @@ -646,6 +676,8 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d fb_format = DRM_FORMAT_XRGB8888; if (dst_format == DRM_FORMAT_ARGB8888) dst_format = DRM_FORMAT_XRGB8888; + if (dst_format == DRM_FORMAT_ABGR8888) + dst_format = DRM_FORMAT_XBGR8888; if (fb_format == DRM_FORMAT_ARGB2101010) fb_format = DRM_FORMAT_XRGB2101010; if (dst_format == DRM_FORMAT_ARGB2101010) @@ -678,6 +710,11 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d drm_fb_rgb565_to_xrgb8888(dst, dst_pitch, src, fb, clip); return 0; } + } else if (dst_format == DRM_FORMAT_XBGR8888) { + if (fb_format == DRM_FORMAT_XRGB8888) { + drm_fb_xrgb8888_to_xbgr8888(dst, dst_pitch, src, fb, clip); + return 0; + } } else if (dst_format == DRM_FORMAT_XRGB2101010) { if (fb_format == DRM_FORMAT_XRGB8888) { drm_fb_xrgb8888_to_xrgb2101010(dst, dst_pitch, src, fb, clip); @@ -820,6 +857,8 @@ static bool is_listed_fourcc(const uint32_t *fourccs, size_t nfourccs, uint32_t static const uint32_t conv_from_xrgb8888[] = { DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, + DRM_FORMAT_ABGR8888, + DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB2101010, DRM_FORMAT_ARGB2101010, DRM_FORMAT_RGB565, From patchwork Thu Nov 17 18:40:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13047187 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 3D146C433FE for ; Thu, 17 Nov 2022 18:41:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 34B4810E66A; Thu, 17 Nov 2022 18:41:15 +0000 (UTC) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by gabe.freedesktop.org (Postfix) with ESMTPS id E6DBE10E66A for ; Thu, 17 Nov 2022 18:40:57 +0000 (UTC) Received: by mail-ed1-x531.google.com with SMTP id s12so3865771edd.5 for ; Thu, 17 Nov 2022 10:40:57 -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=KBWaH/vKohLUzSe6QLXlh4Mx7QgSFZjyZMz+JYtKxxI=; b=PN2H4XymqqWem8S5cTcjWj54sE7zShRhQiFrsQNFZmaqE4nDDPF+zx1c/CGLFv2OSy 3Gswa2GOYRqjT76c748Qwv9+8xkpJ8/cRmmME4jfzEt9cT5e9FDF436nO11EQ6QzGdih KLWGcIHS8regNMFEAkWFvgEmOdmqBduf/vLBjRP+LlMPBmM4im0dIXJv8dhxbFF82WID rvhXXAMbBcbNEfnREGGf636/VVz8o0mi4XCKYk6sioZWhM8v3XxqNe2zU7H/m+j/bqqR pmP9S9PfENRTyn99XM6bP4pJf+D54gYGqXBRWRd08QTQRk6cCJzD/adaeTiP2gsR5K9b Wb3g== 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=KBWaH/vKohLUzSe6QLXlh4Mx7QgSFZjyZMz+JYtKxxI=; b=p/zKDmafYh+rlDYgk1GCVUY7VAxg/VwjdO9raYfHNm+OdsO+A6B6OWvUMQUoeBHklU L6Uejf8PRrmiDVOEdp0W20EQ/Rt8bgOzU0+t1c+vj4a6y0eLOnIQKSmwnlCeBrSvOXNa gsovlVVyiREg/T393bzb4RwwEBQu0LOGSnJpjS8i5UpkSaXaje+7G7ENdNFV+T1se8zK S0dMMi0KKbZrvM21NjkTXuZLTTeIG6nX3CJc7IhlH5XOHkpNJpVKxn7+2DFTf+W96PQJ 8oVU/eJWYGBsTC74bgZWt+ddFdIQde8waSfd7WA/DZleLvSS2OpfUEWEeb9gWiLFjcgu C5Yw== X-Gm-Message-State: ANoB5pmmDvHyboL4Hib1gbBMeyuqy6HEDy72GCLqrRKJxYjVjzmGaOyc NZTdXMgw5f9jf/jesryF8cs= X-Google-Smtp-Source: AA0mqf77/+b+VHZt2iTNuQJF8SBFQKPCJUFtQbHHRL8xCl1iwGBfNl9qWYmvSkfDDyQ+w91qlTVhiQ== X-Received: by 2002:a05:6402:5412:b0:460:e19c:15a3 with SMTP id ev18-20020a056402541200b00460e19c15a3mr3432932edb.252.1668710456001; Thu, 17 Nov 2022 10:40:56 -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 8-20020a170906310800b007aee7ca1199sm730053ejx.10.2022.11.17.10.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:40:55 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v3 7/8] drm/simpledrm: Support the XB24/AB24 format Date: Thu, 17 Nov 2022 19:40:38 +0100 Message-Id: <20221117184039.2291937-8-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117184039.2291937-1-thierry.reding@gmail.com> References: <20221117184039.2291937-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 --- Changes in v2: - treat AB24 as XB24 and support both at the same time drivers/gpu/drm/tiny/simpledrm.c | 2 ++ include/linux/platform_data/simplefb.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index 7f39bc58da52..ba1c2057fc65 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -483,6 +483,8 @@ static int simpledrm_device_init_regulators(struct simpledrm_device *sdev) static const uint32_t simpledrm_primary_plane_formats[] = { DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, + DRM_FORMAT_XBGR8888, + DRM_FORMAT_ABGR8888, DRM_FORMAT_RGB565, //DRM_FORMAT_XRGB1555, //DRM_FORMAT_ARGB1555, 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 Thu Nov 17 18:40:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13047189 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 8CA1DC4332F for ; Thu, 17 Nov 2022 18:41:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CA2110E673; Thu, 17 Nov 2022 18:41:17 +0000 (UTC) Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by gabe.freedesktop.org (Postfix) with ESMTPS id 70EBB10E66A for ; Thu, 17 Nov 2022 18:40:59 +0000 (UTC) Received: by mail-ej1-x631.google.com with SMTP id n20so7472705ejh.0 for ; Thu, 17 Nov 2022 10:40:59 -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=k1XmyqLWH4AqUOHKKfV1yv3QMSJcaiHXG6zk/U0Icvk=; b=aVpjZjUmugzu/Zf4UlP/gNFrPeVw2QoCsRb8vQyv+jCL2d8y5OsKj0GZ64BylixKY0 NfuzLBkmZe8U4Wk8RmKUxISvrCQxlekxCVlwh1jsS1d3zSbod1iElJrNETfONX6hd34B uTxQxEo8KEASodUrTV8If32PYhb+hH5pppYTuYRmGBsgATHW1APz8U0Z++AVWuzVBvqH JIyPjQ5y4tjj+sWJB5ZdTTgjDNb11EMmdDAw6J0W5teFOHpT3FNKzUsp7OBOR79yctoF fMy/I2WJ3TdIvil4m8cnjwiYPvF6Gu5HIix1clcbsjTLjE6t+iA2JJLXTSmH164iVJJL BpbA== 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=k1XmyqLWH4AqUOHKKfV1yv3QMSJcaiHXG6zk/U0Icvk=; b=37iPeSXSW+l+uEJ4KkdqSQZjSWGY6/DXtFVza0gZe4tWdvx9Kcw6i6tvBRr66fwNoj zEKbrdNegpfUZwg14b/J4lVW1jFRL3FO76cOO9GSFTYLV9ffZz53EO5txSEw4t70J6Nv ezGFFI1kg67AjrcdfpsMOFb+wEsNsoiEluZDOOOPya2TCYbLel7MVYILJk5aNLACzxte cFlrFTIhemH8tLVKjGIEsL7zrWIsJV3C/8rktGHNgWxYIn1YCSrl1lkzMkVWJkg5ea9M 99FVKJhD5RPaXptP+Fyzh1TcyYOeOXang8TiV1VKO3TDB/5oH2TGL6SZobYnJBgqjEOK rkOg== X-Gm-Message-State: ANoB5pl1QrYAPbIEZxURwtre6pbQh7T9LFazBL1b1Wb/1cknKQDttymy SrWm6/WbtVAhZ1qZZdN0pX4= X-Google-Smtp-Source: AA0mqf6JIF4Hi+lfPgCjyHzvwjQnYPd8qpC0JNMVn/jTtG1nufCYivUOlHMB4CEB9me5Awc/DBy1CA== X-Received: by 2002:a17:906:3792:b0:7aa:97c7:2bfe with SMTP id n18-20020a170906379200b007aa97c72bfemr3146515ejc.196.1668710457524; Thu, 17 Nov 2022 10:40:57 -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 a13-20020a17090682cd00b0078d424e8c09sm695617ejy.77.2022.11.17.10.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:40:56 -0800 (PST) From: Thierry Reding To: David Airlie , Daniel Vetter , Thomas Zimmermann Subject: [PATCH v3 8/8] arm64: tegra: Add simple framebuffer on Jetson Xavier NX Date: Thu, 17 Nov 2022 19:40:39 +0100 Message-Id: <20221117184039.2291937-9-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117184039.2291937-1-thierry.reding@gmail.com> References: <20221117184039.2291937-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 d0dbfafbc930..ec318b9e700c 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -1972,7 +1972,7 @@ display-hub@15200000 { ranges = <0x15200000 0x15200000 0x40000>; - display@15200000 { + dc0: display@15200000 { compatible = "nvidia,tegra194-dc"; reg = <0x15200000 0x10000>; interrupts = ;