From patchwork Fri Jul 3 03:12:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322053 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=H+TuDReq; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg8j1NS0z9sR4 for ; Fri, 3 Jul 2020 13:16:05 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C6D081C03; Fri, 3 Jul 2020 05:13:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="H+TuDReq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 11C0381BD9; Fri, 3 Jul 2020 05:13:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E0A8A81B78 for ; Fri, 3 Jul 2020 05:12:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd44.google.com with SMTP id q74so7516241iod.1 for ; Thu, 02 Jul 2020 20:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6TaAwMr1C5PygO4k4wKOM3+Y9yGSDcn4pXM6zhd0jxU=; b=H+TuDReq+1UXwVvMQv7n2IcQLgP7QCXwmV+VntRWBxpEfDCTRwwls9OzKklh+QGhUO DJDuihCNW8JUkdAvv1EaB38GVfsxDa3LhA2G21YDPMPAQ6Tw0QjBD+DOrXjF5D4MTe4E LT5k1wGFQedDANxUeyqGx08N33AjrHuNTBSX8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6TaAwMr1C5PygO4k4wKOM3+Y9yGSDcn4pXM6zhd0jxU=; b=B6WrU6xSucKMePjAeDHTEL5T5u14fnEBW2xww2liq/TfIGxdVUAw63OpLafQ/hLPbR 2FNCf1M6+aQ7iCyejaAOZrql6u0+b6Kmm04ZHcBAK2ghP/WeUVHmCDvkKmL9x1S3n+gt ry7MTcK1Km7+tELV2juDqb90wtm/4FYclhByb74Q6MVll8zgpaUMf+TMeQpRAGutD5hy rKdqdzrABxoE52mx5n7F1VZGW8qSOKw1Hoki5TTF45pdQj5i5DsiwNohBoVHFM4QZocH q3/Neiqzu9cknNwJSPCl37e34rkSI8dGXBgI2Hm3GBXv3TqbcT2uzqwH0FKSSMUZlcEe AmLA== X-Gm-Message-State: AOAM532oQAyg5RDFFjCdDMan4ZwQMam0DZtuYQHyqkFvQsrEkffPe6vy Vt0j/HCmziAkVOOcqweVubhFoA== X-Google-Smtp-Source: ABdhPJyV3QpTtjCzVB10+ELcOU2028KJjZ7OS0es9NLedBnw4vdx8ESm+B09PWJogZDyb7WsE9t8gA== X-Received: by 2002:a05:6602:45:: with SMTP id z5mr10391324ioz.112.1593745976724; Thu, 02 Jul 2020 20:12:56 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:56 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 16/26] video: Update the copy framebuffer when writing bitmaps Date: Thu, 2 Jul 2020 21:12:27 -0600 Message-Id: <20200702211204.RESEND.v3.16.I42de10293e7246dce9339826506eb01c133c8c06@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Adjust the bitmap code to sync to the copy framebuffer when done. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/video_bmp.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 7d7f37b445..5a4d12c68d 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -192,7 +192,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, struct video_priv *priv = dev_get_uclass_priv(dev); ushort *cmap_base = NULL; int i, j; - uchar *fb; + uchar *start, *fb; struct bmp_image *bmp = map_sysmem(bmp_image, 0); uchar *bmap; ushort padded_width; @@ -201,6 +201,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, unsigned colours, bpix, bmp_bpix; struct bmp_color_table_entry *palette; int hdr_size; + int ret; if (!bmp || !(bmp->header.signature[0] == 'B' && bmp->header.signature[1] == 'M')) { @@ -261,8 +262,11 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, height = priv->ysize - y; bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset); - fb = (uchar *)(priv->fb + - (y + height - 1) * priv->line_length + x * bpix / 8); + start = (uchar *)(priv->fb + + (y + height) * priv->line_length + x * bpix / 8); + + /* Move back to the final line to be drawn */ + fb = start - priv->line_length; switch (bmp_bpix) { case 1: @@ -369,6 +373,12 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, break; }; + /* Find the position of the top left of the image in the framebuffer */ + fb = (uchar *)(priv->fb + y * priv->line_length + x * bpix / 8); + ret = video_sync_copy(dev, start, fb); + if (ret) + return log_ret(ret); + video_sync(dev, false); return 0;