From patchwork Mon Sep 5 16:32:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12966337 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 D5E07C6FA86 for ; Mon, 5 Sep 2022 16:33:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D53710E457; Mon, 5 Sep 2022 16:33:16 +0000 (UTC) Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5A1E410E451 for ; Mon, 5 Sep 2022 16:33:08 +0000 (UTC) Received: by mail-ej1-x636.google.com with SMTP id u9so18107748ejy.5 for ; Mon, 05 Sep 2022 09:33:08 -0700 (PDT) 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; bh=UsGHds8dL3ejKYB+jlPaiDkEXV7AX3OaV0OJSZr3sdo=; b=h6e97oJcX3gPDg94V5fEFyDY6uvhG/lA7N68Tjf0PJZlq4E1xxFL1Lrk/alhEhlzyv XX+LMsVbaKuSSBRpIL1b1mYh0B91wBP+rtfO2E61NcPJ21Yfu/Yz9JBWND/pozn+PJm+ a8CpHhZcwY6VcI19wydqnS6N6FS5ibM2abbNn4w9eP2A5VcgQw6KjtelDiiVtHGp+Bv7 fNGfgbpG1sLUXWtMbTYUD46UaIyZo+zG48Bkn/dtij8k+a0AasBS50FT6YnxD5evV2lq Fs0egNPLhMM6W9Ii5TybY6FETeSvSbSOQB5Na0j/ALybrUkQsfiO8riV1CJ9N2Sh/sQm Mm2g== 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; bh=UsGHds8dL3ejKYB+jlPaiDkEXV7AX3OaV0OJSZr3sdo=; b=rusPPCD1OCqATZsbDLkxhs0qK2zmwldOJz749dcNWtZyVw1IOeWi9C87wG3wpPUdOl HgwAvbbhoHbhyrYnLeEzX78HdH1cZzS+EPRnzb7XXvNSbrbGOEX69HocjjOYdTVAp4ti kOQNkk8EmkEwgOVu9bBPIAMcYNYusMVczb3dcqP4U7gK018jsUDfQbr9HZWYRxHDBVGL Rs2dT7GycUEjZT2GZdNEcollUtlJkb1rwx/aYLg/mU4MTffPZuK0jxBDZNQqk8rlMsTq 9+wIfjMnuQzzOHlWBALGRupxL0DI53Y5ZikqXuTuWVL8EEs0pIFzWTfb0bvIFwDUJsUy Eseg== X-Gm-Message-State: ACgBeo0aFgU8Ie1Br/+SQStKeBFVJs3WqK55qVGAHCsHFPosA3I43+on QosW7RcYvumDaG7PxZcRDFA= X-Google-Smtp-Source: AA6agR5AiFzASwCVW26MfoGCb5KcGtrpyNfm9M2F3k/LBi79yp5sf6vEB2XM5cter5q14y+TspfkIQ== X-Received: by 2002:a17:906:d552:b0:74f:8506:2dc8 with SMTP id cr18-20020a170906d55200b0074f85062dc8mr11525832ejc.345.1662395586658; Mon, 05 Sep 2022 09:33:06 -0700 (PDT) Received: from localhost (p200300e41f12c800f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f12:c800:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id cm20-20020a0564020c9400b0044e74c9dfedsm2828945edb.86.2022.09.05.09.33.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 09:33:05 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Subject: [PATCH 1/6] dt-bindings: display: simple-framebuffer: Support system memory framebuffers Date: Mon, 5 Sep 2022 18:32:55 +0200 Message-Id: <20220905163300.391692-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220905163300.391692-1-thierry.reding@gmail.com> References: <20220905163300.391692-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, dri-devel@lists.freedesktop.org, Jon Hunter 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. 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 Mon Sep 5 16:32:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12966336 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 D2A0EECAAD3 for ; Mon, 5 Sep 2022 16:33:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3763910E454; Mon, 5 Sep 2022 16:33:15 +0000 (UTC) Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD8AA10E451 for ; Mon, 5 Sep 2022 16:33:09 +0000 (UTC) Received: by mail-ej1-x632.google.com with SMTP id qh18so18077643ejb.7 for ; Mon, 05 Sep 2022 09:33:09 -0700 (PDT) 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; bh=f5DwtJDoisx1vYAodm+93SFt8NZfEbF1NT6PIDTV9Oo=; b=TCSozw31wwW8nYR10JQsH0smjE0+iQ5+sn1v9GoPEFiqzHBH6mV1VFiByfJlSvFnul rFqydVMnKv1odQ+feq4o27dh+W705PgqzDPxXiJYD4sP0vkIzB/neF90/lYM2JsEs6oK UuWIO1UFbX/5e09U68+uv5bozOn1wxMdi5UG5wwsjIVKY7oN4zSs6bE14xRYYRNBny8d iHvXYdaJ9VeZLdLhMATTAd3ABbmS1rTim2Ru7Ul8IEhEj3eInImwIOlKZG6/MAPUX8oT jtATu5Aq5aFzELkTb3OOwyfEiWbZqp3++90JU5+2iG5qxodD0M08m4DGvabj7EUhYq00 gPJg== 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; bh=f5DwtJDoisx1vYAodm+93SFt8NZfEbF1NT6PIDTV9Oo=; b=OgRqJJBGgXr21im2CS+B+toyUx635nmpn6JZUxx4Pln+ESW//o0aEmuePOL62Xyeon I/qbWzLvXDQ40Us+nDqIlMk7ViwYIjnhAThV/RXzuoyDSaDWVlb9fYUApZ+7dekDDz0k x0pGe720fhe9nenXVkTtpQi8kkKnnaJk5hSSiRXxZ82YvsP+wQQS0+SKlkw5qc6+FhdX OJ+VWmhnAiyCFYxgDY3TlulaS2hK9dGsQWVEmtWm89E5whO8vRDX+9ib9PlAdxIOXoCX 2zrnpsuugIM2L7Js8KqqbWaNDVSMAsWj6u5YrWdmZ++euNCPL31M/aQAwM9D/eOwEG1u J+Tg== X-Gm-Message-State: ACgBeo0fpeJffvkJ84I6XLdnKCsr7AhMTl3Rv/p1jcmrAGwG9Zg6msDq SjLXcUIhT+ZiK/ml5/Gkh14= X-Google-Smtp-Source: AA6agR6dax21NvyJRvB7GnjhDUGZA1kjZbVNthvB8vSgspGmVWvTvRSAlv6zzfsIrWX0d6q89/wJfA== X-Received: by 2002:a17:906:9bcd:b0:73d:df4f:2e92 with SMTP id de13-20020a1709069bcd00b0073ddf4f2e92mr31955422ejc.576.1662395588280; Mon, 05 Sep 2022 09:33:08 -0700 (PDT) Received: from localhost (p200300e41f12c800f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f12:c800:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id l21-20020a056402231500b00445f2dc2901sm6688063eda.21.2022.09.05.09.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 09:33:07 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Subject: [PATCH 2/6] dt-bindings: reserved-memory: Support framebuffer reserved memory Date: Mon, 5 Sep 2022 18:32:56 +0200 Message-Id: <20220905163300.391692-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220905163300.391692-1-thierry.reding@gmail.com> References: <20220905163300.391692-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, dri-devel@lists.freedesktop.org, Jon Hunter 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. Signed-off-by: Thierry Reding --- .../bindings/reserved-memory/framebuffer.yaml | 46 +++++++++++++++++++ 1 file changed, 46 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..80574854025d --- /dev/null +++ b/Documentation/devicetree/bindings/reserved-memory/framebuffer.yaml @@ -0,0 +1,46 @@ +# 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: + - | + 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 Mon Sep 5 16:32:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12966338 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 5A234C6FA8C for ; Mon, 5 Sep 2022 16:33:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9335610E45A; Mon, 5 Sep 2022 16:33:23 +0000 (UTC) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0905B10E454 for ; Mon, 5 Sep 2022 16:33:12 +0000 (UTC) Received: by mail-ed1-x52b.google.com with SMTP id u6so11932741eda.12 for ; Mon, 05 Sep 2022 09:33:11 -0700 (PDT) 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; bh=BY5zA1WHllLq+uXJXlZXf/Pl4ckkzNhpiTBDZ92+nNE=; b=EautIyav6Ilh+qp7Aj7XtjX0W5vr8uzzfZ1MmmHe82S812a1z5bQ5m3SW5Naw7AEBX KfmqjhKfFBaiXpKN95Snx8mkWiG3lGLIUHpbiYpJtxlvaNJlZMIc7hIyRBTpXON4LO3Q J9/ZAJgiZn2NdRixk5FcI4Ffg+nQ4aAkLLjawHRhrJiU2xlqUJWUi9ZO4awrm/F8dIyC sFvAtOZITff9LaGj8VDRQRXyS3kxj0q0zHK5zVQ9i3Dq7af/3zJ1S8HIz7U+dAhnOKHW xftMKfJjnuDfCIy/4u0zRwMCcwrb2BVOJo541TJ2C1JDLnmpsbb73os8mqROQy83EU+1 U5QA== 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; bh=BY5zA1WHllLq+uXJXlZXf/Pl4ckkzNhpiTBDZ92+nNE=; b=AHf5/aL0r2Ymr5M1lE1sqXxoD8trtdneIHE3SCePd78MHAUydlmknJvUvE+FIRG2jh aaOTgiafrFWH7xAIFtz+WlbMq9GZEOeOOT1POpv+uqiXg6EYVZRqdI/rCUll20lqi/YL +gm3K0RUkYHoSfVadkmDIq/uUea4M2joPaiTqxXx4F2zAfuVSrb22nDYddBohCXt2+R6 NqVNy2VJd4EvlRTeRBhM1eTRLG0yEmU4gEdK8fLw2UsjROiFh465L8uowxnzqlJ5VXXa 7Lc2g4+6y0Cr3gFGogN7tlBQT11WqwrFktFn7c+kJXCWmqAHUljsKKNxqHEDREuhlh9Y k0Mw== X-Gm-Message-State: ACgBeo2Xc3lx65AVNU3l29l1b4eo6PBfC5dlIhpyCbUUcObVZcSerLDy /Xqu9ekpat/jpM5JmuLA+lU= X-Google-Smtp-Source: AA6agR7ZLfxxdrfzn5klxEnJdBaof0jmZPiJbW1eDeD8QsBzX7qWAoe9M4Zvo0a4lLr4Qb7q62zp4w== X-Received: by 2002:a05:6402:493:b0:445:b5f0:7a0f with SMTP id k19-20020a056402049300b00445b5f07a0fmr43735026edv.120.1662395590232; Mon, 05 Sep 2022 09:33:10 -0700 (PDT) Received: from localhost (p200300e41f12c800f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f12:c800:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id s6-20020aa7c546000000b00448cb764290sm2202829edr.92.2022.09.05.09.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 09:33:09 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Subject: [PATCH 3/6] drm/simpledrm: Add support for system memory framebuffers Date: Mon, 5 Sep 2022 18:32:57 +0200 Message-Id: <20220905163300.391692-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220905163300.391692-1-thierry.reding@gmail.com> References: <20220905163300.391692-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, 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 --- drivers/gpu/drm/tiny/simpledrm.c | 166 +++++++++++++++++++++++++------ 1 file changed, 135 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index a81f91814595..16377b39f012 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -218,6 +219,8 @@ struct simpledrm_device { /* memory management */ void __iomem *screen_base; + phys_addr_t sysmem_start; + size_t sysmem_size; /* modesetting */ uint32_t formats[8]; @@ -451,6 +454,100 @@ static int simpledrm_device_init_regulators(struct simpledrm_device *sdev) } #endif +/* + * Memory management + */ + +static int simpledrm_device_init_mm_sysmem(struct simpledrm_device *sdev, phys_addr_t start, + size_t size) +{ + struct drm_device *dev = &sdev->dev; + phys_addr_t end = start + size - 1; + + drm_info(dev, "using system memory framebuffer at [%pa-%pa]\n", &start, &end); + + sdev->screen_base = devm_memremap(dev->dev, start, size, MEMREMAP_WC); + if (!sdev->screen_base) + return -ENOMEM; + + return 0; +} + +static int simpledrm_device_init_mm_io(struct simpledrm_device *sdev, phys_addr_t start, + size_t size) +{ + struct drm_device *dev = &sdev->dev; + phys_addr_t end = start + size - 1; + struct resource *mem; + + drm_info(dev, "using I/O memory framebuffer at [%pa-%pa]\n", &start, &end); + + mem = devm_request_mem_region(dev->dev, start, size, sdev->dev.driver->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 [%pa-%pa]\n", &start, &end); + } else { + size = resource_size(mem); + start = mem->start; + } + + sdev->screen_base = devm_ioremap_wc(dev->dev, start, size); + if (!sdev->screen_base) + return -ENOMEM; + + return 0; +} + +static void simpledrm_device_exit_mm(void *data) +{ + struct simpledrm_device *sdev = data; + struct drm_device *dev = &sdev->dev; + + of_reserved_mem_device_release(dev->dev); +} + +static int simpledrm_device_init_mm(struct simpledrm_device *sdev) +{ + int (*init)(struct simpledrm_device *sdev, phys_addr_t start, size_t size); + struct drm_device *dev = &sdev->dev; + struct platform_device *pdev = to_platform_device(dev->dev); + phys_addr_t start, end; + size_t size; + int ret; + + ret = of_reserved_mem_device_init_by_idx(dev->dev, dev->dev->of_node, 0); + if (ret) { + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + + init = simpledrm_device_init_mm_io; + size = resource_size(res); + start = res->start; + } else { + devm_add_action_or_reset(dev->dev, simpledrm_device_exit_mm, sdev); + init = simpledrm_device_init_mm_sysmem; + start = sdev->sysmem_start; + size = sdev->sysmem_size; + } + + end = start + size - 1; + + ret = devm_aperture_acquire_from_firmware(dev, start, size); + if (ret) { + drm_err(dev, "could not acquire memory range [%pa-%pa]: %d\n", &start, &end, ret); + return ret; + } + + return init(sdev, start, size); +} + /* * Modesetting */ @@ -511,13 +608,18 @@ static void simpledrm_primary_plane_helper_atomic_update(struct drm_plane *plane struct drm_framebuffer *fb = plane_state->fb; struct drm_device *dev = plane->dev; struct simpledrm_device *sdev = simpledrm_device_of_dev(dev); - struct iosys_map dst = IOSYS_MAP_INIT_VADDR(sdev->screen_base); struct drm_rect src_clip, dst_clip; + struct iosys_map dst; int idx; if (!fb) return; + if (sdev->sysmem_size == 0) + iosys_map_set_vaddr_iomem(&dst, sdev->screen_base); + else + iosys_map_set_vaddr(&dst, sdev->screen_base); + if (!drm_atomic_helper_damage_merged(old_plane_state, plane_state, &src_clip)) return; @@ -721,8 +823,6 @@ 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 drm_plane *primary_plane; struct drm_crtc *crtc; struct drm_encoder *encoder; @@ -790,35 +890,9 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv, drm_dbg(dev, "framebuffer format=%p4cc, size=%dx%d, stride=%d byte\n", &format->format, width, height, stride); - /* - * Memory management - */ - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return ERR_PTR(-EINVAL); - - 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); + ret = simpledrm_device_init_mm(sdev); + if (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; - } - - screen_base = devm_ioremap_wc(&pdev->dev, mem->start, resource_size(mem)); - if (!screen_base) - return ERR_PTR(-ENOMEM); - sdev->screen_base = screen_base; /* * Modesetting @@ -959,5 +1033,35 @@ static struct platform_driver simpledrm_platform_driver = { module_platform_driver(simpledrm_platform_driver); +static int simple_framebuffer_device_init(struct reserved_mem *rmem, struct device *dev) +{ + struct simpledrm_device *sdev = dev_get_drvdata(dev); + + sdev->sysmem_start = rmem->base; + sdev->sysmem_size = rmem->size; + + return 0; +} + +static void simple_framebuffer_device_release(struct reserved_mem *rmem, struct device *dev) +{ +} + +static const struct reserved_mem_ops simple_framebuffer_ops = { + .device_init = simple_framebuffer_device_init, + .device_release = simple_framebuffer_device_release, +}; + +static int simple_framebuffer_init(struct reserved_mem *rmem) +{ + pr_info("framebuffer memory at %pa, size %lu bytes\n", &rmem->base, + (unsigned long)rmem->size); + + rmem->ops = &simple_framebuffer_ops; + + return 0; +} +RESERVEDMEM_OF_DECLARE(simple_framebuffer, "framebuffer", simple_framebuffer_init); + MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 5 16:32:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12966340 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 E251DECAAD5 for ; Mon, 5 Sep 2022 16:33:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08A3A10E45F; Mon, 5 Sep 2022 16:33:32 +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 8E8CD10E454 for ; Mon, 5 Sep 2022 16:33:14 +0000 (UTC) Received: by mail-ej1-x631.google.com with SMTP id fy31so18089813ejc.6 for ; Mon, 05 Sep 2022 09:33:14 -0700 (PDT) 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; bh=uXTNuaFFOdggI8omSyQsRBaLji6UVsxiw3E8D64RifU=; b=SU4g2xDsRRT5Lge5vVMmNdkIdi4Wx4rY2Jb7B1+kjyC4IpWuOpuOCa7gRbYVenGOqc ++w7MZB8ca0gPiv0BO9nKcBCNcIiFskMgKUW0ebaktr8VtrAXbZRIOYdJ250PFxLH9pP 60JLW5enypDB+cXUWpI0rU9y5l8fM7o3T1ruXz2M7jrNImzmZSBait5oF7eL8O+zpHE0 0y0hpo70sVIv8NuDYDm3HN2+0ZPL/SYdfFQeJkk7t8LpWOBST1G32pX4RE4qDucpPE3K oBd59M245Od28432MMfhQjZlO4IAugqgUT5o3Uk7y8kQWztfPoU/a2A2jYcru52fOqjd 8wgQ== 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; bh=uXTNuaFFOdggI8omSyQsRBaLji6UVsxiw3E8D64RifU=; b=0PG18lbnGEEUsoxaUb8kqPwamoZLPUJSTnS0eBPgMUOJH42AmEnSbd4gWvdPiS1VnB W2Z7IXj6Zg+GNYBLF1cuWPQ2TgoTwq4T1DHh1wKRf+wO39mJWAC1vTG2xp+qL/ZxnJij Ok8r8HcUr+sIj05oq+GDW3MS8UdO9g9oFERgU4oQkKux7a0EFuI0pokkskY7/Ghm4DGK xGm+RZJikbw2Wg4iKUxYXJi7m1AoNI7VDccwLdt83BVplYoMA/JXUoIDI5R+yirPakmL h/RZr6wcyhBYAKg+TcTGTA1f2YjW88i69SuquzFp8+3Db/cEvImEa1UBROwUPOUFyHi1 BDMQ== X-Gm-Message-State: ACgBeo1L+uqpdiymu2TCRyho/7IEWNrhIlvW9YLjTuT+LFNzxl77/u85 3zSnwXNz1SLULEGdpaG7CI4= X-Google-Smtp-Source: AA6agR6uI3+HR0n8gdjr49biODWamP0NUzQ2iqhGF7LaoQmgLEoRg/Ki4VZBma74UqlsYDxX034kPg== X-Received: by 2002:a17:906:7315:b0:741:5b1b:920d with SMTP id di21-20020a170906731500b007415b1b920dmr28665181ejc.484.1662395593082; Mon, 05 Sep 2022 09:33:13 -0700 (PDT) Received: from localhost (p200300e41f12c800f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f12:c800:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id d2-20020a056402400200b0043a61f6c389sm6752395eda.4.2022.09.05.09.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 09:33:12 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Subject: [PATCH 4/6] drm/format-helper: Support the AB24 format Date: Mon, 5 Sep 2022 18:32:58 +0200 Message-Id: <20220905163300.391692-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220905163300.391692-1-thierry.reding@gmail.com> References: <20220905163300.391692-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, 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 format to use in drm_fb_blit(). Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_format_helper.c | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c index 56642816fdff..d564412a816b 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_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 & 0xff000000) >> 24) << 24 | + ((pix & 0x00ff0000) >> 16) << 0 | + ((pix & 0x0000ff00) >> 8) << 8 | + ((pix & 0x000000ff) >> 0) << 16; + *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_xrgb2101010_line(void *dbuf, const void *sbuf, unsigned int pixels) { __le32 *dbuf32 = dbuf; @@ -672,6 +702,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_ABGR8888) { + if (fb_format == DRM_FORMAT_XRGB8888) { + drm_fb_xrgb8888_to_abgr8888(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); From patchwork Mon Sep 5 16:32:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12966339 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 F10F2ECAAD3 for ; Mon, 5 Sep 2022 16:33:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6993D10E45D; Mon, 5 Sep 2022 16:33:30 +0000 (UTC) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CDE510E45A for ; Mon, 5 Sep 2022 16:33:17 +0000 (UTC) Received: by mail-ej1-x629.google.com with SMTP id y3so18152958ejc.1 for ; Mon, 05 Sep 2022 09:33:17 -0700 (PDT) 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; bh=R/yzLKhstrQ0xuNqdI7CQxffVFlTJqRQoTH/xpLP5OU=; b=HDUsN9A3LfTPf3YIRADcz2R0FithZkh3c41sWO7FC9dkLdUOH+ieYkK6U96fbkzQtW D+zsGdXNM/YcdTCyx1Bo5ComQeLzLAgEa7B9uZHR/qLJZx34wOipzJSWxfDKKeucEGSp M+Tkb93JL4QbVjIQR+KtQNeK3MXyJwEivUiTPXQU7roBJR4fkKbyfTk1VT/D63yl1pF4 6B0Barl6ZVHJaZmDk33Ne344y31J6t57Q7bMphWvn5u9qOb3/81Oia63CV+o+57rljx6 pihUEfecNDlNJbQvuOVsnQuFprgjw0S6aNirRzFbrRYxh0C4vhTAMo8Cq//uGsXQzzde vSJA== 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; bh=R/yzLKhstrQ0xuNqdI7CQxffVFlTJqRQoTH/xpLP5OU=; b=bnhT090zm+lpL6IqLCiMlvxpl732eEk6vUQFMie+/CBboez0noKxzjsjH2oUAdKhU8 4qefJAmm2ErQMvmwBsOmbs3XYXWZKigPOBU+6wsKHJAdMMBm0KYzh9EdhrlsRzHZ8bGR MxlJ66gVZuxQ6Ol84g8XeDtkfOrT2wLZaeVasKMfRoNTLi7dpmoZZFIZCP49blN7FaOO 5ViVp/ajRJ4Xh9dXYKtIl3c9e+GUn/GWGEaQM6ZfKoyVr8C9j6uY4iEVloZYXhJz96yy 909biQnwhA4nHCTtVIF+6mkx2kFnR5dBgjRvQeErCald1aPFIymGy94UH80p+GvmkR82 JFMg== X-Gm-Message-State: ACgBeo2F+xrWLntp9lK9aF/4O4k1z768ybpxZBoE8E5hQ63mkO5CiJcC FWGojwD50SxkM/lBot3jG8Q= X-Google-Smtp-Source: AA6agR5BBZuXs7pXLimDyLExSj1si+XQzJdO7LmmaCvaRyKgfPjpIyndggLcnlfhtm/jHZRjYtcEhw== X-Received: by 2002:a17:907:980f:b0:73d:8e27:7779 with SMTP id ji15-20020a170907980f00b0073d8e277779mr37852958ejc.205.1662395596077; Mon, 05 Sep 2022 09:33:16 -0700 (PDT) Received: from localhost (p200300e41f12c800f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f12:c800:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id er20-20020a056402449400b0044d6c6a5b5fsm4263709edb.89.2022.09.05.09.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 09:33:15 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Subject: [PATCH 5/6] drm/simpledrm: Support the AB24 format Date: Mon, 5 Sep 2022 18:32:59 +0200 Message-Id: <20220905163300.391692-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220905163300.391692-1-thierry.reding@gmail.com> References: <20220905163300.391692-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, dri-devel@lists.freedesktop.org, Jon Hunter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Add AB24 to the list of supported formats. The format helpers support conversion to that format and it is documented in the simple-framebuffer device tree bindings. Signed-off-by: Thierry Reding Reviewed-by: Thomas Zimmermann --- drivers/gpu/drm/tiny/simpledrm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index 16377b39f012..7829a12ba3dd 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -563,6 +563,7 @@ static int simpledrm_device_init_mm(struct simpledrm_device *sdev) static const uint32_t simpledrm_primary_plane_formats[] = { DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, + DRM_FORMAT_ABGR8888, DRM_FORMAT_RGB565, //DRM_FORMAT_XRGB1555, //DRM_FORMAT_ARGB1555, From patchwork Mon Sep 5 16:33:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12966341 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 B4228ECAAD5 for ; Mon, 5 Sep 2022 16:33:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 60A6B10E45C; Mon, 5 Sep 2022 16:33:31 +0000 (UTC) Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0AB9510E45A for ; Mon, 5 Sep 2022 16:33:20 +0000 (UTC) Received: by mail-ej1-x62b.google.com with SMTP id kk26so18056090ejc.11 for ; Mon, 05 Sep 2022 09:33:19 -0700 (PDT) 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; bh=hG5qOC2H13cLCXaupR4+peOyAcb2vcqeBUPSCe9IBNs=; b=MBI+gg/logTsOdyivgK1UsqKQyV+jND6xnwUGSJbNZU7TjAaFQ4z74KpS1Dz0Snixy mWv/kFOh7fgnTcx7Luh0MsodmrZY7MKPRgYzCudyzKnYDyQ2iGB6/hXt9aGwZosScqB4 ydoDjMdZW+mBHmG1Pj00mXFgV/Q5iUuhls987uyDWSU/z6oUwTQlJZzhmLDcyLTR90dh mnssk4Kfs15LRjireNhxNHqDnYdlN/oepHHrTzzt7uYBytsFx8/JlySjdtslclaZ0Vn4 tRlNrV4GURTDqyWQLBegzlhofnNuCMnLtbHhFqGowwNYwU4Xs4czikTeoUc9ajWu38bF bzzg== 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; bh=hG5qOC2H13cLCXaupR4+peOyAcb2vcqeBUPSCe9IBNs=; b=fx4QUMtuDTw9pM1FS8DcqsOvUM4e68UietYcp3nnIKmGlXl4MF3h+nVODZrTExK26K 0CzmYPKKpIokMjlE091S5wNc8LSC8mT152f5q9q1lX/7md3ymDOBwpXdWz6lzZLvPaxp Oyj/kL44JhcpWkQOI8OkLFg4lWHMN65KecENmvBndNxnLs2HJsRMDWNtsj8P341Ck/kL a3XAFAKo2Ug/KJh1peILSSAOHeZCGzkFjbxZGWuKc4eWHT1onDBisvumqwTpQDjWsVTA X+M7xSSEGzHc4wjIhyVGUGH+qBqrhnz+EH+sQLF23YXfMB+3qS8F1heS7QuQGEOEuWh5 RzTw== X-Gm-Message-State: ACgBeo2GHlOZnXVcSRq9+jgH9wk8LrODndWP5c4Mk2n6ye1XxjCDU/H5 onWrndffPaPOEt4RPXfppE4= X-Google-Smtp-Source: AA6agR61TNYjnDHRsTKAWCI/N+zJmwR6G3Of3lFBODxyik1mowbXKlE2m6prYDYlGfFGBl5sEMdzXw== X-Received: by 2002:a17:907:7f02:b0:73d:dffa:57b3 with SMTP id qf2-20020a1709077f0200b0073ddffa57b3mr34533961ejc.19.1662395598445; Mon, 05 Sep 2022 09:33:18 -0700 (PDT) Received: from localhost (p200300e41f12c800f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f12:c800:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id ca8-20020aa7cd68000000b0043d7b19abd0sm1962920edb.39.2022.09.05.09.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 09:33:17 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Subject: [PATCH 6/6] arm64: tegra: Add simple framebuffer on Jetson Xavier NX Date: Mon, 5 Sep 2022 18:33:00 +0200 Message-Id: <20220905163300.391692-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220905163300.391692-1-thierry.reding@gmail.com> References: <20220905163300.391692-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, 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 --- .../nvidia/tegra194-p3509-0000+p3668-0001.dts | 32 +++++++++++++++++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 +- 2 files changed, 33 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..163950321c38 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,36 @@ / { model = "NVIDIA Jetson Xavier NX Developer Kit (eMMC)"; compatible = "nvidia,p3509-0000+p3668-0001", "nvidia,tegra194"; + + chosen { + framebuffer { + compatible = "simple-framebuffer"; + 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 = <1920>; + height = <1080>; + stride = <7680>; + format = "a8b8g8r8"; + }; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + fb: framebuffer@2,573a0000 { + compatible = "framebuffer"; + reg = <0x2 0x573a0000 0x0 0x007e9000>; + iommu-addresses = <&dc0 0x2 0x573a0000 0x0 0x007e9000>; + }; + }; }; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index 3e6ac20ace3d..5c5343cf8dc9 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -1929,7 +1929,7 @@ display-hub@15200000 { ranges = <0x15200000 0x15200000 0x40000>; - display@15200000 { + dc0: display@15200000 { compatible = "nvidia,tegra194-dc"; reg = <0x15200000 0x10000>; interrupts = ;