From patchwork Fri Oct 7 12:49:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 613582 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D401C433F5 for ; Fri, 7 Oct 2022 12:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229534AbiJGMuB (ORCPT ); Fri, 7 Oct 2022 08:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiJGMuA (ORCPT ); Fri, 7 Oct 2022 08:50:00 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD0DA1C914; Fri, 7 Oct 2022 05:49:55 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id nb11so11117067ejc.5; Fri, 07 Oct 2022 05:49:55 -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 :message-id:reply-to; bh=R1/Q7FM/6wVesragT+lLg++XOxeD1OeWXwDpmo+CaG4=; b=gaNnBrbV3Xpns8rk5Qd2ry9waUgicBEUDrQg2WurXif06s4ezs2estOIDdE2FEIiOA ObAzX3FwLvIYWmXxhhqpyItjUUQScNGn+4XGhSzOGzlYBzLlns9ejTj0T/ai0qtMrXm0 Zs1/YqHVjQUvudyKHj8viF3OLGZ5ql6YW21PKR9A5J4+QgtG2KJt3h+W8A7N1lGQNkp1 sHguNhGwf/DvgLRpiTo1kgkxhBwNK0FcB76BZyUHCkrVmspiVcbzteV/l1hVi2y2CO9G lnaJOupMuhh4zBKgdvVBPcT898mjZnGQgdSb5feisnV1/WUzlZXCsCG2XzBijUwbxr4+ H2+A== 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=R1/Q7FM/6wVesragT+lLg++XOxeD1OeWXwDpmo+CaG4=; b=YEJKASX6HdzjR4vJM2CZ5o5gBobtfD05Ld30V6hUhSfCPpozR2GBffZJJ2MBeHt3vX 00RibKfOtFM/3jlL9DBwLcGOYmjv7vep63E/ZNkO+e9vmoy2sqBcLY+Hd/XadBLWC+OY UqvbN0CGZTJVd4RRMBSskpJprkm1PuL1m04LpAx/2rRrQex+/ZmNgjfztJwqd4yUWGBq +KqS21UUnZfw/ms0fJsq6NPo2vFGtMrzJ2h0DYJTcoL1rpDhdWIRTxANfuXW3vJ2PT8q 2OXGeCsBNmQuSR9nXehTZvh6A95ZqdR+vIm61Vy0Hknd+1yOm2CwIsvpMOdrJ21OGAG6 oAXw== X-Gm-Message-State: ACrzQf0tDFJtrjDtgW1ItTw33T5w3u0HGnqx2sKRA2QWRbLTt6h2l2YS lDuroEvIRP4ixZrMlUSHQ90= X-Google-Smtp-Source: AMsMyM6j/Lz5Ph/6n8cFQ5VxJzYs0uHKqNXN6rVCej8vqUFmcXN0/IqXNi/OGIs9ykHYRMPeWm5aJg== X-Received: by 2002:a17:906:5d11:b0:787:807e:5b8a with SMTP id g17-20020a1709065d1100b00787807e5b8amr3895992ejt.559.1665146993991; Fri, 07 Oct 2022 05:49:53 -0700 (PDT) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id w22-20020a1709067c9600b007812ba2a360sm1186786ejo.149.2022.10.07.05.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 05:49:53 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Cc: Jon Hunter , Robin Murphy , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 1/7] dt-bindings: display: simple-framebuffer: Support system memory framebuffers Date: Fri, 7 Oct 2022 14:49:40 +0200 Message-Id: <20221007124946.406808-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221007124946.406808-1-thierry.reding@gmail.com> References: <20221007124946.406808-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 Fri Oct 7 12:49:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 613237 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDB43C433FE for ; Fri, 7 Oct 2022 12:50:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbiJGMuE (ORCPT ); Fri, 7 Oct 2022 08:50:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbiJGMuD (ORCPT ); Fri, 7 Oct 2022 08:50:03 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D005A23BF1; Fri, 7 Oct 2022 05:49:57 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id s30so6925633eds.1; Fri, 07 Oct 2022 05:49:57 -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 :message-id:reply-to; bh=XBRkFBzTwr0Layx8yRFn/SH2RZGgfSe2fyII0Qe3/MM=; b=VJIgYJ/IoReLEy1bc3Rcmnyf0KVESE1k2s6upBKNnWGK0/OkkoEV+CCQRxl/02qvwP cpy0B/rotWFufIw72HjRUcPVPOGjXaVFbtjN54MGJu5bjXP3p5Rhk6k2QARA16TwgFh5 pnfrG/LATajYizVBkN+/cK0kOf7FuWDw4Gp3PpfrwxtKQBB/KWmQE/flEziV9X7SZkUr IQOV6ExJGxbJhd2A+E4qtgIp8B5eMtkgzbxZFQEU7TsrMGAAaLZZFqxm/iT21bHFF/yB ygp9BX6lCOVghc7yCie1sb8s7zi4yEJ1c33iGSpI6CfTARpgl0sObBO9jxLm1+TfsPev MFUg== 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=XBRkFBzTwr0Layx8yRFn/SH2RZGgfSe2fyII0Qe3/MM=; b=bgPnPg7mCOE8NGMy8VEBB2qw8dy4vooqS9e/Kmd0OkVcPUSuv83leNqtNpPbgs0qgJ i89mzW3JRQ0LM4qzi/pwUR7894MW9yfScn9GN8UVRFmpew0tx/wn5YgQXAlI5EzeQMBK xOW8OLAUeC6sx6uzlak7mHN+ev4nrPk+SRO3xzFeRMrIndbvzh9NPfv8UWdNlGvceB0C icQCFW4/QoTG4UuNxDZBLrg/+HFqpIJJUrRLLkmi5tCoIgWNPvFwL3Lg0fErwnRvHhcv DXeCJ8rt0uPGYsHlILKM8jg3VWx0C8qOCm8TVwMEcI/eGFcf+u6Z3t1Yn0LINy1xhaw4 lMJA== X-Gm-Message-State: ACrzQf1B0BIdYRSYPOpXZZOtPDDEwU8KaFGKIm8GJN2DNREoh9++hUqm HYl4n+mQg5a+tYt4zFFKWEU= X-Google-Smtp-Source: AMsMyM68uGoAncrYPa2ZIbBvO4lb6WPzAUIT3HdjPZjERzYotAUTG3j5fbLxYS+OV9H8g0QARa9EOQ== X-Received: by 2002:a05:6402:26d4:b0:451:280d:3533 with SMTP id x20-20020a05640226d400b00451280d3533mr4330565edd.316.1665146995668; Fri, 07 Oct 2022 05:49:55 -0700 (PDT) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id k8-20020a17090632c800b007030c97ae62sm1153572ejk.191.2022.10.07.05.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 05:49:54 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Cc: Jon Hunter , Robin Murphy , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 2/7] dt-bindings: display: simple-framebuffer: Document 32-bit BGR format Date: Fri, 7 Oct 2022 14:49:41 +0200 Message-Id: <20221007124946.406808-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221007124946.406808-1-thierry.reding@gmail.com> References: <20221007124946.406808-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Thierry Reding This is a variant of the 32-bit RGB format where the red and blue components are swapped. Signed-off-by: Thierry Reding Reviewed-by: Rob Herring --- .../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 Oct 7 12:49:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 613581 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDE56C433FE for ; Fri, 7 Oct 2022 12:50:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbiJGMuH (ORCPT ); Fri, 7 Oct 2022 08:50:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiJGMuG (ORCPT ); Fri, 7 Oct 2022 08:50:06 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BB4D2B60F; Fri, 7 Oct 2022 05:49:59 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a26so11120761ejc.4; Fri, 07 Oct 2022 05:49:59 -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 :message-id:reply-to; bh=U/DGi9HQh/INO76ufx6qo153czghX5f9wyf4yTlgdnU=; b=aDPiK9wgDuCz4iykhw/dpIIa1iCJJIzfjVwFJPE05jLGwbOb5Y9Jbi7xRrJ0kFvAM+ 98DH35bLCCPbb1e+/VgtbQ8LI7kSQMlcv5xVOekSPdapMDYrkz7wPGujvri5ib/ySiXj VsfZykt2TboOSqvJMQ2/MqZmVM0cn13QoXKGy9U31p0sxTavg5vPRwdD89hf1tSNCw8a sHrNaSx61u8KPf03hPcVluNJo6QoWfp7ZxUE9x554yCb7XpN/Ds9+elOSdJTv02BPxv1 b2ZBrpI+RSF2egeWZF/DF/Kha7O049hgBhmEWkVkXhhhjqt021cLCOU33PhU5vwAyZHH XcSg== 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=U/DGi9HQh/INO76ufx6qo153czghX5f9wyf4yTlgdnU=; b=B+GEENoGXJ4dnU6HACMTRLDOk2fiYtfeeHfJjDUsusrwtZ1jb/joXXtTUfYRNQ9crP f6MtbrHy9S/GeHrDQrLDe6MZGydaPXGR77eJN5mK34QZb4/MkK8lcjDYxIas4EKbrScd erC8tUXE/6FcHetyBESR2V6cHJhlXch14iXzheWM3dybRhMDGDgAP4TwReuPtw4nSBmh 5WrYuo0Nv8XrlUAzAy/cJNhgKpsI7t+0JzWCHmRskPkmV3EArFzaysO5BuNSWYhf/vpQ HmTW5AYBeLva3HtxcAsu5Juem3rGW8fKYnVW+UmiBAl2QtJcmXjyeRKMkngTsKN5UF9l Yz8w== X-Gm-Message-State: ACrzQf2dUpuM03OnQj3EXSp1LCRELyROXMJcaGjDqKf7GIhpPt1Rdw+p zf0JRpB38t4reIqxWaqf4us= X-Google-Smtp-Source: AMsMyM4pPVMkGNTzw9EHjcedFTuvHCXHVwUn1M83nCd/82dP2yu3uWlCgG662VxDuaHMUllmScMb0Q== X-Received: by 2002:a17:907:9603:b0:742:9ed3:3af2 with SMTP id gb3-20020a170907960300b007429ed33af2mr3886671ejc.510.1665146997436; Fri, 07 Oct 2022 05:49:57 -0700 (PDT) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id p9-20020a05640243c900b004573052bf5esm1424166edc.49.2022.10.07.05.49.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 05:49:56 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Cc: Jon Hunter , Robin Murphy , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 3/7] dt-bindings: reserved-memory: Support framebuffer reserved memory Date: Fri, 7 Oct 2022 14:49:42 +0200 Message-Id: <20221007124946.406808-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221007124946.406808-1-thierry.reding@gmail.com> References: <20221007124946.406808-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 --- 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 Oct 7 12:49:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 613236 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84AF7C43217 for ; Fri, 7 Oct 2022 12:50:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbiJGMuO (ORCPT ); Fri, 7 Oct 2022 08:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiJGMuN (ORCPT ); Fri, 7 Oct 2022 08:50:13 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7614A2ED5C; Fri, 7 Oct 2022 05:50:01 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id 13so11130527ejn.3; Fri, 07 Oct 2022 05:50:01 -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 :message-id:reply-to; bh=8upa/AE8nGpXl24ostbZMoh41mWOyaVWO9cdEU+UC6c=; b=KqioInl1OGok63D0PEYJEYdJmf6l6crQEOdxne1TXTN7RwWaTISgSVvmKDjkysZpfR xy2FVwlfn8rkJD7CWIknL7k6j7y2W97eeiTF59k+utBZWWUyCZbT4n9JQas3h95UJ/5p eJh4bwFMQW1xyrJNxmNohvs4C8x4nza/5StFnLEQ3XEcOok24nxiYEZxblZTESgEY7Yp iAD2Fs20vPrZJofrSG9H19Y/fy9d3ijnwVwcmvrtrQfcZ6Kv2ULIel2+Cpe5PBgcWuT0 nhAhHX6fJBvEGhHDLTfZbvd5JWMu9F9XpQAV6aXkd5DxcMRvfEvVjZvCntQYO97bckM7 1gew== 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=8upa/AE8nGpXl24ostbZMoh41mWOyaVWO9cdEU+UC6c=; b=j5v2wVagsdTrlvudpzVYy/z/UrxZhN8sT101BQrF5KyZl3oq1pyTjdLIwf6hwk9faQ RxhxRR5zo8ojJmLfWpLPQyJnyrE81GqnpB32q5QFykBV5rbMR6Td8cjo1lZfxr5c9Rx+ DNs8chD7/N/j9cPxtRGXBrNcO1AMhGbF4IMi9wsMN/OLAXiY9WIg72yUNDyGIKfmxo5w yByKX6iAVcnR31uJPxzTEEUPoSHqfmp+BRFWW+hLdJpvlL/uqLCLNyLa6BPK9ZppLwrI AR3SfHKeeaXg66Lcbc21XNBN+8rO5r6o/NlDLOEu1xd1yx+9X5wZkiou6OVIjbagweho hquQ== X-Gm-Message-State: ACrzQf0JkTPYwVwNW8HUPzOB7m2bwSKI9OwiA3SG8vGMvuECSJFzzKhc cRkDk4XoLiF/mkTeELqU2i4= X-Google-Smtp-Source: AMsMyM56DggySACNM4kUVGOr3nTN2K4x0R0idGdKggbS7mIKRxTkL/rKnQT+lLyDg2/BOtWmBl8koA== X-Received: by 2002:a17:906:eeca:b0:730:6880:c397 with SMTP id wu10-20020a170906eeca00b007306880c397mr3865892ejb.593.1665146999629; Fri, 07 Oct 2022 05:49:59 -0700 (PDT) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id j9-20020aa7ca49000000b00458d383a6ddsm1416515edt.44.2022.10.07.05.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 05:49:58 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Cc: Jon Hunter , Robin Murphy , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 4/7] drm/simpledrm: Add support for system memory framebuffers Date: Fri, 7 Oct 2022 14:49:43 +0200 Message-Id: <20221007124946.406808-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221007124946.406808-1-thierry.reding@gmail.com> References: <20221007124946.406808-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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. v2: make screen base a struct iosys_map to avoid sparse warnings Signed-off-by: Thierry Reding --- drivers/gpu/drm/tiny/simpledrm.c | 177 ++++++++++++++++++++++++------- 1 file changed, 141 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index 18489779fb8a..cf36f67d22e4 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 @@ -207,7 +208,9 @@ struct simpledrm_device { unsigned int pitch; /* memory management */ - void __iomem *screen_base; + struct iosys_map screen_base; + phys_addr_t sysmem_start; + size_t sysmem_size; /* modesetting */ uint32_t formats[8]; @@ -441,6 +444,106 @@ 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; + void *screen_base; + + drm_info(dev, "using system memory framebuffer at [%pa-%pa]\n", &start, &end); + + screen_base = devm_memremap(dev->dev, start, size, MEMREMAP_WC); + if (!screen_base) + return -ENOMEM; + + iosys_map_set_vaddr(&sdev->screen_base, screen_base); + + 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; + void __iomem *screen_base; + 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; + } + + screen_base = devm_ioremap_wc(dev->dev, start, size); + if (!screen_base) + return -ENOMEM; + + iosys_map_set_vaddr_iomem(&sdev->screen_base, screen_base); + + 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 */ @@ -491,15 +594,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; 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(&sdev->screen_base, drm_fb_clip_offset(sdev->pitch, sdev->format, + &dst_clip)); + drm_fb_blit(&sdev->screen_base, &sdev->pitch, sdev->format->format, + shadow_plane_state->data, fb, &damage); } drm_dev_exit(idx); @@ -518,7 +621,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); } @@ -635,8 +738,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; @@ -706,35 +807,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 @@ -878,5 +953,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 Fri Oct 7 12:49:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 613580 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D0EDC433FE for ; Fri, 7 Oct 2022 12:50:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229469AbiJGMuS (ORCPT ); Fri, 7 Oct 2022 08:50:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbiJGMuR (ORCPT ); Fri, 7 Oct 2022 08:50:17 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA90F3056F; Fri, 7 Oct 2022 05:50:03 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id s30so6926011eds.1; Fri, 07 Oct 2022 05:50:03 -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 :message-id:reply-to; bh=wrrrdznzTmRNvhxoL8SCZOK3Fq6gtgfxyHdbZJIJpnI=; b=CkS5WkwEuoScpkTqN/Vnex7SlTDJjmWf8ltwebDjzw/VuWw6FVU7zF8K5ztXKpeuba VS1xLXVshPj027dWbHUZcdS/Aqx0YvMDxeIjfjHni3JIso4h78Mljcc0v0+l6D8Pm4Le VGmDOswL/xq5CRRDXKCfl+Aqf6V8vsdF/NPHf5W3i9dV0QAzTQglQQCgEZzqWYbsCBCa GOcyi/3tT8Y/uHBoBWAKNAucE58ejBXYje4E1xJqCgs8sajAvLiDvVZQsQrdC3RFEbjm 11KxxuYoUM9uTPdeC3H1SPsWAanvMaQbQc0LS5VqUp9Q007tc7b90A+9HyDdizP7qpsw zFcA== 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=wrrrdznzTmRNvhxoL8SCZOK3Fq6gtgfxyHdbZJIJpnI=; b=p0vPVIMNmDOUNq4pjipos639SN0YBapp4MKWBVCotw5qLPtzjonwryh8YXrfgaN1Kn U0n5PsKSUHwvm253v/KbW13fiBjyp4FjHoHb/mMRszHTaqelpk3v5b1d/SvQT4pA7Zwl CbaGEMBRJ5aSDIGggOtHSK1jiBp++Xd4OyQvhg4i3S0hCnyhtxCWuo64OXKMUt7a4QoU 4//DZbR4/bSqlprH38leDKPrDbEXT3Cc7lR+TMft9qgy4e0OuPllnQmYo86X7Ba3WXMu rbcAvxL+oklYWMgzxe9pTzgRPtW0qVnG0oi8qNQa1IJ+T67roOwV24GyHi6BbF3yLJQE gKjQ== X-Gm-Message-State: ACrzQf1A62tJ6lHdBNaZ6vvi2tPLmHZcxEaK9n6RzksOvL2YAfvERLa3 WlHLg3IlUZg9dggwz9SML7w= X-Google-Smtp-Source: AMsMyM4k7Cw2VvtfHOta0Uf/xqpK0XGradDOXq7931skX0AqQ8CW2YMP4qvBGzzeZu89rWX/O1LqSg== X-Received: by 2002:a05:6402:35d4:b0:459:348d:a7ac with SMTP id z20-20020a05640235d400b00459348da7acmr4514891edc.149.1665147002327; Fri, 07 Oct 2022 05:50:02 -0700 (PDT) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id mf22-20020a1709071a5600b0074136cac2e7sm1183617ejc.81.2022.10.07.05.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 05:50:01 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Cc: Jon Hunter , Robin Murphy , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 5/7] drm/format-helper: Support the XB24 format Date: Fri, 7 Oct 2022 14:49:44 +0200 Message-Id: <20221007124946.406808-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221007124946.406808-1-thierry.reding@gmail.com> References: <20221007124946.406808-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Thierry Reding Add a conversion helper for the XB24 format to use in drm_fb_blit(). v2: support XB24 format instead of AB24 Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_format_helper.c | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c index e2f76621453c..8a7c200ecba9 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) @@ -673,6 +705,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); From patchwork Fri Oct 7 12:49:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 613235 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90C6BC433F5 for ; Fri, 7 Oct 2022 12:50:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbiJGMuW (ORCPT ); Fri, 7 Oct 2022 08:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229723AbiJGMuU (ORCPT ); Fri, 7 Oct 2022 08:50:20 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65CD442E74; Fri, 7 Oct 2022 05:50:06 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id j23so5469997lji.8; Fri, 07 Oct 2022 05:50:06 -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 :message-id:reply-to; bh=f59EU1a1WnDP8FmZf3wrh4O5KrGlofpHUXUgEfyspJQ=; b=CLZRyqPhA5+M6uyWDg31r6F8m+wKuz4Ptz9QRZt1FtszgNSWuDe5YGR3aeXy6AcqKT 9tOE+oHq71rji+2VsBi5nKN5iHMLBSeUkMBJFFz+0ivIJRjXu9Kj9soi41d9E1xo65QC EsOszCdKg8/8ejmsZ+fXL92Os6Z2ej9gn1sJYMqJLIS/RzwHFWeEjbCLhXXQ50kWYDJl dzx+anyHHwGvYJnFoC3GCmOw/kY+iPbdje81zsQEfcnU3tK667WRAKPvl+jbImBNLlSq cbxGJh61HQ3VB8T7VReug6JcELNSW7Ng/KgSNbbob6ktvF+UVt7pFPg7+Yln2vqdNypH wNJg== 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=f59EU1a1WnDP8FmZf3wrh4O5KrGlofpHUXUgEfyspJQ=; b=hIRDeB6djaOc6zgci6yG9DhO1QgT0sVbbgkkiVwfjT2/OAmu3fINsAVG3ztK+LdAgh 74JZYziTGLESrGYwBlFZZex/i+9LNmM3ynlAkT2+gho3BCausPUtwDEVg3NNFmoBdpZr Z7vSnW2+HmmZgdzi/lE7LJV7Jonpf3wUM/3T1ryGWx7zeFPIhN3U6w5tuADTABJ27ymI t3BYvqvLouiauk1SVkVsnMwgg7O5G/02pJ1oRbLACa2/vxGdZD2gVVkGIWp7NrrG57Ed 42l/f+YPoEa4xEfBe8L1EieIS2qgLwc7WgoPsX5SF63i5JZdH6A2IAk0qA48LxVl6ZEt vwmQ== X-Gm-Message-State: ACrzQf2pNX4aCXNrMU1QXkOBOfrEBOHd+MsQMayNSe4wWAnIfiBoot4R j1v+EjKj66f3kFjTM7tyylo= X-Google-Smtp-Source: AMsMyM5SeUv5h3OUh7LPJ7KiK1szc0oaT23XlSZ9LQ469HdOnpVCJpK8bPnerKLBmkxqF7Uxlp8l/g== X-Received: by 2002:a2e:bcc3:0:b0:26c:4c59:75ed with SMTP id z3-20020a2ebcc3000000b0026c4c5975edmr1564412ljp.505.1665147004219; Fri, 07 Oct 2022 05:50:04 -0700 (PDT) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id a21-20020ac25055000000b0048b0099f40fsm281404lfm.216.2022.10.07.05.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 05:50:03 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Cc: Jon Hunter , Robin Murphy , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 6/7] drm/simpledrm: Support the XB24/AB24 format Date: Fri, 7 Oct 2022 14:49:45 +0200 Message-Id: <20221007124946.406808-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221007124946.406808-1-thierry.reding@gmail.com> References: <20221007124946.406808-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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. v2: treat AB24 as XB24 and support both at the same time Signed-off-by: Thierry Reding --- 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 cf36f67d22e4..ecb303c89320 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -559,6 +559,8 @@ 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_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 Fri Oct 7 12:49:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 613579 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFAD9C43219 for ; Fri, 7 Oct 2022 12:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbiJGMuX (ORCPT ); Fri, 7 Oct 2022 08:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbiJGMuV (ORCPT ); Fri, 7 Oct 2022 08:50:21 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99FBD50528; Fri, 7 Oct 2022 05:50:08 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id m14so5603682ljg.2; Fri, 07 Oct 2022 05:50: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 :message-id:reply-to; bh=2Y5rrHwKLrZ4oqRyovAy2VnaQoMJrQoBHsrafxjglos=; b=G/OrJ8zqmuYb/kkS4UhLEWzbWimpcbgnoO9d6aBezAILPtzafFiTWoGM+F66GRzlIY LMgAgEJ7Pa0gdROKyt8NntQDeLrEljz9GLjSH4Ij0rmhfjVCx9vqEEYof2j6rHosktm7 owcS11xjt87jTesZhyoO3+2tL04cTlwYm2PanSbXSmttF/TZ7KDeRv4EODiWkEDn5bty VEhqWZpIN8w/fx+AvQb6Jb0okDEgwOy/GdZvwLB82j232EfKPsLKcbNV0TJB11M0jLzs FjZHe1UOO1A0JCJFHOPoXE1/zxW+6j0g+6TRHnU+5i+dw6Fic7iwCHfKeEYUUOSKDXw1 FWAw== 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=2Y5rrHwKLrZ4oqRyovAy2VnaQoMJrQoBHsrafxjglos=; b=j9Ylv6uwsZQGQPSKUn/uFvr0llIVIfi1Ovj3pYfSM70AwsOyCFX8Kjj+r4XlfSmb5S 7IdJeehgpxt0wzTV4Se9GUSJrKimbX2JUFkSuEEW8RBBHGogZ5fcYYm2wbrglLyTI7vN 0pjYDguKzYifMG602FCyn2jzI7okU9cj54xiKNR3mbhyWJdmKhAE2kgTSwLnE0QTPvpq /sNow9LVuQSdppmY3k/emKtuN9AXYCJ7il9i7SZIaJL9Vj2S/T0LJ0On8MhPyS68/qYW UcAdQUAWnZdIdC7yLk20FitbHJdNBotNrRkdgTSahsMnc1RMItOQm0vBkbr6iSDGoJe8 76lw== X-Gm-Message-State: ACrzQf0OHIwo/c3NLdBc1553/d8u4y6OI84oo6ARZwAevrF6oGgzQ9Ea ijVsOB+0E8E9kxpAvJgRIto= X-Google-Smtp-Source: AMsMyM5ifxC7UlGdvc8qqaOEFBsU8euuliNMcSqjfAmJ19hRmNULRYAXYUCwGxaNG7vixk8xgJwMYg== X-Received: by 2002:a2e:96d0:0:b0:26a:8a3c:861e with SMTP id d16-20020a2e96d0000000b0026a8a3c861emr1574575ljj.54.1665147006947; Fri, 07 Oct 2022 05:50:06 -0700 (PDT) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id t27-20020a2e8e7b000000b0026dfe55be7fsm241505ljk.63.2022.10.07.05.50.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 05:50:06 -0700 (PDT) From: Thierry Reding To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding Cc: Jon Hunter , Robin Murphy , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 7/7] arm64: tegra: Add simple framebuffer on Jetson Xavier NX Date: Fri, 7 Oct 2022 14:49:46 +0200 Message-Id: <20221007124946.406808-8-thierry.reding@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221007124946.406808-1-thierry.reding@gmail.com> References: <20221007124946.406808-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 | 33 +++++++++++++++++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 +- 2 files changed, 34 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..44600479ea5f 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,37 @@ / { 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 = ""; + }; + }; + + 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>; + }; + }; }; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index 4d10b6b5324d..a961d42c81d6 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -1960,7 +1960,7 @@ display-hub@15200000 { ranges = <0x15200000 0x15200000 0x40000>; - display@15200000 { + dc0: display@15200000 { compatible = "nvidia,tegra194-dc"; reg = <0x15200000 0x10000>; interrupts = ;