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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D8996C636CD for ; Sun, 5 Feb 2023 19:47:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5DEEA8577C; Sun, 5 Feb 2023 20:47:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CmIwig5M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E5B20857A1; Sun, 5 Feb 2023 20:46:56 +0100 (CET) Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 76C04857C8 for ; Sun, 5 Feb 2023 20:46:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id y2so3799938iot.4 for ; Sun, 05 Feb 2023 11:46:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=56daZ9oVoJi318PhcrMG+2kB/22zd03Xp+VZl4Kpty4=; b=CmIwig5Ma+DPOIG8QCDbigtIC4BWM9sk6TeYlBTJl1eosaM+DoeVj/DeJPrrA1L4Nx dq2w09Qn//XOLC/Oj1RqwDBMhjvqy51ncNwIlsUIgGVPD/8nkznpdraXmh3NODIqpljf 9Y1snHSRxWVFG1TWxw+uadps5afIoVPe0bG8c= 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=56daZ9oVoJi318PhcrMG+2kB/22zd03Xp+VZl4Kpty4=; b=WnN5QlTtDYvVyDhAy7caAOL1dMX6wyHZdQu5xVvxTCdrKkCExMhrURJS8xOtO+UR9q jAUDF7dLuQVOLCjmI5Ytinny0qzUU5P9PYsMobtOqSyq9kptZNcdu4I+wNoHnCIiTFhd 2akRlkBa1ZBFF2dqWgbhczFygJ8Js4lDGoBa4OIHq0070yv7fRrRUvh0zn9Dxc5c7IVP ESvoIxtRNGAod2ggneWYLk+pfehkXb3u+gAoY1cSiT7/VXaVsBBjroBK36sGjeYNzZlh xajHyZA4BUO9fy0vvaymLIak2EiK6q7kESyxLgyZPpsORrTt1y9FFcfpc16gqfQGn6f0 g/dg== X-Gm-Message-State: AO0yUKX6Khxwo7EuKfWZ54sBkr/HCyENvtgvE2QBEI5njK/29vTbM0hu yvBqQqb0t0O1jbkoPleY6fnC8GicgwFP2acH X-Google-Smtp-Source: AK7set/dejjjFPD6tjH2WhRpJKptM8oB4p7TYiLg1QrljvOlEdORSw6lJnvnhNJaYaGif+CHStobGQ== X-Received: by 2002:a05:6602:2d0a:b0:71c:c276:421c with SMTP id c10-20020a0566022d0a00b0071cc276421cmr13651846iow.3.1675626405933; Sun, 05 Feb 2023 11:46:45 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id p13-20020a6b8d0d000000b007219624f89fsm2594282iod.11.2023.02.05.11.46.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Feb 2023 11:46:45 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Anatolij Gustschin , Heinrich Schuchardt , Simon Glass Subject: [PATCH 07/11] video: Allow a copy framebuffer with pre-allocated fb Date: Sun, 5 Feb 2023 12:46:23 -0700 Message-Id: <20230205194627.203961-8-sjg@chromium.org> X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog In-Reply-To: <20230205194627.203961-1-sjg@chromium.org> References: <20230205194627.203961-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean At present it is not possible for the video driver to use a pre-allocated frame buffer (such as is done with EFI) with the copy framebuffer. This can be useful to speed up the display. Adjust the implementation so that copy_size can be set to the required size, with this being allocated if the normal framebuffer size is 0. Signed-off-by: Simon Glass --- drivers/video/video-uclass.c | 32 ++++++++++++++++++++++++-------- include/video.h | 2 ++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 0b773af2ff3..954ebbce23a 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -78,24 +78,40 @@ void video_set_flush_dcache(struct udevice *dev, bool flush) priv->flush_dcache = flush; } +static ulong alloc_fb_(ulong align, ulong size, ulong *addrp) +{ + ulong base; + + align = align ? align : 1 << 20; + base = *addrp - size; + base &= ~(align - 1); + size = *addrp - base; + *addrp = base; + + return size; +} + static ulong alloc_fb(struct udevice *dev, ulong *addrp) { struct video_uc_plat *plat = dev_get_uclass_plat(dev); - ulong base, align, size; + ulong size; + + if (!plat->size) { + if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->copy_size) { + size = alloc_fb_(plat->align, plat->copy_size, addrp); + plat->copy_base = *addrp; + return size; + } - if (!plat->size) return 0; + } /* Allow drivers to allocate the frame buffer themselves */ if (plat->base) return 0; - align = plat->align ? plat->align : 1 << 20; - base = *addrp - plat->size; - base &= ~(align - 1); - plat->base = base; - size = *addrp - base; - *addrp = base; + size = alloc_fb_(plat->align, plat->size, addrp); + plat->base = *addrp; return size; } diff --git a/include/video.h b/include/video.h index 3f67a93bc93..4d99e5dc27f 100644 --- a/include/video.h +++ b/include/video.h @@ -24,6 +24,7 @@ struct udevice; * @base: Base address of frame buffer, 0 if not yet known * @copy_base: Base address of a hardware copy of the frame buffer. See * CONFIG_VIDEO_COPY. + * @copy_size: Size of copy framebuffer, used if @size is 0 * @hide_logo: Hide the logo (used for testing) */ struct video_uc_plat { @@ -31,6 +32,7 @@ struct video_uc_plat { uint size; ulong base; ulong copy_base; + ulong copy_size; bool hide_logo; }; -- 2.39.1.519.gcb327c4b5f-goog