From nobody Tue Apr 30 14:45:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529569800955306.8143169668366; Thu, 21 Jun 2018 01:30:00 -0700 (PDT) Received: from localhost ([::1]:53753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVuyd-0002tP-J7 for importer@patchew.org; Thu, 21 Jun 2018 04:29:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVuwk-0001je-A0 for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVuwh-0004d8-9K for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:02 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:31090) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVuwg-0004cG-QA for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:27:59 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 51CA17456B8; Thu, 21 Jun 2018 10:27:57 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id B77127456C7; Thu, 21 Jun 2018 10:27:56 +0200 (CEST) Message-Id: <9933d3e471467712047b5e60627bad2e3a38bcae.1529568501.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Date: Thu, 21 Jun 2018 10:08:21 +0200 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH 1/5] sm501: Implement i2c part for reading monitor EDID 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Emulate the i2c part of SM501 which is used to access the EDID info from a monitor. The vmstate structure is changed and its version is increased but SM501 is only used on SH and PPC sam460ex machines that don't support cross-version migration. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- default-configs/ppc-softmmu.mak | 1 + default-configs/ppcemb-softmmu.mak | 1 + default-configs/sh4-softmmu.mak | 2 + default-configs/sh4eb-softmmu.mak | 2 + hw/display/sm501.c | 136 +++++++++++++++++++++++++++++++++= ++-- 5 files changed, 138 insertions(+), 4 deletions(-) diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.= mak index b8b0526..e131e24 100644 --- a/default-configs/ppc-softmmu.mak +++ b/default-configs/ppc-softmmu.mak @@ -24,6 +24,7 @@ CONFIG_ETSEC=3Dy # For Sam460ex CONFIG_USB_EHCI_SYSBUS=3Dy CONFIG_SM501=3Dy +CONFIG_DDC=3Dy CONFIG_IDE_SII3112=3Dy CONFIG_I2C=3Dy CONFIG_BITBANG_I2C=3Dy diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-so= ftmmu.mak index 37af193..ac44f15 100644 --- a/default-configs/ppcemb-softmmu.mak +++ b/default-configs/ppcemb-softmmu.mak @@ -17,6 +17,7 @@ CONFIG_XILINX=3Dy CONFIG_XILINX_ETHLITE=3Dy CONFIG_USB_EHCI_SYSBUS=3Dy CONFIG_SM501=3Dy +CONFIG_DDC=3Dy CONFIG_IDE_SII3112=3Dy CONFIG_I2C=3Dy CONFIG_BITBANG_I2C=3Dy diff --git a/default-configs/sh4-softmmu.mak b/default-configs/sh4-softmmu.= mak index 546d855..caeccd5 100644 --- a/default-configs/sh4-softmmu.mak +++ b/default-configs/sh4-softmmu.mak @@ -9,6 +9,8 @@ CONFIG_PFLASH_CFI02=3Dy CONFIG_SH4=3Dy CONFIG_IDE_MMIO=3Dy CONFIG_SM501=3Dy +CONFIG_I2C=3Dy +CONFIG_DDC=3Dy CONFIG_ISA_TESTDEV=3Dy CONFIG_I82378=3Dy CONFIG_I8259=3Dy diff --git a/default-configs/sh4eb-softmmu.mak b/default-configs/sh4eb-soft= mmu.mak index 2d3fd49..53b9cd7 100644 --- a/default-configs/sh4eb-softmmu.mak +++ b/default-configs/sh4eb-softmmu.mak @@ -9,6 +9,8 @@ CONFIG_PFLASH_CFI02=3Dy CONFIG_SH4=3Dy CONFIG_IDE_MMIO=3Dy CONFIG_SM501=3Dy +CONFIG_I2C=3Dy +CONFIG_DDC=3Dy CONFIG_ISA_TESTDEV=3Dy CONFIG_I82378=3Dy CONFIG_I8259=3Dy diff --git a/hw/display/sm501.c b/hw/display/sm501.c index ca0840f..0625cf5 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "qemu/cutils.h" #include "qapi/error.h" +#include "qemu/log.h" #include "qemu-common.h" #include "cpu.h" #include "hw/hw.h" @@ -34,6 +35,8 @@ #include "hw/devices.h" #include "hw/sysbus.h" #include "hw/pci/pci.h" +#include "hw/i2c/i2c.h" +#include "hw/i2c/i2c-ddc.h" #include "qemu/range.h" #include "ui/pixel_ops.h" =20 @@ -471,10 +474,12 @@ typedef struct SM501State { MemoryRegion local_mem_region; MemoryRegion mmio_region; MemoryRegion system_config_region; + MemoryRegion i2c_region; MemoryRegion disp_ctrl_region; MemoryRegion twoD_engine_region; uint32_t last_width; uint32_t last_height; + I2CBus *i2c_bus; =20 /* mmio registers */ uint32_t system_control; @@ -487,6 +492,11 @@ typedef struct SM501State { uint32_t misc_timing; uint32_t power_mode_control; =20 + uint8_t i2c_byte_count; + uint8_t i2c_status; + uint8_t i2c_addr; + uint8_t i2c_data[16]; + uint32_t uart0_ier; uint32_t uart0_lcr; uint32_t uart0_mcr; @@ -897,6 +907,107 @@ static const MemoryRegionOps sm501_system_config_ops = =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 +static uint64_t sm501_i2c_read(void *opaque, hwaddr addr, unsigned size) +{ + SM501State *s =3D (SM501State *)opaque; + uint8_t ret =3D 0; + + switch (addr) { + case SM501_I2C_BYTE_COUNT: + ret =3D s->i2c_byte_count; + break; + case SM501_I2C_STATUS: + ret =3D s->i2c_status; + break; + case SM501_I2C_SLAVE_ADDRESS: + ret =3D s->i2c_addr; + break; + case SM501_I2C_DATA ... SM501_I2C_DATA + 15: + ret =3D s->i2c_data[addr - SM501_I2C_DATA]; + break; + default: + qemu_log_mask(LOG_UNIMP, "sm501 i2c : not implemented register rea= d." + " addr=3D0x%" HWADDR_PRIx "\n", addr); + } + + SM501_DPRINTF("sm501 i2c regs : read addr=3D%" HWADDR_PRIx " val=3D%x\= n", + addr, ret); + return ret; +} + +static void sm501_i2c_write(void *opaque, hwaddr addr, uint64_t value, + unsigned size) +{ + SM501State *s =3D (SM501State *)opaque; + SM501_DPRINTF("sm501 i2c regs : write addr=3D%" HWADDR_PRIx + " val=3D%" PRIx64 "\n", addr, value); + + switch (addr) { + case SM501_I2C_BYTE_COUNT: + s->i2c_byte_count =3D value & 0xf; + break; + case SM501_I2C_CONTROL: + if (value & 1) { + if (value & 4) { + int res =3D i2c_start_transfer(s->i2c_bus, + s->i2c_addr >> 1, + s->i2c_addr & 1); + s->i2c_status |=3D (res ? 1 << 2 : 0); + if (!res) { + int i; + SM501_DPRINTF("sm501 i2c : transferring %d bytes to 0x= %x\n", + s->i2c_byte_count + 1, s->i2c_addr >> 1); + for (i =3D 0; i <=3D s->i2c_byte_count; i++) { + res =3D i2c_send_recv(s->i2c_bus, &s->i2c_data[i], + !(s->i2c_addr & 1)); + if (res) { + SM501_DPRINTF("sm501 i2c : transfer failed" + " i=3D%d, res=3D%d\n", i, res); + s->i2c_status |=3D (res ? 1 << 2 : 0); + return; + } + } + if (i) { + SM501_DPRINTF("sm501 i2c : transferred %d bytes\n"= , i); + s->i2c_status =3D 8; + } + } + } else { + SM501_DPRINTF("sm501 i2c : end transfer\n"); + i2c_end_transfer(s->i2c_bus); + s->i2c_status &=3D ~4; + } + } + break; + case SM501_I2C_RESET: + s->i2c_status &=3D ~4; + break; + case SM501_I2C_SLAVE_ADDRESS: + s->i2c_addr =3D value & 0xff; + break; + case SM501_I2C_DATA ... SM501_I2C_DATA + 15: + s->i2c_data[addr - SM501_I2C_DATA] =3D value & 0xff; + break; + default: + qemu_log_mask(LOG_UNIMP, "sm501 i2c : not implemented register wri= te. " + "addr=3D0x%" HWADDR_PRIx " val=3D%" PRIx64 "\n", add= r, value); + } +} + +static const MemoryRegionOps sm501_i2c_ops =3D { + .read =3D sm501_i2c_read, + .write =3D sm501_i2c_write, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 4, + }, + .impl =3D { + .min_access_size =3D 1, + .max_access_size =3D 1, + }, + .endianness =3D DEVICE_LITTLE_ENDIAN, +}; + static uint32_t sm501_palette_read(void *opaque, hwaddr addr) { SM501State *s =3D (SM501State *)opaque; @@ -1577,6 +1688,10 @@ static void sm501_reset(SM501State *s) s->irq_mask =3D 0; s->misc_timing =3D 0; s->power_mode_control =3D 0; + s->i2c_byte_count =3D 0; + s->i2c_status =3D 0; + s->i2c_addr =3D 0; + memset(s->i2c_data, 0, 16); s->dc_panel_control =3D 0x00010000; /* FIFO level 3 */ s->dc_video_control =3D 0; s->dc_crt_control =3D 0x00010000; @@ -1615,6 +1730,11 @@ static void sm501_init(SM501State *s, DeviceState *d= ev, memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA); s->local_mem =3D memory_region_get_ram_ptr(&s->local_mem_region); =20 + /* i2c */ + s->i2c_bus =3D i2c_init_bus(dev, "sm501.i2c"); + I2CDDCState *ddc =3D I2CDDC(qdev_create(BUS(s->i2c_bus), TYPE_I2CDDC)); + i2c_set_slave_address(I2C_SLAVE(ddc), 0x50); + /* mmio */ memory_region_init(&s->mmio_region, OBJECT(dev), "sm501.mmio", MMIO_SI= ZE); memory_region_init_io(&s->system_config_region, OBJECT(dev), @@ -1622,6 +1742,9 @@ static void sm501_init(SM501State *s, DeviceState *de= v, "sm501-system-config", 0x6c); memory_region_add_subregion(&s->mmio_region, SM501_SYS_CONFIG, &s->system_config_region); + memory_region_init_io(&s->i2c_region, OBJECT(dev), &sm501_i2c_ops, s, + "sm501-i2c", 0x14); + memory_region_add_subregion(&s->mmio_region, SM501_I2C, &s->i2c_region= ); memory_region_init_io(&s->disp_ctrl_region, OBJECT(dev), &sm501_disp_ctrl_ops, s, "sm501-disp-ctrl", 0x1000); @@ -1705,6 +1828,11 @@ static const VMStateDescription vmstate_sm501_state = =3D { VMSTATE_UINT32(twoD_destination_base, SM501State), VMSTATE_UINT32(twoD_alpha, SM501State), VMSTATE_UINT32(twoD_wrap, SM501State), + /* Added in version 2 */ + VMSTATE_UINT8(i2c_byte_count, SM501State), + VMSTATE_UINT8(i2c_status, SM501State), + VMSTATE_UINT8(i2c_addr, SM501State), + VMSTATE_UINT8_ARRAY(i2c_data, SM501State, 16), VMSTATE_END_OF_LIST() } }; @@ -1770,8 +1898,8 @@ static void sm501_reset_sysbus(DeviceState *dev) =20 static const VMStateDescription vmstate_sm501_sysbus =3D { .name =3D TYPE_SYSBUS_SM501, - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .fields =3D (VMStateField[]) { VMSTATE_STRUCT(state, SM501SysBusState, 1, vmstate_sm501_state, SM501State), @@ -1843,8 +1971,8 @@ static void sm501_reset_pci(DeviceState *dev) =20 static const VMStateDescription vmstate_sm501_pci =3D { .name =3D TYPE_PCI_SM501, - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, SM501PCIState), VMSTATE_STRUCT(state, SM501PCIState, 1, --=20 2.7.6 From nobody Tue Apr 30 14:45:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152956982159144.18864290783574; Thu, 21 Jun 2018 01:30:21 -0700 (PDT) Received: from localhost ([::1]:53756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVuyy-0003K5-NR for importer@patchew.org; Thu, 21 Jun 2018 04:30:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVuwk-0001jd-9j for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVuwh-0004co-1H for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:02 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:31085) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVuwg-0004cF-QL for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:27:58 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 3CAD87456C8; Thu, 21 Jun 2018 10:27:57 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id BA8C174568D; Thu, 21 Jun 2018 10:27:56 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Date: Thu, 21 Jun 2018 10:08:21 +0200 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH 2/5] 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- Notes: v4: Updated commit message hw/display/sm501.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 0625cf5..a2ee6e3 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -479,6 +479,7 @@ typedef struct SM501State { MemoryRegion twoD_engine_region; uint32_t last_width; uint32_t last_height; + uint32_t do_full_update; /* perform a full update next time */ I2CBus *i2c_bus; =20 /* mmio registers */ @@ -1032,6 +1033,7 @@ static void sm501_palette_write(void *opaque, hwaddr = addr, =20 assert(range_covers_byte(0, 0x400 * 3, addr)); *(uint32_t *)&s->dc_palette[addr] =3D value; + s->do_full_update =3D 1; } =20 static uint64_t sm501_disp_ctrl_read(void *opaque, hwaddr addr, @@ -1620,6 +1622,12 @@ static void sm501_update_display(void *opaque) full_update =3D 1; } =20 + /* someone else requested a full update */ + if (s->do_full_update) { + s->do_full_update =3D 0; + full_update =3D 1; + } + /* draw each line according to conditions */ snap =3D memory_region_snapshot_and_clear_dirty(&s->local_mem_region, offset, width * height * src_bpp, DIRTY_MEMORY_VGA); --=20 2.7.6 From nobody Tue Apr 30 14:45:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529569802095423.60907010347864; Thu, 21 Jun 2018 01:30:02 -0700 (PDT) Received: from localhost ([::1]:53755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVuyf-0002vo-8R for importer@patchew.org; Thu, 21 Jun 2018 04:30:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVuwo-0001m9-1f for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVuwn-0004fq-8h for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:06 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:31105) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVuwn-0004fa-1G for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:05 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id E75B374568D; Thu, 21 Jun 2018 10:28:03 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id BD9597456C6; Thu, 21 Jun 2018 10:27:56 +0200 (CEST) Message-Id: <5d2cb324f936a647f8d1aadaf1bf4f0e04f61fbe.1529568501.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Date: Thu, 21 Jun 2018 10:08:21 +0200 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH 3/5] sm501: Use values from the pitch register for 2d operations 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sebastian Bauer Before, crt_h_total was used for src_width and dst_width. This is a property of the current display setting and not relevant for the 2d operation that also can be done off-screen. The pitch register's purpose is to describe line pitch relevant of the 2d operation. Signed-off-by: Sebastian Bauer Signed-off-by: BALATON Zoltan --- hw/display/sm501.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index a2ee6e3..a6232ed 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -701,8 +701,8 @@ static void sm501_2d_operation(SM501State *s) /* get frame buffer info */ uint8_t *src =3D s->local_mem + (s->twoD_source_base & 0x03FFFFFF); uint8_t *dst =3D s->local_mem + (s->twoD_destination_base & 0x03FFFFFF= ); - int src_width =3D (s->dc_crt_h_total & 0x00000FFF) + 1; - int dst_width =3D (s->dc_crt_h_total & 0x00000FFF) + 1; + int src_width =3D s->twoD_pitch & 0x1FFF; + int dst_width =3D (s->twoD_pitch >> 16) & 0x1FFF; =20 if (addressing !=3D 0x0) { printf("%s: only XY addressing is supported.\n", __func__); --=20 2.7.6 From nobody Tue Apr 30 14:45:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529569958628352.698773563135; Thu, 21 Jun 2018 01:32:38 -0700 (PDT) Received: from localhost ([::1]:53774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVv1B-00059Q-Vj for importer@patchew.org; Thu, 21 Jun 2018 04:32:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVuwk-0001jc-9H for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVuwh-0004cw-1d for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:02 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:16897) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVuwg-0004cA-QH for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:27:58 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id EF7597456C9; Thu, 21 Jun 2018 10:27:56 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id C0CA87456C8; Thu, 21 Jun 2018 10:27:56 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Date: Thu, 21 Jun 2018 10:08:21 +0200 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH 4/5] sm501: Set updated region dirty after 2D operation 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Set the changed memory region dirty after performed a 2D operation to ensure that the screen is updated properly. Signed-off-by: BALATON Zoltan --- hw/display/sm501.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index a6232ed..e426d2f 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -774,6 +774,11 @@ static void sm501_2d_operation(SM501State *s) abort(); break; } + + memory_region_set_dirty(&s->local_mem_region, + s->twoD_destination_base & 0x03FFFFFF, + (dst_y + operation_height) * dst_width + + dst_x + operation_width); } =20 static uint64_t sm501_system_config_read(void *opaque, hwaddr addr, --=20 2.7.6 From nobody Tue Apr 30 14:45:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529569950489954.5052686087429; Thu, 21 Jun 2018 01:32:30 -0700 (PDT) Received: from localhost ([::1]:53768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVv10-0004wy-57 for importer@patchew.org; Thu, 21 Jun 2018 04:32:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVuwk-0001jg-AJ for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVuwh-0004d2-4o for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:28:02 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:31079) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVuwg-0004cB-QE for qemu-devel@nongnu.org; Thu, 21 Jun 2018 04:27:59 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 1985D7456B5; Thu, 21 Jun 2018 10:27:57 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id C617F7456B8; Thu, 21 Jun 2018 10:27:56 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Date: Thu, 21 Jun 2018 10:08:21 +0200 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH 5/5] sm501: Fix support for non-zero frame buffer start address 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Display updates and drawing hardware cursor did not work when frame buffer address was non-zero. Fix this by taking the frame buffer address into account in these cases. This fixes screen dragging on AmigaOS. Based on patch by Sebastian Bauer. Signed-off-by: Sebastian Bauer Signed-off-by: BALATON Zoltan --- hw/display/sm501.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index e426d2f..acc26f6 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -578,6 +578,11 @@ static uint32_t get_local_mem_size_index(uint32_t size) return index; } =20 +static ram_addr_t get_fb_addr(SM501State *s, int crt) +{ + return crt ? s->dc_crt_fb_addr : s->dc_panel_fb_addr; +} + static inline int get_width(SM501State *s, int crt) { int width =3D crt ? s->dc_crt_h_total : s->dc_panel_h_total; @@ -680,7 +685,8 @@ static inline void hwc_invalidate(SM501State *s, int cr= t) start *=3D w * bpp; end *=3D w * bpp; =20 - memory_region_set_dirty(&s->local_mem_region, start, end - start); + memory_region_set_dirty(&s->local_mem_region, + get_fb_addr(s, crt) + start, end - start); } =20 static void sm501_2d_operation(SM501State *s) @@ -1577,7 +1583,7 @@ static void sm501_update_display(void *opaque) draw_hwc_line_func *draw_hwc_line =3D NULL; int full_update =3D 0; int y_start =3D -1; - ram_addr_t offset =3D 0; + ram_addr_t offset; uint32_t *palette; uint8_t hwc_palette[3 * 3]; uint8_t *hwc_src =3D NULL; @@ -1634,9 +1640,10 @@ static void sm501_update_display(void *opaque) } =20 /* draw each line according to conditions */ + offset =3D get_fb_addr(s, crt); snap =3D memory_region_snapshot_and_clear_dirty(&s->local_mem_region, offset, width * height * src_bpp, DIRTY_MEMORY_VGA); - for (y =3D 0, offset =3D 0; y < height; y++, offset +=3D width * src_b= pp) { + for (y =3D 0; y < height; y++, offset +=3D width * src_bpp) { int update, update_hwc; =20 /* check if hardware cursor is enabled and we're within its range = */ --=20 2.7.6