From patchwork Tue May 19 23:10: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: 1293821 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=CkJbzFjJ; 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 49RWpp5dTLz9sT4 for ; Wed, 20 May 2020 09:11:30 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 61C8181E58; Wed, 20 May 2020 01:11:27 +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="CkJbzFjJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9A5A081E44; Wed, 20 May 2020 01:11:24 +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 AE4D481E44 for ; Wed, 20 May 2020 01:11:20 +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 j3so1150785ilk.11 for ; Tue, 19 May 2020 16:11:20 -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=ws4pq0wN5kwJaIzdKphbc29XJaHiiePRjfsAOGfleAo=; b=CkJbzFjJ2fAIm2H28y4ivBDVoDlyelS6oDenP/dvmdYJNMmcJOfgPuswhBpocNNqp8 HRrG0lgBt0nvk2iVOHoo2L4YmfcpE7qQvXvuJWnivJPWZk8jI+BmoA54mLn1nOgFNgGa knj6FxXS0E4VxCRbGmETL9VSTArXnixAlqAeI= 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=ws4pq0wN5kwJaIzdKphbc29XJaHiiePRjfsAOGfleAo=; b=kZt6KDZROXRALEuug2Np54+jrnlSN+lQFFUBjjuEKIS2Nf2UXzgtmtqA8H1lVgCxKt kAlTlb/Oh38p6TPdFnb1hQ/3Lo1EysmuKMLLMjWgEgqQ8GCIh+y2CKat4lhycnb1NQ2j gK/GEyPHo2W8M6ce9Bvg7PirPvkPDxDiC5x1VMLwYsWieNTWX5rXXxMJEA/2Qu54buod W7WuwOt2iMq21wX9DDS/nwh9f2dMapbHnM4vObLo2L7/esvEXRq/7Iv3Y9ziQJK0JqFo Lpz/vXBTJQFZ3DD4L1PfBkBqRDDHb6vCDjQZgeyZ/t8dC//qcUtKodY5EidJGZ9qJQRx gP4Q== X-Gm-Message-State: AOAM531DR2A1i9+jzoWI8JJDmF9JdyNgFA3NXf0zxGCg3SfwHech49KG rImbP14weUPIdvOa4kdxSwahdPj8ou0= X-Google-Smtp-Source: ABdhPJy4Uq1CKQsIBA45diTUdvlauJOgdkpZmrsFxsJmbS9qI97yQNkPhqwSMVT0VKEZ9Do7L2SMvg== X-Received: by 2002:a92:de02:: with SMTP id x2mr1463808ilm.267.1589929879197; Tue, 19 May 2020 16:11:19 -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 m4sm415701iol.35.2020.05.19.16.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Masahiro Yamada Subject: [PATCH 01/26] x86: fsp: Reinit the FPU after FSP meminit Date: Tue, 19 May 2020 17:10:33 -0600 Message-Id: <20200519231058.19945-2-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293826 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=mUX0lvLt; 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 49RWrV1fGDz9sT3 for ; Wed, 20 May 2020 09:12:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 66E6481E72; Wed, 20 May 2020 01:11: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="mUX0lvLt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 577D981E6F; Wed, 20 May 2020 01:11:32 +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 9451581E49 for ; Wed, 20 May 2020 01:11:21 +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 j8so1035202iog.13 for ; Tue, 19 May 2020 16:11:21 -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=hucpHgWJB80ITa7B+mzKrgXl3VrL08p4fVoNVQntPz8=; b=mUX0lvLtYU/NSuRW3/K5ApI2mdt86XaYxrJlD+GV9/HZw6JnFJlAZMWy/dsPbg79pH LmrYVCU/XhzxMI4vSC9rsqndsLMXgpLAWgdjOstfxBvxv6YmLcieJYyio5vxgYUG0Z4X aWW04x+E/G7AGbsP/yxek4oY6D6IYXnBnzWNo= 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=hucpHgWJB80ITa7B+mzKrgXl3VrL08p4fVoNVQntPz8=; b=h0jQMZw+jlHPzwk5elfbcGwPXnnOxl0hWb/cah1T3T6V2IzLeh2r1uYJh9ivjR7lqy x3bkt5C83t71f+y8gt9xZ+eQx/tNV78pASpykbjl39nKRkxwbL14/13p8SZCW6l/VXBO vPCnomvo4gUwM1Jm4EibtublpxUmZvxCLHyzPIJ3apReDYqIQXEFAfny5+NetoSoKunX JBVr0jBkyHyD6b7Gk34MqgFLvg75FE59dhT/vUDV6zmyZYpfd0A+SpGFps0XrptOVSiB MeonSmlXYjnqjC5RKKLNR/E6YuYdrNv8PZ/ljTxh46l6m5CFBVECgXQ/J35jYZIg74dP Q/dw== X-Gm-Message-State: AOAM5301M99+tgrAdgaTVe6fdRq6v3AB8etX17in3/L+5OGr6fvdF1OH nNZhupLgf+l3ZADDC2Xy6sEO4ja7LfI= X-Google-Smtp-Source: ABdhPJxh5VAkP9Y1TQcTO6/Zdj7xGyfdcywMEMkZfjrSROpSMfdJW9MxW+LbhM8mBXJftggg++35GQ== X-Received: by 2002:a05:6602:2295:: with SMTP id d21mr1269108iod.21.1589929880030; Tue, 19 May 2020 16:11:20 -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 m4sm415701iol.35.2020.05.19.16.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:19 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Heinrich Schuchardt , Joe Hershberger , Patrice Chotard , Patrick Delaunay , Simon Goldschmidt Subject: [PATCH 02/26] console: Add a way to output to serial only Date: Tue, 19 May 2020 17:10:34 -0600 Message-Id: <20200519231058.19945-3-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean In the video drivers it is useful to print errors while debugging but doing so risks an infinite loop as the debugging info itself may go through the video drivers. Add a new console function that prints information only to the serial device, thus making it safe for use in debugging. Signed-off-by: Simon Glass --- common/console.c | 28 ++++++++++++++++++++++------ include/console.h | 13 +++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/common/console.c b/common/console.c index 1deca3cb78..31f46470d2 100644 --- a/common/console.c +++ b/common/console.c @@ -229,18 +229,34 @@ static void console_putc(int file, const char c) } } -static void console_puts_noserial(int file, const char *s) +/** + * console_puts_select() - Output a string to all console devices + * + * @file: File number to output to (e,g, stdout, see stdio.h) + * @serial_only: true to output only to serial, false to output to everything + * else + * @s: String to output + */ +static void console_puts_select(int file, bool serial_only, const char *s) { int i; struct stdio_dev *dev; for (i = 0; i < cd_count[file]; i++) { + bool is_serial; + dev = console_devices[file][i]; - if (dev->puts != NULL && !console_dev_is_serial(dev)) + is_serial = console_dev_is_serial(dev); + if (dev->puts && serial_only == is_serial) dev->puts(dev, s); } } +void console_puts_select_stderr(bool serial_only, const char *s) +{ + console_puts_select(stderr, serial_only, s); +} + static void console_puts(int file, const char *s) { int i; @@ -275,9 +291,9 @@ static inline void console_putc(int file, const char c) stdio_devices[file]->putc(stdio_devices[file], c); } -static inline void console_puts_noserial(int file, const char *s) +void console_puts_select(int file, bool serial_only, const char *s) { - if (!console_dev_is_serial(stdio_devices[file])) + if (serial_only == console_dev_is_serial(stdio_devices[file])) stdio_devices[file]->puts(stdio_devices[file], s); } @@ -489,7 +505,7 @@ static void print_pre_console_buffer(int flushpoint) puts(buf_out); break; case PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL: - console_puts_noserial(stdout, buf_out); + console_puts_select(stdout, false, buf_out); break; } } @@ -776,7 +792,7 @@ int console_announce_r(void) display_options_get_banner(false, buf, sizeof(buf)); - console_puts_noserial(stdout, buf); + console_puts_select(stdout, false, buf); #endif return 0; diff --git a/include/console.h b/include/console.h index 74afe22b7e..4c6b8f2614 100644 --- a/include/console.h +++ b/include/console.h @@ -7,6 +7,8 @@ #ifndef __CONSOLE_H #define __CONSOLE_H +#include + extern char console_buffer[]; /* common/console.c */ @@ -72,6 +74,17 @@ int console_record_avail(void); */ int console_announce_r(void); +/** + * console_puts_select_stderr() - Output a string to selected console devices + * + * This writes to stderr only. It is useful for outputting errors + * + * @serial_only: true to output only to serial, false to output to everything + * else + * @s: String to output + */ +void console_puts_select_stderr(bool serial_only, const char *s); + /* * CONSOLE multiplexing. */ From patchwork Tue May 19 23:10:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293824 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=XNXc96Mf; 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 49RWqw74jmz9sT3 for ; Wed, 20 May 2020 09:12:28 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AAB7581E69; Wed, 20 May 2020 01:11: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=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="XNXc96Mf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E80C381E42; Wed, 20 May 2020 01:11:30 +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 43A8181E42 for ; Wed, 20 May 2020 01:11: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=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id j2so1192462ilr.5 for ; Tue, 19 May 2020 16:11:22 -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=K70PFahEtxz5ANA5qiB4OXHSwTWihZ3vd7K8dDRT2uE=; b=XNXc96MfWhBfY9udZk8nU+tpaO6/zaJfOWJYuijxtMGh+qS9fZZ3gwoIM3YwB8eSMO omjak2ZX+/pmMtEFWnekymEGNX9iIH2eVAUdDhtlR78Mcnohg0UR8Uj7jwoBvogDkp/V 6uENkG7cSjD9aGN6KXPKhS/jtkpZvyngPvUWs= 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=K70PFahEtxz5ANA5qiB4OXHSwTWihZ3vd7K8dDRT2uE=; b=mEzkgcDtDYndnudfb/+QoXu/gWJ7fBizFqd1t1ul7RW3QdFRQbFv6fZ8tleWIjCT9J TOM9iJLMmwtzaYElQOkfrS9tpT/5y6H0iwC7wXIcwi1NHpoVljuNvAaL8AxqVT8AniVs phf9dhyw2SNTFFSE/W7ZACT2/cDEmxG0+Vo8fVyGT2Hrtesyw1etwh5Hor/A+EulEJze 2tazxKprJruPUx0mMR9C3qf+VKedJngf+MVEbddXLNCawKKEHRN3OcG55sSIVeWVsLdR 6yfqofkBoQ91YmPzyPF+t8JzSvhvbt3fHll86WfqrS1/kSfEQ3dUOhatYR5hY4eUFE0S dFyw== X-Gm-Message-State: AOAM533byaYG2fkfFyOnmdddTeKI+rPYR7uAhunTbXHVco/q3V7Fr1Hg NLaIhWUJ9MhPseN9zH0EtP2vC6c//HE= X-Google-Smtp-Source: ABdhPJwfBC+vTnZwqNAGT3eztOaKkPWGpltTz3ZpItt9483HIPfJSqRcabJ/ONkkDUvAQoJMi4qRBw== X-Received: by 2002:a92:10a:: with SMTP id 10mr1451241ilb.203.1589929880927; Tue, 19 May 2020 16:11:20 -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 m4sm415701iol.35.2020.05.19.16.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 03/26] video: Show an error when a vidconsole function fails Date: Tue, 19 May 2020 17:10:35 -0600 Message-Id: <20200519231058.19945-4-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 d30e6db6f6..e06912cf36 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 Tue May 19 23:10:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293822 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=BNHHKvys; 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 49RWqK6Pbjz9sT4 for ; Wed, 20 May 2020 09:11:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B641E81E59; Wed, 20 May 2020 01:11:45 +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="BNHHKvys"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3FEEC81E5F; Wed, 20 May 2020 01:11:28 +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 1300881E4F for ; Wed, 20 May 2020 01:11:23 +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 o67so1223851ila.0 for ; Tue, 19 May 2020 16:11:23 -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=BOR/MuMWcn0wpGlyfZx9YCaK/1SDVaBEmKU1mDux494=; b=BNHHKvysRUizlbmQRl13cEE0MSxRbEeQnXTb/OKAX01gUCCktJKwSCHlwzPDDeraB/ A0Le4kMUvp5YKDnr/mmF5+eso9WmqzhbHqtWI9N2APdkzjAKREJcoc1zMSebHiqLAo4F OTn56Vz74+huTygYx3k0OY+NEOK88Qm2MCRAI= 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=BOR/MuMWcn0wpGlyfZx9YCaK/1SDVaBEmKU1mDux494=; b=Ixebkq0AwOcKoF7pmgjAGuxXhvfJm2PNHub671jpdmDbtklNiWn2qD0TxxhH+mOs8x AW5hdsFvr782dNEuVqwM7Yj0o2uNfodDf+3PH0Oh+d5VQUbY7qzqlGwmo7KY6u5PTgXP dlzL47jU9S4k1Z7GRTMaCgRSdmCiLJ/6hDZBjpZIV6UZvjOeDHlZZkEJhI7EoGlckN05 J7+fO6TBkcUqxALWycDwwq7QE8UXZhJE3uFX+chdzj4rho/X4N/Vzs57fTUWusuTF+xv AX3d3lJCKZ2FyAzh5Ch4D0T5BIs8HL6ciP3cteIOgSi0NlU/XajYa7+14QrdsbSq2Y73 gjPA== X-Gm-Message-State: AOAM532fI/p0TqTABgI7IiQ4ZQCXoJCeO6ldXvUn2c0G36tW65ZLLNB6 iu9juiR9UMZWIupQV50cZhnfaGP/fg0= X-Google-Smtp-Source: ABdhPJx/zqv5xvm22Ad9zPsNyQEtLjXb6TkYEOwkbZ29FAvIvoTSqBNyufIoHqtMaUHDwFsabsLK9w== X-Received: by 2002:a92:d4cf:: with SMTP id o15mr1503324ilm.49.1589929881682; Tue, 19 May 2020 16:11:21 -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 m4sm415701iol.35.2020.05.19.16.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:21 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 04/26] sandbox: video: Allow selection of rotated console Date: Tue, 19 May 2020 17:10:36 -0600 Message-Id: <20200519231058.19945-5-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10: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: 1293823 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=HXna3hA7; 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 49RWqg38QWz9sT3 for ; Wed, 20 May 2020 09:12:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4391281E4F; Wed, 20 May 2020 01:11: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=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="HXna3hA7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0D84681E65; Wed, 20 May 2020 01:11:29 +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 51FF781E53 for ; Wed, 20 May 2020 01:11:24 +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 j8so1035290iog.13 for ; Tue, 19 May 2020 16:11:24 -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=M6M+Ik2gnKjAgfLyHLkF63IKHHmRXaJd6oekFqdxMJw=; b=HXna3hA7RPxoQVxDiByvc1iuKdpMXAXcnA0HNyEtX48rU+PXAtC/mmzJgC8NUzfJ1s EajCvRcmSMNKOWPgV6AdIqmJXdoQRpPORoDX0hbAYgVkjt0EafDFw/sWBS7zLM4ggihj 1wnI+wbgM76dTWl4dFpdYT22VRwNE3e0igwn8= 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=M6M+Ik2gnKjAgfLyHLkF63IKHHmRXaJd6oekFqdxMJw=; b=DiIxXeD6XwdbIe/MUAlJTWXEn1UVwzJwkskg9Bw1XjktbhF23ruaw6K1NJ13/tHlZ9 3nCqJqS3F8zT6Cs4wdXWg3YimOJv3K9KdpmXO5KqIk2wwRcumjekRjkQfdVb+ZR5E127 u9ioWWv/rHzHp3VoQDHFxhlDtuRbhRS6igxcfug7MfBDQcqP0FScmJkN0LPD03yoOS96 INEbQU85Saj3HvXRxp+t+R66lKIN2Jwph2p32x7Uc/Doe+J3z5ZDmu8TFVn+Yn08A0xO eTXCebMCOjuRA0t7gX9nGQ0K+3wQLvpMVUf+j59eZpiBOlew7DbUBtquX15UnpLy8VLo fdDw== X-Gm-Message-State: AOAM531mpVgO6E4ngZwQeXPkwsuPTGKu5F+lpNK9xnbMMFQylSn1N+8o dn0j8dB8I/OBt9veuGvJCJk0IuP1cmo= X-Google-Smtp-Source: ABdhPJzCoBtA/iS+mpZ4QvAWXMjQWd3aYR8wrxRTooO9F7MsHcG026J60PD1vlmlJK057tIvHhGQ7Q== X-Received: by 2002:a5d:8591:: with SMTP id f17mr1320683ioj.26.1589929882549; Tue, 19 May 2020 16:11:22 -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 m4sm415701iol.35.2020.05.19.16.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 05/26] video: Split out expression parts into variables Date: Tue, 19 May 2020 17:10:37 -0600 Message-Id: <20200519231058.19945-6-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293825 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=PYUF2hBF; 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 49RWrC1nYNz9sT4 for ; Wed, 20 May 2020 09:12:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AD73481E6D; Wed, 20 May 2020 01:11: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="PYUF2hBF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 84CDF81E69; Wed, 20 May 2020 01:11:30 +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 786DD81DAE for ; Wed, 20 May 2020 01:11:25 +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 w18so1140956ilm.13 for ; Tue, 19 May 2020 16:11:24 -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=1cGbxy2ytBB9nPcB6xh0LYqUidl0ofFXrzK7G3o8BIA=; b=PYUF2hBFmfGSOKd7zMmlAtBse0b1gm92f8JcVaN2iyT7daU3pvZNDQ7OtIW7BBJWgq HTEtqFStm93Q4g1PoqcHO2mHZ4YLh/DzwDYF/m6aB7pLk72DHJJiM/hE+0as/FiMvNkO rQ/ZQVWKF5WolFvkv8gA4S7hPw+g1WrsZuT6c= 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=1cGbxy2ytBB9nPcB6xh0LYqUidl0ofFXrzK7G3o8BIA=; b=DMFhUub3+IvaPriW77/+tuJv21V8HGsr0pSJbMZe49W70e2heEaX2hs+HhsyAOfPud 0Sp4yzZ/nLrwdIcwIDbqMy/2OXJqELUCjerP6Bxtrtxoc/4pgcTAsHaeF0YIPawVkXce a6MfiifgdZorAykgDp3McWtYh7v/0qszLe0gSa4Petoe3culdugBH81Aq4mAMXx5Abfp EOyl9YoP5jZqWroX2ou7NO6RUcbLLQEImgI3Zqo0y5IsUz32ef9qG5amakEcRsft5WFA H14oIR87+UQLuaP0L1aTzov8ZjiIbYI5RXXMtlT+q8NN8cns/YaR3KhSDwTNPWBa/wex G/MQ== X-Gm-Message-State: AOAM533f/AKkhRCxOWlXk2fgrOSZ5/LC8/MY2PjuA2X7IXRh4nH88QIu qWzO3Lydnld7m0ivAv7oAw/h29t4v1s= X-Google-Smtp-Source: ABdhPJzeo/MmBghK84fA0PYEfo+ehAZijh/mtivd9y8jpXMf/VJIElrv6eLnxAYZ8S6EdO/NHTFU/A== X-Received: by 2002:a05:6e02:6cf:: with SMTP id p15mr1527100ils.146.1589929883587; Tue, 19 May 2020 16:11:23 -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 m4sm415701iol.35.2020.05.19.16.11.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 06/26] video: Adjust rotated console to start at right edge Date: Tue, 19 May 2020 17:10:38 -0600 Message-Id: <20200519231058.19945-7-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293827 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=NJbIpMXF; 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 49RWrp2xjqz9sT3 for ; Wed, 20 May 2020 09:13:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2BAFB81E77; Wed, 20 May 2020 01:12: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="NJbIpMXF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B9E1780825; Wed, 20 May 2020 01:11:32 +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 4818B80825 for ; Wed, 20 May 2020 01:11: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=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id f4so1051972iov.11 for ; Tue, 19 May 2020 16:11:26 -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=iFx9+v+LoDO6zbyhUyKXBhaILch2t2Sz7yLsTUxbO6Q=; b=NJbIpMXFom2nTjg5Ai/hfGW0bj2KagaM2ANux5ICGsbesgYWFeZ2B2Y6gP5592pfhg jD1AuYEgneVjITQjN1q0ouBXwmCXq/EzN408u+qdfcpNo88jPkebtdchdss9YsEw9NyG Xbk4ONWIIrcLZxKRc3wnkCwR1pdjHBXiJeKOc= 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=iFx9+v+LoDO6zbyhUyKXBhaILch2t2Sz7yLsTUxbO6Q=; b=OqksRC6t/TVHQuuxlfkXtwLXCEyarUu8ZPdAV+QHTUiv/POIDKIDa5IJ1mb/YbJyhd Fco0MMdHDkwWq1QbBNhr9ZPjBNXu0y9IkH56I1oN7JBwmBqEEQfS9tSDDj32HxJYEolu 7pByD1cySqh68P57AUYdxxqlvovXlgCaJ2//3lMIDWQH+xF616G6sHb0mUEWOGvP3lnW +HpGO6WWXQpOnWIbEV3LuO7JXrXc6w2F1n8fBsqyqMEcwtIbSTY/E2rrXVST8ontEibg TTR7t/QxcdEAsUmpqXt7DKDVMtCe3okwyRExKb8Z3DYaV/jG2GsvJHIDImF1ZaCU8YTP JGrg== X-Gm-Message-State: AOAM532SYdaheVQK3bcAmwyJYhCjrXwCVagz7zk2I489DLATR2eU3SVN oqz5wIVdGmMrcVCxoWo3E66gtIrOffI= X-Google-Smtp-Source: ABdhPJxcTqXqFOUmmOG6ET7rkJxEflqEg1Ceg49d+a38Uk/VbvGUS2v/FmfAF9cN7I8MJQaiBVKhXQ== X-Received: by 2002:a05:6638:84:: with SMTP id v4mr2128152jao.110.1589929884626; Tue, 19 May 2020 16:11:24 -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 m4sm415701iol.35.2020.05.19.16.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 07/26] video: Drop unnecessary #ifdef around vid_console_color() Date: Tue, 19 May 2020 17:10:39 -0600 Message-Id: <20200519231058.19945-8-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293828 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=AKSql6Uz; 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 49RWs35CXkz9sT3 for ; Wed, 20 May 2020 09:13:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2BDCB81E7D; Wed, 20 May 2020 01:12: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="AKSql6Uz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B0C081E69; Wed, 20 May 2020 01:11:33 +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 9AC3481E44 for ; Wed, 20 May 2020 01:11: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=sjg@chromium.org Received: by mail-il1-x144.google.com with SMTP id 17so1201643ilj.3 for ; Tue, 19 May 2020 16:11:26 -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=htAZYXGmSyjTXbEpok8S+TNk6LPAET2c4KEcCPBziZY=; b=AKSql6Uzwd15k5L7ENNcM8Wl/jSK20kp2YIf8nv6uUIjIzF3u4YWUxh5/H4tsL4oO1 ZBCF4CQwVNif+6AQvGQUQlJZPaOedDmZv3WrNRrst5DAhHrLNd4Pgs7qH5UjqzVEoEJe nuFqJL666bHgoCfiBlE8Tvx1eGu5QxmaXdH8w= 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=htAZYXGmSyjTXbEpok8S+TNk6LPAET2c4KEcCPBziZY=; b=c+XmUl44vkwF7x9n9zFAVqQWSCFaRPdvzqFUl7i8+vBaRIOWSEeGCgWP/rTjLsGnml V/uF36t3IGqmCrhLu5kXSXF5HLSweXWyZLAqXJF/A6nbeTM0UP6XpM7cTuDj6bDKxELC mcbYNQtCwjm6KjT422IbmGTi2MDBE22a9LXyxIlUwY73V/HX8s8r1DY4SWt1H06P/ah1 O7KktF6UOuuzOW4YgzaKS5VLNo3yXevPGz8hsl96Mm0Vc76Dx+/oFa2Cnh+q+HLfJNLf QeUdWM66MfZBgCPlU/5+eoLEypyX6GfN6njkvjZXcx6H9yBtyufYkS26O6G7zMfOfyPZ WQkw== X-Gm-Message-State: AOAM5324lj1LllKyDWBVmIN3Pi2VBm+PqulkBHNALQhkzvaBwgne6VeU p0VQNvDdiX5Fe5zrRuBvGs3VRCvk48s= X-Google-Smtp-Source: ABdhPJzMkbb6XW8GKa7KPhzEAlPVyFIw5m0sdKE2V/BxsFCO7EW013esqtZjiXRqQN/yxhGuHuRvEw== X-Received: by 2002:a92:40ca:: with SMTP id d71mr1504914ill.200.1589929885351; Tue, 19 May 2020 16:11:25 -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 m4sm415701iol.35.2020.05.19.16.11.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 08/26] video: Add a comment for struct video_uc_platdata Date: Tue, 19 May 2020 17:10:40 -0600 Message-Id: <20200519231058.19945-9-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293830 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=eej7OcgW; 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 49RWsY4jm9z9sT3 for ; Wed, 20 May 2020 09:13:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 615B481E8A; Wed, 20 May 2020 01:12:12 +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="eej7OcgW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D6A481E6E; Wed, 20 May 2020 01:11:36 +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-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (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 9C5DF81E59 for ; Wed, 20 May 2020 01:11:27 +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-xd42.google.com with SMTP id t15so1104884ios.4 for ; Tue, 19 May 2020 16:11:27 -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=m5Nmam0xREA63VdP3pVpwAm+VnzHIggIhzo/tEb7GUk=; b=eej7OcgW6KE/b8D9BY2ANxMMIAK6AiHbqnvz9m8plBS62S5kKMWya9u31C7zpP35KQ idL4Hpf1OeeiVmNNJD5AjOWjw9TA55X1Et+jBEKKL2cqYQ/sUM08OobZlD74uxFf5722 qTeWxwMBRPUuRowSA1uheZbtqwNIEcrxMDnLc= 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=m5Nmam0xREA63VdP3pVpwAm+VnzHIggIhzo/tEb7GUk=; b=CfR39qybSTD12aHLpC0UAxQSAL2LbXz1jChA1rKGwdlfWvsSnMdtqmXLTc2nWw/uh9 KRdi0pex5yV0CLbiVC7uSVm1SZQx9rqJpUaA6pQwxr/iwU7De9P90o08aLG9eI1snWBb XCD8Fi2ZLL4PDWGWatKIRPT8bokJV9Eixj5iY/0TDM7RHG9ntN+8fxRj87K20rvLW4Lp z0ij9ychO5VXxXmoArdIZkJxyYgWKExln9tgkv+7jTXfPD0kEN6nr8hPy44aNr7XuOvU ukiIbWLRsmwXpemwNEvstCxJcpxc14hOO5Le14GPdLBQS0Xo+quH+kDbE28vpCjdYp9y i39g== X-Gm-Message-State: AOAM533exbJQF76DsyIRtwrfWg8ehZCpAmZ8zLEH+L029GpwGb0rqUyb qtBKyPO2Fpij0+H73jmCaFj3hA5fFpM= X-Google-Smtp-Source: ABdhPJzc7A4wPoReo6h/JctoOGlnJnhSpCucwqxj97wCU5CXV5/adt6sEZWOcPmSD4KSqqTo5F7DiQ== X-Received: by 2002:a05:6638:224d:: with SMTP id m13mr2056735jas.100.1589929886141; Tue, 19 May 2020 16:11:26 -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 m4sm415701iol.35.2020.05.19.16.11.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 09/26] video: Add support for copying to a hardware framebuffer Date: Tue, 19 May 2020 17:10:41 -0600 Message-Id: <20200519231058.19945-10-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 38123543a5..1cf63efd48 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -14,6 +14,18 @@ config DM_VIDEO option compiles in the video uclass and routes all LCD/video access through this. +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 DM_VIDEO && DM_PWM diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index bf396d1091..9fbaa8db10 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -200,6 +201,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 Tue May 19 23:10:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293829 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=HOxCc13j; 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 49RWsK6Qbcz9sT3 for ; Wed, 20 May 2020 09:13:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2C5BB81E84; Wed, 20 May 2020 01:12:10 +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="HOxCc13j"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0D3D181E67; Wed, 20 May 2020 01:11:34 +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 4526181E4F for ; Wed, 20 May 2020 01:11:28 +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 s10so1082119iog.7 for ; Tue, 19 May 2020 16:11:28 -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=XgdiiKzjbfNoTtJJitkoDj6DXS1ZTrpwtrUIieeNaIU=; b=HOxCc13jdNrxCmzapSf0+AtYMGcBWmDjFj59jVp+Cv09QjGPj3CiccgxsEsbvUP0ET eGm/Sr1X+UYJXiastkoztg5LniiU2lhz7mUj39CUN7FMzApjEEscGoP1WT8c32t2cbWT uTkM6OhVsnyLE6uaj3G+cG/RKrZF5DzRhaBw8= 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=XgdiiKzjbfNoTtJJitkoDj6DXS1ZTrpwtrUIieeNaIU=; b=ade+UPLKaKJj60IB0Q8MbrLv5G9b2SkmI0qFWN4Ue2vDUALkZw/bfpQIseps+sfp2i o6ZQV04iCs6gylrwxLfcDNTIksSmHxrclzrJiKvJ+lzfjEq9yzEkAgNXmosdDds6JAFS UhQZiAgJ5g8qLnLSsKG2TYebb4g4eUAHMFlnaa/VSk40aQBh5zgOoKdZ/SYKel5Y0trT p0td2rUCEbCXPFRHsHZwrcL9zUKG1G0wYAjG9RaAKXtMz5JeJtS8KzmXUILmYDVLiuUU XsohxbDYfK/aPVY+zKAZ3XVHCHWOraz4On9PeydlkgIhBZ9fW+96Q2aMjcalfmA1ioTZ 8tqA== X-Gm-Message-State: AOAM531HdQC0P/yBswAPVyGRoDwq9g/lgTbR6uC08pZ6cBvJFeehdcLN 5z3MJu01v90AsaxpV0EgLm5Sgf1IEvo= X-Google-Smtp-Source: ABdhPJwr7iWk+3Vz9Mi5vjWL3i4j3KSiUZHpS5Wy+xMG5qFDcR/exavH3lB+AEmr67BMtTuxWvek+A== X-Received: by 2002:a02:1746:: with SMTP id 67mr1941529jah.103.1589929886963; Tue, 19 May 2020 16:11:26 -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 m4sm415701iol.35.2020.05.19.16.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:26 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 10/26] video: Set up the copy framebuffer when enabled Date: Tue, 19 May 2020 17:10:42 -0600 Message-Id: <20200519231058.19945-11-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 9fbaa8db10..0c97377ea9 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -292,6 +292,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 Tue May 19 23:10:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293831 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=h1PEnmzT; 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 49RWsm6qbJz9sT3 for ; Wed, 20 May 2020 09:14:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 23E7781E90; Wed, 20 May 2020 01:12:15 +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="h1PEnmzT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 88F6381E67; Wed, 20 May 2020 01:11:35 +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 1EE5081E53 for ; Wed, 20 May 2020 01:11:29 +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 c16so1104276iol.3 for ; Tue, 19 May 2020 16:11:28 -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=YlOiMxS+cJqf7w9y3MWMPluAOakFCXKIPjwZ+qOVLjU=; b=h1PEnmzTcNL1TbOWJLP4nXxqx1d9OQb+G9AU9TtIlv7YVjluBI46w12mQZ9ybX9PRb T5MExDi6v9huigfOLrWMCfBzoFQ29157zhwCqwClw7a3wzse89VcE60qVS7tEHpWX/oX wr/Vi9/IcyTlyrt0VqL77QuDOwCqdlaaCxqPs= 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=YlOiMxS+cJqf7w9y3MWMPluAOakFCXKIPjwZ+qOVLjU=; b=RSP1oy6NPRgHYfL0EpdpKjIw+3aqlAJ2Of/lpi++LsQwAQ7ryAiFYF+H3n11iQe+K6 qij5V1nOmRz9FCrGtf0G7+meBPPjfwbGd/xJf9pUWxsVY5cg+YkJSPS4hkWkvTGJupUE lRQXbTo1vP3PnZ4QaKG3wl9KQoH72gysej/1cS+wWpz2Q1KrmBJv8ik75yZJ6MVaiBpD 2ufTdbYKkzYDmpv5AfQYajbsj7T23ubphbCHmixKAML/EkyrZd1N5zqyflqmHG1qXQE1 9XDUSTL2drvaoBuXGLnKmdStSupM1rCIO0dlrMVVPPaCSiWqV8ALN1wxlMcLMVARVzz0 M8nA== X-Gm-Message-State: AOAM530hQsTSWPZKhouctdInE8vI7eYQERPUwGTSgy54YRhfSge4L9nM wCDEIkskNwWoNgmQlh6xfEq5sKxM9Vw= X-Google-Smtp-Source: ABdhPJys1lLSDp4DzcU9DCVnvtwVbLWa2VSkxqXV4/awdrriwDTAzHryR2gOMIP0zMnOoO2aC/R72w== X-Received: by 2002:a02:3e06:: with SMTP id s6mr1996465jas.57.1589929887708; Tue, 19 May 2020 16:11:27 -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 m4sm415701iol.35.2020.05.19.16.11.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:27 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 11/26] video: Clear the copy framebuffer when clearing the screen Date: Tue, 19 May 2020 17:10:43 -0600 Message-Id: <20200519231058.19945-12-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 0c97377ea9..4d6f950eab 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -94,6 +94,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: @@ -118,6 +119,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 Tue May 19 23:10:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293833 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=EX4ITIi9; 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 49RWtC67wkz9sT3 for ; Wed, 20 May 2020 09:14:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A9DE81E9D; Wed, 20 May 2020 01:12:19 +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="EX4ITIi9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 139D781E59; Wed, 20 May 2020 01:11:38 +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 D0E6181E65 for ; Wed, 20 May 2020 01:11:29 +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 s10so1082176iog.7 for ; Tue, 19 May 2020 16:11:29 -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=A9gida9JsjvH0cn8ANnWBsIF2EN37diXvUxBaGz8Xow=; b=EX4ITIi9HflkDJA5oCfoNesLcg0R1Ma5ZFmvrDZ4l/XC3K7jFhkz+FFc6zjjJXl197 4RWm38hFrS+Q1DK9T83MUkoURzD85LVUdzeVqXl+ItKBs1rbednHsgAQtSN9OCzmQiAN 4bmYkJ+oBCnh/v90XllvvI/fGaB1X0M+rPgso= 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=A9gida9JsjvH0cn8ANnWBsIF2EN37diXvUxBaGz8Xow=; b=B/nCvZsv68vREYx7iTmHHDEnsuG2UDguUJiLWr5pMp1skh/6dZxTej1Ex6qY+gO/ie zlFwoYiq1JbTlfPD2dBmltuZE7RyqnTUTHIbboQok8Upz4mWmNLMhOEq9Y2I0v149mzU E2Oxbb5lovjtw71q/DCseZ8KHG7O8vYoAMTow1t9jPLHDGm0p969Lp7zYpygBJEXV0Bb FcUVXDMqKh9xVWScsospBgzwCifBXqL6ViapnCTDgiCeD0q57BW6JjU2nQvHlSy6j12+ aB1WtJW/Se8u2gbu0OiiEeffXKYPUeYIRAQZEoM/s+/8RQhuSBrQdzNEGpR+yjUO3BGS 9ILw== X-Gm-Message-State: AOAM530GrUk2cPpEytxCKO0nRizU6eo67T4PYjJ/+aAO8A1g/ZkdPLtN HkBUDVbrCZZUpbj5CF1tfMEF3hewiYk= X-Google-Smtp-Source: ABdhPJySspbUCoQNtn7ioDLNXpifdilkwVS4uQgKoAs70gKHLi/Vly+BxvaXJ6BMHhrEO8GfHvruzQ== X-Received: by 2002:a02:77c7:: with SMTP id g190mr1950481jac.140.1589929888495; Tue, 19 May 2020 16:11:28 -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 m4sm415701iol.35.2020.05.19.16.11.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 12/26] video: Add helpers for vidconsole for the copy framebuffer Date: Tue, 19 May 2020 17:10:44 -0600 Message-Id: <20200519231058.19945-13-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- drivers/video/vidconsole-uclass.c | 22 ++++++++++++++ include/video_console.h | 49 +++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index e06912cf36..130c04bc27 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -629,6 +629,28 @@ 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) +{ + int ret; + + memmove(dst, src, size); + ret = vidconsole_sync_copy(dev, dst, dst + size); + if (ret) + return ret; + + return 0; +} +#endif + void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row) { struct vidconsole_priv *priv = dev_get_uclass_priv(dev); 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 Tue May 19 23:10:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293832 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=Y3tLQ6jh; 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 49RWt00KgVz9sT4 for ; Wed, 20 May 2020 09:14:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 17E4481E95; Wed, 20 May 2020 01:12:17 +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="Y3tLQ6jh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9F6A381E64; Wed, 20 May 2020 01:11:37 +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 863EE81DAE for ; Wed, 20 May 2020 01:11:30 +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 f4so1052106iov.11 for ; Tue, 19 May 2020 16:11:30 -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=TzDFUW/MU6FRu9MEaPwtSqW+SdWdNSqRnXvI3/OUDbA=; b=Y3tLQ6jhznhkWdIZyPknV9vC18PeAcSi3/zpBQZnXKtGAgyn6Lv6iL30CJFiYj2sED cfDjAuzRnOlls4+Jmj0MnF1IFX2pqZtkI0xcA3d60vkSEuccU2mfiqILefw4D5MGuPhF 74vN//aanDhWFGLpxHTBJHCj6sWYD/Rd/DyhA= 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=TzDFUW/MU6FRu9MEaPwtSqW+SdWdNSqRnXvI3/OUDbA=; b=LbggGX0VNKqUrK2xU8/N5PpSpyeKy5e4FmA45JCmj83ad4S9mL9wSMGbIyXE2lIdOh /nFWp8dpHTLCIPNiYMmTCE89RkkvS7nz3clT0d1lynvPnRi+HA9u2DgCsNKWtd4b4BYm aAU0MCdKydFICymj0AJ3VufF2nkzPS/QDtcdbBdSsFitjPSjTAAvDYr2JlKDK9lYpoKD r0ehfuyCb+T1sLXStHClg6Aza1vH77IuEIckej1JfghYA4ITRpKeoHHTnP4GzgtnMCth rg6GTc7RGSsuJIv50LZ6UVqmfFCr3UWPxAk33VkbDZQ9mJpE1mLMd7ef0fjAOWjj5gZ5 6/yw== X-Gm-Message-State: AOAM530dD7N45upyAui1L4TbEO0psHeHDlm148ERL+CGGRvmj7vDzY/Z jEAe9r9HSVSwUsUN48TOHkOxMkyx4NI= X-Google-Smtp-Source: ABdhPJwrqEjo8of3eES9nwvUF/LRplfCGnNF5KtKlWnqCN5G/wDb3YI/EVURxn/KIluSQrldiSOn+A== X-Received: by 2002:a05:6638:118c:: with SMTP id f12mr2146598jas.6.1589929889259; Tue, 19 May 2020 16:11:29 -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 m4sm415701iol.35.2020.05.19.16.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 13/26] video: Update normal console to support copy buffer Date: Tue, 19 May 2020 17:10:45 -0600 Message-Id: <20200519231058.19945-14-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293834 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=Kdug2xVM; 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 49RWtR4rb2z9sT3 for ; Wed, 20 May 2020 09:14:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5042E81EA2; Wed, 20 May 2020 01:12:21 +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="Kdug2xVM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 36C1481E64; Wed, 20 May 2020 01:11:39 +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 80FE581E6A for ; Wed, 20 May 2020 01:11: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=sjg@chromium.org Received: by mail-il1-x144.google.com with SMTP id a14so1209893ilk.2 for ; Tue, 19 May 2020 16:11:31 -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=NngOjUECllnB1LC9n5J1QU6t5popsXMlbZ3p2uNlVsQ=; b=Kdug2xVM8ijVqdkj0rtVIDITMIawS9QpGGPeGXSlN0Kaz1VXlgWHwggfYcUMV7VXuG qhZKL0mvsSzay0uiDbcQEF81lTRddDgrguRwzkCdVrYo3hmnRGMF9EvC7B9pOh6NGrCy dcX/qTHvWW4jlA8n6O1wPt6bnIgiBEm0wAXIE= 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=NngOjUECllnB1LC9n5J1QU6t5popsXMlbZ3p2uNlVsQ=; b=V7spT1BmZUI5lxDjYFVzeaAapzmvjJJW1xzK58x0IkzhT8usdIaZYtAEANpEc84/xw qbFLCVT3r9q+i9fIul74JMAeG1RggK2Q3VgKcf9tcXQFeTE3LJouJyDjmE+0ry7IH+Ai Hr2a/e/IqGkciRDflqbFE+oFIKRhUdmhF4wqccgRU9aaMA9riz1P22CnxBK97EPMREdj aEYizy1jFy/Jk3qoyxjpjrcd1mjbAn7dyasx9bYP/fG1RG0rvgMp/afN/e+XEVG6nLmb 1d4XK/17cfnSCPEXQgjGty/DindusMTRVyQc/1xN7WXDLYDcWtleVwD60TgbTH5x7ssL KnlQ== X-Gm-Message-State: AOAM533N5cz5WOdtLNYyJ4eR0bjCWgJGsKY3PUpRwAF2IceeHsDTR7Wi TGwJJueHvLFaYX0LacVckLk7bw3wpmc= X-Google-Smtp-Source: ABdhPJw7uECtdO/pP0N94VzX1ijMUQfTnkKVQh+96PCutNL/zXjgLvKnvcN/rRPx7blxLGxMYKGTKA== X-Received: by 2002:a05:6e02:46:: with SMTP id i6mr1402429ilr.298.1589929889996; Tue, 19 May 2020 16:11:29 -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 m4sm415701iol.35.2020.05.19.16.11.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:29 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 14/26] video: Update truetype console to support copy buffer Date: Tue, 19 May 2020 17:10:46 -0600 Message-Id: <20200519231058.19945-15-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293837 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=ALCswgLg; 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 49RWv35B8Xz9sT3 for ; Wed, 20 May 2020 09:15:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C183481EB5; Wed, 20 May 2020 01:12:27 +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="ALCswgLg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0606781E64; Wed, 20 May 2020 01:11:42 +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 AD35781E42 for ; Wed, 20 May 2020 01:11:32 +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 c20so1192270ilk.6 for ; Tue, 19 May 2020 16:11:32 -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=o6Lw97m1BG+F6hgZmdudUTnN9xcBqzZ6hZ/1hnb+Njk=; b=ALCswgLgXyrpijpHSq49MiTwXx9we1PW75he4oqD/c7o9yB7URg9IkCyzfa1uz31DO bMX+cupYpxHH1ziXiHK3MLefgtVCd4sc55TrFWvuh4dDc4rhJHOnq3EVxMgPmRiJ205b kSFikAKPcR6wkyYYZXEG4xkF5k8sPiDwOX81Y= 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=o6Lw97m1BG+F6hgZmdudUTnN9xcBqzZ6hZ/1hnb+Njk=; b=IKxLIARczkZbPQoTlkkyMcxvk1esGPLrx1q2yWcv1ANuGcXhnnU8nA1t+C7Vke7wDM EbwkPptvR6o7U/IBzm6bIHR0guLUrsaSOlkCtffOFAU3/gUeL95qdygVXp7YY4e4FAr3 B9y9gdK+uxwayS6oNLl/CS02uRFDPkHBK6F3zH0BsGh9eIxZMdpeQKQ/1h+5IxEN+0Nn eZUsnrUlgUWe3hbztfCCQogrp0kwHkyUoWCb1hBVJBgY62ZscExc8zB7X5JNCEhMukc0 5YC1AW+QjwqHIZEONn8HnxkFhNy7qfz1fIl/KfxRQea2Q55CW0wMTNPMrCX5i10Xb9eJ 5TdA== X-Gm-Message-State: AOAM531s2uYwoLZdi2F2wMVkTqmxtxKo6iQ/KWAS08I9OtNoOUfYJVqV ofT+UKrRd++zz9hAPGbHXPikKcnvY7Q= X-Google-Smtp-Source: ABdhPJwqFyKLJTbTixR1lq6FR0z3+xH10fJmWE7NU7AOZmPS0ECUyufBbfIhML4qshCaqjxQwNDnTg== X-Received: by 2002:a92:9e51:: with SMTP id q78mr1511489ili.268.1589929890949; Tue, 19 May 2020 16:11:30 -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 m4sm415701iol.35.2020.05.19.16.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 15/26] video: Update rotated console to support copy buffer Date: Tue, 19 May 2020 17:10:47 -0600 Message-Id: <20200519231058.19945-16-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293835 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=c163TzWm; 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 49RWtf11vrz9sT3 for ; Wed, 20 May 2020 09:14:50 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8DCE881EA7; Wed, 20 May 2020 01:12:23 +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="c163TzWm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2A59C81E73; Wed, 20 May 2020 01:11:41 +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 18B6181E49 for ; Wed, 20 May 2020 01:11:33 +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 c16so1104419iol.3 for ; Tue, 19 May 2020 16:11:33 -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=9CVKkat+sZWyjdoSTrKP4gsaVPgIOBUi7ul6aV0VKo0=; b=c163TzWm6cLz7vCDQP53lkX7HJrKM8Jxb43udgVGS6dUWQXligq1iJ+xQ8lnreEGOf 8ryYx994DmEJH0QEKYxoz64qrmCtiDLy8VD55O7Og/miiSGuz8Yb95KX1b5CahDsZ8em GXYK11qui5mXBWBZJ9WBDlUKyoTT0WAL1ETFc= 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=9CVKkat+sZWyjdoSTrKP4gsaVPgIOBUi7ul6aV0VKo0=; b=oPpT/BDn89vb5JAgrPuXlIdeTSxz4FrcNV5L8SIEShxeRdq2oD8+HdwyoWv3DefqQC ny0dwOeYy2u1cbqweCmcLM3jWH4fapqPCK4a+o2GzoCOJvGz09Q2hRn4krJJ6WLkMYHy iSCdrmEEHfe4a1EKAnxskDoo5ecz/Gsb9LaxzB8BkXs4rqNSdh+I38Ggo7LzM2Fty1NR fA4PQDAFUybzOYPXQ64ac4tB85O3M9t5sYuO3F6EvygLalWvvT1/qS52lFhhc5WfFqdr 2yY1JvPDCFhpqZyPUFfw2DC5uoSKbFub3GjJdB8dGJ0Rgr6Yhu2RAuWG9OH3FQKdIiTo ALmA== X-Gm-Message-State: AOAM5300dcusLFQFFxrmXvsKvk3tmhowRfpft1Gk5i1AZ3gG7unR68Ml Tm5ZOVmakl4zNK+D49u5JU1pY9+kE2I= X-Google-Smtp-Source: ABdhPJzJ+3qJLtMszlbAStOC30oYw0Xmk5eG33RAvOOBbVdllWwOZg1SUd+l3l0yCDAokwsLQBWH5w== X-Received: by 2002:a05:6638:f0c:: with SMTP id h12mr2042675jas.85.1589929891791; Tue, 19 May 2020 16:11:31 -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 m4sm415701iol.35.2020.05.19.16.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 16/26] video: Update the copy framebuffer when writing bitmaps Date: Tue, 19 May 2020 17:10:48 -0600 Message-Id: <20200519231058.19945-17-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 eb9636541d..732ce3bcc1 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')) { @@ -259,8 +260,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: @@ -354,6 +358,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 Tue May 19 23:10:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293836 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=UWpyEym4; 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 49RWts2LnHz9sT3 for ; Wed, 20 May 2020 09:15:01 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A73D481EAE; Wed, 20 May 2020 01:12:25 +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="UWpyEym4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 33EE681E59; Wed, 20 May 2020 01:11:42 +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 DFE6D81E44 for ; Wed, 20 May 2020 01:11:33 +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 n11so1199222ilj.4 for ; Tue, 19 May 2020 16:11:33 -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=uUBDMnMg+BHo+u8cWEvBeMoCSFEoNC/9rDUWFXzRS5E=; b=UWpyEym4oxjnxjiCqdoRy7L9RDmOQwr08Nz+yn0qF/1ImR9+cB5UfLT4/8EATOVOv6 k2LlmgZYQszg18V4LPSrZ6EP56DEHy2FPo591+CQagEixoQvxvyxPJgDa0jrWPaoUtUu SZlxQJjl7AadfgVm2cvuz8qkJCX08esYXq5Bs= 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=uUBDMnMg+BHo+u8cWEvBeMoCSFEoNC/9rDUWFXzRS5E=; b=AFsXP7A7MbDJTjkq7wwt7EK6fc7uaEK+hFe3rAq4W3B/VBLg+Iz9mOphQFO9qBsspK Twh3kMEsZbPyd/dXIqZ10cAIVE3KOeMhJ+GinqVk6uu5c2k3Y1Yu7syGUZEkUksIVI0Z 97DwNANc8v6LJ3nBJ8iBDmuv0u9dN4bFGRaYXZLZj4EuFo9+Hjas6bkhdP+NztOZfZQv zvQBLk1Glwe0+QeT1kod3tH7kaf13zjV9O53S4lvPmtXqd5/i6feRvdrNSq8FsUOzekj P/Mvk3Uc6SQcXaPy76oWjryWExIVRUGDWvFcZz4ttGLn71H8gENefg54Gc+67xrC6u1Y walQ== X-Gm-Message-State: AOAM532ROPST0whKDt9qNlOikXyEUGtjX9LWBIcxFK13y+lW0cpTFY9m ae8OZme6wCloNi/1r6T29tGu5dZGsPU= X-Google-Smtp-Source: ABdhPJznhu+6B48X4i21/tkF0QckP+ItNqbt4evroGCx3TvS27MaEWipO/bC6ks51wqcK9bQcadcOg== X-Received: by 2002:a92:ba46:: with SMTP id o67mr1451031ili.66.1589929892531; Tue, 19 May 2020 16:11:32 -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 m4sm415701iol.35.2020.05.19.16.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:32 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 17/26] video: Add comments to struct sandbox_sdl_plat Date: Tue, 19 May 2020 17:10:49 -0600 Message-Id: <20200519231058.19945-18-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293839 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=U1b0uEHX; 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 49RWvT2Fqkz9sT3 for ; Wed, 20 May 2020 09:15:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5622681EC3; Wed, 20 May 2020 01:12:33 +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="U1b0uEHX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AF34381E44; Wed, 20 May 2020 01:11:43 +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-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 1F85581E69 for ; Wed, 20 May 2020 01:11:35 +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 79so1111470iou.2 for ; Tue, 19 May 2020 16:11:35 -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=/Mg2T3tc4HlJQCiMkI0B60wfkuU/eaXjnhoW50X+EKs=; b=U1b0uEHXYSdt0ZwfD8M1dAuXT6pnUzyY/MB+p5lNH1Vj+mECbXr54eE2Xr4+WNrNav IazqMkUfiWR+NCxpXXEpTOpiL0dQOw24xQn1QQYyXvPHVtMhEKD8XkKl8fXnXVsDQduM ayRVBjNwt4YApHMaLwt2vWoYUc+wyQ5MrF0Wo= 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=/Mg2T3tc4HlJQCiMkI0B60wfkuU/eaXjnhoW50X+EKs=; b=ZwuUu5uiHwpXEcFxsYrvVtjsHGFo7ITWhwJfr8X8On7CIPU+CIVYlIkjrYGm0/HBfB aRsuwF+Skv5958YWBhf8jYtrpuuuDmO9eaIvymNmM+PHnjpdo6S/Ck8tYjFWSR1caEe6 HVedxjpAq27cNVcpTY60oJ9GIxNVbJkkYvL0/v5T/eIWxyc/F061AF8jeNY0nBPhz1fd 5JdJ3iQlcbSlaL3o+R3+O0K+KEvhRZ/8RRa452RpfdhK5oe/2xtavcSBSE8rVaxfcyOk LV8cJjPeynBh6pLPyrCB828M1cb6Z/IBiikskf2XIO5TGHm9r1chKhyDScjMxEbD60em tqkQ== X-Gm-Message-State: AOAM530re2C2UhR1TnV19QWmEbUpGFtDA8Dqj9gEih4nz5ZLxptBQzo9 5aXUQXQBXmV9m4fLHfdhhV43MtgVpdM= X-Google-Smtp-Source: ABdhPJzdgLTrc6DoFhl41PLMSfNEnODvMGRrHa2vcp84iQV2YZfVH2n8+sAfhgNG0Me6SpBT1bM+WQ== X-Received: by 2002:a02:ce26:: with SMTP id v6mr2025984jar.40.1589929893398; Tue, 19 May 2020 16:11:33 -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 m4sm415701iol.35.2020.05.19.16.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:33 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 18/26] video: sandbox: Add support for the copy framebuffer Date: Tue, 19 May 2020 17:10:50 -0600 Message-Id: <20200519231058.19945-19-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 9445d78118..ea567506e5 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -215,6 +215,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 Tue May 19 23:10:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293838 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=ZkUffkQr; 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 49RWvH4wlWz9sT3 for ; Wed, 20 May 2020 09:15:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C1DB781E69; Wed, 20 May 2020 01:12:30 +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="ZkUffkQr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4C69981E49; Wed, 20 May 2020 01:11:43 +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 B059E81E53 for ; Wed, 20 May 2020 01:11:35 +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 n11so1199287ilj.4 for ; Tue, 19 May 2020 16:11:35 -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=sMbXpzZ24uj7I7LCvZuGlQpI3E4EgtwIzXpJG6b7yDU=; b=ZkUffkQrL9BCK1QpUdbWeCEwBobqqnzcfV/wntr4NbL7kTf6kaA1M6nw1mdNryiIjP ZH4lTUtcTsu8VkUrSase6opJFokmbgPZi3/FSA/8b51dGCg1QCgvctKoQ8MCLomBMvLC x+oEpZ/0BTuaK3vfhAH3gcg7X18OpTjnYyGew= 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=sMbXpzZ24uj7I7LCvZuGlQpI3E4EgtwIzXpJG6b7yDU=; b=GYoz6610x4EIs7SGS8iBMD2qkilqx/6DZrY60qR9eteqU3zbLZEJQOOyNtrLVfvX05 dcCCkfCdXsq/w7PUWGvOJRfH5oNg7hmMrS0KJOdhlOeAHZsAF2tP7zj4UqRSZSl7ubKz k/1xX1JJHqbO9YkPpRDZiYza90/j1xXXAb9pd2e0FFyX05R2FZOFIOcXG8pHwjrU/RcQ OQ1JuWSRNMBQCyn2kvby98t2sC6mk4j+hFdg6ynjQqIWUl57zhtE7FXVtfrzZHi0UFgF /H33YVyke363EZTbnQ9zmAEKlSv1EBHQ7bvcjP+wJzMqJShWjAC8x0nfElY2BPlzWlC7 OoWA== X-Gm-Message-State: AOAM532g2O+knqMHRIr5IH65KQ5USxWuBCOFQ5/9PmKL3MwfrhSr8Wmd ECv53mo4cDzwHzQCanYHaFKdYjkgOaM= X-Google-Smtp-Source: ABdhPJxAvvZOoQvKHJSu34mDFWFO5CuWEYhrL+txwQjMQnHAsL6GVFMP2HIn7C7KfHgnitnGLILccQ== X-Received: by 2002:a92:6608:: with SMTP id a8mr1572203ilc.204.1589929894412; Tue, 19 May 2020 16:11:34 -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 m4sm415701iol.35.2020.05.19.16.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin , Andy Shevchenko , Wolfgang Wallner Subject: [PATCH 19/26] video: pci: Set up the copy framebuffer Date: Tue, 19 May 2020 17:10:51 -0600 Message-Id: <20200519231058.19945-20-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 Tue May 19 23:10:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293840 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=Lawv5iHk; 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 49RWvg608qz9sT3 for ; Wed, 20 May 2020 09:15:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BD41081EC7; Wed, 20 May 2020 01:12:35 +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="Lawv5iHk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B7A1C81E64; Wed, 20 May 2020 01:11:45 +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 943F181E4F for ; Wed, 20 May 2020 01:11: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=sjg@chromium.org Received: by mail-il1-x143.google.com with SMTP id 18so1174810iln.9 for ; Tue, 19 May 2020 16:11:36 -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=Kd0AdRNL/n6oKB+keSmzwc/OhgHKHg1S+e20NvUkeTk=; b=Lawv5iHkKotpi/MYhKyi9b2uHRdJa9FFu66zqKnudaIZPDTVGjEPbvqTXdN8heRPf9 pxDvOp6aoyPUJz8z4McfIRzoZhl4xGQozzJTO3mr0ekW56ad4w6xbmPDuqnyiP3aW1B8 MPEwxruKU+7lcqhYugk7NzAVWYbCoBDD/+q7w= 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=Kd0AdRNL/n6oKB+keSmzwc/OhgHKHg1S+e20NvUkeTk=; b=Jn3DJce+8xKEI9J82EJPhxWZwXQT5qBIqtotwuvKwDAzYnuNE03ODsqQ8S9XAKX05s oMFQ42nS1pzXyXzj4sxjucF+ynhhCe/AS7CzT2wHn4IV3z2M2/0f/Vxk1U42wsmw8dt+ ag5lAiH9nvZdu52kOX12NG06kuyg3pfaYCTr4ApIoBqOtnCErJpajS3hUwyHkfS1l2h0 4RLxtkNLbb3q0Upzlj/W3uwltNsN/l7o5nsLn7Q5azd/RDVZqgL6gMaCOQrXdNq4zOEA kF5Z6+dsdWWfBRzN15xUKOx3dzNWsjw/yAcUIXEzYVf7u4dw6O7Or2HJUUa2UrpxvUhs XV0A== X-Gm-Message-State: AOAM533HpmdWpU1Qm/dfYgBVfPI8DyDLBJK+Mv8OWN59HPFkTqOj9kFs lHrE36ltfy/7BdKTvoLb21bEBpGVj9o= X-Google-Smtp-Source: ABdhPJy5L6/oLdFEPwob//Wyj3YBTzi/SVRxu0M2bCpRgE8G13JcZjXUwECJwfmzY7Egk2Y7RNEcsQ== X-Received: by 2002:a92:1906:: with SMTP id 6mr1466881ilz.144.1589929895373; Tue, 19 May 2020 16:11:35 -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 m4sm415701iol.35.2020.05.19.16.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 20/26] x86: fsp: video: Allocate a frame buffer when needed Date: Tue, 19 May 2020 17:10:52 -0600 Message-Id: <20200519231058.19945-21-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 70224c1a48..4eaa4fa6d4 100644 --- a/arch/x86/lib/fsp/fsp_graphics.c +++ b/arch/x86/lib/fsp/fsp_graphics.c @@ -116,6 +116,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" }, { } @@ -125,7 +135,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 Tue May 19 23:10:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293842 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=OO4oX6Gr; 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 49RWwF0jgxz9sT3 for ; Wed, 20 May 2020 09:16:13 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C0A9281EDA; Wed, 20 May 2020 01:12:45 +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="OO4oX6Gr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D6D4881E4F; Wed, 20 May 2020 01:11:45 +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 8A9DD81E6E for ; Wed, 20 May 2020 01:11:37 +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 b15so1149502ilq.12 for ; Tue, 19 May 2020 16:11:37 -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=EuYYI+A5CgJWg3EkrT2KJiC0Nln12Bvx0c8x3XQH8EY=; b=OO4oX6GrxsSZbwwxVTmJMqMFECClcofvBa4lUlPl4JPpYmJbNV1vL3q13Z9R6987pG 2FUAO8kH58NxULZZmyhmK2R/sOU2JEYE8hVF5zLKP2yxn8vIVTWdCvEV1wUBSn1zMqOY TLw02yhBwnHkaNpz8EHIwTVwUp4FHwtDcHuHA= 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=EuYYI+A5CgJWg3EkrT2KJiC0Nln12Bvx0c8x3XQH8EY=; b=HhgxQXQoPVjTHihZzJ54WInNn8Ej7IdBKgoNGL5WYoGIhgeUijii96JaxehZY1I0dy SZ/T2vD2n+46ULz7DxZx8STn7pDrMMHqc25IJgAQB/vh0qUtiIhtR3niDWglNOMXe3ba BN0eQCWgf4E9/An3uxjqtpokTRkPQfLguF/E0xs48PUnaO1UOea4erXQTGgzhoKwr6tO +M2AlTPq4p+JgohOiJivzmXllqqdWpDWqtzyTNkFnw4BOEzBAfS6COet7ShtY5xVSpYB xFBMuxUoMzwU9oclB0e9STP2KFFLSMoNXrdLAwU24cTn6secBsOu2zvYYIg5QLcIaVcl bYTw== X-Gm-Message-State: AOAM533UKjTXKp1c5acqspFX95ZlVPFvKn+xZsXzJ+1PSOfQAU3fULUb eszqzMAncleSM2D4MH6l7MQTkmoarjU= X-Google-Smtp-Source: ABdhPJy5NW6DKnT9gztPLLhacxcrlWQqihFwloBLi14bdnyeh2Pow4SoPFxwqQnTzsl+kDRoypqMkw== X-Received: by 2002:a92:8b43:: with SMTP id i64mr1484214ild.171.1589929896115; Tue, 19 May 2020 16:11:36 -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 m4sm415701iol.35.2020.05.19.16.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:35 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 21/26] video: Correctly handle multiple framebuffers Date: Tue, 19 May 2020 17:10:53 -0600 Message-Id: <20200519231058.19945-22-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 4d6f950eab..aa543cb5df 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); @@ -350,12 +363,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 @@ -367,7 +389,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; } @@ -380,6 +402,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 Tue May 19 23:10:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293844 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=cmW/Ql43; 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 49RWwc708Mz9sT3 for ; Wed, 20 May 2020 09:16:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 73B2981EE7; Wed, 20 May 2020 01: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=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="cmW/Ql43"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1BD4C81E69; Wed, 20 May 2020 01:11:46 +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 5B0A481E65 for ; Wed, 20 May 2020 01:11:38 +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 b71so1171399ilg.8 for ; Tue, 19 May 2020 16:11:38 -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=u2yyfMpSJNZuC485Q1j9xLlXCSqLVhzG5wO9BAA3GLk=; b=cmW/Ql43pTAyxUuCE2fRMiV5dS7Ela+dyuHCKt/w5/q6kh3320AQ98jrU1yej4Ab7W r8EcxTUFYA4z131ZyEIqP2aqOVvemhtPw6HBW04bIjOPe0SkA/o9sHioOhJ+4PWu3ktb NcXYYe+lOgZne4VbW69c6Ka/C6vRP4e5rzzDE= 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=u2yyfMpSJNZuC485Q1j9xLlXCSqLVhzG5wO9BAA3GLk=; b=gQH/gSuB3tBxuuubF/ftB/s/5TGsZoWuwXlaRMwm7pHp3SBxI/21/9XsyV8VIJCP91 DKGWRaLTsbIMqx6jZtaFq9IQyHDfxhKrdJ9k31Wn/QvUmNEY9rNy9+oCr1O7jwzyYLmr 5iDTR3iLeBIJWB4481QSsgRmy0U/pT7FHF5+mMZD/H9k/4/vs4/W37IkY8L7n7KTflFx zr9XFXSxTMepLxO18q3BWEBDTZlLAtzQcbRnUjqKOqcYwVXEmeBFvwDHN8SbsXS65IrL B3GtPgJlE0f0ibuWC1ZMz/edmA4G3A8gp/jzt26jQ3pX8XmnSImnlSBExUUMW+hT658c 3S5A== X-Gm-Message-State: AOAM533QDd57S8+9rvoE+ZyBrTFkw7/7sdHYLIBOrzJBTYJyQGWZB26v JNHHPHZpmARcGt6FYSfd17kqPW6f/b0= X-Google-Smtp-Source: ABdhPJwI8bvy6mFE0dqF2n5iKRe2h8VhEVcdqj5hTnZo9P/1kF2AM+Xz5Gtbsw/pj62jjG/zEO6hVw== X-Received: by 2002:a92:4ca:: with SMTP id 193mr1470060ile.75.1589929896920; Tue, 19 May 2020 16:11:36 -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 m4sm415701iol.35.2020.05.19.16.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:36 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 22/26] x86: video: Support copy framebuffer with probed devices Date: Tue, 19 May 2020 17:10:54 -0600 Message-Id: <20200519231058.19945-23-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 1cf63efd48..3e65052359 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -14,6 +14,25 @@ config DM_VIDEO option compiles in the video uclass and routes all LCD/video access through this. +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 aa543cb5df..b5a03042c2 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; debug("Video frame buffers from %lx to %lx\n", gd->video_bottom, gd->video_top); From patchwork Tue May 19 23:10:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293841 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=TlqgVwp+; 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 49RWvs1szMz9sT3 for ; Wed, 20 May 2020 09:15:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3B65681ECF; Wed, 20 May 2020 01:12:38 +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="TlqgVwp+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 70CE181E49; Wed, 20 May 2020 01:11:46 +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 5ED1681E67 for ; Wed, 20 May 2020 01:11: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=sjg@chromium.org Received: by mail-il1-x143.google.com with SMTP id j3so1151414ilk.11 for ; Tue, 19 May 2020 16:11:39 -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=Ckpl0cXx/QPf4gSJNlqEwxQ0mkh3rdgy7Mx0KHkBYYE=; b=TlqgVwp+Naka8xZHb6RWM56OQPTzwj1Rp7u6HbDUZzbABCL5E2byEeAOqf4eUdekJD apd0afV5yG1QYRSLVjtY2liB/E11gs/3pgZjOHjvjTUaLd0Vw3xEy0ltyaARfuqhhqtQ CpIyZ/COgAbcXMQYbc5gHDZXyjUK0rlRxjSAs= 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=Ckpl0cXx/QPf4gSJNlqEwxQ0mkh3rdgy7Mx0KHkBYYE=; b=T3dVbog9bmaPyOQRrnV31522CytUIAD2/qMxwVX6l3qMgoMf0CsUqLQIsI9DkbEBTZ Cw83E3N24SFF4iUJNthg9WZlLkGn/Pz7fYBiAYj7bixUGD+DRyN+yOseddJujSU+f71a ovGUWIn9ck/oH56QkiiKxZtdVJuDdMYMt1bCugMNH3MMEXUPHlr3Q4qloaUtaaSZAh+w y3Z7mDEC0rlJ0qMuH0Tb5L89M83Ead7xRFnsnt4Mxs+GQ/+Ol37UVXpRBfDsskSo/IeG tMoTMFtTMxRmJBCB08jYiVRtn36+yoKyj/d+KH8jn9GhnVIf5jhhskC589qVg7he9S1R X64g== X-Gm-Message-State: AOAM532VQf0IQczy770Q4JqXSJs4Yv7nPiwweNZ0ZE4uNIP/bJ070sWG r9U7dDL3qu84pkFhzoSXLQPzDk9MQqA= X-Google-Smtp-Source: ABdhPJy9Z5QR1EhnHdFoa5A+5b3UGJ0lsK3pZ30aNyO9Z8N8sUn4WrEQUMaw3+MFw9tQgL3R1Ljhxg== X-Received: by 2002:a92:aa4e:: with SMTP id j75mr1476678ili.174.1589929897759; Tue, 19 May 2020 16:11:37 -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 m4sm415701iol.35.2020.05.19.16.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:37 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 23/26] x86: chromebook_samus: Enable the copy framebuffer Date: Tue, 19 May 2020 17:10:55 -0600 Message-Id: <20200519231058.19945-24-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Update the video driver to support this feature and enable it on samus. Also remove the multi-line scrolling since normal scrolling is fast enough now. With this change, the time taken to print the environment to the display without CONFIG_CONSOLE_SCROLL_LINES is reduced from about 430ms to 12ms. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- configs/chromebook_samus_defconfig | 2 +- drivers/video/broadwell_igd.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/configs/chromebook_samus_defconfig b/configs/chromebook_samus_defconfig index fb4d88028c..13058ea7d7 100644 --- a/configs/chromebook_samus_defconfig +++ b/configs/chromebook_samus_defconfig @@ -67,7 +67,7 @@ CONFIG_SPI=y CONFIG_TPM_TIS_LPC=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y +CONFIG_VIDEO_COPY=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_11A=y -CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_TPM=y diff --git a/drivers/video/broadwell_igd.c b/drivers/video/broadwell_igd.c index 8e8fe9d9b3..df6a761d2d 100644 --- a/drivers/video/broadwell_igd.c +++ b/drivers/video/broadwell_igd.c @@ -664,6 +664,7 @@ static int broadwell_igd_probe(struct udevice *dev) struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); bool is_broadwell; + ulong fbbase; int ret; if (!ll_boot_init()) { @@ -690,7 +691,8 @@ static int broadwell_igd_probe(struct udevice *dev) return ret; /* Use write-combining for the graphics memory, 256MB */ - ret = mtrr_add_request(MTRR_TYPE_WRCOMB, plat->base, 256 << 20); + fbbase = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base; + ret = mtrr_add_request(MTRR_TYPE_WRCOMB, fbbase, 256 << 20); if (!ret) ret = mtrr_commit(true); if (ret && ret != -ENOSYS) { @@ -752,6 +754,17 @@ static int broadwell_igd_ofdata_to_platdata(struct udevice *dev) return 0; } +static int broadwell_igd_bind(struct udevice *dev) +{ + struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + + /* Set the maximum supported resolution */ + uc_plat->size = 2560 * 1600 * 4; + log_debug("%s: Frame buffer size %x\n", __func__, uc_plat->size); + + return 0; +} + static const struct video_ops broadwell_igd_ops = { }; @@ -766,6 +779,7 @@ U_BOOT_DRIVER(broadwell_igd) = { .of_match = broadwell_igd_ids, .ops = &broadwell_igd_ops, .ofdata_to_platdata = broadwell_igd_ofdata_to_platdata, + .bind = broadwell_igd_bind, .probe = broadwell_igd_probe, .priv_auto_alloc_size = sizeof(struct broadwell_igd_priv), .platdata_auto_alloc_size = sizeof(struct broadwell_igd_plat), From patchwork Tue May 19 23:10:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293843 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=XzLfKsPs; 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 49RWwS02mbz9sT3 for ; Wed, 20 May 2020 09:16:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A40BD81EE1; Wed, 20 May 2020 01: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=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="XzLfKsPs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 273F181E64; Wed, 20 May 2020 01:11:47 +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 19EAA81E6A for ; Wed, 20 May 2020 01:11:40 +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 m6so1180464ilq.7 for ; Tue, 19 May 2020 16:11:39 -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=RNeU2SDxz1hMNjMykPXRCtzibeIc4PNqC/uMxLUPepw=; b=XzLfKsPs0YKzKMS3C9pj1KhaWrMu5mIEVIPOIlBFWmL8xA6TiFzfMZYc8nydZKvF3L QH8zcCMcSq+FgkDYknJ+WpworgElSuKD9+2pgGMzWUynMPvDn/jO4SM5Sua+htEWxxr+ byxZGi7I0mLcc4Gs4cL4ocW5CuRTdFbKHPUHc= 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=RNeU2SDxz1hMNjMykPXRCtzibeIc4PNqC/uMxLUPepw=; b=DsA3u2etNoPPUGXAd4zIcjrZ3sPAWiKyphg9Qiv7+NLPyBMjXvCntCwG6bnc0AEPu7 ORgiXj8zYDi8kmjblHRNEjKfARi3s3vjPe3fkVMMSl54Nzl6BmUxyzRZplGF0UzEyOvA QW2qCFVQoRWEL+Ebc2AsVwTHj0zgvFoSNMwPRqDEaz3A20Y23Owqgj40Rqg0qHKGzlOb eodemhZtxiWx/Mo/HTiMbuNE/7rN/5/RNr4UsYwtGEGxiPyd90tO0Z1omuncEnex30eH lgpiPCHVsFnJOyf1oFINT2BVFhgZ1adsJX9IiWoPH1P2SvzVOYS+xTi0Eq7ACM7ZUjgt 5yjA== X-Gm-Message-State: AOAM533eOtMx//Awn4DCd7X1hk3tThxSNT2aok7gAVYjt3xlfyTi0JDo 0e/65Kky6d/NPmMlbMx/oVaaIR8PNG4= X-Google-Smtp-Source: ABdhPJxQIvTDMImok//jX0SBIipOnjot/XULerEK71PLZjgBE/yTeOSxYyFojOA7Rm4EE4b5o76luQ== X-Received: by 2002:a92:cc0a:: with SMTP id s10mr1512845ilp.88.1589929898548; Tue, 19 May 2020 16:11:38 -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 m4sm415701iol.35.2020.05.19.16.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:38 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 24/26] x86: chromebook_link: Enable the copy framebuffer Date: Tue, 19 May 2020 17:10:56 -0600 Message-Id: <20200519231058.19945-25-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Update the video driver to support this feature and enable it on link. Also remove the multi-line scrolling since normal scrolling is fast enough now. With this change, the time taken to print the environment to the display without CONFIG_CONSOLE_SCROLL_LINES is reduced from about 930ms to 29ms. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- configs/chromebook_link_defconfig | 2 +- drivers/video/ivybridge_igd.c | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/configs/chromebook_link_defconfig b/configs/chromebook_link_defconfig index de4186cdf2..215185c974 100644 --- a/configs/chromebook_link_defconfig +++ b/configs/chromebook_link_defconfig @@ -62,10 +62,10 @@ CONFIG_SPI=y CONFIG_TPM_TIS_LPC=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y +CONFIG_VIDEO_COPY=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_11A=y CONFIG_VIDEO_IVYBRIDGE_IGD=y -CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_CMD_DHRYSTONE=y CONFIG_TPM=y # CONFIG_EFI_LOADER is not set diff --git a/drivers/video/ivybridge_igd.c b/drivers/video/ivybridge_igd.c index 4c57e311d1..2587f53ac1 100644 --- a/drivers/video/ivybridge_igd.c +++ b/drivers/video/ivybridge_igd.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -722,7 +723,6 @@ static int gma_func0_init(struct udevice *dev) { struct udevice *nbridge; void *gtt_bar; - ulong base; u32 reg32; int ret; int rev; @@ -742,11 +742,6 @@ static int gma_func0_init(struct udevice *dev) reg32 |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO; dm_pci_write_config32(dev, PCI_COMMAND, reg32); - /* Use write-combining for the graphics memory, 256MB */ - base = dm_pci_read_bar32(dev, 2); - mtrr_add_request(MTRR_TYPE_WRCOMB, base, 256 << 20); - mtrr_commit(true); - gtt_bar = (void *)(ulong)dm_pci_read_bar32(dev, 0); debug("GT bar %p\n", gtt_bar); ret = gma_pm_init_pre_vbios(gtt_bar, rev); @@ -758,6 +753,8 @@ static int gma_func0_init(struct udevice *dev) static int bd82x6x_video_probe(struct udevice *dev) { + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + ulong fbbase; void *gtt_bar; int ret, rev; @@ -774,6 +771,22 @@ static int bd82x6x_video_probe(struct udevice *dev) if (ret) return ret; + /* Use write-combining for the graphics memory, 256MB */ + fbbase = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base; + mtrr_add_request(MTRR_TYPE_WRCOMB, fbbase, 256 << 20); + mtrr_commit(true); + + return 0; +} + +static int bd82x6x_video_bind(struct udevice *dev) +{ + struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + + /* Set the maximum supported resolution */ + uc_plat->size = 2560 * 1600 * 4; + log_debug("%s: Frame buffer size %x\n", __func__, uc_plat->size); + return 0; } @@ -786,5 +799,6 @@ U_BOOT_DRIVER(bd82x6x_video) = { .name = "bd82x6x_video", .id = UCLASS_VIDEO, .of_match = bd82x6x_video_ids, + .bind = bd82x6x_video_bind, .probe = bd82x6x_video_probe, }; From patchwork Tue May 19 23:10:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293846 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=XTnH+wkz; 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 49RWx06wvZz9sT4 for ; Wed, 20 May 2020 09:16:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6076381EF5; Wed, 20 May 2020 01: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=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="XTnH+wkz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8BFCF81E67; Wed, 20 May 2020 01:11:54 +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 E8F7D81E6D for ; Wed, 20 May 2020 01:11:40 +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 c16so1104689iol.3 for ; Tue, 19 May 2020 16:11:40 -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=DEZG1/S+jALOrYAJzpy5WS+QVF/fX1hajBaBEjZoaI8=; b=XTnH+wkz/WpjHfTzE5WSfsMl0aolRJmCDPL6vnmfv8XbKCZudlEDN0nsGqH//AyuJt 6G9h6Q3Mc9yLEi8Y2MJmi1V4K28ywmB9iFC33TufmJggGRta7pxfXoYEYy4Vboyb9wwf MJUyXDN4vAdsnW+UccSSdVa4rnwFSQyDRieYA= 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=DEZG1/S+jALOrYAJzpy5WS+QVF/fX1hajBaBEjZoaI8=; b=HPk9RcUDOR0PX/XNwMHKc8c1aUcghj3ljFFMBnZiBgcyYCYrP+Il0YA6RJ8UHQiFNH JZW1Yuqjgu3xt1XsJfIItTmesAT9YSjCw0/UK6oPYi0EAKwxT26yToI/AnUFFKswivKz u8YXaqkYw+Q1ifQISQBAwVLKEpDKIYa00AynXjkppxG4bQZ9+jF16qbR1ogWmrIxImmV rsFJuVjTpA1ocIYiZvf2gnkUhkg6dARSesqWx0F/6FWOmevjpWBKmLKTEIPqv26XMkjl zKsJx9aynNq7P8fXEMIogWrm7n0nsZpddBKyWIQrCq6gK9L9g8vBk79zHmpjMmUKsypS 9K5w== X-Gm-Message-State: AOAM532bgAPNAazpWnkS5zykIkHNhSInaoZKmLsYq86Q3BoixipmHszt 1IfsIGFZrjj5Iw5AIPAg5/pxuctXifU= X-Google-Smtp-Source: ABdhPJwms/dx56Wcg/fFVsdr674wrDj7YZ3KPMah38bUFJUa7PIAbFjvYOgerb60HKlva9XyJ1y5vw== X-Received: by 2002:a02:85ec:: with SMTP id d99mr2017247jai.144.1589929899423; Tue, 19 May 2020 16:11:39 -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 m4sm415701iol.35.2020.05.19.16.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:39 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH 25/26] x86: minnowmax: Enable the copy framebuffer Date: Tue, 19 May 2020 17:10:57 -0600 Message-Id: <20200519231058.19945-26-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Update the video driver to support this feature and enable it on minnowmax to speed up the display. With this change, the time taken to print the environment to the display without CONFIG_CONSOLE_SCROLL_LINES is reduced from over 13 seconds to 300ms, at 1280x1024. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- configs/minnowmax_defconfig | 2 +- drivers/video/vesa.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/configs/minnowmax_defconfig b/configs/minnowmax_defconfig index 127fd5d53e..19528c4641 100644 --- a/configs/minnowmax_defconfig +++ b/configs/minnowmax_defconfig @@ -59,6 +59,6 @@ CONFIG_RTL8169=y CONFIG_SPI=y 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_CONSOLE_SCROLL_LINES=5 diff --git a/drivers/video/vesa.c b/drivers/video/vesa.c index 6c03611e80..9656326bdb 100644 --- a/drivers/video/vesa.c +++ b/drivers/video/vesa.c @@ -5,12 +5,39 @@ #include #include +#include #include #include +#include +#include static int vesa_video_probe(struct udevice *dev) { - return vbe_setup_video(dev, NULL); + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + ulong fbbase; + int ret; + + ret = vbe_setup_video(dev, NULL); + if (ret) + return log_ret(ret); + + /* Use write-combining for the graphics memory, 256MB */ + fbbase = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base; + mtrr_add_request(MTRR_TYPE_WRCOMB, fbbase, 256 << 20); + mtrr_commit(true); + + return 0; +} + +static int vesa_video_bind(struct udevice *dev) +{ + struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + + /* Set the maximum supported resolution */ + uc_plat->size = 2560 * 1600 * 4; + log_debug("%s: Frame buffer size %x\n", __func__, uc_plat->size); + + return 0; } static const struct udevice_id vesa_video_ids[] = { @@ -22,6 +49,7 @@ U_BOOT_DRIVER(vesa_video) = { .name = "vesa_video", .id = UCLASS_VIDEO, .of_match = vesa_video_ids, + .bind = vesa_video_bind, .probe = vesa_video_probe, }; From patchwork Tue May 19 23:10:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1293845 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=BHx4uAHR; 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 49RWwp54rMz9sT3 for ; Wed, 20 May 2020 09:16:42 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F1F3A81EF0; Wed, 20 May 2020 01: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=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="BHx4uAHR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9B33881E6A; Wed, 20 May 2020 01:11: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-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 C784081DAE for ; Wed, 20 May 2020 01:11:41 +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 j3so1151484ilk.11 for ; Tue, 19 May 2020 16:11:41 -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=gA5tT4AbedNMLzbc/2yIReuPKuKWTF9T4f6o1hruaBY=; b=BHx4uAHR6NqeHQEDj/M0+1KkaSIes9a4GZIBQDBxF1AmBLt66tkjWZBe8CIYg/5L1o XqXglJyrLQHZXOxfnCVTfKPinyP5P7ZCjEkNArZq0YkzeE99nGEXrzA9kg/WbT5jpKkO cSwMCvkcr+6IcMA4ZuLXLmO6XBu/EV0NzTpUY= 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=gA5tT4AbedNMLzbc/2yIReuPKuKWTF9T4f6o1hruaBY=; b=IfKw988SCyQQbWiU5w5rH8bx0JwhkjgDuZ6G/4VjNmYgzT8Ye3u1XmIEweUpUMNTCm dwPCOLACIMv7h+JLhfaWyTEqxONeh+r6OJR7mnqAyDUoI6bZS4xqD+dSibF0GjfVbbq4 6h/6AuuPxGclmTuBKi6KA7fI0qSE65xWmyQ5qo4olVuco06mPEjqR60iTy8IhIka9Ws9 oBckckiII+dFzQWALOQtpmzomc1IrXgZaC3KF2g2CgIEgG7eYE5kg6iFk9gn/10tNpA2 FUoIUopsVESDS+btwMsNzoJjD/ECpnrVRSTFFY75pEFqBhKNhG0jIuCsLTx2Dl+C3ytL 9aRQ== X-Gm-Message-State: AOAM533cAlSF0zhQdJ3FU+tCQWnWm89Q6/suaZsUJAqKtmgmW6bncCfF 7rqRWkqt8ZgGrOYhMTDX+JarlFyVZro= X-Google-Smtp-Source: ABdhPJxqIcEkzqtTBxOmIrwqfVFWz7ZGT8PxpSc/cTDlJlvLqE7brIvXtnK1fgKjpysF+AxOgwWblA== X-Received: by 2002:a92:8803:: with SMTP id h3mr1426469ild.121.1589929900250; Tue, 19 May 2020 16:11:40 -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 m4sm415701iol.35.2020.05.19.16.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 16:11:39 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH 26/26] x86: minnowmax: Drop screen resolution to 1024x768 Date: Tue, 19 May 2020 17:10:58 -0600 Message-Id: <20200519231058.19945-27-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200519231058.19945-1-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- configs/minnowmax_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/minnowmax_defconfig b/configs/minnowmax_defconfig index 19528c4641..cce9ee6fea 100644 --- a/configs/minnowmax_defconfig +++ b/configs/minnowmax_defconfig @@ -61,4 +61,4 @@ 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