From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77B80C07E99 for ; Mon, 5 Jul 2021 22:34:33 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F35C56103E for ; Mon, 5 Jul 2021 22:34:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F35C56103E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9268882C29; Tue, 6 Jul 2021 00:33: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="Jcqe+5Lj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B57982C0A; Tue, 6 Jul 2021 00:33:25 +0200 (CEST) Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (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 DC74682BD7 for ; Tue, 6 Jul 2021 00:33:18 +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-oi1-x22c.google.com with SMTP id r29so5923592oiw.13 for ; Mon, 05 Jul 2021 15:33:18 -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=BiM6mf/4P3U/qewq57IZHVHCh+KLf22R49Fn4q10YUQ=; b=Jcqe+5Ljg9y4WWjf51hnzkQGkJKILQGOfHzofqPmgI1ecTX93ggk3YvDyY1olithZY 3CfMJElPwyKIC0ebvJBBFkY6LdFZs3Y3iSmcSbF+DDoCM5pHAFQaN+iIvGV8ZPE38B6N a9yYT6sq34KK+T7B4iP7HbSuftXtVLjdzyH/8= 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=BiM6mf/4P3U/qewq57IZHVHCh+KLf22R49Fn4q10YUQ=; b=FsEXjss2+HncuLlPBPJvfAunjVZ+jYfMUB8roT3SjCkZMZDDVFIieMUapmXtZNUYDr nSVSe7OE1zhhxzxp1cilAEQzrRH6UfrwOXwEj27QVVvoUHROeOjv0ETkUOD9NdUfZJwD JL2nVtKq8GOfnRWIgwGr/TA4f4Nk0K3PBM+WYGNpdRdah1qqv098uY9pxSFshta7cp72 6nV2jGng+quqKortVCbqn3EIAhYLLpLos0Ayz+jkyx/euzVQAf8WfnQPymx38vv6jbcj vGpd4ny4oo+cJrJSwVfi/TLn/A9QIOThGhekAZz/PPgzoJrJA2745HDkTApEvxnHVRzH 87yw== X-Gm-Message-State: AOAM530lvaAA6o8M/cr2aBIuh5tPeTEGIDG/atKNtqUsW9JGGdy4JmsJ XUHFdCcPWo/3EAZTKMeT4gwQ5Q0yN/gVFbwy X-Google-Smtp-Source: ABdhPJzI14pGn2nKFWFTMMTOttHFdjel9uzTvtFGoirimn9WX7nlubGuMLIhp5iuYz7ycyJBr+0l2g== X-Received: by 2002:a05:6808:158d:: with SMTP id t13mr11496279oiw.134.1625524397367; Mon, 05 Jul 2021 15:33:17 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:16 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Harald Seiler , Heinrich Schuchardt Subject: [PATCH 08/22] sandbox: Add work-around for SDL2 display Date: Mon, 5 Jul 2021 16:32:46 -0600 Message-Id: <20210705223300.2139971-7-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.103.2 at phobos.denx.de X-Virus-Status: Clean At present the display does not show on some machines, e.g. Ubunutu 20.04 but the reason is unknown. Add a work-around until this can be determined. Also include more error checking just in case. Signed-off-by: Simon Glass --- arch/sandbox/cpu/sdl.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index 8102649be3a..e2649494818 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -164,8 +164,29 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp, int sandbox_sdl_sync(void *lcd_base) { + struct SDL_Rect rect; + int ret; + + if (!sdl.texture) + return 0; + SDL_RenderClear(sdl.renderer); SDL_UpdateTexture(sdl.texture, NULL, lcd_base, sdl.pitch); - SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL); + ret = SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL); + if (ret) { + printf("SDL copy %d: %s\n", ret, SDL_GetError()); + return -EIO; + } + + /* + * On some machines this does not appear. Draw an empty rectangle which + * seems to fix that. + */ + rect.x = 0; + rect.y = 0; + rect.w = 0; + rect.h = 0; + SDL_RenderDrawRect(sdl.renderer, &rect); + SDL_RenderPresent(sdl.renderer); sandbox_sdl_poll_events(); -- 2.32.0.93.g670b81a890-goog