From patchwork Fri Jul 3 03:12:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322040 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=cGC8eGGO; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg6B6TGpz9sR4 for ; Fri, 3 Jul 2020 13:13:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8823581BBA; Fri, 3 Jul 2020 05:13:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="cGC8eGGO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C26E081B79; Fri, 3 Jul 2020 05:12:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B2DE081B47 for ; Fri, 3 Jul 2020 05:12:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x144.google.com with SMTP id r12so18879923ilh.4 for ; Thu, 02 Jul 2020 20:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zxMn/Z1P9ZMTco8WeT+74Yl2ItYwiNF+/xYV5Ql+liM=; b=cGC8eGGO2aFNtUEtnpz5RlUwq5u5AcwFiOCmxu+BgVCIidi43TY6yFxOAMidz5nq+f elZYT1EalpMxLFQhAPYHPiRi2t3em4m/OeAjqhhNzkd7oZ+ljr030K4y5Gqnm+ugdW8H BSWO96FSuPbOD8oHFRBt1iqzgacNd44b4Yh+M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zxMn/Z1P9ZMTco8WeT+74Yl2ItYwiNF+/xYV5Ql+liM=; b=AVa8jRDwIDnjYkLKo0rw/ORrLM4AWVYUbCmm4fRLkKGqGbsQE0HgGebJWAoVZkieWx VazyC9OkcA0LxoFy9+Fy5cXuZ4rBIpBgFCpweAjaXHALPsX3LZf6DCEMfRngUcbFThY3 N2M1BAsocZtN9N6Ix8pgQD0cffwSTYwNEfCUtLj2giFadfvCiC0m6ynnevtpDMMcNjYh F2D38D5o+h41DU3OdNgSXychTMnYYw1B3lYPCof1vhd2uR7YP4mj6nD6m6Fg+6Gr3qUP 6TCwDKe64Dt4EE2M/p2cSitBmm/XtP0DDQAIcaX1JtroVT0sH0Va0+QcQHY0WOtHSLzZ qCrg== X-Gm-Message-State: AOAM530Vay5KCY5PnvDieLkYdySTjdkOUk+MXcezZw0G9ZLje+75LW1/ SeEmLjKTOrPrYm+ys6GXzqYT6A== X-Google-Smtp-Source: ABdhPJyNtR/cpgq0t9HFb2oxcJCe2AySyr5N/v15S7Rh72gOpU+5dtpEKCSLPJPD8GjeyxgOsNRujA== X-Received: by 2002:a92:5207:: with SMTP id g7mr16058261ilb.49.1593745968679; Thu, 02 Jul 2020 20:12:48 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:48 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 06/26] video: Adjust rotated console to start at right edge Date: Thu, 2 Jul 2020 21:12:17 -0600 Message-Id: <20200702211204.RESEND.v3.6.Ie8637472573bd3e94375131aa034e7498df340b1@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean At present when the console is rotated 180 degrees it starts almost a whole character to the left of the right edge (typically 7 pixels with an 8-pixel-wide font). On a display which aligns with the font width, this just wastes space. On a display that does not this can result in x_frac going negative for the final character (the one on the left side) and the overflow -EAGAIN check at the start of the function failing. Change the function to start at the rightmost pixel to fix these problems. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/console_rotate.c | 2 +- test/dm/video.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c index 8bb05ae02c..da0ce7b9ce 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c @@ -212,7 +212,7 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) return -EAGAIN; linenum = vid_priv->ysize - y - 1; - x = vid_priv->xsize - VID_TO_PIXEL(x_frac) - VIDEO_FONT_WIDTH - 1; + x = vid_priv->xsize - VID_TO_PIXEL(x_frac) - 1; line = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes; for (row = 0; row < VIDEO_FONT_HEIGHT; row++) { diff --git a/test/dm/video.c b/test/dm/video.c index 0664e3f22b..68f5ba44e7 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -251,7 +251,7 @@ DM_TEST(dm_test_video_rotation1, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); /* Test rotated text output through the console uclass */ static int dm_test_video_rotation2(struct unit_test_state *uts) { - ut_assertok(check_vidconsole_output(uts, 2, 785, 446)); + ut_assertok(check_vidconsole_output(uts, 2, 783, 445)); return 0; }