From patchwork Tue Jun 26 21:18:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 935113 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=eik.bme.hu Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Fg6w24FJz9rx7 for ; Wed, 27 Jun 2018 08:04:08 +1000 (AEST) Received: from localhost ([::1]:55587 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXw4E-0005ua-06 for incoming@patchwork.ozlabs.org; Tue, 26 Jun 2018 18:04:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXw0c-00041Z-Fd for qemu-devel@nongnu.org; Tue, 26 Jun 2018 18:00:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXw0X-0002hJ-HI for qemu-devel@nongnu.org; Tue, 26 Jun 2018 18:00:22 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:30210) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fXw0X-0002en-93 for qemu-devel@nongnu.org; Tue, 26 Jun 2018 18:00:17 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id EBCFD7456C0; Wed, 27 Jun 2018 00:00:14 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id CD3D77456B9; Wed, 27 Jun 2018 00:00:14 +0200 (CEST) Message-Id: <70edd7a1c32a88531ee5c1cc8dfcbbad6223145c.1530047900.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Date: Tue, 26 Jun 2018 23:18:20 +0200 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:738:2001:2001::2001 Subject: [Qemu-devel] [PATCH v2 2/7] sm501: Perform a full update after palette change X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Sebastian Bauer , Magnus Damm , Aurelien Jarno , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Sebastian Bauer Changing the palette of a color index has as an immediate effect on all pixels with the corresponding index on real hardware. Performing a full update after a palette change is a simple way to emulate this effect. Signed-off-by: Sebastian Bauer Signed-off-by: BALATON Zoltan --- v2: change type to bool hw/display/sm501.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 273495e..2fbb10e 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -487,6 +487,7 @@ typedef struct SM501State { MemoryRegion twoD_engine_region; uint32_t last_width; uint32_t last_height; + bool do_full_update; /* perform a full update next time */ I2CBus *i2c_bus; /* mmio registers */ @@ -1042,6 +1043,7 @@ static void sm501_palette_write(void *opaque, hwaddr addr, assert(range_covers_byte(0, 0x400 * 3, addr)); *(uint32_t *)&s->dc_palette[addr] = value; + s->do_full_update = true; } static uint64_t sm501_disp_ctrl_read(void *opaque, hwaddr addr, @@ -1630,6 +1632,12 @@ static void sm501_update_display(void *opaque) full_update = 1; } + /* someone else requested a full update */ + if (s->do_full_update) { + s->do_full_update = false; + full_update = 1; + } + /* draw each line according to conditions */ snap = memory_region_snapshot_and_clear_dirty(&s->local_mem_region, offset, width * height * src_bpp, DIRTY_MEMORY_VGA);