Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF258C433FE for ; Thu, 6 Oct 2022 14:38:11 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1EA2284E64; Thu, 6 Oct 2022 16:37: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="VCQmwsbK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 60D5684E37; Thu, 6 Oct 2022 16:37:20 +0200 (CEST) Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (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 40AAB84DC4 for ; Thu, 6 Oct 2022 16:36:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x135.google.com with SMTP id r20so1080705ilt.11 for ; Thu, 06 Oct 2022 07:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PWpcXjkWE/UPBWiKULjcyqzEGz8AOu1GFpfWqpQaXzA=; b=VCQmwsbKXT7uvHc5SO2GCayrA+dl3MoResgnihHpaXCnDd7MOcrfPctuK/SKwYUVEP 2cmL1j94oET5CqrFuflolkLPRQ3JhmXGlK4sklSwatbSxDHqhwY403rzHJD+yC4vhrhS +4lxEorJvYgdy77FxNvA2M3uaokQVqa2dAcFo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PWpcXjkWE/UPBWiKULjcyqzEGz8AOu1GFpfWqpQaXzA=; b=G4KepROusa+2+wqXhD2jEm71NH0SPkyDMPi1dMiMZ20/0dhXDeFJWQhvXbTfEyhJ/4 C8hlPH8vyimWsafdyZu24JyNOHiItx8W6vlf8gF6j5vblR4wWQmBXjV4/7YVyQKk5eqc 7LiB88ZV+cCgdYbiVU3x0sf3uXXyKPcXSX093wsRPtJBTAVikOeQVbJaRLsGNi1mPNtD XQ3sjewqQ10Su+MK5HmBvO0y8AAI8dRFeKM1CEkGv+n9YNLfrbIcj2phJpC6bTcl+a9y 6ae3dZp3ssvjNawkPNHlf0SGcM93K1szA4zqu4F4tBKxhM4w0PLX8ipP6flTtQHZIdOa u9Qw== X-Gm-Message-State: ACrzQf2ZEnUdTFO9PUC8LtMW//d36XJVnJN8wuJNLuBnzhEExCR0gpGN XWuLfwyBm63eLzlYj98pq8K1wbYSi6iA5Q== X-Google-Smtp-Source: AMsMyM7/tKFGtJMIHgpZzsTJJ23rvNKUoo1kfVcyKROcTvUJJtbZFI5porECg47IFNtqDpuesGgTCQ== X-Received: by 2002:a05:6e02:12ec:b0:2fa:9024:b513 with SMTP id l12-20020a056e0212ec00b002fa9024b513mr1458823iln.120.1665067012257; Thu, 06 Oct 2022 07:36:52 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id g22-20020a056602073600b006a102cb4900sm388573iox.39.2022.10.06.07.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 07:36:51 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Anatolij Gustschin , Simon Glass Subject: [PATCH 06/16] video: Allow filling the display with a colour Date: Thu, 6 Oct 2022 08:36:08 -0600 Message-Id: <20221006143619.354301-7-sjg@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221006143619.354301-1-sjg@chromium.org> References: <20221006143619.354301-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean Generalise the video_clear() function to allow filling with a different colour. Tidy up the comments while we are here. Signed-off-by: Simon Glass --- drivers/video/video-uclass.c | 20 ++++++++++++++++---- include/video.h | 13 +++++++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index b258a8a00fc..9f22da02528 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -126,7 +126,7 @@ int video_reserve(ulong *addrp) return 0; } -int video_clear(struct udevice *dev) +int video_fill(struct udevice *dev, u32 colour) { struct video_priv *priv = dev_get_uclass_priv(dev); int ret; @@ -138,7 +138,7 @@ int video_clear(struct udevice *dev) u16 *end = priv->fb + priv->fb_size; while (ppix < end) - *ppix++ = priv->colour_bg; + *ppix++ = colour; break; } case VIDEO_BPP32: @@ -147,11 +147,11 @@ int video_clear(struct udevice *dev) u32 *end = priv->fb + priv->fb_size; while (ppix < end) - *ppix++ = priv->colour_bg; + *ppix++ = colour; break; } default: - memset(priv->fb, priv->colour_bg, priv->fb_size); + memset(priv->fb, colour, priv->fb_size); break; } ret = video_sync_copy(dev, priv->fb, priv->fb + priv->fb_size); @@ -161,6 +161,18 @@ int video_clear(struct udevice *dev) return video_sync(dev, false); } +int video_clear(struct udevice *dev) +{ + struct video_priv *priv = dev_get_uclass_priv(dev); + int ret; + + ret = video_fill(dev, priv->colour_bg); + if (ret) + return ret; + + return 0; +} + static const struct vid_rgb colours[VID_COLOUR_COUNT] = { { 0x00, 0x00, 0x00 }, /* black */ { 0xc0, 0x00, 0x00 }, /* red */ diff --git a/include/video.h b/include/video.h index 1c30aea73c0..4c216d851b6 100644 --- a/include/video.h +++ b/include/video.h @@ -185,13 +185,22 @@ u32 video_index_to_colour(struct video_priv *priv, unsigned int idx); int video_reserve(ulong *addrp); /** - * video_clear() - Clear a device's frame buffer to background color. + * video_clear() - Clear a device's frame buffer to background colour. * * @dev: Device to clear - * Return: 0 + * Return: 0 on success */ int video_clear(struct udevice *dev); +/** + * video_fill() - Fill a device's frame buffer to a colour. + * + * @dev: Device to fill + * @colour: Colour to use, in the frame buffer's format + * Return: 0 on success + */ +int video_fill(struct udevice *dev, u32 colour); + /** * video_sync() - Sync a device's frame buffer with its hardware * -- 2.38.0.rc1.362.ged0d419d3c-goog