From patchwork Mon Jun 6 23:43:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 1639704 X-Patchwork-Delegate: agust@denx.de 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=) 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 (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LH97r4mRFz9sFk for ; Tue, 7 Jun 2022 09:44:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C46DB842FC; Tue, 7 Jun 2022 01:43:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 40075842A3; Tue, 7 Jun 2022 01:43:48 +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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from zulu616.server4you.de (mail.csgraf.de [85.25.223.15]) by phobos.denx.de (Postfix) with ESMTP id A92EF842AF for ; Tue, 7 Jun 2022 01:43:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=agraf@csgraf.de Received: from localhost.localdomain (dynamic-077-002-002-002.77.2.pool.telefonica.de [77.2.2.2]) by csgraf.de (Postfix) with ESMTPSA id 02381608105B; Tue, 7 Jun 2022 01:43:39 +0200 (CEST) From: Alexander Graf To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Anatolij Gustschin , Simon Glass , Matthias Brugger , Da Xue Subject: [PATCH 3/6] vidconsole: Add damage notifications to all vidconsole drivers Date: Tue, 7 Jun 2022 01:43:33 +0200 Message-Id: <20220606234336.5021-4-agraf@csgraf.de> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220606234336.5021-1-agraf@csgraf.de> References: <20220606234336.5021-1-agraf@csgraf.de> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Now that we have a damage tracking API, let's populate damage done by vidconsole drivers. We try to declare as little memory as damaged as possible, with the exception of rotated screens that I couldn't get my head wrapped around. On those, we revert to the old behavior and mark the full screen as damaged on every update. Signed-off-by: Alexander Graf Reported-by: Da Xue --- drivers/video/console_normal.c | 10 ++++++++++ drivers/video/console_rotate.c | 18 ++++++++++++++++++ drivers/video/console_truetype.c | 12 ++++++++++++ 3 files changed, 40 insertions(+) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 04f022491e..5b5586fd3e 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -57,6 +57,9 @@ static int console_normal_set_row(struct udevice *dev, uint row, int clr) if (ret) return ret; + video_damage(dev->parent, 0, VIDEO_FONT_HEIGHT * row, vid_priv->xsize, + VIDEO_FONT_HEIGHT); + return 0; } @@ -76,6 +79,9 @@ static int console_normal_move_rows(struct udevice *dev, uint rowdst, if (ret) return ret; + video_damage(dev->parent, 0, VIDEO_FONT_HEIGHT * rowdst, vid_priv->xsize, + VIDEO_FONT_HEIGHT * count); + return 0; } @@ -143,6 +149,10 @@ static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, } line += vid_priv->line_length; } + + video_damage(dev->parent, VID_TO_PIXEL(x_frac), y, VIDEO_FONT_WIDTH, + VIDEO_FONT_HEIGHT); + ret = vidconsole_sync_copy(dev, start, line); if (ret) return ret; diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c index 36c8d0609d..4d5084e8d1 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c @@ -57,6 +57,8 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) if (ret) return ret; + video_damage(dev->parent, 0, 0, vid_priv->xsize, vid_priv->ysize); + return 0; } @@ -83,6 +85,8 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, dst += vid_priv->line_length; } + video_damage(dev->parent, 0, 0, vid_priv->xsize, vid_priv->ysize); + return 0; } @@ -150,6 +154,8 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch) if (ret) return ret; + video_damage(dev->parent, 0, 0, vid_priv->xsize, vid_priv->ysize); + return VID_TO_POS(VIDEO_FONT_WIDTH); } @@ -199,6 +205,8 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) if (ret) return ret; + video_damage(dev->parent, 0, 0, vid_priv->xsize, vid_priv->ysize); + return 0; } @@ -218,6 +226,8 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, vidconsole_memmove(dev, dst, src, VIDEO_FONT_HEIGHT * vid_priv->line_length * count); + video_damage(dev->parent, 0, 0, vid_priv->xsize, vid_priv->ysize); + return 0; } @@ -288,6 +298,8 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) if (ret) return ret; + video_damage(dev->parent, 0, 0, vid_priv->xsize, vid_priv->ysize); + return VID_TO_POS(VIDEO_FONT_WIDTH); } @@ -335,6 +347,8 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) if (ret) return ret; + video_damage(dev->parent, 0, 0, vid_priv->xsize, vid_priv->ysize); + return 0; } @@ -359,6 +373,8 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, dst += vid_priv->line_length; } + video_damage(dev->parent, 0, 0, vid_priv->xsize, vid_priv->ysize); + return 0; } @@ -424,6 +440,8 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch) if (ret) return ret; + video_damage(dev->parent, 0, 0, vid_priv->xsize, vid_priv->ysize); + return VID_TO_POS(VIDEO_FONT_WIDTH); } diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index c04b449a6d..8fab28fd15 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -168,6 +168,9 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) if (ret) return ret; + video_damage(dev->parent, 0, priv->y_charsize * rowdst, vid_priv->xsize, + priv->y_charsize); + return 0; } @@ -192,6 +195,9 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, for (i = 0; i < priv->pos_ptr; i++) priv->pos[i].ypos -= diff; + video_damage(dev->parent, 0, priv->y_charsize * rowdst, vid_priv->xsize, + priv->y_charsize * count); + return 0; } @@ -348,6 +354,9 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, line += vid_priv->line_length; } + + video_damage(dev->parent, x, y, width, height); + ret = vidconsole_sync_copy(dev, start, line); if (ret) return ret; @@ -415,6 +424,9 @@ static int console_truetype_erase(struct udevice *dev, int xstart, int ystart, } line += vid_priv->line_length; } + + video_damage(dev->parent, xstart, ystart, xend - xstart, yend - ystart); + ret = vidconsole_sync_copy(dev, start, line); if (ret) return ret;