From patchwork Fri Jul 3 03:12:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322036 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=XnUbsBQm; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg5J453Mz9sR4 for ; Fri, 3 Jul 2020 13:13:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8171F81B6E; Fri, 3 Jul 2020 05:12:53 +0200 (CEST) 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="XnUbsBQm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ABC7981B83; Fri, 3 Jul 2020 05:12:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (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 22BF981B62 for ; Fri, 3 Jul 2020 05:12:46 +0200 (CEST) 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-il1-x144.google.com with SMTP id h16so2759790ilj.11 for ; Thu, 02 Jul 2020 20:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w6b7fyV6fruUdtYG+XwxlKKLDeop24eT68ewUQOeqS8=; b=XnUbsBQmAZrSl9aiM0qW12eNsIn9/fkDDeC7s7ZQjMcfc4/yjzsYZzfHhOiAKsVixv FhcnBt68/hfNuwOH0Xw9GVvZe+Ez051wx8WsefSDXPnosoIkb1zSL747DNphgA7ccleJ I0oD6XuNMHX52q4KRScpkwAgieiFirWQy5u8s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w6b7fyV6fruUdtYG+XwxlKKLDeop24eT68ewUQOeqS8=; b=C8mZmzcH583xZxFcmgmgjAqPAbU3U4Ml5LdgtteKu5gCUNJALQQBzsM44d5UqJbrNg O/ERCF4m6LsrHQVNmuuy63aMDREFDc5kwFfalcN/KeNz/CZvUUMLbqJYX5HdeEPqvy7H hB1UQqMuaJC8Bl8T6XHuVwrOMqPiA6EpnXabtw6Mx2qsHVFZGpNS0EgjB4KQVQiW+0MM mTxjWjDbIEW4cKlAlbT+x76wCB8lv9WSvIdPlIYqxR0aXDe6pyLuEqAqG6quoXGOnOfB s3tGUU6mPFxslVnlcy4rvE6JPOK93My7xoYSwV1l71Y7beVVHXwd+/eXWoqXFdBEQZNJ nDlQ== X-Gm-Message-State: AOAM531gjE3fN7X/wvV9N1B56Y0tCNkAu1bmfnJMECnJrA1rTiH32Ugn 6ojblEFEWNZ+3QC0KtsiokUnSQ== X-Google-Smtp-Source: ABdhPJzOquFALD5KD+W+bMmbdGprBiJyZSBNwaUeuG1NYIiOvLGZd8fEEjk3B5pJbiDTYXQJ9eEqCw== X-Received: by 2002:a92:cf42:: with SMTP id c2mr16535258ilr.13.1593745964717; Thu, 02 Jul 2020 20:12:44 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:44 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , u-boot@lists.denx.de Subject: [RESEND PATCH v3 01/26] x86: fsp: Reinit the FPU after FSP meminit Date: Thu, 2 Jul 2020 21:12:12 -0600 Message-Id: <20200703031237.1546362-2-sjg@chromium.org> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean The APL FSP appears to leave the FPU in a bad state in that it has registers in use. This causes an error when the next FPU operation is performed. Work around this by re-resetting the FPU after calling FSP-M. This allows the freetype console to work correctly. Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/cpu/i386/cpu.c | 5 +++++ arch/x86/include/asm/u-boot-x86.h | 8 ++++++++ arch/x86/lib/fsp2/fsp_meminit.c | 1 + 3 files changed, 14 insertions(+) diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c index 435e50edad..d27324cb4e 100644 --- a/arch/x86/cpu/i386/cpu.c +++ b/arch/x86/cpu/i386/cpu.c @@ -363,6 +363,11 @@ static void setup_cpu_features(void) : : "i" (em_rst), "i" (mp_ne_set) : "eax"); } +void cpu_reinit_fpu(void) +{ + asm ("fninit\n"); +} + static void setup_identity(void) { /* identify CPU via cpuid and store the decoded info into gd->arch */ diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h index 3e5d56d075..bd3f44014c 100644 --- a/arch/x86/include/asm/u-boot-x86.h +++ b/arch/x86/include/asm/u-boot-x86.h @@ -43,6 +43,14 @@ int x86_cpu_reinit_f(void); */ int x86_cpu_init_tpl(void); +/** + * cpu_reinit_fpu() - Reinit the FPU if something is wrong with it + * + * The FSP-M code can leave registers in use in the FPU. This functions reinits + * it so that the FPU can be used safely + */ +void cpu_reinit_fpu(void); + int cpu_init_f(void); void setup_gdt(struct global_data *id, u64 *gdt_addr); /* diff --git a/arch/x86/lib/fsp2/fsp_meminit.c b/arch/x86/lib/fsp2/fsp_meminit.c index 1a758147b0..faf9c29aef 100644 --- a/arch/x86/lib/fsp2/fsp_meminit.c +++ b/arch/x86/lib/fsp2/fsp_meminit.c @@ -85,6 +85,7 @@ int fsp_memory_init(bool s3wake, bool use_spi_flash) func = (fsp_memory_init_func)(hdr->img_base + hdr->fsp_mem_init); ret = func(&upd, &hob); bootstage_accum(BOOTSTAGE_ID_ACCUM_FSP_M); + cpu_reinit_fpu(); if (ret) return log_msg_ret("SDRAM init fail\n", ret); From patchwork Fri Jul 3 03:12:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322038 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bon5vATI; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg5m5X0Xz9sR4 for ; Fri, 3 Jul 2020 13:13:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9680B81BB3; Fri, 3 Jul 2020 05:12:58 +0200 (CEST) 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="bon5vATI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4EE5581B97; Fri, 3 Jul 2020 05:12:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (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 8E0C281B6E for ; Fri, 3 Jul 2020 05:12:47 +0200 (CEST) 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-xd41.google.com with SMTP id a12so31110103ion.13 for ; Thu, 02 Jul 2020 20:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ppYlddpIkDvwhghM08cMrzdufwd0HP64gFWGnhai5dY=; b=bon5vATIsBaPoFmuYDba9ET6S9hy4Rilfml+Y0qjnKDRpJpPp+R/p04nwolNk5C/N0 DX9lodSiier1Rwb6tklDtBoXTAi5MEBjSTu7XiXdYB7WxH5x9gLyAnJwaM4L1PIwQzFI vvYP6Y0jU/Z9N4cK2P0XprrtCuvzfSmsEswOs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ppYlddpIkDvwhghM08cMrzdufwd0HP64gFWGnhai5dY=; b=oYq8OfAcZWJTko5zE09tXus0A5FWnFkX3s6iAACLhrl8OFrcJFMC86UB7Y0HtkQwXU URUOXXhCojIQg2exd55BV9DbPHFGKPbnDcSiqG8m4Pg60Mn5H8do9ZGVlT1FNSskXqcs 0bwxJXIWE6addy/tPpevGEy4fWs5jmGMETUZd7DIMQubtIYBwN2NWmAG/Ki9eqEqDrBz eNyMmuta303Qd9y2mHXjiWxcdUSROr7qQIS2dCkQeZDGwarFH8PxbvbaAbb8vI6LDwDP hk78lHtRkuoUxCRxeQPaJDmmplkZmfkwymVqbX84kwGDmjVLsKhxsaJN0qCXSkzXleDS NwGw== X-Gm-Message-State: AOAM530dpuW2KhpXJMcktynkPuRZZWAVhTHpmZTcEZf1MRhLDrAB1+wQ PPHNPOXc/Zi22Oe6d8zkr13zAg== X-Google-Smtp-Source: ABdhPJxmXE9UEYJEdOLH4FlllnjzejnqmKvKyaWxVgGowVAfwY+0omkO+p5Lk8fAWhmHWFshJUQTCQ== X-Received: by 2002:a02:5e88:: with SMTP id h130mr38041876jab.116.1593745966358; Thu, 02 Jul 2020 20:12:46 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:46 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 03/26] video: Show an error when a vidconsole function fails Date: Thu, 2 Jul 2020 21:12:14 -0600 Message-Id: <20200702211204.RESEND.v3.3.I8c38c21ef51885e25a6245fb7e4f6ac5567d9937@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present these functions fail silently even when debugging, which is not very helpful. Add a way to print a message to the serial output when an error is detected. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/vidconsole-uclass.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 3f20f70e9a..841cfdaf93 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -9,12 +9,13 @@ #include #include +#include #include -#include #include #include #include #include /* Bitmap font for code page 437 */ +#include /* * Structure to describe a console color @@ -556,16 +557,31 @@ int vidconsole_put_string(struct udevice *dev, const char *str) static void vidconsole_putc(struct stdio_dev *sdev, const char ch) { struct udevice *dev = sdev->priv; + int ret; - vidconsole_put_char(dev, ch); + ret = vidconsole_put_char(dev, ch); + if (ret) { +#ifdef DEBUG + console_puts_select_stderr(true, "[vc err: putc]"); +#endif + } video_sync(dev->parent, false); } static void vidconsole_puts(struct stdio_dev *sdev, const char *s) { struct udevice *dev = sdev->priv; + int ret; + + ret = vidconsole_put_string(dev, s); + if (ret) { +#ifdef DEBUG + char str[30]; - vidconsole_put_string(dev, s); + snprintf(str, sizeof(str), "[vc err: puts %d]", ret); + console_puts_select_stderr(true, str); +#endif + } video_sync(dev->parent, false); } From patchwork Fri Jul 3 03:12:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322037 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Q9TgN+G5; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg5V3S5Cz9sR4 for ; Fri, 3 Jul 2020 13:13:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5DA7A81BA5; Fri, 3 Jul 2020 05:12:56 +0200 (CEST) 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="Q9TgN+G5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F11181B8B; Fri, 3 Jul 2020 05:12:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (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 45E8981B79 for ; Fri, 3 Jul 2020 05:12:48 +0200 (CEST) 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-il1-x141.google.com with SMTP id h16so2759849ilj.11 for ; Thu, 02 Jul 2020 20:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H9hPEZvmcXGYo5/xSnbGOL9GH4N2kPDYrU7Obg+8PZw=; b=Q9TgN+G5Mlh5TXHSnf3R/iJYIt4/D0mVZUFP6DNv1ehTI26GTlvAfY7q43mtx7scZF JcjuaKLLu6ts2CHOEKG/Alt6u5KFBaHXELSaMOmaLzqqKwFc48apEqKfZ1im6MsWDpS0 LfvQEvwrP7C8lRPxRaOIvFd5RReW/7EDJCIpc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H9hPEZvmcXGYo5/xSnbGOL9GH4N2kPDYrU7Obg+8PZw=; b=CFjC1+WeiqZlbFAWhjmUXvMsji14G0lNgq2y97RQ7bzSIDTda5eH72IVEC/jDF0jM5 +jjKoaTKktINbUw6itFmH0Q0Q4llAJwoAMh04T+66WSeYSWlkW7lsaULrITToCuEiReP tiVY02lhWZe3MoQ2HZdEtwRyoinyfGUX8RD4z0PdOyFNj1qARDM2cacvvvYmu4Jnyfgk eEUflIikx7JsHylBXRSDCcYiS7goLQCCeUEuFQByGm3MwOx8rf5APEr6LRkqJ3KW8nFo +dIwJ/YDoNLbr+wIrRibDMQpUm64EZcNZNlRqJfsCb4ca1v/368r9c/AFGkO/Z1qI3Cg HTDA== X-Gm-Message-State: AOAM5333JGPOQzLxTW+EmMPICMMIhVZBRhe/SApR/9TynDiX9ZNoNVD4 BxRAgu4a+mq6nOPNFZH7uW0W+w== X-Google-Smtp-Source: ABdhPJwq/4OZNUm95X7rPQVavALmPWBGqksrALxiiswBO+h6u9ad8N/fQ/jQUn3IxXTC3SY6RIgwwQ== X-Received: by 2002:a92:d811:: with SMTP id y17mr14492991ilm.35.1593745967160; Thu, 02 Jul 2020 20:12:47 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:46 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 04/26] sandbox: video: Allow selection of rotated console Date: Thu, 2 Jul 2020 21:12:15 -0600 Message-Id: <20200702211204.RESEND.v3.4.Ic64153abc8c8e22f5b5348fe2002fa2b17239852@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Add a devicetree property to select a rotated console. This uses the same encoding as vidconsole itself: 0=normal; 1=90 degrees clockwise, 2=upside down, 3=90 degrees anticlockwise. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/sandbox_sdl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c index 20248e6607..c678e728db 100644 --- a/drivers/video/sandbox_sdl.c +++ b/drivers/video/sandbox_sdl.c @@ -53,6 +53,7 @@ static int sandbox_sdl_bind(struct udevice *dev) plat->xres = dev_read_u32_default(dev, "xres", LCD_MAX_WIDTH); plat->yres = dev_read_u32_default(dev, "yres", LCD_MAX_HEIGHT); plat->bpix = dev_read_u32_default(dev, "log2-depth", VIDEO_BPP16); + plat->rot = dev_read_u32_default(dev, "rotate", 0); uc_plat->size = plat->xres * plat->yres * (1 << plat->bpix) / 8; debug("%s: Frame buffer size %x\n", __func__, uc_plat->size); From patchwork Fri Jul 3 03:12:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322039 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=V7ECgki1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg5w6pZlz9sR4 for ; Fri, 3 Jul 2020 13:13:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 792A681BC2; Fri, 3 Jul 2020 05:13:01 +0200 (CEST) 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="V7ECgki1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6C66681B93; Fri, 3 Jul 2020 05:12:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (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 15FC481B78 for ; Fri, 3 Jul 2020 05:12:49 +0200 (CEST) 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-il1-x142.google.com with SMTP id t18so6158548ilh.2 for ; Thu, 02 Jul 2020 20:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jLJ1TEoumVIDlplMz20To6rPjXDIyInkDdSB+3z5JmA=; b=V7ECgki1xk1ZAnOHP6aEMjFMbThkNsljkAmB+I36AHiA99vnC0V/dgpT+Lv85Y5N72 Hy+T1ICg7PCfktJDfDjguMIs9oJJm9wXa8CzeCgOuvQHlMkSB1or1c/8gWPEEfdhfBBv srzfl0fbsNdMu863HcFz3YUURwsyilzzZ56uI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jLJ1TEoumVIDlplMz20To6rPjXDIyInkDdSB+3z5JmA=; b=pwjb6Hw09f54RHMJe6VAgkub+uWHGrdL+x1Eb4KFsT3pQmnRzQy5y+rx36qAgdh4aj vZtCd0RkstW/Hfe+cz3Mh5aU4MMLXfl6uhS6frhx04t2mGSfe1othFkznNAJjbKTKTo/ SIZj0cXVAF6pHR2zBvlgmr9dWEVg1dV0uoHVrmGiZnnGhN9SLScY66YjD9WLwqAoO8Zt fZO589EUm4THoA5n+EKIZaO0zutme4CxMyboBC2gaOZIK6dOS14cu+WObyewv9k9Qypm uMfL9oP61+rybRWZp8/MAIAPs3J8N6P4+gmHL2emFUfK5X9k9JdhXXq0QeUmRxmgAzHu I4aA== X-Gm-Message-State: AOAM530n/lDTKuO08AdiPKcueXZDtgaLcFthKUbzjwXU0+HkUqKRRxvX fcLxer647duLS0sk44W55cTN5w== X-Google-Smtp-Source: ABdhPJweS/XHHu7DAOoL3eMhdsvgYBbwGDOXGniScnjABedZF0h05nKyzhNMTj3q/o9nK+T3PQJuZw== X-Received: by 2002:a92:c0c4:: with SMTP id t4mr15414784ilf.211.1593745967893; Thu, 02 Jul 2020 20:12:47 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:47 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 05/26] video: Split out expression parts into variables Date: Thu, 2 Jul 2020 21:12:16 -0600 Message-Id: <20200702211204.RESEND.v3.5.If9aaebbcc4389b38b66478fc3dd0aaff49c3105e@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean The functions in this file do similar things but not always in the same way. To make the code easier to read and compare, use a separate 'linenum' variable in every function. This is then multiplied by the line length to get the offset within the frame buffer to modify. Also use an 'x' variable to hold the pixel position within that line. This is multipled by the pixel size and added to the offset. Also move the pbytes declaration up a little with the other long lines. A side effect of splitting out these variables is that they are promoted to int, i.e. a signed type, from the unsigned short used in the vidconsole_priv struct. This would be necessary should any of the variables go negative. At present this can actually happen in console_putc_xy_2(), if the display width is not a multiple of the character size (see next patch). Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/console_rotate.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c index b485255598..8bb05ae02c 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c @@ -59,9 +59,9 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, uint count) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); + int pbytes = VNBYTES(vid_priv->bpix); void *dst; void *src; - int pbytes = VNBYTES(vid_priv->bpix); int j; dst = vid_priv->fb + vid_priv->line_length - @@ -83,14 +83,15 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch) struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); + uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT; int pbytes = VNBYTES(vid_priv->bpix); - int i, col; + int i, col, x, linenum; int mask = 0x80; void *line; - uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT; - line = vid_priv->fb + (VID_TO_PIXEL(x_frac) + 1) * - vid_priv->line_length - (y + 1) * pbytes; + linenum = VID_TO_PIXEL(x_frac) + 1; + x = y + 1; + line = vid_priv->fb + linenum * vid_priv->line_length - x * pbytes; if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) return -EAGAIN; @@ -204,16 +205,15 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); - int i, row; + int pbytes = VNBYTES(vid_priv->bpix); + int i, row, x, linenum; void *line; if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) return -EAGAIN; - - line = vid_priv->fb + (vid_priv->ysize - y - 1) * - vid_priv->line_length + - (vid_priv->xsize - VID_TO_PIXEL(x_frac) - - VIDEO_FONT_WIDTH - 1) * VNBYTES(vid_priv->bpix); + linenum = vid_priv->ysize - y - 1; + x = vid_priv->xsize - VID_TO_PIXEL(x_frac) - VIDEO_FONT_WIDTH - 1; + line = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes; for (row = 0; row < VIDEO_FONT_HEIGHT; row++) { unsigned int idx = (u8)ch * VIDEO_FONT_HEIGHT + row; @@ -312,9 +312,9 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, uint count) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); + int pbytes = VNBYTES(vid_priv->bpix); void *dst; void *src; - int pbytes = VNBYTES(vid_priv->bpix); int j; dst = vid_priv->fb + rowdst * VIDEO_FONT_HEIGHT * pbytes; @@ -334,16 +334,16 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch) struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); + uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT; int pbytes = VNBYTES(vid_priv->bpix); - int i, col; + int i, col, x; int mask = 0x80; - void *line = vid_priv->fb + - (vid_priv->ysize - VID_TO_PIXEL(x_frac) - 1) * - vid_priv->line_length + y * pbytes; - uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT; + void *line; if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) return -EAGAIN; + x = vid_priv->ysize - VID_TO_PIXEL(x_frac) - 1; + line = vid_priv->fb + x * vid_priv->line_length + y * pbytes; for (col = 0; col < VIDEO_FONT_HEIGHT; col++) { switch (vid_priv->bpix) { From patchwork Fri Jul 3 03:12:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322040 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=cGC8eGGO; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg6B6TGpz9sR4 for ; Fri, 3 Jul 2020 13:13:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8823581BBA; Fri, 3 Jul 2020 05:13:08 +0200 (CEST) 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="cGC8eGGO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C26E081B79; Fri, 3 Jul 2020 05:12:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (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 B2DE081B47 for ; Fri, 3 Jul 2020 05:12:49 +0200 (CEST) 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-il1-x144.google.com with SMTP id r12so18879923ilh.4 for ; Thu, 02 Jul 2020 20:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zxMn/Z1P9ZMTco8WeT+74Yl2ItYwiNF+/xYV5Ql+liM=; b=cGC8eGGO2aFNtUEtnpz5RlUwq5u5AcwFiOCmxu+BgVCIidi43TY6yFxOAMidz5nq+f elZYT1EalpMxLFQhAPYHPiRi2t3em4m/OeAjqhhNzkd7oZ+ljr030K4y5Gqnm+ugdW8H BSWO96FSuPbOD8oHFRBt1iqzgacNd44b4Yh+M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zxMn/Z1P9ZMTco8WeT+74Yl2ItYwiNF+/xYV5Ql+liM=; b=AVa8jRDwIDnjYkLKo0rw/ORrLM4AWVYUbCmm4fRLkKGqGbsQE0HgGebJWAoVZkieWx VazyC9OkcA0LxoFy9+Fy5cXuZ4rBIpBgFCpweAjaXHALPsX3LZf6DCEMfRngUcbFThY3 N2M1BAsocZtN9N6Ix8pgQD0cffwSTYwNEfCUtLj2giFadfvCiC0m6ynnevtpDMMcNjYh F2D38D5o+h41DU3OdNgSXychTMnYYw1B3lYPCof1vhd2uR7YP4mj6nD6m6Fg+6Gr3qUP 6TCwDKe64Dt4EE2M/p2cSitBmm/XtP0DDQAIcaX1JtroVT0sH0Va0+QcQHY0WOtHSLzZ qCrg== X-Gm-Message-State: AOAM530Vay5KCY5PnvDieLkYdySTjdkOUk+MXcezZw0G9ZLje+75LW1/ SeEmLjKTOrPrYm+ys6GXzqYT6A== X-Google-Smtp-Source: ABdhPJyNtR/cpgq0t9HFb2oxcJCe2AySyr5N/v15S7Rh72gOpU+5dtpEKCSLPJPD8GjeyxgOsNRujA== X-Received: by 2002:a92:5207:: with SMTP id g7mr16058261ilb.49.1593745968679; Thu, 02 Jul 2020 20:12:48 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:48 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 06/26] video: Adjust rotated console to start at right edge Date: Thu, 2 Jul 2020 21:12:17 -0600 Message-Id: <20200702211204.RESEND.v3.6.Ie8637472573bd3e94375131aa034e7498df340b1@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present when the console is rotated 180 degrees it starts almost a whole character to the left of the right edge (typically 7 pixels with an 8-pixel-wide font). On a display which aligns with the font width, this just wastes space. On a display that does not this can result in x_frac going negative for the final character (the one on the left side) and the overflow -EAGAIN check at the start of the function failing. Change the function to start at the rightmost pixel to fix these problems. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/console_rotate.c | 2 +- test/dm/video.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c index 8bb05ae02c..da0ce7b9ce 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c @@ -212,7 +212,7 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) return -EAGAIN; linenum = vid_priv->ysize - y - 1; - x = vid_priv->xsize - VID_TO_PIXEL(x_frac) - VIDEO_FONT_WIDTH - 1; + x = vid_priv->xsize - VID_TO_PIXEL(x_frac) - 1; line = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes; for (row = 0; row < VIDEO_FONT_HEIGHT; row++) { diff --git a/test/dm/video.c b/test/dm/video.c index 0664e3f22b..68f5ba44e7 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -251,7 +251,7 @@ DM_TEST(dm_test_video_rotation1, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); /* Test rotated text output through the console uclass */ static int dm_test_video_rotation2(struct unit_test_state *uts) { - ut_assertok(check_vidconsole_output(uts, 2, 785, 446)); + ut_assertok(check_vidconsole_output(uts, 2, 783, 445)); return 0; } From patchwork Fri Jul 3 03:12:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322041 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=gh8v7DyB; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg6Q617fz9sR4 for ; Fri, 3 Jul 2020 13:14:06 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7409481BD4; Fri, 3 Jul 2020 05:13:11 +0200 (CEST) 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="gh8v7DyB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B49481BA3; Fri, 3 Jul 2020 05:12:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (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 827E881B62 for ; Fri, 3 Jul 2020 05:12:50 +0200 (CEST) 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-xd43.google.com with SMTP id v6so17414783iob.4 for ; Thu, 02 Jul 2020 20:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=djjQovkPZZGxrw53nmPIlsqZJWuyYLEBLl4C/R+vgMA=; b=gh8v7DyBfJQdAunthHShqQBSlKLuVGzbaMkam5uK5dm5gYD7xA3+TC4DtYsCYLOe5k 9bWOEVLFiZBSBFzelyYmH2kWmKlndOqxuTvOQ8YgUhyrj/lH0NCH8Dy/cIWifGjkLBTS XjLIMOzO/bnBw44QVXyc3OAyu798A8oh/RcHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=djjQovkPZZGxrw53nmPIlsqZJWuyYLEBLl4C/R+vgMA=; b=fPhvaYHq313qenmDFoXa5mPtxnc2Ba6LXWp5UrCSDu/0WfUkXLVIZTdvbi/gtbztrp m5nrPwLom94QPcNbOE1Np9hjziwjD0C6jXdx0OYwx/zKTKXn7NvS8UK/kkuaRhYvCxOh /3KYbqkeBQIQQsXIk20ckVJrkgXsfPXnHPwbEPB/JwrR4v0fBXZewbgYplfclLmLGyBb QF6Dxy8qq36ghe/ZlyPxritLi1jYbhty1dRpgrLgAZVgkFcX+Cq+XdtSeUhYd6/62jIX km5ldGXf407pfbR7LV0MXmlrUpT2HND2RTxwk80Nt7N4yPXKMzy1UBgnez7/uL3reb2q KFnA== X-Gm-Message-State: AOAM532CjIVh8HeyR4oNQpW3646nSf2y7awq04n/OepGqGmJt13tXMSj Rt81dxqugg1q5vXOqL1uI2aDsg== X-Google-Smtp-Source: ABdhPJxIBS4FnwLBsFkMBpCzzhSSPllWc2+croE+fOQcYaf4+aQd4CEhkSzC5erznlLL2r5zMIsdJA== X-Received: by 2002:a02:cc58:: with SMTP id i24mr15744354jaq.38.1593745969393; Thu, 02 Jul 2020 20:12:49 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:49 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 07/26] video: Drop unnecessary #ifdef around vid_console_color() Date: Thu, 2 Jul 2020 21:12:18 -0600 Message-Id: <20200702211204.RESEND.v3.7.I077675d6a9b88621e29511331f0773f8bdaf5fc7@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean All of the functions in this file only apply if DM_VIDEO is enabled. Drop the #ifdef as it just clutters things up. Add the needed forward declaration. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) include/video_console.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/video_console.h b/include/video_console.h index 0936ceaaf1..d3bc063165 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -8,6 +8,8 @@ #include +struct video_priv; + #define VID_FRAC_DIV 256 #define VID_TO_PIXEL(x) ((x) / VID_FRAC_DIV) @@ -241,8 +243,6 @@ int vidconsole_put_string(struct udevice *dev, const char *str); void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row); -#ifdef CONFIG_DM_VIDEO - /** * vid_console_color() - convert a color code to a pixel's internal * representation @@ -257,5 +257,3 @@ void vidconsole_position_cursor(struct udevice *dev, unsigned col, u32 vid_console_color(struct video_priv *priv, unsigned int idx); #endif - -#endif From patchwork Fri Jul 3 03:12:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322042 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=K+9C95nT; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg6c6ry1z9sR4 for ; Fri, 3 Jul 2020 13:14:16 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E4B6181BD8; Fri, 3 Jul 2020 05:13:14 +0200 (CEST) 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="K+9C95nT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EFE3781BB2; Fri, 3 Jul 2020 05:12:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (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 5EB9581B89 for ; Fri, 3 Jul 2020 05:12:51 +0200 (CEST) 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-il1-x143.google.com with SMTP id e18so15378269ilr.7 for ; Thu, 02 Jul 2020 20:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/w+zwAGE+AqaDgClV/PakBddvrpSSl4PYq3AbL2ggm8=; b=K+9C95nTOM3IQ4FVfsZUOKgcrKgKgEKoAKRgVNntL6EQfjVILrWhJZEe8cMC7aKDUa GdsmaP1DYrut7HfWV4VyrAzNCsldaOoA5o/mP0qReju5TVSvzNrgY63nLYr+miAM2/Q+ 79ad9jEfQxTvBSGWa+33MpDeMzctAduLm71Eg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/w+zwAGE+AqaDgClV/PakBddvrpSSl4PYq3AbL2ggm8=; b=Rvf2tsG4/8hNoOo/tjhoEl0M+8ajqRRKPG2GX4tPva2XVFDId1wTnXuaCnDT30ElbZ oUNXALAwd+EUturX9xingEhn3iFEc9J3WGMOfAWxsdNRaEF0MoWZoc7QnXQPK7nSUQma nsuSqEX8sEUtKdp3yoF9UkvoN7pNJA+K3CoUoh7Azly3NKpALMB7gvBpgb2dMUtCGc17 PXnp91vm38wMX0cFSxPwPBlbKhfRWnDrH0Qqunz+dt0c/wcanBU8+v5YTAc6mjZTCsyb mW/7GYiYmgW3q9XsQpJKjHRh7BaUCRY46RwsNbYzws7eefoMYe1XRp1R9BCZNKU/4tUT wCqw== X-Gm-Message-State: AOAM531hQ/RT7zyBPgEjAqGDWT0xi0wt8KUGrnF6uu8cXTkedF1126qn zGKwWk1hyDvIyfaf9GyxVXq++A== X-Google-Smtp-Source: ABdhPJy3lTWpI+LBh53u0cUM4+7HqCPk3zrj20McoHFe6RPmy7psSEcgf+PrkTDTK6yla2kj2/PE7w== X-Received: by 2002:a92:b685:: with SMTP id m5mr15093675ill.219.1593745970201; Thu, 02 Jul 2020 20:12:50 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:49 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 08/26] video: Add a comment for struct video_uc_platdata Date: Thu, 2 Jul 2020 21:12:19 -0600 Message-Id: <20200702211204.RESEND.v3.8.Ia4b140d3a91a26c97fa8609ad63a4a3784621d5a@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Add a few notes to explain the purpose of each member of this struct. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) include/video.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/video.h b/include/video.h index e7c58e86cb..813b5653b0 100644 --- a/include/video.h +++ b/include/video.h @@ -19,6 +19,18 @@ struct udevice; +/** + * struct video_uc_platdata - uclass platform data for a video device + * + * This holds information that the uclass needs to know about each device. It + * is accessed using dev_get_uclass_platdata(dev). See 'Theory of operation' at + * the top of video-uclass.c for details on how this information is set. + * + * @align: Frame-buffer alignment, indicating the memory boundary the frame + * buffer should start on. If 0, 1MB is assumed + * @size: Frame-buffer size, in bytes + * @base: Base address of frame buffer, 0 if not yet known + */ struct video_uc_platdata { uint align; uint size; From patchwork Fri Jul 3 03:12:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322044 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=jIQu1zbB; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg716lgVz9sR4 for ; Fri, 3 Jul 2020 13:14:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3671781BDA; Fri, 3 Jul 2020 05:13:26 +0200 (CEST) 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="jIQu1zbB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CD22781BA3; Fri, 3 Jul 2020 05:12:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (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 26A1C81B92 for ; Fri, 3 Jul 2020 05:12:52 +0200 (CEST) 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-il1-x141.google.com with SMTP id r12so18879979ilh.4 for ; Thu, 02 Jul 2020 20:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wy/VZex/L9sFcoc2bnzH3YV/ZoeELq4wArXCY5KPr20=; b=jIQu1zbBqHnozlc0Ng1WLVz3wAIzpqTgvG4Q0SoMx7tNXZWqhOL7cc4utSAACPo2Xv y6MMRZHpHM5pTUyz48vPjLtYRvpcZlu4aT/fGpSyOwDoIOCr/CVJ+p6a0/H3168WIB1A oUGS0TsT6HjufgZkQfQfaolMgdvFeC5GNoXUI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wy/VZex/L9sFcoc2bnzH3YV/ZoeELq4wArXCY5KPr20=; b=Pb1Fcc79+aLOQbtx7GkWvkFyXqSx7dP/J/YSliRFCAU0ph7KpNvKtxWg/Tx+d6InVz /lCxp6oGT4lAiSfEcSuUbDche1Xdh19nm1wpG+W4X0Pv4pbk9wbYFmeF7v/edW+M31hC 1kBRWFf9XZFwlAsm1amkfEzt/CAN2bqcJykL6ffb/JIxrb5tQXA1Wbm0tcq05d757ffb AB6j0IjTliDTw0Nyz00PyNW06majaZCf+oMngVVpy1SvZyf1OhHiN5brH5mu8iHpIEUw 8OBi6AHsujd8PFRo2CYBKHCo3qZTZcXc1LWkD+n8+hGPl521gmAcViO2AreVSUH07Oqs owow== X-Gm-Message-State: AOAM5332fHzWORlCCMt0/F+0TrLZTTHN67ie49sJVj220Wg5FE1nEIV1 DyN/JjlULW8+sCVLUqoa9RF6zA== X-Google-Smtp-Source: ABdhPJyUCbUUDEUtFBzLPCYnG9jjsZZT8rLIedGXwT9BwcXgEiXQiF85nm4hNaCminX0U0IjajEiog== X-Received: by 2002:a92:5a56:: with SMTP id o83mr15931187ilb.71.1593745970995; Thu, 02 Jul 2020 20:12:50 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:50 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 09/26] video: Add support for copying to a hardware framebuffer Date: Thu, 2 Jul 2020 21:12:20 -0600 Message-Id: <20200702211204.RESEND.v3.9.I27c41308a73654764c8980faf799b37138c1e4b3@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Some architectures use a cached framebuffer and flush the cache as needed so that changes are visible. This is supported by U-Boot. However x86 uses an uncached framebuffer with a 'write-combining' feature to speed up writes. Reads are permitted but they are extremely expensive. Unfortunately, reading from the frame buffer is quite common, e.g. to scroll it. This makes scrolling very slow. Add a new feature which supports copying modified parts of the frame buffer to the uncached hardware buffer. This speeds up scrolling by at least 10x on x86 so the extra complexity cost seems worth it. As a starting point, add the Kconfig, update the video structures to keep track of the buffer and add a function to do the copy. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/Kconfig | 12 ++++++++ drivers/video/video-uclass.c | 54 ++++++++++++++++++++++++++++++++++++ include/video.h | 29 +++++++++++++++++++ 3 files changed, 95 insertions(+) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 52f5bc6127..8f0feec6af 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -22,6 +22,18 @@ config BACKLIGHT This provides backlight uclass driver that enables basic panel backlight support. +config VIDEO_COPY + bool "Enable copying the frame buffer to a hardware copy" + depends on DM_VIDEO + help + On some machines (e.g. x86), reading from the frame buffer is very + slow because it is uncached. To improve performance, this feature + allows the frame buffer to be kept in cached memory (allocated by + U-Boot) and then copied to the hardware frame-buffer as needed. + + To use this, your video driver must set @copy_base in + struct video_uc_platdata. + config BACKLIGHT_PWM bool "Generic PWM based Backlight Driver" depends on BACKLIGHT && DM_PWM diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 1f2874554a..341db68e38 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -201,6 +202,59 @@ int video_get_ysize(struct udevice *dev) return priv->ysize; } +#ifdef CONFIG_VIDEO_COPY +int video_sync_copy(struct udevice *dev, void *from, void *to) +{ + struct video_priv *priv = dev_get_uclass_priv(dev); + + if (priv->copy_fb) { + long offset, size; + + /* Find the offset of the first byte to copy */ + if ((ulong)to > (ulong)from) { + size = to - from; + offset = from - priv->fb; + } else { + size = from - to; + offset = to - priv->fb; + } + + /* + * Allow a bit of leeway for valid requests somewhere near the + * frame buffer + */ + if (offset < -priv->fb_size || offset > 2 * priv->fb_size) { +#ifdef DEBUG + char str[80]; + + snprintf(str, sizeof(str), + "[sync_copy fb=%p, from=%p, to=%p, offset=%lx]", + priv->fb, from, to, offset); + console_puts_select_stderr(true, str); +#endif + return -EFAULT; + } + + /* + * Silently crop the memcpy. This allows callers to avoid doing + * this themselves. It is common for the end pointer to go a + * few lines after the end of the frame buffer, since most of + * the update algorithms terminate a line after their last write + */ + if (offset + size > priv->fb_size) { + size = priv->fb_size - offset; + } else if (offset < 0) { + size += offset; + offset = 0; + } + + memcpy(priv->copy_fb + offset, priv->fb + offset, size); + } + + return 0; +} +#endif + /* Set up the colour map */ static int video_pre_probe(struct udevice *dev) { diff --git a/include/video.h b/include/video.h index 813b5653b0..1a0ffd8037 100644 --- a/include/video.h +++ b/include/video.h @@ -30,11 +30,14 @@ struct udevice; * buffer should start on. If 0, 1MB is assumed * @size: Frame-buffer size, in bytes * @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. */ struct video_uc_platdata { uint align; uint size; ulong base; + ulong copy_base; }; enum video_polarity { @@ -75,6 +78,8 @@ enum video_log2_bpp { * @font_size: Font size in pixels (0 to use a default value) * @fb: Frame buffer * @fb_size: Frame buffer size + * @copy_fb: Copy of the frame buffer to keep up to date; see struct + * video_uc_platdata * @line_length: Length of each frame buffer line, in bytes. This can be * set by the driver, but if not, the uclass will set it after * probing @@ -101,6 +106,7 @@ struct video_priv { */ void *fb; int fb_size; + void *copy_fb; int line_length; u32 colour_fg; u32 colour_bg; @@ -214,6 +220,29 @@ void video_set_flush_dcache(struct udevice *dev, bool flush); */ void video_set_default_colors(struct udevice *dev, bool invert); +#ifdef CONFIG_VIDEO_COPY +/** + * vidconsole_sync_copy() - Sync back to the copy framebuffer + * + * This ensures that the copy framebuffer has the same data as the framebuffer + * for a particular region. It should be called after the framebuffer is updated + * + * @from and @to can be in either order. The region between them is synced. + * + * @dev: Vidconsole device being updated + * @from: Start/end address within the framebuffer (->fb) + * @to: Other address within the frame buffer + * @return 0 if OK, -EFAULT if the start address is before the start of the + * frame buffer start + */ +int video_sync_copy(struct udevice *dev, void *from, void *to); +#else +static inline int video_sync_copy(struct udevice *dev, void *from, void *to) +{ + return 0; +} +#endif + #endif /* CONFIG_DM_VIDEO */ #ifndef CONFIG_DM_VIDEO From patchwork Fri Jul 3 03:12:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322046 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=UN+X1w5t; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg7R1LfWz9sR4 for ; Fri, 3 Jul 2020 13:14:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 630B781B6E; Fri, 3 Jul 2020 05:13:36 +0200 (CEST) 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="UN+X1w5t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EA06481B92; Fri, 3 Jul 2020 05:12:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 E3D2981B98 for ; Fri, 3 Jul 2020 05:12:52 +0200 (CEST) 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-xd44.google.com with SMTP id f23so31113752iof.6 for ; Thu, 02 Jul 2020 20:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cz7z+yXHgI53H7wmHBFhGqrn4dsDcWJUkwNtRI1D674=; b=UN+X1w5tpMtaDP5cwEORZPwbfRT6+vpD00V8Yr+hArv//7yImmnXTei0L1l9vdu5f9 jN0hHmzhChgVaUMSkNYOf9XZrC9DXA2Bt1iKjPJWymhbpNbLEVvLJuQ+WCjAYX04F6QE sD+uqkR7pg95PsFYL2uBks83Wtqd8Wwnef8co= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cz7z+yXHgI53H7wmHBFhGqrn4dsDcWJUkwNtRI1D674=; b=TffiJL3NJbcYLMfrBmqamoCxFbetgP/lPiQ4Xri6aQRzs8DpM8Kz/2G7j523qhKCpJ +eamyiZF6IIHDBRdcP3UtF0zfs8IsScWZ/NvwkWcjZeKxj+4mGsED4zzbJ0p0epQ17ci iA1CuFKdpgYfRBCpmL6K+kD0ODwQUpavh42QL5IC/aRiSEAj3NBh3wChMa/LX1Cd+wBn QQQtRhPThVMVPaZ0WT2e5nB0+ok+v/fIzRtyApiqVkWrSIFIUNqWov6mk6UI232XUWYG GfUAYV5dYw91CdhznKzttVNgmGsKQdntWZfDCHt/iniJa/gtV8JFIN2ta5qkf4REkXI9 CawQ== X-Gm-Message-State: AOAM5312WH6XE248qmxO797UfUpOhUEnuRWFp2ESLQlT9GHfcK5fM4Iy SaHYHXMk7N/+1+wNJdE/rTzuhQ== X-Google-Smtp-Source: ABdhPJyEsgUWamMBxbXyA19k4Q6cehpmaPTbVRKprri3JngS+rC11Ng/kB9mRgxTcha3/Rx+E5y2EQ== X-Received: by 2002:a05:6602:2103:: with SMTP id x3mr10531157iox.130.1593745971808; Thu, 02 Jul 2020 20:12:51 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:51 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 10/26] video: Set up the copy framebuffer when enabled Date: Thu, 2 Jul 2020 21:12:21 -0600 Message-Id: <20200702211204.RESEND.v3.10.I606e8e25387b8d82547def3f4465ae62d1685f84@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean This framebuffer is separately mapped. Update the video post-probe function to set this up. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/video-uclass.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 341db68e38..0c80fd5bfe 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -293,6 +293,9 @@ static int video_post_probe(struct udevice *dev) priv->fb_size = priv->line_length * priv->ysize; + if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->copy_base) + priv->copy_fb = map_sysmem(plat->copy_base, plat->size); + /* Set up colors */ video_set_default_colors(dev, false); From patchwork Fri Jul 3 03:12:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322043 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=jvv08MI7; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg6q5BlBz9sR4 for ; Fri, 3 Jul 2020 13:14:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 517DD81BCC; Fri, 3 Jul 2020 05:13:22 +0200 (CEST) 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="jvv08MI7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F04C181BB4; Fri, 3 Jul 2020 05:12:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (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 A9B8A81B78 for ; Fri, 3 Jul 2020 05:12:53 +0200 (CEST) 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-xd43.google.com with SMTP id a12so31110280ion.13 for ; Thu, 02 Jul 2020 20:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M/JzgUc5Aj8HMRjLAacIfNx9/I1QibLMzlumh97/ZsQ=; b=jvv08MI740cE8eXyaFdRfLo6f7IjXCBhxwExugpqDLKnRImuGUqMYDB+A2Xv7m5J45 vEBl7bIMvsLGZ7SMIDh9E+/fIQ357Yfm/7Y6VOAytQN0HVvwRKTSaxt38HTxo4ct08yw ZCBIEWxVWiLMARR2hXLZwkoA7WKuE2TTdkWsg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M/JzgUc5Aj8HMRjLAacIfNx9/I1QibLMzlumh97/ZsQ=; b=VnP0EGPRrR6M9cfPXjWdbPTbaKTC3Do/RqLE3Kh4haY65VBxOO8zyWuKLFjg+B5J8S hMtxEElY/UHzaju+8Vab4sSxtIkX9cTpd98dNXwfe0Uqw5nLCRXwJy1Y2jjT9FKQcpSs SOj1PE0N7pKPIImgRfOfhvI2tOa/Gz23V+cVTDLdkufBIe7BmElBbz5bBq4+bZTWE0+N QniVZhQxIFL4ZUuSw8+IqpzVjm+ti1CefbflG+/J3TQcE9aup17TYpAv0dUy+3MQUfsX lFvasFMlNfz2iZZHMSH86ZySVwE8D4wPiTpc/pwfxO4a6y16AGgzkQjHQ3ngFVjNbTpO JOXA== X-Gm-Message-State: AOAM533ieCi88fF0Xtjtir3t3gNuKjXoYpBIffX/r3F56WVTneyEuPvb p1vkpVln7y+8ZJbfCkMc5WAoqg== X-Google-Smtp-Source: ABdhPJzfR56jm8YTGoKcpNHTEF8u97Yt32WpvPvgv+oAq6O/K9NDS67ycpRDrylZfWd6PrhjW5jkpQ== X-Received: by 2002:a6b:e20b:: with SMTP id z11mr10191485ioc.2.1593745972600; Thu, 02 Jul 2020 20:12:52 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:52 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 11/26] video: Clear the copy framebuffer when clearing the screen Date: Thu, 2 Jul 2020 21:12:22 -0600 Message-Id: <20200702211204.RESEND.v3.11.Idb93182c5620fa4a55ad25cd4ef796bb8ce2241d@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Update video_clear() to also sync to the copy framebuffer. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/video-uclass.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 0c80fd5bfe..4ddd8bc1db 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -95,6 +95,7 @@ int video_reserve(ulong *addrp) int video_clear(struct udevice *dev) { struct video_priv *priv = dev_get_uclass_priv(dev); + int ret; switch (priv->bpix) { case VIDEO_BPP16: @@ -119,6 +120,9 @@ int video_clear(struct udevice *dev) memset(priv->fb, priv->colour_bg, priv->fb_size); break; } + ret = video_sync_copy(dev, priv->fb, priv->fb + priv->fb_size); + if (ret) + return ret; return 0; } From patchwork Fri Jul 3 03:12:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322048 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=aBYKc+n1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg7q3lWkz9sRf for ; Fri, 3 Jul 2020 13:15:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D013081BEC; Fri, 3 Jul 2020 05:13:42 +0200 (CEST) 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="aBYKc+n1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C3EBE81BD1; Fri, 3 Jul 2020 05:13:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (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 A043B81B97 for ; Fri, 3 Jul 2020 05:12:54 +0200 (CEST) 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-il1-x143.google.com with SMTP id o3so8704765ilo.12 for ; Thu, 02 Jul 2020 20:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oNhWBl/MFFOvrsjyyp4uSmq0600ubclFehsl6q7X/FQ=; b=aBYKc+n1MA8Fj0mzTSg/uUykRhB9oH5TlxdqRh/EIQmoW61wxKlW060IL7tV+UAYc2 AM09VYvwvFlb3phrgFIZuvoHBwernCRcCfmVAocahLK7UvrAwvn7x/Ts0JCXHJpjKmkB DqZLTKcGGRyU9Lbno8aU1rwjJYQyMGhvPAezU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oNhWBl/MFFOvrsjyyp4uSmq0600ubclFehsl6q7X/FQ=; b=bfvUinvdvaBJJIiXtTk00374leP3rd/KwvPJG+9toZWQwMuN5W1CgWMFSw7yMv9Am0 qVS9Ops/xUkRdleQ8yx8G9DAPwt7Khe2PbMCdPBYUJ76WY5ApLejM1hhKs1yuZGTe2+o qXTfSoV49GEd4NJipGguBrKPvhYDYbMZ/4wZOb6hr1MfjZsfbB0d7RWVmBwX2xrbdEwf OTz2ZGZTXlB1kipR09jHOEMwl8WUn76afqrPOJK7KVUSRS4AL39AsPWXrH8AVCx741ik CiT8G2EaEXZxr2J14+zbJmrX5KAipt025xVbC++bvZt4KS4K8a7JhbZqyt14oN9px+9Z oFgw== X-Gm-Message-State: AOAM533JoYEvXubAckH9h86cp+bHgsvT2ens5DiNghxxEga/PT7r2VHr 0LlpPJNlSjbi1YEpBAvjQvLRgg== X-Google-Smtp-Source: ABdhPJyWe6pxYv9YaNyVJx/ioZj7Ph5v4gouHgzvmNJ/yMMMvzdpdbngLyxC44+EW0zi7XAfveeO2g== X-Received: by 2002:a05:6e02:106a:: with SMTP id q10mr15350638ilj.30.1593745973408; Thu, 02 Jul 2020 20:12:53 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:53 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 12/26] video: Add helpers for vidconsole for the copy framebuffer Date: Thu, 2 Jul 2020 21:12:23 -0600 Message-Id: <20200702211204.RESEND.v3.12.If5b172fd65f0d257381cc0f78cca1b506d5d0bcf@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Add a convenience function to call video_sync_copy() for a vidconsole. Also add a memmove() helper, which does the memmove() as well as the sync. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- Changes in v3: - Drop unnecessary variable Changes in v2: - Simplify return sequence in vidconsole_memmove() since there is no logging drivers/video/vidconsole-uclass.c | 16 ++++++++++ include/video_console.h | 49 +++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 841cfdaf93..3a07f36ce2 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -629,6 +629,22 @@ UCLASS_DRIVER(vidconsole) = { .per_device_auto_alloc_size = sizeof(struct vidconsole_priv), }; +#ifdef CONFIG_VIDEO_COPY +int vidconsole_sync_copy(struct udevice *dev, void *from, void *to) +{ + struct udevice *vid = dev_get_parent(dev); + + return video_sync_copy(vid, from, to); +} + +int vidconsole_memmove(struct udevice *dev, void *dst, const void *src, + int size) +{ + memmove(dst, src, size); + return vidconsole_sync_copy(dev, dst, dst + size); +} +#endif + #if CONFIG_IS_ENABLED(CMD_VIDCONSOLE) void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row) { diff --git a/include/video_console.h b/include/video_console.h index d3bc063165..06b798ef10 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -256,4 +256,53 @@ void vidconsole_position_cursor(struct udevice *dev, unsigned col, */ u32 vid_console_color(struct video_priv *priv, unsigned int idx); +#ifdef CONFIG_VIDEO_COPY +/** + * vidconsole_sync_copy() - Sync back to the copy framebuffer + * + * This ensures that the copy framebuffer has the same data as the framebuffer + * for a particular region. It should be called after the framebuffer is updated + * + * @from and @to can be in either order. The region between them is synced. + * + * @dev: Vidconsole device being updated + * @from: Start/end address within the framebuffer (->fb) + * @to: Other address within the frame buffer + * @return 0 if OK, -EFAULT if the start address is before the start of the + * frame buffer start + */ +int vidconsole_sync_copy(struct udevice *dev, void *from, void *to); + +/** + * vidconsole_memmove() - Perform a memmove() within the frame buffer + * + * This handles a memmove(), e.g. for scrolling. It also updates the copy + * framebuffer. + * + * @dev: Vidconsole device being updated + * @dst: Destination address within the framebuffer (->fb) + * @src: Source address within the framebuffer (->fb) + * @size: Number of bytes to transfer + * @return 0 if OK, -EFAULT if the start address is before the start of the + * frame buffer start + */ +int vidconsole_memmove(struct udevice *dev, void *dst, const void *src, + int size); +#else +static inline int vidconsole_sync_copy(struct udevice *dev, void *from, + void *to) +{ + return 0; +} + +static inline int vidconsole_memmove(struct udevice *dev, void *dst, + const void *src, int size) +{ + memmove(dst, src, size); + + return 0; +} + +#endif + #endif From patchwork Fri Jul 3 03:12:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322045 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=UATwSf0G; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg7D3lb1z9sR4 for ; Fri, 3 Jul 2020 13:14:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1B4E181BDF; Fri, 3 Jul 2020 05:13:31 +0200 (CEST) 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="UATwSf0G"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 960F881BCF; Fri, 3 Jul 2020 05:13:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (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 4669581B79 for ; Fri, 3 Jul 2020 05:12:55 +0200 (CEST) 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-il1-x144.google.com with SMTP id e18so15378369ilr.7 for ; Thu, 02 Jul 2020 20:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cPYYqI5PzHvHke57gWfaF5O4sluFRU28QHftT23INSs=; b=UATwSf0Gw0SksqGboMkcAIrLJsB+HePmIEVfwaugF7cvQAMegOFCu9h1aAhRsqj58N G52e1yNC7uTW2TVwooEYYd0v9+C+6mb3DBTkboRxJqQTiKQamili4mB1+qGg2kyRVlyR EJReLvm5sZ0Wz9eBlSOPpnEobdLEDC5YGznZo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cPYYqI5PzHvHke57gWfaF5O4sluFRU28QHftT23INSs=; b=ZJg0/ssbUiEuTFvdKhjfzBcNBpfXA10TG0jgrRyKPx4QN6LBOLto4zR2TBuwCFZdT/ 9TDwThMWzqZM2gPwh6YIPyKGO0DzJrxeF3+nkOitEBe+x+sTw9BxagkmOWhF3QXV2o8v kJx5sbaQp+jGGOXqnyhLushfgYcHNdk6PgElGm+pYF/nQ4Pi1InAMFxD9Tk5u3QLnPLQ YfUz0nwFaw3n/2+xhiMDyHywKhZ7q9aYjKJleObbq2dTiExDA4TflvaiciDf9Z+UQ0qm oYDwQ1M+DcaJd3CH6z/vBIqZSnxI1wa1vC9O/IZGkxgr/97jLuh2FO6qW3OW2RHUt2HQ 4QBg== X-Gm-Message-State: AOAM533ED3BFmNuIv86djiH34HcGdXUrP8LgvwZ6w/L6w9iFQNi88xiq pstBy0/QLcWNsJGxNM+RiDVoew== X-Google-Smtp-Source: ABdhPJye6KJRRJkZ/Zalb4/D2ixEHKDtUEZPWKLsJS57tW3mzb4Eae2eqrB//Urp9Nf+Sxof+OBiRw== X-Received: by 2002:a92:c5cf:: with SMTP id s15mr14726373ilt.36.1593745974212; Thu, 02 Jul 2020 20:12:54 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:53 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 13/26] video: Update normal console to support copy buffer Date: Thu, 2 Jul 2020 21:12:24 -0600 Message-Id: <20200702211204.RESEND.v3.13.Ibeb0ab19b593a5cfcb737f756feeaddf09d5e3cb@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Update the implementation to keep a track of what it changes in the frame buffer and then tell the copy buffer about it. Use the special vidconsole_memmove() helper so that memmove() operations are also reflected in the copy buffer. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/console_normal.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index c3f7ef8add..04f022491e 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -16,8 +16,9 @@ static int console_normal_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - void *line; + void *line, *end; int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize; + int ret; int i; line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length; @@ -28,6 +29,7 @@ static int console_normal_set_row(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) *dst++ = clr; + end = dst; break; } case VIDEO_BPP16: @@ -36,6 +38,7 @@ static int console_normal_set_row(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) *dst++ = clr; + end = dst; break; } case VIDEO_BPP32: @@ -44,11 +47,15 @@ static int console_normal_set_row(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) *dst++ = clr; + end = dst; break; } default: return -ENOSYS; } + ret = vidconsole_sync_copy(dev, line, end); + if (ret) + return ret; return 0; } @@ -59,10 +66,15 @@ static int console_normal_move_rows(struct udevice *dev, uint rowdst, struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); void *dst; void *src; + int size; + int ret; dst = vid_priv->fb + rowdst * VIDEO_FONT_HEIGHT * vid_priv->line_length; src = vid_priv->fb + rowsrc * VIDEO_FONT_HEIGHT * vid_priv->line_length; - memmove(dst, src, VIDEO_FONT_HEIGHT * vid_priv->line_length * count); + size = VIDEO_FONT_HEIGHT * vid_priv->line_length * count; + ret = vidconsole_memmove(dev, dst, src, size); + if (ret) + return ret; return 0; } @@ -74,8 +86,13 @@ static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, struct udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); int i, row; - void *line = vid_priv->fb + y * vid_priv->line_length + + void *start; + void *line; + int ret; + + start = vid_priv->fb + y * vid_priv->line_length + VID_TO_PIXEL(x_frac) * VNBYTES(vid_priv->bpix); + line = start; if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) return -EAGAIN; @@ -126,6 +143,9 @@ static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, } line += vid_priv->line_length; } + ret = vidconsole_sync_copy(dev, start, line); + if (ret) + return ret; return VID_TO_POS(VIDEO_FONT_WIDTH); } From patchwork Fri Jul 3 03:12:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322047 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=GTQoAvZg; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg7d3mGtz9sRf for ; Fri, 3 Jul 2020 13:15:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B80EA81BA9; Fri, 3 Jul 2020 05:13:39 +0200 (CEST) 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="GTQoAvZg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 90F3781BC8; Fri, 3 Jul 2020 05:13:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 1499081BA2 for ; Fri, 3 Jul 2020 05:12:56 +0200 (CEST) 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-xd44.google.com with SMTP id f23so31113844iof.6 for ; Thu, 02 Jul 2020 20:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sKaPssPjL0LeTnH7447DmUkVcIVhOl96Uxcw6HQGreo=; b=GTQoAvZg6YYYo86jxtDDpmz+hdsBBflb2/KPRkJoa+nsbBcUvckRBj4O7/XKNH6os6 lUj7UIDIwYqlS9kXYsUVlCGXDLXW6nSGxT8imVWRK6OnVyFtHT0dUWtRQA1FisFqRTGr NGOoIbK2zJTCfBz95aeXhy+deGDmEWEexg6Sc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sKaPssPjL0LeTnH7447DmUkVcIVhOl96Uxcw6HQGreo=; b=p9tq9NlWDipbJW6ZDWMBuJdI2UXR7dyzUBaheMMyuyzP4F7h+JecqsB1Hu7VDXLk2q kF2rBquXFh0CBVgroJDPmWPtO6YbGszRAfVVYiQlKWseEGsUkWFhuh4VW9lNyvNjCMR2 6j+EauBI7drAK5T05DP6sjoFpKESuiEFL6LzK1pHROrQlNMW49Regi7PW6jIHVaLl3KE Oq2bTZMJ1qt6v7EE/RnBNbalq+Q+YW/eoZ4vZXsk9/IJ/Wn7yR4TB7KF1RIw0PTjnzMr UurTGjgx269xAGMSjjuKH4oOzwwSdo7pq2ZEVT1M/jkZcdenP1FRaZ+kKW2Fnvc46pA6 EoyA== X-Gm-Message-State: AOAM531x2CsLcBjlrcOmvsXulZrN+k4qOM+GcZOR0VE76YMjrRds/zZJ B4RjzlnsLmTi9DQYKA7wSTSCfA== X-Google-Smtp-Source: ABdhPJybwd7z+F7H6qFnt7ngCgRvSSpYFbI/h+dbLcVxxIklUW1CJF3aiRZolG54JOZKmlKWb3/NXA== X-Received: by 2002:a05:6602:2c8f:: with SMTP id i15mr10622570iow.45.1593745974945; Thu, 02 Jul 2020 20:12:54 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:54 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 14/26] video: Update truetype console to support copy buffer Date: Thu, 2 Jul 2020 21:12:25 -0600 Message-Id: <20200702211204.RESEND.v3.14.I7b2b4487cb81658022e283a2676803ae1bc173ff@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Update the implementation to keep a track of what it changes in the frame buffer and then tell the copy buffer about it. Use the special vidconsole_memmove() helper so that memmove() operations are also reflected in the copy buffer. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/console_truetype.c | 43 +++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 5f7f03904b..22b2ea7191 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -127,9 +127,9 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct console_tt_priv *priv = dev_get_priv(dev); - void *line; + void *end, *line; int pixels = priv->font_size * vid_priv->line_length; - int i; + int i, ret; line = vid_priv->fb + row * priv->font_size * vid_priv->line_length; switch (vid_priv->bpix) { @@ -139,6 +139,7 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) *dst++ = clr; + end = dst; break; } #endif @@ -148,6 +149,7 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) *dst++ = clr; + end = dst; break; } #endif @@ -157,12 +159,16 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) *dst++ = clr; + end = dst; break; } #endif default: return -ENOSYS; } + ret = vidconsole_sync_copy(dev, line, end); + if (ret) + return ret; return 0; } @@ -174,11 +180,14 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, struct console_tt_priv *priv = dev_get_priv(dev); void *dst; void *src; - int i, diff; + int i, diff, ret; dst = vid_priv->fb + rowdst * priv->font_size * vid_priv->line_length; src = vid_priv->fb + rowsrc * priv->font_size * vid_priv->line_length; - memmove(dst, src, priv->font_size * vid_priv->line_length * count); + ret = vidconsole_memmove(dev, dst, src, priv->font_size * + vid_priv->line_length * count); + if (ret) + return ret; /* Scroll up our position history */ diff = (rowsrc - rowdst) * priv->font_size; @@ -203,8 +212,8 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, struct pos_info *pos; u8 *bits, *data; int advance; - void *line; - int row; + void *start, *end, *line; + int row, ret; /* First get some basic metrics about this character */ stbtt_GetCodepointHMetrics(font, ch, &advance, &lsb); @@ -253,11 +262,12 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, /* Figure out where to write the character in the frame buffer */ bits = data; - line = vid_priv->fb + y * vid_priv->line_length + + start = vid_priv->fb + y * vid_priv->line_length + VID_TO_PIXEL(x) * VNBYTES(vid_priv->bpix); linenum = priv->baseline + yoff; if (linenum > 0) - line += linenum * vid_priv->line_length; + start += linenum * vid_priv->line_length; + line = start; /* * Write a row at a time, converting the 8bpp image into the colour @@ -286,6 +296,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, *dst++ &= out; bits++; } + end = dst; break; } #endif @@ -307,6 +318,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, *dst++ &= out; bits++; } + end = dst; break; } #endif @@ -317,6 +329,9 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, line += vid_priv->line_length; } + ret = vidconsole_sync_copy(dev, start, line); + if (ret) + return ret; free(data); return width_frac; @@ -340,12 +355,13 @@ static int console_truetype_erase(struct udevice *dev, int xstart, int ystart, int xend, int yend, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - void *line; + void *start, *line; int pixels = xend - xstart; - int row, i; + int row, i, ret; - line = vid_priv->fb + ystart * vid_priv->line_length; - line += xstart * VNBYTES(vid_priv->bpix); + start = vid_priv->fb + ystart * vid_priv->line_length; + start += xstart * VNBYTES(vid_priv->bpix); + line = start; for (row = ystart; row < yend; row++) { switch (vid_priv->bpix) { #ifdef CONFIG_VIDEO_BPP8 @@ -380,6 +396,9 @@ static int console_truetype_erase(struct udevice *dev, int xstart, int ystart, } line += vid_priv->line_length; } + ret = vidconsole_sync_copy(dev, start, line); + if (ret) + return ret; return 0; } From patchwork Fri Jul 3 03:12:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322049 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=YMSM+zw2; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg804xwnz9sR4 for ; Fri, 3 Jul 2020 13:15:28 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E442281BBD; Fri, 3 Jul 2020 05:13:44 +0200 (CEST) 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="YMSM+zw2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DD5BE81B9A; Fri, 3 Jul 2020 05:13:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 E7BA881B9A for ; Fri, 3 Jul 2020 05:12:56 +0200 (CEST) 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-xd44.google.com with SMTP id y2so31112317ioy.3 for ; Thu, 02 Jul 2020 20:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eGvSrnLiMr7Am0jHjiuL1kPVJ1FdvKSp9MlI4yXk5g0=; b=YMSM+zw2Zte7RyF5Ia96DjR+uHqvHTecheGuBiv/eCqBn9mefF5cM3y1NfRP/59Czd akMs9v9tcDhCSqRbprzLNbrKk/dV/1DdnQQSYrLO27d9GmN1OJhFnjxjzvcN4WUGPkAa N4FzjMO3uh9/EJEDC33l0yMzPrHqi+XqEWnMc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eGvSrnLiMr7Am0jHjiuL1kPVJ1FdvKSp9MlI4yXk5g0=; b=G/MWanyCVrjWjfzMgVOoAhROVYyFTBvuPOJW2onRDbFiokLN9ks3GpNSO2blWS9yVr ojoDMKmt1bIc04VMnjIqrJq1+iXjDw2unj2G34NBm0neoweVXY/lSWa5ivISQTeK1qim QbGuBJk6xZQoS6tMvSZj9/cmWVd7ujXwYEEcBEnJZKt6aZ1RG/g7Md5GXbN9E2EsjdWQ 5Yf2vpxqL8EuCn6VFuA4XOsbuuEaa0WzKs+iEeZbz584OeKJiV4E6caFgK6M1sv3LFzc jDkpHZZDPJqoqFQZ9OBF3apgzYdWSlsfJ88BiZjHjXTaUHSXOkyBkXdbWsaDFLJOgN0F hz8Q== X-Gm-Message-State: AOAM532wmbKM+4rmbVKZcZYtvXoz2bE7ibRCckzaJvvsC6TilAJJyWF6 T98bBGe9tLr/qG2QekHYldQzoQ== X-Google-Smtp-Source: ABdhPJxCX40WDHwdBUxesQUx5ere4wQhXCaYVJ/tfuAyk1Pz2oNKZ6OTfvy6S9xhSGpr64d+VSRgZg== X-Received: by 2002:a05:6602:13c6:: with SMTP id o6mr10115278iov.84.1593745975718; Thu, 02 Jul 2020 20:12:55 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:55 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 15/26] video: Update rotated console to support copy buffer Date: Thu, 2 Jul 2020 21:12:26 -0600 Message-Id: <20200702211204.RESEND.v3.15.Ieb8fa645754166cb903055967c544f29fc2cfd2c@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Update the implementation to keep a track of what it changes in the frame buffer and then tell the copy buffer about it. Use the special vidconsole_memmove() helper so that memmove() operations are also reflected in the copy buffer. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/console_rotate.c | 83 ++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 23 deletions(-) diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c index da0ce7b9ce..36c8d0609d 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c @@ -15,11 +15,13 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); int pbytes = VNBYTES(vid_priv->bpix); - void *line; + void *start, *line; int i, j; + int ret; - line = vid_priv->fb + vid_priv->line_length - + start = vid_priv->fb + vid_priv->line_length - (row + 1) * VIDEO_FONT_HEIGHT * pbytes; + line = start; for (j = 0; j < vid_priv->ysize; j++) { switch (vid_priv->bpix) { case VIDEO_BPP8: @@ -51,6 +53,9 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) } line += vid_priv->line_length; } + ret = vidconsole_sync_copy(dev, start, line); + if (ret) + return ret; return 0; } @@ -62,7 +67,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, int pbytes = VNBYTES(vid_priv->bpix); void *dst; void *src; - int j; + int j, ret; dst = vid_priv->fb + vid_priv->line_length - (rowdst + count) * VIDEO_FONT_HEIGHT * pbytes; @@ -70,7 +75,10 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, (rowsrc + count) * VIDEO_FONT_HEIGHT * pbytes; for (j = 0; j < vid_priv->ysize; j++) { - memmove(dst, src, VIDEO_FONT_HEIGHT * pbytes * count); + ret = vidconsole_memmove(dev, dst, src, + VIDEO_FONT_HEIGHT * pbytes * count); + if (ret) + return ret; src += vid_priv->line_length; dst += vid_priv->line_length; } @@ -85,13 +93,14 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch) struct video_priv *vid_priv = dev_get_uclass_priv(vid); uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT; int pbytes = VNBYTES(vid_priv->bpix); - int i, col, x, linenum; + int i, col, x, linenum, ret; int mask = 0x80; - void *line; + void *start, *line; linenum = VID_TO_PIXEL(x_frac) + 1; x = y + 1; - line = vid_priv->fb + linenum * vid_priv->line_length - x * pbytes; + start = vid_priv->fb + linenum * vid_priv->line_length - x * pbytes; + line = start; if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) return -EAGAIN; @@ -136,6 +145,10 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch) line += vid_priv->line_length; mask >>= 1; } + /* We draw backwards from 'start, so account for the first line */ + ret = vidconsole_sync_copy(dev, start - vid_priv->line_length, line); + if (ret) + return ret; return VID_TO_POS(VIDEO_FONT_WIDTH); } @@ -144,12 +157,13 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch) static int console_set_row_2(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - void *line; + void *start, *line, *end; int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize; - int i; + int i, ret; - line = vid_priv->fb + vid_priv->ysize * vid_priv->line_length - + start = vid_priv->fb + vid_priv->ysize * vid_priv->line_length - (row + 1) * VIDEO_FONT_HEIGHT * vid_priv->line_length; + line = start; switch (vid_priv->bpix) { case VIDEO_BPP8: if (IS_ENABLED(CONFIG_VIDEO_BPP8)) { @@ -157,6 +171,7 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) *dst++ = clr; + end = dst; break; } case VIDEO_BPP16: @@ -165,6 +180,7 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) *dst++ = clr; + end = dst; break; } case VIDEO_BPP32: @@ -173,11 +189,15 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) *dst++ = clr; + end = dst; break; } default: return -ENOSYS; } + ret = vidconsole_sync_copy(dev, start, end); + if (ret) + return ret; return 0; } @@ -195,7 +215,8 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, vid_priv->line_length; src = end - (rowsrc + count) * VIDEO_FONT_HEIGHT * vid_priv->line_length; - memmove(dst, src, VIDEO_FONT_HEIGHT * vid_priv->line_length * count); + vidconsole_memmove(dev, dst, src, + VIDEO_FONT_HEIGHT * vid_priv->line_length * count); return 0; } @@ -206,14 +227,15 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) struct udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); int pbytes = VNBYTES(vid_priv->bpix); - int i, row, x, linenum; - void *line; + int i, row, x, linenum, ret; + void *start, *line; if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) return -EAGAIN; linenum = vid_priv->ysize - y - 1; x = vid_priv->xsize - VID_TO_PIXEL(x_frac) - 1; - line = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes; + start = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes; + line = start; for (row = 0; row < VIDEO_FONT_HEIGHT; row++) { unsigned int idx = (u8)ch * VIDEO_FONT_HEIGHT + row; @@ -261,6 +283,10 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) } line -= vid_priv->line_length; } + /* Add 4 bytes to allow for the first pixel writen */ + ret = vidconsole_sync_copy(dev, start + 4, line); + if (ret) + return ret; return VID_TO_POS(VIDEO_FONT_WIDTH); } @@ -269,10 +295,11 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); int pbytes = VNBYTES(vid_priv->bpix); - void *line; - int i, j; + void *start, *line; + int i, j, ret; - line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * pbytes; + start = vid_priv->fb + row * VIDEO_FONT_HEIGHT * pbytes; + line = start; for (j = 0; j < vid_priv->ysize; j++) { switch (vid_priv->bpix) { case VIDEO_BPP8: @@ -304,6 +331,9 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) } line += vid_priv->line_length; } + ret = vidconsole_sync_copy(dev, start, line); + if (ret) + return ret; return 0; } @@ -315,13 +345,16 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, int pbytes = VNBYTES(vid_priv->bpix); void *dst; void *src; - int j; + int j, ret; dst = vid_priv->fb + rowdst * VIDEO_FONT_HEIGHT * pbytes; src = vid_priv->fb + rowsrc * VIDEO_FONT_HEIGHT * pbytes; for (j = 0; j < vid_priv->ysize; j++) { - memmove(dst, src, VIDEO_FONT_HEIGHT * pbytes * count); + ret = vidconsole_memmove(dev, dst, src, + VIDEO_FONT_HEIGHT * pbytes * count); + if (ret) + return ret; src += vid_priv->line_length; dst += vid_priv->line_length; } @@ -336,15 +369,15 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch) struct video_priv *vid_priv = dev_get_uclass_priv(vid); uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT; int pbytes = VNBYTES(vid_priv->bpix); - int i, col, x; + int i, col, x, ret; int mask = 0x80; - void *line; + void *start, *line; if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) return -EAGAIN; x = vid_priv->ysize - VID_TO_PIXEL(x_frac) - 1; - line = vid_priv->fb + x * vid_priv->line_length + y * pbytes; - + start = vid_priv->fb + x * vid_priv->line_length + y * pbytes; + line = start; for (col = 0; col < VIDEO_FONT_HEIGHT; col++) { switch (vid_priv->bpix) { case VIDEO_BPP8: @@ -386,6 +419,10 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch) line -= vid_priv->line_length; mask >>= 1; } + /* Add a line to allow for the first pixels writen */ + ret = vidconsole_sync_copy(dev, start + vid_priv->line_length, line); + if (ret) + return ret; return VID_TO_POS(VIDEO_FONT_WIDTH); } From patchwork Fri Jul 3 03:12:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322053 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=H+TuDReq; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg8j1NS0z9sR4 for ; Fri, 3 Jul 2020 13:16:05 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C6D081C03; Fri, 3 Jul 2020 05:13:53 +0200 (CEST) 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="H+TuDReq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 11C0381BD9; Fri, 3 Jul 2020 05:13:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 E0A8A81B78 for ; Fri, 3 Jul 2020 05:12:57 +0200 (CEST) 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-xd44.google.com with SMTP id q74so7516241iod.1 for ; Thu, 02 Jul 2020 20:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6TaAwMr1C5PygO4k4wKOM3+Y9yGSDcn4pXM6zhd0jxU=; b=H+TuDReq+1UXwVvMQv7n2IcQLgP7QCXwmV+VntRWBxpEfDCTRwwls9OzKklh+QGhUO DJDuihCNW8JUkdAvv1EaB38GVfsxDa3LhA2G21YDPMPAQ6Tw0QjBD+DOrXjF5D4MTe4E LT5k1wGFQedDANxUeyqGx08N33AjrHuNTBSX8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6TaAwMr1C5PygO4k4wKOM3+Y9yGSDcn4pXM6zhd0jxU=; b=B6WrU6xSucKMePjAeDHTEL5T5u14fnEBW2xww2liq/TfIGxdVUAw63OpLafQ/hLPbR 2FNCf1M6+aQ7iCyejaAOZrql6u0+b6Kmm04ZHcBAK2ghP/WeUVHmCDvkKmL9x1S3n+gt ry7MTcK1Km7+tELV2juDqb90wtm/4FYclhByb74Q6MVll8zgpaUMf+TMeQpRAGutD5hy rKdqdzrABxoE52mx5n7F1VZGW8qSOKw1Hoki5TTF45pdQj5i5DsiwNohBoVHFM4QZocH q3/Neiqzu9cknNwJSPCl37e34rkSI8dGXBgI2Hm3GBXv3TqbcT2uzqwH0FKSSMUZlcEe AmLA== X-Gm-Message-State: AOAM532oQAyg5RDFFjCdDMan4ZwQMam0DZtuYQHyqkFvQsrEkffPe6vy Vt0j/HCmziAkVOOcqweVubhFoA== X-Google-Smtp-Source: ABdhPJyV3QpTtjCzVB10+ELcOU2028KJjZ7OS0es9NLedBnw4vdx8ESm+B09PWJogZDyb7WsE9t8gA== X-Received: by 2002:a05:6602:45:: with SMTP id z5mr10391324ioz.112.1593745976724; Thu, 02 Jul 2020 20:12:56 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:56 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 16/26] video: Update the copy framebuffer when writing bitmaps Date: Thu, 2 Jul 2020 21:12:27 -0600 Message-Id: <20200702211204.RESEND.v3.16.I42de10293e7246dce9339826506eb01c133c8c06@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Adjust the bitmap code to sync to the copy framebuffer when done. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/video_bmp.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 7d7f37b445..5a4d12c68d 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -192,7 +192,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, struct video_priv *priv = dev_get_uclass_priv(dev); ushort *cmap_base = NULL; int i, j; - uchar *fb; + uchar *start, *fb; struct bmp_image *bmp = map_sysmem(bmp_image, 0); uchar *bmap; ushort padded_width; @@ -201,6 +201,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, unsigned colours, bpix, bmp_bpix; struct bmp_color_table_entry *palette; int hdr_size; + int ret; if (!bmp || !(bmp->header.signature[0] == 'B' && bmp->header.signature[1] == 'M')) { @@ -261,8 +262,11 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, height = priv->ysize - y; bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset); - fb = (uchar *)(priv->fb + - (y + height - 1) * priv->line_length + x * bpix / 8); + start = (uchar *)(priv->fb + + (y + height) * priv->line_length + x * bpix / 8); + + /* Move back to the final line to be drawn */ + fb = start - priv->line_length; switch (bmp_bpix) { case 1: @@ -369,6 +373,12 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, break; }; + /* Find the position of the top left of the image in the framebuffer */ + fb = (uchar *)(priv->fb + y * priv->line_length + x * bpix / 8); + ret = video_sync_copy(dev, start, fb); + if (ret) + return log_ret(ret); + video_sync(dev, false); return 0; From patchwork Fri Jul 3 03:12:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322052 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=htAmRX7K; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg8X1cQ1z9sR4 for ; Fri, 3 Jul 2020 13:15:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8ABC981BFB; Fri, 3 Jul 2020 05:13:51 +0200 (CEST) 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="htAmRX7K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 042AF81BDE; Fri, 3 Jul 2020 05:13:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (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 AA7BD81BB6 for ; Fri, 3 Jul 2020 05:12:58 +0200 (CEST) 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-xd41.google.com with SMTP id i4so31047491iov.11 for ; Thu, 02 Jul 2020 20:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iQxXN6RtpaShlT2xSeOEV8tLcSgqYVeRZ/YBqQ4K/jk=; b=htAmRX7KwoRZIeRkG7kOg8T2h+YGBSCoTVzDmzHbrxxHvOmpXXhcQByODTssf3ZFHE 7E+17070uS5UcgwMKPP4k/czJEhzfaQC9uHWVho+gMQmnHFO1pDCPEJSFDxsYqn3zZmP 9RI3bygIhCXYum3dk7Yw3E/Oj90E8caIQxSps= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iQxXN6RtpaShlT2xSeOEV8tLcSgqYVeRZ/YBqQ4K/jk=; b=O5U4LAe84b6EKNVaiDtwMZZ/LlztTFNv3jXfJa1IBJJW/F/oIWODiqCLdJ6CY5uHgy AIaGOBCBB9UIEd1YFxwLoeXRuRzNrKETqJc7YFUo1udKSXPdMohC1ap3M2DJYREouNh5 02Md2ffmcNUAJlabhr7pv0a44G/2adv2BpK0x3WOV3DOrH3AbE2qfFLGi1UbrsKydFhp L+TTLz9U2yuDZvLRhFRaIkD7Z6g9kKpiBpGSg/cOsB+/on8RgiunTyWxCCJy9TqAwtpH SwemghrOl6lHAzHUpy6b4Q7X1DoswcgruNRimFrgSrjIWi71O/cXootcBrTwdahMweVF XDFw== X-Gm-Message-State: AOAM532D8f+XbAFDGES+NKFrOau2ob9MhRpC5Q45M7TpfU5AkZLgCYqC EqtcDmJg73fzPlbYv7Uw1fSLQg== X-Google-Smtp-Source: ABdhPJwEbDKfBOT3qeiwQeW42qB/epU+J7IxwoBNu71O3ruPiaiARLprx4RR9i7ZWHcl87Rmp1KmUw== X-Received: by 2002:a05:6602:234d:: with SMTP id r13mr10167288iot.83.1593745977471; Thu, 02 Jul 2020 20:12:57 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:57 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 17/26] video: Add comments to struct sandbox_sdl_plat Date: Thu, 2 Jul 2020 21:12:28 -0600 Message-Id: <20200702211204.RESEND.v3.17.I5a77b98330d65a94fd165b06d60fb51d83109d2d@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean This struct is not commented but needs it. Also fix the comment in check_vidconsole_output() about the encoding for the rotation value. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) include/dm/test.h | 14 +++++++++++++- test/dm/video.c | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/dm/test.h b/include/dm/test.h index f0f36624ce..d39686cde2 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -159,7 +159,19 @@ enum { /* Declare a new driver model test */ #define DM_TEST(_name, _flags) UNIT_TEST(_name, _flags, dm_test) -/* This platform data is needed in tests, so declare it here */ +/* + * struct sandbox_sdl_plat - Platform data for the SDL video driver + * + * This platform data is needed in tests, so declare it here + * + * @xres: Width of display in pixels + * @yres: Height of display in pixels + * @bpix: Log2 of bits per pixel (enum video_log2_bpp) + * @rot: Console rotation (0=normal orientation, 1=90 degrees clockwise, + * 2=upside down, 3=90 degree counterclockwise) + * @vidconsole_drv_name: Name of video console driver (set by tests) + * @font_size: Console font size to select (set by tests) + */ struct sandbox_sdl_plat { int xres; int yres; diff --git a/test/dm/video.c b/test/dm/video.c index 68f5ba44e7..729c31b47d 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -188,7 +188,8 @@ DM_TEST(dm_test_video_ansi, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); * check_vidconsole_output() - Run a text console test * * @uts: Test state - * @rot: Console rotation (0, 90, 180, 270) + * @rot: Console rotation (0=normal orientation, 1=90 degrees clockwise, + * 2=upside down, 3=90 degree counterclockwise) * @wrap_size: Expected size of compressed frame buffer for the wrap test * @scroll_size: Same for the scroll test * @return 0 on success From patchwork Fri Jul 3 03:12:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322051 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=XNqJcfID; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg8L6ZZyz9sR4 for ; Fri, 3 Jul 2020 13:15:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1459D81BD0; Fri, 3 Jul 2020 05:13:49 +0200 (CEST) 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="XNqJcfID"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5999B81BDA; Fri, 3 Jul 2020 05:13:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE, T_FILL_THIS_FORM_SHORT,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (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 65EFA81BC4 for ; Fri, 3 Jul 2020 05:12:59 +0200 (CEST) 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-xd2f.google.com with SMTP id f23so31113939iof.6 for ; Thu, 02 Jul 2020 20:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OJqSCeEB8N8Xf858mBUP29I/bkjWDaaA3HlJus2YXrY=; b=XNqJcfIDSLphU7iixNv5B0gxBvYladCzK/4jy5Fmt88jk4dSZD51RF3yvVHEf5px6I 5Q9+ZkkHKDqnnf78HtNpnWyEhp8ysslJ8WqpMCeZeGjWr/NPOLeU8CjN0mp6rG44xPGx Q9dD/ZPZjpVd/eQbvrqITG0QxWFEvXEwLZ6/U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OJqSCeEB8N8Xf858mBUP29I/bkjWDaaA3HlJus2YXrY=; b=H4kzeYE6v0CdNRW8uHXppfsu7xZ+Kn8iIt8bRsPKRGPhwMoZGIa3EPHQiuDmUu5s0O doqlJRARxH/ZBkSvKwltkHH4RYiecyzBWzwtQ3mgBPCNPsroXYGgosz8jJ9thu6wMzrn 5kHC+2Irf4AnDz9LJCgUKG8Uv9qmYo6P90gJShiRXPUQBuoPqeXDwbwxsrtWaKdJ6AZ1 Ic2q4pUqthvpC4TXjRjR8QxCy1xUwkyEJwZv9QsN0KeDO0YIVc4Z4Mt3VNmAZAJUr3u/ fFZadCqvaBJsh1zsuCO8b5WWukrWlIF5b3mH6B3ZCBVfgHjQFubaNvetMZTiMuT2IqKb z4cw== X-Gm-Message-State: AOAM530I6kOrs+FX8E75tMFvTYVhw8RfmFkiV2JsLjV/CpZnbePjdxT1 6miWIAqfccDE6ZbRcFck272O/g== X-Google-Smtp-Source: ABdhPJzxdnCtN9KpxDgl0HoAbjyAIPxujHyC+kEfLKZ1DZctFgbcC89v78DSsCyLgZy/tsfYmdx9rg== X-Received: by 2002:a05:6602:134d:: with SMTP id i13mr10710382iov.113.1593745978250; Thu, 02 Jul 2020 20:12:58 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:57 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 18/26] video: sandbox: Add support for the copy framebuffer Date: Thu, 2 Jul 2020 21:12:29 -0600 Message-Id: <20200702211204.RESEND.v3.18.I43794bcb7a8a65f9ffa7a0821642ba4b602dcf47@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Enable this feature on sandbox by updating the SDL driver to have two framebuffers. Update the video tests to check that the copy framebuffer is kept in sync. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) configs/sandbox_defconfig | 1 + drivers/video/sandbox_sdl.c | 9 +++++- test/dm/video.c | 55 +++++++++++++++++++++++-------------- 3 files changed, 43 insertions(+), 22 deletions(-) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 20a81a0350..ee7ae9cb21 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -214,6 +214,7 @@ CONFIG_DM_USB=y CONFIG_USB_EMUL=y CONFIG_USB_KEYBOARD=y CONFIG_DM_VIDEO=y +CONFIG_VIDEO_COPY=y CONFIG_CONSOLE_ROTATION=y CONFIG_CONSOLE_TRUETYPE=y CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c index c678e728db..f529a350fb 100644 --- a/drivers/video/sandbox_sdl.c +++ b/drivers/video/sandbox_sdl.c @@ -23,6 +23,7 @@ enum { static int sandbox_sdl_probe(struct udevice *dev) { + struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); struct sandbox_sdl_plat *plat = dev_get_platdata(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct sandbox_state *state = state_get_current(); @@ -40,6 +41,8 @@ static int sandbox_sdl_probe(struct udevice *dev) uc_priv->rot = plat->rot; uc_priv->vidconsole_drv_name = plat->vidconsole_drv_name; uc_priv->font_size = plat->font_size; + if (IS_ENABLED(CONFIG_VIDEO_COPY)) + uc_plat->copy_base = uc_plat->base - uc_plat->size / 2; return 0; } @@ -55,7 +58,11 @@ static int sandbox_sdl_bind(struct udevice *dev) plat->bpix = dev_read_u32_default(dev, "log2-depth", VIDEO_BPP16); plat->rot = dev_read_u32_default(dev, "rotate", 0); uc_plat->size = plat->xres * plat->yres * (1 << plat->bpix) / 8; - debug("%s: Frame buffer size %x\n", __func__, uc_plat->size); + + /* Allow space for two buffers, the lower one being the copy buffer */ + log_debug("Frame buffer size %x\n", uc_plat->size); + if (IS_ENABLED(CONFIG_VIDEO_COPY)) + uc_plat->size *= 2; return ret; } diff --git a/test/dm/video.c b/test/dm/video.c index 729c31b47d..19f78b6239 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -51,12 +51,18 @@ DM_TEST(dm_test_video_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); * size of the compressed data. This provides a pretty good level of * certainty and the resulting tests need only check a single value. * + * If the copy framebuffer is enabled, this compares it to the main framebuffer + * too. + * + * @uts: Test state * @dev: Video device * @return compressed size of the frame buffer, or -ve on error */ -static int compress_frame_buffer(struct udevice *dev) +static int compress_frame_buffer(struct unit_test_state *uts, + struct udevice *dev) { struct video_priv *priv = dev_get_uclass_priv(dev); + struct video_priv *uc_priv = dev_get_uclass_priv(dev); uint destlen; void *dest; int ret; @@ -72,6 +78,13 @@ static int compress_frame_buffer(struct udevice *dev) if (ret) return ret; + /* Check here that the copy frame buffer is working correctly */ + if (IS_ENABLED(CONFIG_VIDEO_COPY)) { + ut_assertf(!memcmp(uc_priv->fb, uc_priv->copy_fb, + uc_priv->fb_size), + "Copy framebuffer does not match fb"); + } + return destlen; } @@ -110,25 +123,25 @@ static int dm_test_video_text(struct unit_test_state *uts) ut_assertok(select_vidconsole(uts, "vidconsole0")); ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); - ut_asserteq(46, compress_frame_buffer(dev)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_putc_xy(con, 0, 0, 'a'); - ut_asserteq(79, compress_frame_buffer(dev)); + ut_asserteq(79, compress_frame_buffer(uts, dev)); vidconsole_putc_xy(con, 0, 0, ' '); - ut_asserteq(46, compress_frame_buffer(dev)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); for (i = 0; i < 20; i++) vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); - ut_asserteq(273, compress_frame_buffer(dev)); + ut_asserteq(273, compress_frame_buffer(uts, dev)); vidconsole_set_row(con, 0, WHITE); - ut_asserteq(46, compress_frame_buffer(dev)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); for (i = 0; i < 20; i++) vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); - ut_asserteq(273, compress_frame_buffer(dev)); + ut_asserteq(273, compress_frame_buffer(uts, dev)); return 0; } @@ -144,7 +157,7 @@ static int dm_test_video_chars(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); - ut_asserteq(466, compress_frame_buffer(dev)); + ut_asserteq(466, compress_frame_buffer(uts, dev)); return 0; } @@ -164,20 +177,20 @@ static int dm_test_video_ansi(struct unit_test_state *uts) /* reference clear: */ video_clear(con->parent); video_sync(con->parent, false); - ut_asserteq(46, compress_frame_buffer(dev)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); /* test clear escape sequence: [2J */ vidconsole_put_string(con, "A\tB\tC"ANSI_ESC"[2J"); - ut_asserteq(46, compress_frame_buffer(dev)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); /* test set-cursor: [%d;%df */ vidconsole_put_string(con, "abc"ANSI_ESC"[2;2fab"ANSI_ESC"[4;4fcd"); - ut_asserteq(143, compress_frame_buffer(dev)); + ut_asserteq(143, compress_frame_buffer(uts, dev)); /* test colors (30-37 fg color, 40-47 bg color) */ vidconsole_put_string(con, ANSI_ESC"[30;41mfoo"); /* black on red */ vidconsole_put_string(con, ANSI_ESC"[33;44mbar"); /* yellow on blue */ - ut_asserteq(272, compress_frame_buffer(dev)); + ut_asserteq(272, compress_frame_buffer(uts, dev)); return 0; } @@ -208,24 +221,24 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); - ut_asserteq(46, compress_frame_buffer(dev)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); /* Check display wrap */ for (i = 0; i < 120; i++) vidconsole_put_char(con, 'A' + i % 50); - ut_asserteq(wrap_size, compress_frame_buffer(dev)); + ut_asserteq(wrap_size, compress_frame_buffer(uts, dev)); /* Check display scrolling */ for (i = 0; i < SCROLL_LINES; i++) { vidconsole_put_char(con, 'A' + i % 50); vidconsole_put_char(con, '\n'); } - ut_asserteq(scroll_size, compress_frame_buffer(dev)); + ut_asserteq(scroll_size, compress_frame_buffer(uts, dev)); /* If we scroll enough, the screen becomes blank again */ for (i = 0; i < SCROLL_LINES; i++) vidconsole_put_char(con, '\n'); - ut_asserteq(46, compress_frame_buffer(dev)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); return 0; } @@ -299,7 +312,7 @@ static int dm_test_video_bmp(struct unit_test_state *uts) ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); - ut_asserteq(1368, compress_frame_buffer(dev)); + ut_asserteq(1368, compress_frame_buffer(uts, dev)); return 0; } @@ -315,7 +328,7 @@ static int dm_test_video_bmp_comp(struct unit_test_state *uts) ut_assertok(read_file(uts, "tools/logos/denx-comp.bmp", &addr)); ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); - ut_asserteq(1368, compress_frame_buffer(dev)); + ut_asserteq(1368, compress_frame_buffer(uts, dev)); return 0; } @@ -330,7 +343,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); - ut_asserteq(12237, compress_frame_buffer(dev)); + ut_asserteq(12237, compress_frame_buffer(uts, dev)); return 0; } @@ -351,7 +364,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); - ut_asserteq(35030, compress_frame_buffer(dev)); + ut_asserteq(35030, compress_frame_buffer(uts, dev)); return 0; } @@ -372,7 +385,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); - ut_asserteq(29018, compress_frame_buffer(dev)); + ut_asserteq(29018, compress_frame_buffer(uts, dev)); return 0; } From patchwork Fri Jul 3 03:12:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322050 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Xk0gXtmi; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg8B32mZz9sR4 for ; Fri, 3 Jul 2020 13:15:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F198D81BDB; Fri, 3 Jul 2020 05:13:46 +0200 (CEST) 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="Xk0gXtmi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F9D481BA2; Fri, 3 Jul 2020 05:13:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 3BBFE81B98 for ; Fri, 3 Jul 2020 05:13:00 +0200 (CEST) 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-xd44.google.com with SMTP id a12so31110461ion.13 for ; Thu, 02 Jul 2020 20:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tmuDpXLMI/Ai84KWPT3ZCIk+Kk7Ov5hbJtM6HDTcwCA=; b=Xk0gXtmiAD+TJgBLGmjxKCCW90spwy6l2OFxWTz5tqx/+OMbYwgMkGUAxkLrWjcBRn 1S3QKW353K+S4BigGAJcsUC4WRVEgaJJPcxpsntwhym+m41TBRPzRlr6n8UC9gYif3rj LfRWtKZ3nLq7MGR4opyc0b8BDnwY6ocspRyWk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tmuDpXLMI/Ai84KWPT3ZCIk+Kk7Ov5hbJtM6HDTcwCA=; b=Kg5VMhy+YmDM0rx+IqLHF2MGQIsQLHGyeCiHzKPGU41ua8G18cNwaNhTfV4OzbAiF+ tDHnbyos4o/LyqC8IVxbKPOQmmjRcfHXYvaiOqtIYL+f6D7d0qCAgXF9oGn8qxZoKu2j c5obm0Djw4+JxIjTn0SWznV862jsqPbhjP7dr1no+h1uiA8+B4MC0F3HWyl47MizpvoP eo+l3nfUXygrbSxtfVP+10P3cqtjSpE6VzgTadSMkRPUzajByoEYzI+HQxwVuL6y+FMY AS5+MJMaltSgjeCLa6UxbYkigWOGLGH7j+FvqWielGFhARlFajL0LH4BhX/EVecnYKFd sJpg== X-Gm-Message-State: AOAM5317KZv2jwTRfQiPgdI1twS8zeupSoJADUUHQt3jhRzzAY0uQTg6 lCxkCP8Ic51HE+3VTUfHFyr66A== X-Google-Smtp-Source: ABdhPJzTXbIMQeSToPio+1+QT/1SXPfJLxM1Sxm9qrzFiwxEeFXI/MunnPP9IeI7Nb9THWQ4ET3d5w== X-Received: by 2002:a02:2b24:: with SMTP id h36mr37703441jaa.104.1593745979106; Thu, 02 Jul 2020 20:12:59 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:58 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 19/26] video: pci: Set up the copy framebuffer Date: Thu, 2 Jul 2020 21:12:30 -0600 Message-Id: <20200702211204.RESEND.v3.19.I6830e2259b28645c0ed29b68bbadf67598c0ed70@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean When using a copy framebuffer we need to tell the video subsystem its address. U-Boot's normally allocated framebuffer is used as the working buffer, but nothing is displayed until it is copied to the copy framebuffer. For this to work the video driver must request that a framebuffer be allocated separately from the hardware framebuffer, so add a check for that. Also add a log category so that logging appears correctly. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/pci/pci_rom.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c index 6a9bc49978..fa29d69e85 100644 --- a/drivers/pci/pci_rom.c +++ b/drivers/pci/pci_rom.c @@ -22,6 +22,8 @@ * Copyright 1997 -- 1999 Martin Mares */ +#define LOG_CATEGORY UCLASS_PCI + #include #include #include @@ -344,7 +346,16 @@ int vbe_setup_video_priv(struct vesa_mode_info *vesa, default: return -EPROTONOSUPPORT; } - plat->base = vesa->phys_base_ptr; + + /* Use double buffering if enabled */ + if (IS_ENABLED(CONFIG_VIDEO_COPY)) { + if (!plat->base) + return log_msg_ret("copy", -ENFILE); + plat->copy_base = vesa->phys_base_ptr; + } else { + plat->base = vesa->phys_base_ptr; + } + log_debug("base = %lx, copy_base = %lx\n", plat->base, plat->copy_base); plat->size = vesa->bytes_per_scanline * vesa->y_resolution; return 0; @@ -372,6 +383,15 @@ int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void)) ret = vbe_setup_video_priv(&mode_info.vesa, uc_priv, plat); if (ret) { + if (ret == -ENFILE) { + /* + * See video-uclass.c for how to set up reserved memory + * in your video driver + */ + log_err("CONFIG_VIDEO_COPY enabled but driver '%s' set up no reserved memory\n", + dev->driver->name); + } + debug("No video mode configured\n"); return ret; } From patchwork Fri Jul 3 03:12:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322055 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=OIgh6kI+; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg935GBQz9sR4 for ; Fri, 3 Jul 2020 13:16:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E990981C19; Fri, 3 Jul 2020 05:13:56 +0200 (CEST) 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="OIgh6kI+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 363ED81B9A; Fri, 3 Jul 2020 05:13:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 EEB1C81BB4 for ; Fri, 3 Jul 2020 05:13:00 +0200 (CEST) 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-xd44.google.com with SMTP id q8so31088028iow.7 for ; Thu, 02 Jul 2020 20:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SpZylUOu2K8QrPgIlD0EhZ6u4U7EmWNhB8TjAtydBLQ=; b=OIgh6kI+8UfQRDGDocwKk3ZbTY9okVDhRJj/cA7KySjqX36/yqsvQpAjN0V+tAxs80 EbCrHKFB+NUPU6hYlFbmaPJ/JoOINxi4yCIG1zEHPzs2fQErqPMnz/6PV1fQz3TpN4I4 S4cNOiL9n6uJ45QRsdSejv6gkDR+3ijXNk2ks= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SpZylUOu2K8QrPgIlD0EhZ6u4U7EmWNhB8TjAtydBLQ=; b=mQuJN+3YrcPhFDAWQWsXWg9f0DyoNf+iu/FO1BUBNg2q5jqJYr2Qgi4fwMrUf91g+V QyZSbYVpQqTjWlYkwYaXk4KkvEStvNDVyes4kr6G2T6j3TQ+zR0gd2+HeYgbK/OkY8J+ x6mmhvdKBT1BfWLOiUrY4I3gi0HGIOxz6fqTe0B8XwG8BSFwkxmV/sDTtW39pbyCXkNW Di0BdL5iC7+S11MchbMnOZWkAj9qNT5lkVp8+lhO1L0DxDbw8LGRddAPUVm2Q3eOsLPm AIlmWmW4OCsNHW3dqdInpaFZqgqHr1vutVtrUC39/XSHBKPXzelOA8KDvmrDrGRajwOx hfUQ== X-Gm-Message-State: AOAM533Z5/rj4/gyYmNhuy3S0+biMKH1IwV3R1EL7iZhAfNJmYzwhE8G JQVVB1mN9UnpTuogiynn7Y6soA== X-Google-Smtp-Source: ABdhPJw0t2MXSFf7dx/hWKHZ8OiJu0cAzZ8fDILZx0Vh3FvUSybuRzZR0bgU/lhnz5ZAjTUGU4/QFg== X-Received: by 2002:a05:6602:5c3:: with SMTP id w3mr10679419iox.3.1593745979857; Thu, 02 Jul 2020 20:12:59 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:59 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 20/26] x86: fsp: video: Allocate a frame buffer when needed Date: Thu, 2 Jul 2020 21:12:31 -0600 Message-Id: <20200702211204.RESEND.v3.20.I924a9e665cb5136a4034703a9360c1b4049c97b7@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean When the copy framebuffer is in use, we must also have the standard U-Boot framebuffer available. Update the FSP driver to support this. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) arch/x86/lib/fsp/fsp_graphics.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c index 6e23f3c95f..e8c1e07af1 100644 --- a/arch/x86/lib/fsp/fsp_graphics.c +++ b/arch/x86/lib/fsp/fsp_graphics.c @@ -117,6 +117,16 @@ err: return ret; } +static int fsp_video_bind(struct udevice *dev) +{ + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + + /* Set the maximum supported resolution */ + plat->size = 2560 * 1600 * 4; + + return 0; +} + static const struct udevice_id fsp_video_ids[] = { { .compatible = "fsp-fb" }, { } @@ -126,7 +136,9 @@ U_BOOT_DRIVER(fsp_video) = { .name = "fsp_video", .id = UCLASS_VIDEO, .of_match = fsp_video_ids, + .bind = fsp_video_bind, .probe = fsp_video_probe, + .flags = DM_FLAG_PRE_RELOC, }; static struct pci_device_id fsp_video_supported[] = { From patchwork Fri Jul 3 03:12:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322054 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=i/W+EUOI; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg8t0Y9Vz9sR4 for ; Fri, 3 Jul 2020 13:16:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C21681C13; Fri, 3 Jul 2020 05:13:55 +0200 (CEST) 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="i/W+EUOI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2BD8381BD9; Fri, 3 Jul 2020 05:13:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (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 E59B781BC6 for ; Fri, 3 Jul 2020 05:13:01 +0200 (CEST) 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-xd43.google.com with SMTP id v6so17415088iob.4 for ; Thu, 02 Jul 2020 20:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x5xjcn+xavOAEnE3z4V/em5tjkxBZ/MhuCMLVpW7kRU=; b=i/W+EUOIDr5S/C+oavunFUl7KViezVEq1jI5rDR+k6cmyBkrszQ2IjOw+qQUBFfxu+ 8RKJlyRS3SG2i73/Ziljwuoyzn9R1kz61jv/yWXlMETMVywBTEnD5HUcT8JecMzl2rph UyvOWCixnDoc4xQfZOTZ6EN+vVFDwZSQRwh+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x5xjcn+xavOAEnE3z4V/em5tjkxBZ/MhuCMLVpW7kRU=; b=aoXgwg4VXWfvchhWdSzqfesHjV9VFKWaYbZdF1ti2x20UO8tifNKSqVEJ1/m6dy6cB Fxdh3om1UUAqHG0lze9pp58JouaO/b8hQDS7HuWvYUu9knO1gN/DEwtTNdkmbKrW4Abe qqx04618/PUZ/CfGe4zC1YqxcCTNLrxGmL409ZJUNAhAK8NKVGWEnSPrAqkXDyfZ11wV nkJ0H6EquRSJG+0DS1qRAco0xPbpTj8oLPp7u3o3cBWktsB2axPHW/xU+y+ljuipz8bv h3jVl21FyA8VU4SLb+1ECq/dsIsLJWtXajONC2fURsvimXf9sm/ftnibugsQJFitEcrX 2RPg== X-Gm-Message-State: AOAM530F4NPMr6qgCmCZG0FydsHmiaw3tyKg5DqbM6es8pmHUWLEnA/x GCbWDkQG8PPuPjisdCCmkcYBQjJHqVuIZQ== X-Google-Smtp-Source: ABdhPJz3KMw5rHcnXEQOKDvdZjoCWxdX870ZOYICu0wp50puuwB1Mtv6i+8zi5/0CaAvPhx5ee8rQg== X-Received: by 2002:a5d:9ed0:: with SMTP id a16mr10390943ioe.176.1593745980650; Thu, 02 Jul 2020 20:13:00 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:13:00 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 21/26] video: Correctly handle multiple framebuffers Date: Thu, 2 Jul 2020 21:12:32 -0600 Message-Id: <20200702211204.RESEND.v3.21.I3472e0c85a061aad040c07d26651a3b80da500f2@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present video_bottom is set to the bottom of each framebuffer when it is allocated. This is not correct, since it should hold the bottom of the entire area available for framebuffers. Fix this by adding a private address in the uclass which keeps track of the next available spot for a framebuffer. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/video-uclass.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 4ddd8bc1db..4735a22dc1 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -46,6 +46,19 @@ */ DECLARE_GLOBAL_DATA_PTR; +/** + * struct video_uc_priv - Information for the video uclass + * + * @video_ptr: Current allocation position of the video framebuffer pointer. + * While binding devices after relocation, this points to the next + * available address to use for a device's framebuffer. It starts at + * gd->video_top and works downwards, running out of space when it hits + * gd->video_bottom. + */ +struct video_uc_priv { + ulong video_ptr; +}; + void video_set_flush_dcache(struct udevice *dev, bool flush) { struct video_priv *priv = dev_get_uclass_priv(dev); @@ -351,12 +364,21 @@ static int video_post_probe(struct udevice *dev) /* Post-relocation, allocate memory for the frame buffer */ static int video_post_bind(struct udevice *dev) { - ulong addr = gd->video_top; + struct video_uc_priv *uc_priv; + ulong addr; ulong size; /* Before relocation there is nothing to do here */ if (!(gd->flags & GD_FLG_RELOC)) return 0; + + /* Set up the video pointer, if this is the first device */ + uc_priv = dev->uclass->priv; + if (!uc_priv->video_ptr) + uc_priv->video_ptr = gd->video_top; + + /* Allocate framebuffer space for this device */ + addr = uc_priv->video_ptr; size = alloc_fb(dev, &addr); if (addr < gd->video_bottom) { /* Device tree node may need the 'u-boot,dm-pre-reloc' or @@ -368,7 +390,7 @@ static int video_post_bind(struct udevice *dev) } debug("%s: Claiming %lx bytes at %lx for video device '%s'\n", __func__, size, addr, dev->name); - gd->video_bottom = addr; + uc_priv->video_ptr = addr; return 0; } @@ -381,6 +403,7 @@ UCLASS_DRIVER(video) = { .pre_probe = video_pre_probe, .post_probe = video_post_probe, .pre_remove = video_pre_remove, + .priv_auto_alloc_size = sizeof(struct video_uc_priv), .per_device_auto_alloc_size = sizeof(struct video_priv), .per_device_platdata_auto_alloc_size = sizeof(struct video_uc_platdata), }; From patchwork Fri Jul 3 03:12:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322056 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=CqQz0ldN; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg9F1TfPz9sR4 for ; Fri, 3 Jul 2020 13:16:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 702A181C20; Fri, 3 Jul 2020 05:13:59 +0200 (CEST) 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="CqQz0ldN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2D20A81BD9; Fri, 3 Jul 2020 05:13:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (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 C91D481BCC for ; Fri, 3 Jul 2020 05:13:02 +0200 (CEST) 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-il1-x141.google.com with SMTP id s21so10948391ilk.5 for ; Thu, 02 Jul 2020 20:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VlS23PX0Q7KjuLiVHUwk8RQg8PaC3T1dTrq7Z1GIKqw=; b=CqQz0ldN62Cf1zf4zqCURDH9VArJynb94dXHgmWpxnV5Mp1ruchV8VOEEKIXpUKGoP c8+hfjrvZkARJlaDYnKmN+ejftUGZQKAhounLxQWAe+ADXxdp7zOj5hxxP+4Qvn+G65O UWBNguWZcOgDn0Ns74Lpxp863D4lnza4aOw9c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VlS23PX0Q7KjuLiVHUwk8RQg8PaC3T1dTrq7Z1GIKqw=; b=bdSxZ9ME4a7Mn8g1zH1Pcd5pFytC9/x46T6kZBOm414w91Fbf1YCbwDnOL0oMag9/O c3CclmnzEqcR2lKJMSz2qVYX2npUm7/KnmfIq1jM4AujbMVxUfHEEipXHzRGBUms1Jsh WiX/jkzwkJUEoZudw8TV04+OAjZcW40ALXrHZ3db7EID05kBVWxkXpi4q9LgX+fCZ4e2 7HBHuObUhpJPOkPWIXrm3H3qah+S7BmZJKQYeM/7CmXpiV8igtVtTc7KYq8YF/rVSdVv lXwgwVVMKQx1LgQJ37IZ064Kg9Yp9X45mcQP/T1SR7yc1pa2rs1AozyIAv/Q+BWj07dI tcLQ== X-Gm-Message-State: AOAM530cRMsGAzHuFc8tdybxO3JafTnob3HIMwgv/P7bJpQmNsxl8OUT PGYYKNjhUNJy05uBp9XgUQaQYg== X-Google-Smtp-Source: ABdhPJwQwIKYZIhLCDYiGNvznwk31gsdj4TgikVw6vu6lwIvdL/29mZPCw8WVNaVgfjcKIboaL2HWA== X-Received: by 2002:a05:6e02:11ae:: with SMTP id 14mr4564380ilj.201.1593745981428; Thu, 02 Jul 2020 20:13:01 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:13:01 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 22/26] x86: video: Support copy framebuffer with probed devices Date: Thu, 2 Jul 2020 21:12:33 -0600 Message-Id: <20200702211204.RESEND.v3.22.I77e552931a507922710db3d34954e8367239e531@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean For PCI video devices that are not mentioned in the devicetree, U-Boot does not bind a driver before relocation, since PCI is not fully probed at that point. Furthermore it is possible for the video device to be on a secondary bus which is not even scanned. This is fine if the framebuffer is allocated in fixed memory, as it normally is on x86. But when using this as a copy framebuffer, we also need U-Boot to allocate its own cached framebuffer for working in. Since the video driver is never bound before relocation, the framebuffer size is never set and U-Boot does no allocation. Add a new CONFIG option to reserve 16MB of memory for this eventuality. This allows vesa devices to use the copy framebuffer. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/Kconfig | 19 +++++++++++++++++++ drivers/video/video-uclass.c | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 8f0feec6af..9ecd6d4df4 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -22,6 +22,25 @@ config BACKLIGHT This provides backlight uclass driver that enables basic panel backlight support. +config VIDEO_PCI_DEFAULT_FB_SIZE + hex "Default framebuffer size to use if no drivers request it" + depends on DM_VIDEO + default 0x1000000 if X86 && PCI + default 0 if !(X86 && PCI) + help + Generally, video drivers request the amount of memory they need for + the frame buffer when they are bound, by setting the size field in + struct video_uc_platdata. That memory is then reserved for use after + relocation. But PCI drivers cannot be bound before relocation unless + they are mentioned in the devicetree. + + With this value set appropriately, it is possible for PCI video + devices to have a framebuffer allocated by U-Boot. + + Note: the framebuffer needs to be large enough to store all pixels at + maximum resolution. For example, at 1920 x 1200 with 32 bits per + pixel, 2560 * 1600 * 32 / 8 = 0xfa0000 bytes are needed. + config VIDEO_COPY bool "Enable copying the frame buffer to a hardware copy" depends on DM_VIDEO diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 4735a22dc1..650891e49d 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -97,6 +97,11 @@ int video_reserve(ulong *addrp) debug("%s: Reserving %lx bytes at %lx for video device '%s'\n", __func__, size, *addrp, dev->name); } + + /* Allocate space for PCI video devices in case there were not bound */ + if (*addrp == gd->video_top) + *addrp -= CONFIG_VIDEO_PCI_DEFAULT_FB_SIZE; + gd->video_bottom = *addrp; gd->fb_base = *addrp; debug("Video frame buffers from %lx to %lx\n", gd->video_bottom, From patchwork Fri Jul 3 03:12:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322057 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=INnQtWpi; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg9Q6mlMz9sR4 for ; Fri, 3 Jul 2020 13:16:42 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5EB3081C23; Fri, 3 Jul 2020 05:14:04 +0200 (CEST) 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="INnQtWpi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 07D5181BDA; Fri, 3 Jul 2020 05:13:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (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 91F0E81BCD for ; Fri, 3 Jul 2020 05:13:06 +0200 (CEST) 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-il1-x133.google.com with SMTP id t27so21139596ill.9 for ; Thu, 02 Jul 2020 20:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wnARN7to11Nv0fP1VsUaiDipq9CV7uBJnnRK7eIeOUA=; b=INnQtWpizUQ9E/OCS71PVfPlLIjEt+x2QITei6VH84Cj667PVr0L+dfKxrzWVFy0f9 r11Ua+ZDukOAJxjSLc+KdIl0xluPlsOjMojMkWvt2G+0Olz9cdqYXpeoSnXZdlkFidLL VyPm0Ia8Yxr4CObRVWe6lNUgSNnS2XYs03/xw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wnARN7to11Nv0fP1VsUaiDipq9CV7uBJnnRK7eIeOUA=; b=iKXq1BlwwYCP3BXtUoJyjTcYuulh/JtDAKT0ECFYq8Kiq2uRm1A1RjciIlQrEkb45W Udw0i9i7dlwpQtGdvFQ3ePv0SzdWvueMRDTlX68i5Pg+u+M+sP6JtNrJlgbol0AJWT3K Yc5xf/ZabRH9wAnEO0rDxHIvbRNVUT0S3RSAe5gV9i5UoEOOUTviecTnZPTFJKTqHgYV idiOIUbYbKVhleOX6i3pHP5YLuocSYYx2WFTUlsQTlEpxA2u+FP7uJ40u/HlmBdZfZGh OqY1KWRdOW0t5Iq6e1yq73rwwLTKgp5rx9YPPt/7iTzlv++OKwKEFzy3Q9o23g9xQvFE mMsg== X-Gm-Message-State: AOAM531FLVUyRO8cY9aPxhq0xklx5ejk0/C7XtPPW9z32JLBRkyAt8II DGaMxedD0z4k2ZWdUHwqbN4GVA== X-Google-Smtp-Source: ABdhPJzxVLR5xFYHfw+Qq8nPyftWi5kI/GAy3C8ox6tlTUD3ip59J8DZG71ONg178t+X4Vf8FO0O3A== X-Received: by 2002:a92:7949:: with SMTP id u70mr14685748ilc.88.1593745985252; Thu, 02 Jul 2020 20:13:05 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.13.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:13:04 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , u-boot@lists.denx.de Subject: [RESEND PATCH v3 26/26] x86: minnowmax: Drop screen resolution to 1024x768 Date: Thu, 2 Jul 2020 21:12:37 -0600 Message-Id: <20200702211204.RESEND.v3.26.Ia291ebfeddb9d936914febb00854daa5d0ec2e26@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean This seems like a more reasonable resolution for this board, since it is quite slow. It also allows it to work with a 5" LCD display in my lab. Signed-off-by: Simon Glass --- (no changes since v1) configs/minnowmax_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/minnowmax_defconfig b/configs/minnowmax_defconfig index 4fbc920dd0..13d6edd08c 100644 --- a/configs/minnowmax_defconfig +++ b/configs/minnowmax_defconfig @@ -61,5 +61,5 @@ CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y CONFIG_VIDEO_COPY=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y -CONFIG_FRAMEBUFFER_VESA_MODE_11B=y +CONFIG_FRAMEBUFFER_VESA_MODE_118=y # CONFIG_GZIP is not set