Xilinx DisplayPort.
v3 cover Xilinx DisplayPort.
From: KONRAD Frederic <[email protected]>
This is the third version of this patch-set of the implementation of the Xilinx DisplayPort and DPDMA.
This third version took a lot of coding style fix. There are no functional changes.
First patch introduces an AUX bus needed by the DP to read the DPCD. It's also possible to connect an I2C device on it to to I2C through AUX commands. The drivers requires I2C broadcast write to be modeled as well which seems to be missing currently upstream.
The tree can be cloned at:
[email protected]:fkonrad/xilinx_dp.git branch xilinx_dp_v3_release
Details of the DPDMA part:
* DPDMA is implemented as a QEMU SYSBUS device.
* Interrupts are implemented except the axi error and fifo.
Details of the XILINX-DP:
* DP is also implemented as a QEMU SYSBUS. Multiple memory regions are used to avoid having a single big region as there are holes in the DP memory map.
* An aux-bus has been implemented, it creates a memory map for aux slaves and has an i2c bus (which is already implemented in QEMU).
* The normal programmable i2c clock and controller implementation is missing from the QEMU tree so the easiest way for us was to implement a dummy-clk driver in the kernel. It's a clock which does nothing but fakes a clock such that the DPDMA driver works. The patch will be send separately.
* The graphic plane works on channel 3, video on channel 0 and audios on channel 4 and 5.
Thanks,
Fred
V2 -> V3 changes:
* dpcd:
* Add a CONFIG_DPCD.
* i2c-ddc:
* Fill in VMSD.
* aux:
* Remove address field.
* Add a CONFIG_AUX.
* dpdma:
* Fill in VMSD.
* Some coding style changes.
* dp:
* Fill in VMSD.
* Coding style changes.
V1 -> V2 changes:
* xlnx-zynqmp:
* Remove the dummy object_property_add_child(..).
* dpcd:
* Compile only when the ZYNQMP platform is compiled.
* Use qemu_log instead of printf.
* Compile test debug traces.
* Remove the unused current_reg.
* Remove the blank realize.
* Use dpcd_ prefixes instead of aux_ prefixes.
* Add a reset callback.
* Add the VMSD.
* Add size constraint in the MemoryRegionOps structure instead of asserting.
* Style fixes.
* aux:
* Compile only when the ZYNQMP platform is compiled.
* Remove the class init and the class for aux-slave.
* dpdma:
* Compile only when the ZYNQMP platform is compiled.
* Unify per channel macro in one, simplify the switch case.
* Use extractXX.
* Make DPDMA_GBL an or'ed register.
* dp:
* Compile only when the ZYNQMP platform is compiled.
* Don't look at the audio channel count.
* Use a third pixman plane when we do blending.
* other:
* Drop the useless "console: add qemu_alloc_display_format." patch as suggested by Gerd.
* Rebase on current master (f3e3b083d4c266ea864ae3c83da49d4086857679).
KONRAD Frederic (7):
i2cbus: remove unused dev field.
Introduce AUX bus.
i2c: implement broadcast write.
introduce dpcd module.
Introduce xilinx dpdma.
Introduce xilinx dp.
arm: xlnx-zynqmp: Add DisplayPort and DPDMA.
Peter Maydell (1):
hw/i2c-ddc.c: Implement DDC I2C slave
default-configs/aarch64-softmmu.mak | 3 + hw/arm/xlnx-zynqmp.c | 20 + hw/display/Makefile.objs | 2 + hw/display/dpcd.c | 157 ++++ hw/display/dpcd.h | 94 +++ hw/display/xlnx_dp.c | 1370 +++++++++++++++++++++++++++++++++++ hw/display/xlnx_dp.h | 110 +++ hw/dma/Makefile.objs | 1 + hw/dma/xlnx_dpdma.c | 789 ++++++++++++++++++++ hw/dma/xlnx_dpdma.h | 77 ++ hw/i2c/Makefile.objs | 1 + hw/i2c/core.c | 46 +- hw/i2c/i2c-ddc.c | 302 ++++++++ hw/i2c/i2c-ddc.h | 36 + hw/misc/Makefile.objs | 1 + hw/misc/aux.c | 374 ++++++++++ include/hw/arm/xlnx-zynqmp.h | 5 + include/hw/aux.h | 125 ++++ 18 files changed, 3511 insertions(+), 2 deletions(-) create mode 100644 hw/display/dpcd.c create mode 100644 hw/display/dpcd.h create mode 100644 hw/display/xlnx_dp.c create mode 100644 hw/display/xlnx_dp.h create mode 100644 hw/dma/xlnx_dpdma.c create mode 100644 hw/dma/xlnx_dpdma.h create mode 100644 hw/i2c/i2c-ddc.c create mode 100644 hw/i2c/i2c-ddc.h create mode 100644 hw/misc/aux.c create mode 100644 include/hw/aux.h
Signature · 1 line
1.9.0
PATCH v3 1/8 i2cbus: remove unused dev field.
From: KONRAD Frederic <[email protected]>
Seems this field is not needed.
--- hw/i2c/core.c | 1 - 1 file changed, 1 deletion(-)
hw/i2c/core.c +0 -1
@@ -13,7 +13,6 @@ struct I2CBus {BusState qbus;I2CSlave *current_dev; -I2CSlave *dev;uint8_t saved_address; };
Signature · 1 line
1.9.0
PATCH v3 2/8 Introduce AUX bus.
In reply to [email protected]From: KONRAD Frederic <[email protected]>
This introduces a new bus: aux-bus.
It contains an address space for aux slaves devices and a bridge to an I2C bus for I2C through AUX transactions.
--- default-configs/aarch64-softmmu.mak | 1 + hw/misc/Makefile.objs | 1 + hw/misc/aux.c | 374 ++++++++++++++++++++++++++++++++++++ include/hw/aux.h | 125 ++++++++++++ 4 files changed, 501 insertions(+) create mode 100644 hw/misc/aux.c create mode 100644 include/hw/aux.h
default-configs/aarch64-softmmu.mak +1 -0
@@ -3,4 +3,5 @@ # We support all the 32 bit boards so need all their config include arm-softmmu.mak +CONFIG_AUX=y CONFIG_XLNX_ZYNQMP=y
hw/misc/Makefile.objs +1 -0
@@ -40,3 +40,4 @@ obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_EDU) += edu.o +obj-$(CONFIG_AUX) += aux.o
hw/misc/aux.c new file +374 -0
374 lines not on this page · raw message
include/hw/aux.h new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH v3 3/8 i2c: implement broadcast write.
In reply to [email protected]From: KONRAD Frederic <[email protected]>
This does a write to every slaves when the I2C bus get a write to address 0.
--- hw/i2c/core.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)
hw/i2c/core.c +44 -1
@@ -14,6 +14,7 @@ struct I2CBusBusState qbus;I2CSlave *current_dev;uint8_t saved_address; +bool broadcast; };static Property i2c_props[] = {
@@ -55,6 +56,7 @@ static const VMStateDescription vmstate_i2c_bus = { .post_load = i2c_bus_post_load, .fields = (VMStateField []) {VMSTATE_UINT8 (saved_address, I2CBus), +VMSTATE_BOOL (broadcast, I2CBus),VMSTATE_END_OF_LIST () } };
@@ -66,6 +68,7 @@ I2CBus *i2c_init_bus(DeviceState *parent, const char *name) bus =I2C_BUS (qbus_create (TYPE_I2C_BUS , parent, name));vmstate_register (NULL ,-1 , &vmstate_i2c_bus, bus); +return bus; }
@@ -88,6 +91,19 @@ int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv)I2CSlave *slave =NULL ;I2CSlaveClass *sc; +if (address ==0x00 ) { +/* This is a broadcast. */ + bus->broadcast = true; + QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) { +I2CSlave *dev =I2C_SLAVE (kid->child); + sc =I2C_SLAVE_GET_CLASS (dev); +if (sc->event) { + sc->event (dev, recv ?I2C_START_RECV :I2C_START_SEND ); + } + } +return 0 ; + } + QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) {DeviceState *qdev = kid->child;I2CSlave *candidate =I2C_SLAVE (qdev);
@@ -113,9 +129,22 @@ int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv)void i2c_end_transfer (I2CBus *bus) { +BusChild *kid;I2CSlave *dev = bus->current_dev;I2CSlaveClass *sc; +if (bus->broadcast) { + QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) { +I2CSlave *dev =I2C_SLAVE (kid->child); + sc =I2C_SLAVE_GET_CLASS (dev); +if (sc->event) { + sc->event (dev,I2C_FINISH ); + } + } + bus->broadcast = false; +return ; + } +if (!dev) {return ; }
@@ -130,8 +159,22 @@ void i2c_end_transfer(I2CBus *bus)int i2c_send (I2CBus *bus,uint8_t data) { +BusChild *kid;I2CSlave *dev = bus->current_dev;I2CSlaveClass *sc; +int ret =0 ; + +if (bus->broadcast) { + QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) { +I2CSlave *dev =I2C_SLAVE (kid->child); + sc =I2C_SLAVE_GET_CLASS (dev); + bus->broadcast = true; +if (sc->send) { + ret |= sc->send (dev, data); + } + } +return ret; + }if (!dev) {return -1 ;
@@ -150,7 +193,7 @@ int i2c_recv(I2CBus *bus)I2CSlave *dev = bus->current_dev;I2CSlaveClass *sc; -if (!dev) { +if ((!dev) || (bus->broadcast)) {return -1 ; }
Signature · 1 line
1.9.0
PATCH v3 4/8 introduce dpcd module.
In reply to [email protected]From: KONRAD Frederic <[email protected]>
This introduces a DPCD module. It wires on a aux-bus and can be accessed by driver to get lane-speed, etc.
--- default-configs/aarch64-softmmu.mak | 1 + hw/display/Makefile.objs | 1 + hw/display/dpcd.c | 157 ++++++++++++++++++++++++++++++++++++ hw/display/dpcd.h | 94 +++++++++++++++++++++ 4 files changed, 253 insertions(+) create mode 100644 hw/display/dpcd.c create mode 100644 hw/display/dpcd.h
default-configs/aarch64-softmmu.mak +1 -0
@@ -4,4 +4,5 @@ include arm-softmmu.mak CONFIG_AUX=y +CONFIG_DPCD=y CONFIG_XLNX_ZYNQMP=y
hw/display/Makefile.objs +1 -0
@@ -38,3 +38,4 @@ common-obj-$(CONFIG_QXL) += qxl.o qxl-logger.o qxl-render.o obj-$(CONFIG_VIRTIO) += virtio-gpu.o obj-$(CONFIG_VIRTIO_PCI) += virtio-gpu-pci.o obj-$(CONFIG_VIRTIO_VGA) += virtio-vga.o +obj-$(CONFIG_DPCD) += dpcd.o
hw/display/dpcd.c new file +157 -0
157 lines not on this page · raw message
hw/display/dpcd.h new file +94 -0
94 lines not on this page · raw message
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH V3 4/8] introduce dpcd module.
Hi Fred,
Thanks for the patch.
Quoted 55 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, July 06, 2015 9:22 AM
To: [email protected]
Cc: [email protected]; Peter Crosthwaite; Hyun Kwon; [email protected]; [email protected]; [email protected]
Subject: [PATCH V3 4/8] introduce dpcd module.From: KONRAD Frederic <[email protected]>
This introduces a DPCD module. It wires on a aux-bus and can be accessed by
driver to get lane-speed, etc.Signed-off-by KONRAD Frederic <[email protected]>--- default-configs/aarch64-softmmu.mak | 1 + hw/display/Makefile.objs | 1 + hw/display/dpcd.c | 157 ++++++++++++++++++++++++++++++++++++ hw/display/dpcd.h | 94 +++++++++++++++++++++ 4 files changed, 253 insertions(+) create mode 100644 hw/display/dpcd.c create mode 100644 hw/display/dpcd.hdefault- renamed from default-configs/aarch64-softmmu.mak +0
-0configs/aarch64-softmmu.mak
index d3a2665..87165b7 100644default-configs/aarch64-softmmu.mak +1
-0@@ -4,4 +4,5 @@ include arm-softmmu.mak CONFIG_AUX=y +CONFIG_DPCD=y CONFIG_XLNX_ZYNQMP=yhw/display/Makefile.objs +0
-0@@ -38,3 +38,4 @@ common-obj-$(CONFIG_QXL) += qxl.o qxl-logger.o qxl-render.o
obj-$(CONFIG_VIRTIO) += virtio-gpu.o
obj-$(CONFIG_VIRTIO_PCI) += virtio-gpu-pci.o
obj-$(CONFIG_VIRTIO_VGA) += virtio-vga.ohw/display/Makefile.objs +1
-0+obj-$(CONFIG_DPCD) += dpcd.ohw/display/dpcd.c new file +2
-0@@ -0,0 +1,157 @@ +/* +* dpcd.c
[snip]
hw/display/dpcd.c line 105
Quoted 10 lines
hw/display/dpcd.c new file +10
-0+ +static void dpcd_reset (DeviceState *dev) +{ +DPCDState *s =DPCD (dev); + +memset (&(s->dpcd_info),0 ,sizeof (s->dpcd_info)); + + s->dpcd_info[DPCD_REVISION ] =DPCD_REV_1_0 ; + s->dpcd_info[DPCD_MAX_LINK_RATE ] =DPCD_5_4GBPS ; + s->dpcd_info[DPCD_MAX_LANE_COUNT ] =DPCD_ONE_LANE ;
In my opinion, it's better to use the maximum value. Thus, I'd use DPCD_FOUR_LANES here.
hw/display/dpcd.c
Quoted 12 lines
hw/display/dpcd.c new file +9
-0+ s->dpcd_info[DPCD_RECEIVE_PORT0_CAP_0 ] =DPCD_EDID_PRESENT ; +/* buffer size */ + s->dpcd_info[DPCD_RECEIVE_PORT0_CAP_1 ] =0xFF ; + + s->dpcd_info[DPCD_LANE0_1_STATUS ] =DPCD_LANE0_CR_DONE + |DPCD_LANE0_CHANNEL_EQ_DONE + |DPCD_LANE0_SYMBOL_LOCKED ; + + s->dpcd_info[DPCD_LANE_ALIGN_STATUS_UPDATED] =
DPCD_INTERLANE_ALIGN_DONE;hw/display/dpcd.c new file +2
-0+ s->dpcd_info[DPCD_SINK_STATUS ] =DPCD_RECEIVE_PORT_0_STATUS ; +}
For some reason, on my set up, this dpcd_reset() functions isn't being called. I had to add it to the dpcd_init() as before. I'm not sure if that is from using different baseline. Please make sure the dpcd is initialized correctly.
Thanks,
-hyun
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Re: [Qemu-devel] [PATCH V3 4/8] introduce dpcd module.
Quoted 87 lines · Hyun Kwon
Hi Fred,
Thanks for the patch.
Quoted 55 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, July 06, 2015 9:22 AM
To: [email protected]
Cc: [email protected]; Peter Crosthwaite; Hyun Kwon; [email protected]; [email protected]; [email protected]
Subject: [PATCH V3 4/8] introduce dpcd module.From: KONRAD Frederic <[email protected]>
This introduces a DPCD module. It wires on a aux-bus and can be accessed by
driver to get lane-speed, etc.Signed-off-by KONRAD Frederic <[email protected]>--- default-configs/aarch64-softmmu.mak | 1 + hw/display/Makefile.objs | 1 + hw/display/dpcd.c | 157 ++++++++++++++++++++++++++++++++++++ hw/display/dpcd.h | 94 +++++++++++++++++++++ 4 files changed, 253 insertions(+)create mode 100644
hw/display/dpcd.c
create mode 100644hw/display/dpcd.hdefault- renamed from default-configs/aarch64-softmmu.mak +0
-0configs/aarch64-softmmu.mak
index d3a2665..87165b7 100644default-configs/aarch64-softmmu.mak +1
-0@@ -4,4 +4,5 @@ include arm-softmmu.mak CONFIG_AUX=y +CONFIG_DPCD=y CONFIG_XLNX_ZYNQMP=yhw/display/Makefile.objs +0
-0@@ -38,3 +38,4 @@ common-obj-$(CONFIG_QXL) += qxl.o qxl-logger.o qxl-render.o
obj-$(CONFIG_VIRTIO) += virtio-gpu.o
obj-$(CONFIG_VIRTIO_PCI) += virtio-gpu-pci.o
obj-$(CONFIG_VIRTIO_VGA) += virtio-vga.ohw/display/Makefile.objs +1
-0+obj-$(CONFIG_DPCD) += dpcd.ohw/display/dpcd.c new file +2
-0@@ -0,0 +1,157 @@ +/* +* dpcd.c [snip]
hw/display/dpcd.c line 105
Quoted 10 lines
hw/display/dpcd.c new file +10
-0+ +static void dpcd_reset (DeviceState *dev) +{ +DPCDState *s =DPCD (dev); + +memset (&(s->dpcd_info),0 ,sizeof (s->dpcd_info)); + + s->dpcd_info[DPCD_REVISION ] =DPCD_REV_1_0 ; + s->dpcd_info[DPCD_MAX_LINK_RATE ] =DPCD_5_4GBPS ; + s->dpcd_info[DPCD_MAX_LANE_COUNT ] =DPCD_ONE_LANE ;In my opinion, it's better to use the maximum value. Thus, I'd use
DPCD_FOUR_LANEShere.hw/display/dpcd.c
Quoted 12 lines
hw/display/dpcd.c new file +9
-0+ s->dpcd_info[DPCD_RECEIVE_PORT0_CAP_0 ] =DPCD_EDID_PRESENT ; +/* buffer size */ + s->dpcd_info[DPCD_RECEIVE_PORT0_CAP_1 ] =0xFF ; + + s->dpcd_info[DPCD_LANE0_1_STATUS ] =DPCD_LANE0_CR_DONE + |DPCD_LANE0_CHANNEL_EQ_DONE + |DPCD_LANE0_SYMBOL_LOCKED ; + + s->dpcd_info[DPCD_LANE_ALIGN_STATUS_UPDATED] =
DPCD_INTERLANE_ALIGN_DONE;hw/display/dpcd.c new file +2
-0+ s->dpcd_info[DPCD_SINK_STATUS ] =DPCD_RECEIVE_PORT_0_STATUS ; +}For some reason, on my set up, this
dpcd_reset()functions isn't being called. I had to add it to thedpcd_init()as before. I'm not sure if that is from using different baseline. Please make sure the dpcd is initialized correctly.
Quoted 2 lines
Thanks,
-hyun
Ok this seems to be called.. I can't reproduce the issue.
Thanks,
Fred
Quoted 4 lines
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
PATCH v3 5/8 hw/i2c-ddc.c: Implement DDC I2C slave
In reply to [email protected]From: Peter Maydell <[email protected]>
Implement an I2C slave which implements DDC and returns the EDID data for an attached monitor.
- Rebased on the current master.
- Modified for QOM.
--- default-configs/aarch64-softmmu.mak | 1 + hw/i2c/Makefile.objs | 1 + hw/i2c/i2c-ddc.c | 302 ++++++++++++++++++++++++++++++++++++ hw/i2c/i2c-ddc.h | 36 +++++ 4 files changed, 340 insertions(+) create mode 100644 hw/i2c/i2c-ddc.c create mode 100644 hw/i2c/i2c-ddc.h
default-configs/aarch64-softmmu.mak +1 -0
@@ -4,5 +4,6 @@ include arm-softmmu.mak CONFIG_AUX=y +CONFIG_DDC=y CONFIG_DPCD=y CONFIG_XLNX_ZYNQMP=y
hw/i2c/Makefile.objs +1 -0
@@ -1,4 +1,5 @@ common-obj-y += core.o smbus.o smbus_eeprom.o +common-obj-$(CONFIG_DDC) += i2c-ddc.o common-obj-$(CONFIG_VERSATILE_I2C) += versatile_i2c.o common-obj-$(CONFIG_ACPI_X86) += smbus_ich9.o common-obj-$(CONFIG_APM) += pm_smbus.o
hw/i2c/i2c-ddc.c new file +302 -0
302 lines not on this page · raw message
hw/i2c/i2c-ddc.h new file +36 -0
@@ -0,0 +1,36 @@ +/* A simple I2C slave for returning monitor EDID data via DDC. +* +* Copyright (c) 2011 Linaro Limited +* Written by Peter Maydell +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef I2C_DDC +#define I2C_DDC + +/* A simple I2C slave which just returns the contents of its EDID blob. */ + +typedef struct I2CDDCState { +/*< private >*/ +I2CSlave i2c; +/*< public >*/ +bool firstbyte; +uint8_t reg; +uint8_t edid_blob[128 ]; +}I2CDDCState ; + +#define TYPE_I2CDDC "i2c-ddc" +#define I2CDDC (obj) OBJECT_CHECK(I2CDDCState, (obj), TYPE_I2CDDC) + +#endif /* !I2C_DDC */
Signature · 1 line
1.9.0
PATCH v3 6/8 Introduce xilinx dpdma.
In reply to [email protected]From: KONRAD Frederic <[email protected]>
This is the implementation of the DPDMA.
--- hw/dma/Makefile.objs | 1 + hw/dma/xlnx_dpdma.c | 789 +++++++++++++++++++++++++++++++++++++++++++++++++++ hw/dma/xlnx_dpdma.h | 77 +++++ 3 files changed, 867 insertions(+) create mode 100644 hw/dma/xlnx_dpdma.c create mode 100644 hw/dma/xlnx_dpdma.h
hw/dma/Makefile.objs +1 -0
@@ -8,6 +8,7 @@ common-obj-$(CONFIG_XILINX_AXI) += xilinx_axidma.o common-obj-$(CONFIG_ETRAXFS) += etraxfs_dma.o common-obj-$(CONFIG_STP2000) += sparc32_dma.o common-obj-$(CONFIG_SUN4M) += sun4m_iommu.o +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dpdma.o obj-$(CONFIG_OMAP) += omap_dma.o soc_dma.o obj-$(CONFIG_PXA2XX) += pxa2xx_dma.o
hw/dma/xlnx_dpdma.c new file +789 -0
789 lines not on this page · raw message
hw/dma/xlnx_dpdma.h new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH V3 6/8] Introduce xilinx dpdma.
Hi Fred,
Thanks for the patch.
Quoted 43 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, July 06, 2015 9:22 AM
To: [email protected]
Cc: [email protected]; Peter Crosthwaite; Hyun Kwon; [email protected]; [email protected]; [email protected]
Subject: [PATCH V3 6/8] Introduce xilinx dpdma.From: KONRAD Frederic <[email protected]>
This is the implementation of the DPDMA.
Signed-off-by KONRAD Frederic <[email protected]>--- hw/dma/Makefile.objs | 1 + hw/dma/xlnx_dpdma.c | 789 +++++++++++++++++++++++++++++++++++++++++++++++++++ hw/dma/xlnx_dpdma.h | 77 +++++ 3 files changed, 867 insertions(+) create mode 100644 hw/dma/xlnx_dpdma.c create mode 100644 hw/dma/xlnx_dpdma.hhw/dma/Makefile.objs +1
-0@@ -8,6 +8,7 @@ common-obj-$(CONFIG_XILINX_AXI) += xilinx_axidma.o common-obj-$(CONFIG_ETRAXFS) += etraxfs_dma.o common-obj-$(CONFIG_STP2000) += sparc32_dma.o common-obj-$(CONFIG_SUN4M) += sun4m_iommu.o +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dpdma.o obj-$(CONFIG_OMAP) += omap_dma.o soc_dma.o obj-$(CONFIG_PXA2XX) += pxa2xx_dma.ohw/dma/xlnx_dpdma.c new file +2
-0@@ -0,0 +1,789 @@ +/* +* xlnx_dpdma.c
[snip]
Quoted 7 lines
hw/dma/xlnx_dpdma.c new file +7
-0+ +size_t xlnx_dpdma_start_operation (XlnxDPDMAState *s,uint8_t channel, +bool one_desc) +{ +uint64_t desc_addr; +uint64_t source_addr[6 ]; +DPDMADescriptor desc;
hw/dma/xlnx_dpdma.c line 629
Quoted 10 lines
hw/dma/xlnx_dpdma.c new file +10
-0+bool done = false; +size_t ptr =0 ; + +assert (channel <=5 ); + +/* Trigger a VSYNC IRQ when the graphic callback asks for data. */ +if (channel ==3 ) { + s->registers[DPDMA_ISR ] |= (1 <<27 ); +xlnx_dpdma_update_irq (s); + }
I'd rather make this VSYNC interrupt generation as a separate function, and have it called by whenever xlnx_dp_update_display() is called. Please see my comment in patch 7/8 as well.
Thanks,
-hyun
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Re: [Qemu-devel] [PATCH V3 6/8] Introduce xilinx dpdma.
Quoted 68 lines · Hyun Kwon
Hi Fred,
Thanks for the patch.
Quoted 43 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, July 06, 2015 9:22 AM
To: [email protected]
Cc: [email protected]; Peter Crosthwaite; Hyun Kwon; [email protected]; [email protected]; [email protected]
Subject: [PATCH V3 6/8] Introduce xilinx dpdma.From: KONRAD Frederic <[email protected]>
This is the implementation of the DPDMA.
Signed-off-by KONRAD Frederic <[email protected]>--- hw/dma/Makefile.objs | 1 + hw/dma/xlnx_dpdma.c | 789 +++++++++++++++++++++++++++++++++++++++++++++++++++ hw/dma/xlnx_dpdma.h | 77 +++++ 3 files changed, 867 insertions(+)create mode 100644
hw/dma/xlnx_dpdma.c
create mode 100644hw/dma/xlnx_dpdma.hhw/dma/Makefile.objs +1
-0@@ -8,6 +8,7 @@ common-obj-$(CONFIG_XILINX_AXI) += xilinx_axidma.o common-obj-$(CONFIG_ETRAXFS) += etraxfs_dma.o common-obj-$(CONFIG_STP2000) += sparc32_dma.o common-obj-$(CONFIG_SUN4M) += sun4m_iommu.o +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dpdma.o obj-$(CONFIG_OMAP) += omap_dma.o soc_dma.o obj-$(CONFIG_PXA2XX) += pxa2xx_dma.ohw/dma/xlnx_dpdma.c new file +2
-0@@ -0,0 +1,789 @@ +/* +* xlnx_dpdma.c [snip]
Quoted 7 lines
hw/dma/xlnx_dpdma.c new file +7
-0+ +size_t xlnx_dpdma_start_operation (XlnxDPDMAState *s,uint8_t channel, +bool one_desc) +{ +uint64_t desc_addr; +uint64_t source_addr[6 ]; +DPDMADescriptor desc;hw/dma/xlnx_dpdma.c line 629
Quoted 10 lines
hw/dma/xlnx_dpdma.c new file +10
-0+bool done = false; +size_t ptr =0 ; + +assert (channel <=5 ); + +/* Trigger a VSYNC IRQ when the graphic callback asks for data. */ +if (channel ==3 ) { + s->registers[DPDMA_ISR ] |= (1 <<27 ); +xlnx_dpdma_update_irq (s); + }I'd rather make this VSYNC interrupt generation as a separate function, and have it called by whenever
xlnx_dp_update_display()is called. Please see my comment in patch 7/8 as well.
Quoted 2 lines
Thanks,
-hyun
Ok I do that.
Thanks,
Fred
Quoted 4 lines
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
PATCH v3 7/8 Introduce xilinx dp.
In reply to [email protected]From: KONRAD Frederic <[email protected]>
This is the implementation of the DisplayPort.
It has an aux-bus to access dpcd and edid .
Graphic plane is connected to the channel 3. Video plane is connected to the channel 0. Audio stream are connected to the channels 4 and 5.
--- hw/display/Makefile.objs | 1 + hw/display/xlnx_dp.c | 1370 ++++++++++++++++++++++++++++++++++++++++++++++ hw/display/xlnx_dp.h | 110 ++++ 3 files changed, 1481 insertions(+) create mode 100644 hw/display/xlnx_dp.c create mode 100644 hw/display/xlnx_dp.h
hw/display/Makefile.objs +1 -0
@@ -39,3 +39,4 @@ obj-$(CONFIG_VIRTIO) += virtio-gpu.o obj-$(CONFIG_VIRTIO_PCI) += virtio-gpu-pci.o obj-$(CONFIG_VIRTIO_VGA) += virtio-vga.o obj-$(CONFIG_DPCD) += dpcd.o +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dp.o
hw/display/xlnx_dp.c new file +1370 -0
1,370 lines not on this page · raw message
hw/display/xlnx_dp.h new file +110 -0
110 lines not on this page · raw message
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH V3 7/8] Introduce xilinx dp.
Hi Fred,
Thanks for the patch.
Quoted 46 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, July 06, 2015 9:22 AM
To: [email protected]
Cc: [email protected]; Peter Crosthwaite; Hyun Kwon; [email protected]; [email protected]; [email protected]
Subject: [PATCH V3 7/8] Introduce xilinx dp.From: KONRAD Frederic <[email protected]>
This is the implementation of the DisplayPort.
It has an aux-bus to access dpcd and edid .
Graphic plane is connected to the channel 3. Video plane is connected to the channel 0. Audio stream are connected to the channels 4 and 5.
Signed-off-by KONRAD Frederic <[email protected]>--- hw/display/Makefile.objs | 1 + hw/display/xlnx_dp.c | 1370 ++++++++++++++++++++++++++++++++++++++++++++++ hw/display/xlnx_dp.h | 110 ++++ 3 files changed, 1481 insertions(+) create mode 100644 hw/display/xlnx_dp.c create mode 100644 hw/display/xlnx_dp.hhw/display/Makefile.objs +1
-0@@ -39,3 +39,4 @@ obj-$(CONFIG_VIRTIO) += virtio-gpu.o obj-$(CONFIG_VIRTIO_PCI) += virtio-gpu-pci.o obj-$(CONFIG_VIRTIO_VGA) += virtio-vga.o obj-$(CONFIG_DPCD) += dpcd.o +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dp.ohw/display/xlnx_dp.c new file +2
-0@@ -0,0 +1,1370 @@ +/* +* xlnx_dp.c
[snip]
hw/display/xlnx_dp.c line 373
Quoted 10 lines
hw/display/xlnx_dp.c new file +10
-0+ +static void xlnx_dp_audio_callback (void *opaque,int avail) +{ +/* +* Get some data from the DPDMA and compute these datas. +* Then wait for QEMU's audio subsystem to call this callback. +*/ +XlnxDPState *s =XLNX_DP (opaque); +size_t written =0 ; +static uint8_t buffer;
This 'buffer' doesn't seem to be needed anywhere.
Quoted 9 lines
hw/display/xlnx_dp.c new file +5
-0+ +/* If there are already some data don't get more data. */ +if (s->byte_left ==0 ) { + buffer++; + s->audio_data_available[0] = xlnx_dpdma_start_operation(s->dpdma,4,
hw/display/xlnx_dp.c new file +2
-0+ true); + s->audio_data_available[1] = xlnx_dpdma_start_operation(s->dpdma,5,
hw/display/xlnx_dp.c line 386
Quoted 6 lines
hw/display/xlnx_dp.c new file +6
-0+ true); +xlnx_dp_audio_mix_buffer (s); + } + +/* Send the buffer through the audio. */ +if (s->byte_left <=MAX_QEMU_BUFFER_SIZE ) {
How was the value of MAX_QEMU_BUFFER_SIZE decided? Doesn't 'avail' have to be used instead to check min or max amount of data to write? I'd like to make sure this is fine.
Quoted 20 lines
hw/display/xlnx_dp.c new file +20
-0+if (s->byte_left !=0 ) { + written =AUD_write (s->amixer_output_stream, + &s->out_buffer[s->data_ptr], s->byte_left); + }else { +/* +* There is nothing to play.. We don't have any data! Fill the +* buffer with zero's and send it. +*/ + written =0 ; +memset (s->out_buffer,0 ,1024 ); +AUD_write (s->amixer_output_stream, s->out_buffer,1024 ); + } + }else { + written =AUD_write (s->amixer_output_stream, + &s->out_buffer[s->data_ptr],MAX_QEMU_BUFFER_SIZE ); + } + s->byte_left -= written; + s->data_ptr += written; +} +
[snip]
Quoted 33 lines
hw/display/xlnx_dp.c new file +8
-0+ +/* +* Change the graphic format of the surface. +* XXX: To be completed. +*/ +static void xlnx_dp_change_graphic_fmt (XlnxDPState *s) +{ + switch (s->avbufm_registers[AV_BUF_FORMAT] & DP_GRAPHIC_MASK){
hw/display/xlnx_dp.c new file +23
-0+case DP_GRAPHIC_RGBA8888 : + s->g_plane.format = PIXMAN_r8g8b8a8; +break ; +case DP_GRAPHIC_ABGR8888 : + s->g_plane.format = PIXMAN_a8b8g8r8; +break ; +case DP_GRAPHIC_RGB565 : + s->g_plane.format = PIXMAN_r5g6b5; +break ; +case DP_GRAPHIC_RGB888 : + s->g_plane.format = PIXMAN_r8g8b8; +break ; +case DP_GRAPHIC_BGR888 : + s->g_plane.format = PIXMAN_b8g8r8; +break ; +default : +DPRINTF ("error: unsupported graphic format %u.\n" , + s->avbufm_registers[AV_BUF_FORMAT ] &DP_GRAPHIC_MASK ); +abort (); +break ; + } + + switch (s->avbufm_registers[AV_BUF_FORMAT] &
DP_NL_VID_FMT_MASK) {
hw/display/xlnx_dp.c line 640
Quoted 5 lines
hw/display/xlnx_dp.c new file +5
-0+case 0 : + s->v_plane.format = PIXMAN_r8g8b8a8; +break ; +case DP_NL_VID_RGBA8880 : + s->v_plane.format = PIXMAN_r8g8b8a8;
The pixman format for DP_NL_VID_RGBA8880 and default should be PIXMAN_x8b8g8r8. The DP documentation has confusing naming scheme. :-)
Quoted 12 lines
hw/display/xlnx_dp.c new file +4
-0+break ; +default : + DPRINTF("error: unsupported video format %u.\n", + s->avbufm_registers[AV_BUF_FORMAT] &
DP_NL_VID_FMT_MASK);hw/display/xlnx_dp.c new file +7
-0+abort (); +break ; + } + +xlnx_dp_recreate_surface (s); +} +
[snip]
Quoted 42 lines
hw/display/xlnx_dp.c new file +42
-0+ +static void xlnx_dp_update_display (void *opaque) +{ +XlnxDPState *s =XLNX_DP (opaque); + +if (DEBUG_DP ) { +int64_t last_time =0 ; +int64_t frame =0 ; +int64_t time =get_clock (); +int64_t fps; + +if (last_time ==0 ) { + last_time =get_clock (); + } + frame++; +if (last_time +1000000000 < time) { + fps = (1000000000.0 * frame) / (time - last_time); + last_time = time; + frame =0 ; +DPRINTF ("xlnx_dp: %ldfps\n" , fps); + } + } + + +if ((s->core_registers[DP_TRANSMITTER_ENABLE ] &0x01 ) ==0 ) { +return ; + } + + s->core_registers[DP_INT_STATUS ] |= (1 <<13 ); +xlnx_dp_update_irq (s); + +/* +* Trigger the DMA channel. +*/ +if (!xlnx_dpdma_start_operation (s->dpdma,3 , false)) { +/* +* An error occured don't do anything with the data.. +* Trigger an underflow interrupt. +*/ + s->core_registers[DP_INT_STATUS ] |= (1 <<21 ); +xlnx_dp_update_irq (s); +return ;
hw/display/xlnx_dp.c line 1212
Quoted 10 lines
hw/display/xlnx_dp.c new file +10
-0+ } + +if (xlnx_dp_global_alpha_enabled (s)) { +if (!xlnx_dpdma_start_operation (s->dpdma,0 , false)) { + s->core_registers[DP_INT_STATUS ] |= (1 <<21 ); +xlnx_dp_update_irq (s); +return ; + } +xlnx_dp_blend_surface (s); + }
I'm not sure when to generate the underflow DP interrupt. The current implementation doesn't catch any partial transaction (ex, when only 500 lines are fetched from 1000 lines) done by xlnx_dpdma_start_operation(). The best way would be to calculate the actual size of requested surface, and compare it to the return value of xlnx_dpdma_start_operation(). But, that can be implemented later, and I'm fine with as is.
In addition, currently xlnx_dp_update_display() assumes that the channel 3 is required to be running, and the channel 0 runs on top optionally. In fact, the other way around should work as well. How about something like below?
xlnx_dpdma_trigger_vsync();
if (!xlnx_dpdma_start_operation(channel 3) && !xlnx_dpdma_start_operation(channe 0)) {
return;
}
If (xlnx_dp_global_alpha_enabled()) {
xlnx_dp_blend_surface();
}
dpy_gfx_update();We may also want to move xlnx_dp_global_alpha_enabled() into xlnx_dp_blend_surface() if we consider that pixel-by-pixel blending support can be added later.
Quoted 8 lines
hw/display/xlnx_dp.c new file +8
-0+ +/* +* XXX: We might want to update only what changed. +*/ +dpy_gfx_update (s->console,0 ,0 ,surface_width (s->g_plane.surface), +surface_height (s->g_plane.surface)); +} +
[snip]
Quoted 11 lines
hw/display/xlnx_dp.c new file +10
-0+ +static void xlnx_dp_realize (DeviceState *dev,Error **errp) +{ +XlnxDPState *s =XLNX_DP (dev); +DisplaySurface *surface; +struct audsettings as; + + s->console =graphic_console_init (dev,0 , &xlnx_dp_gfx_ops, s); + surface =qemu_console_surface (s->console); + xlnx_dpdma_set_host_data_location(s->dpdma,
DP_GRAPHIC_DMA_CHANNEL,
hw/display/xlnx_dp.c line 1286
Quoted 6 lines
hw/display/xlnx_dp.c new file +6
-0+ surface_data(surface)); + + as.freq =44100 ; + as.nchannels =2 ; + as.fmt =AUD_FMT_S16 ; + as.endianness =0 ;
Do you know if this is configurable at run time? It looks like it from what I can tell from other source code. I'm fine with fixed configuration for now, but in theory, the Xilinx DP supports dynamic configuration of these.
Thanks,
-hyun
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Re: [Qemu-devel] [PATCH V3 7/8] Introduce xilinx dp.
Quoted 52 lines · Hyun Kwon
Hi Fred,
Thanks for the patch.
Quoted 46 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, July 06, 2015 9:22 AM
To: [email protected]
Cc: [email protected]; Peter Crosthwaite; Hyun Kwon; [email protected]; [email protected]; [email protected]
Subject: [PATCH V3 7/8] Introduce xilinx dp.From: KONRAD Frederic <[email protected]>
This is the implementation of the DisplayPort.
It has an aux-bus to access dpcd and edid .
Graphic plane is connected to the channel 3. Video plane is connected to the channel 0. Audio stream are connected to the channels 4 and 5.
Signed-off-by KONRAD Frederic <[email protected]>--- hw/display/Makefile.objs | 1 + hw/display/xlnx_dp.c | 1370 ++++++++++++++++++++++++++++++++++++++++++++++ hw/display/xlnx_dp.h | 110 ++++ 3 files changed, 1481 insertions(+)create mode 100644
hw/display/xlnx_dp.c
create mode 100644hw/display/xlnx_dp.hhw/display/Makefile.objs +1
-0@@ -39,3 +39,4 @@ obj-$(CONFIG_VIRTIO) += virtio-gpu.o obj-$(CONFIG_VIRTIO_PCI) += virtio-gpu-pci.o obj-$(CONFIG_VIRTIO_VGA) += virtio-vga.o obj-$(CONFIG_DPCD) += dpcd.o +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dp.ohw/display/xlnx_dp.c new file +2
-0@@ -0,0 +1,1370 @@ +/* +* xlnx_dp.c [snip]
Quoted 11 lines
hw/display/xlnx_dp.c line 373
Quoted 10 lines
hw/display/xlnx_dp.c new file +10
-0+ +static void xlnx_dp_audio_callback (void *opaque,int avail) +{ +/* +* Get some data from the DPDMA and compute these datas. +* Then wait for QEMU's audio subsystem to call this callback. +*/ +XlnxDPState *s =XLNX_DP (opaque); +size_t written =0 ; +static uint8_t buffer;This 'buffer' doesn't seem to be needed anywhere.
oops good point.
Quoted 17 lines
Quoted 10 lines
hw/display/xlnx_dp.c new file +5
-0+ +/* If there are already some data don't get more data. */ +if (s->byte_left ==0 ) { + buffer++; + s->audio_data_available[0] = xlnx_dpdma_start_operation(s->dpdma,4,
hw/display/xlnx_dp.c new file +2
-0+ true); + s->audio_data_available[1] = xlnx_dpdma_start_operation(s->dpdma,5,
hw/display/xlnx_dp.c line 386
Quoted 6 lines
hw/display/xlnx_dp.c new file +6
-0+ true); +xlnx_dp_audio_mix_buffer (s); + } + +/* Send the buffer through the audio. */ +if (s->byte_left <=MAX_QEMU_BUFFER_SIZE ) {How was the value of
MAX_QEMU_BUFFER_SIZEdecided? Doesn't 'avail' have to be used instead to check min or max amount of data to write? I'd like to make sure this is fine.
Hmm that might be the problem we have with the small audio glitch. I'll take a look.
Quoted 54 lines
Quoted 20 lines
hw/display/xlnx_dp.c new file +20
-0+if (s->byte_left !=0 ) { + written =AUD_write (s->amixer_output_stream, + &s->out_buffer[s->data_ptr], s->byte_left); + }else { +/* +* There is nothing to play.. We don't have any data! Fill the +* buffer with zero's and send it. +*/ + written =0 ; +memset (s->out_buffer,0 ,1024 ); +AUD_write (s->amixer_output_stream, s->out_buffer,1024 ); + } + }else { + written =AUD_write (s->amixer_output_stream, + &s->out_buffer[s->data_ptr],MAX_QEMU_BUFFER_SIZE ); + } + s->byte_left -= written; + s->data_ptr += written; +} +[snip]
Quoted 31 lines
hw/display/xlnx_dp.c new file +8
-0+ +/* +* Change the graphic format of the surface. +* XXX: To be completed. +*/ +static void xlnx_dp_change_graphic_fmt (XlnxDPState *s) +{ + switch (s->avbufm_registers[AV_BUF_FORMAT] & DP_GRAPHIC_MASK){
hw/display/xlnx_dp.c new file +22
-0+case DP_GRAPHIC_RGBA8888 : + s->g_plane.format = PIXMAN_r8g8b8a8; +break ; +case DP_GRAPHIC_ABGR8888 : + s->g_plane.format = PIXMAN_a8b8g8r8; +break ; +case DP_GRAPHIC_RGB565 : + s->g_plane.format = PIXMAN_r5g6b5; +break ; +case DP_GRAPHIC_RGB888 : + s->g_plane.format = PIXMAN_r8g8b8; +break ; +case DP_GRAPHIC_BGR888 : + s->g_plane.format = PIXMAN_b8g8r8; +break ; +default : +DPRINTF ("error: unsupported graphic format %u.\n" , + s->avbufm_registers[AV_BUF_FORMAT ] &DP_GRAPHIC_MASK ); +abort (); +break ; + } +
Quoted 8 lines
hw/display/xlnx_dp.c line 640
Quoted 7 lines
+ switch (s->avbufm_registers[AV_BUF_FORMAT] &
DP_NL_VID_FMT_MASK) {hw/display/xlnx_dp.c new file +5
-0+case 0 : + s->v_plane.format = PIXMAN_r8g8b8a8; +break ; +case DP_NL_VID_RGBA8880 : + s->v_plane.format = PIXMAN_r8g8b8a8;The pixman format for
DP_NL_VID_RGBA8880and default should bePIXMAN_x8b8g8r8. The DP documentation has confusing naming scheme. :-)
Ok I changed that.
Quoted 82 lines
Quoted 12 lines
hw/display/xlnx_dp.c new file +4
-0+break ; +default : + DPRINTF("error: unsupported video format %u.\n", + s->avbufm_registers[AV_BUF_FORMAT] &
DP_NL_VID_FMT_MASK);hw/display/xlnx_dp.c new file +7
-0+abort (); +break ; + } + +xlnx_dp_recreate_surface (s); +} +[snip]
Quoted 42 lines
hw/display/xlnx_dp.c new file +42
-0+ +static void xlnx_dp_update_display (void *opaque) +{ +XlnxDPState *s =XLNX_DP (opaque); + +if (DEBUG_DP ) { +int64_t last_time =0 ; +int64_t frame =0 ; +int64_t time =get_clock (); +int64_t fps; + +if (last_time ==0 ) { + last_time =get_clock (); + } + frame++; +if (last_time +1000000000 < time) { + fps = (1000000000.0 * frame) / (time - last_time); + last_time = time; + frame =0 ; +DPRINTF ("xlnx_dp: %ldfps\n" , fps); + } + } + + +if ((s->core_registers[DP_TRANSMITTER_ENABLE ] &0x01 ) ==0 ) { +return ; + } + + s->core_registers[DP_INT_STATUS ] |= (1 <<13 ); +xlnx_dp_update_irq (s); + +/* +* Trigger the DMA channel. +*/ +if (!xlnx_dpdma_start_operation (s->dpdma,3 , false)) { +/* +* An error occured don't do anything with the data.. +* Trigger an underflow interrupt. +*/ + s->core_registers[DP_INT_STATUS ] |= (1 <<21 ); +xlnx_dp_update_irq (s); +return ;hw/display/xlnx_dp.c line 1212
Quoted 10 lines
hw/display/xlnx_dp.c new file +10
-0+ } + +if (xlnx_dp_global_alpha_enabled (s)) { +if (!xlnx_dpdma_start_operation (s->dpdma,0 , false)) { + s->core_registers[DP_INT_STATUS ] |= (1 <<21 ); +xlnx_dp_update_irq (s); +return ; + } +xlnx_dp_blend_surface (s); + }I'm not sure when to generate the underflow DP interrupt. The current implementation doesn't catch any partial transaction (ex, when only 500 lines are fetched from 1000 lines) done by
xlnx_dpdma_start_operation(). The best way would be to calculate the actual size of requested surface, and compare it to the return value ofxlnx_dpdma_start_operation(). But, that can be implemented later, and I'm fine with as is.In addition, currently
xlnx_dp_update_display()assumes that the channel 3 is required to be running, and the channel 0 runs on top optionally. In fact, the other way around should work as well. How about something like below?xlnx_dpdma_trigger_vsync(); if (!xlnx_dpdma_start_operation(channel 3) && !xlnx_dpdma_start_operation(channe 0)) { return; } If (xlnx_dp_global_alpha_enabled()) { xlnx_dp_blend_surface(); } dpy_gfx_update();
Quoted 2 lines
We may also want to move
xlnx_dp_global_alpha_enabled()intoxlnx_dp_blend_surface()if we consider that pixel-by-pixel blending support can be added later.
Ok the problem is what happen if we get data from both channels but the blending is not enabled?
Quoted 20 lines
Quoted 8 lines
hw/display/xlnx_dp.c new file +8
-0+ +/* +* XXX: We might want to update only what changed. +*/ +dpy_gfx_update (s->console,0 ,0 ,surface_width (s->g_plane.surface), +surface_height (s->g_plane.surface)); +} +[snip]
Quoted 10 lines
hw/display/xlnx_dp.c new file +10
-0+ +static void xlnx_dp_realize (DeviceState *dev,Error **errp) +{ +XlnxDPState *s =XLNX_DP (dev); +DisplaySurface *surface; +struct audsettings as; + + s->console =graphic_console_init (dev,0 , &xlnx_dp_gfx_ops, s); + surface =qemu_console_surface (s->console); + xlnx_dpdma_set_host_data_location(s->dpdma,
Quoted 8 lines
hw/display/xlnx_dp.c line 1286
Quoted 7 lines
DP_GRAPHIC_DMA_CHANNEL,hw/display/xlnx_dp.c new file +6
-0+ surface_data(surface)); + + as.freq =44100 ; + as.nchannels =2 ; + as.fmt =AUD_FMT_S16 ; + as.endianness =0 ;Do you know if this is configurable at run time? It looks like it from what I can tell from other source code. I'm fine with fixed configuration for now, but in theory, the Xilinx DP supports dynamic configuration of these.
I didn't see any configuration registers for that. That's why I just hardcoded that.
Thanks,
Fred
Quoted 8 lines
Thanks,
-hyunThis email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
PATCH v3 8/8 arm: xlnx-zynqmp: Add DisplayPort and DPDMA.
In reply to [email protected]From: KONRAD Frederic <[email protected]>
This adds the DP and the DPDMA to the Zynq MP.
--- hw/arm/xlnx-zynqmp.c | 20 ++++++++++++++++++++ include/hw/arm/xlnx-zynqmp.h | 5 +++++ 2 files changed, 25 insertions(+)
hw/arm/xlnx-zynqmp.c +20 -0
@@ -28,6 +28,12 @@#define GIC_DIST_ADDR 0xf9010000#define GIC_CPU_ADDR 0xf9020000 +#define DP_ADDR 0xfd4a0000 +#define DP_IRQ 113 + +#define DPDMA_ADDR 0xfd4c0000 +#define DPDMA_IRQ 116 +static const uint64_t gem_addr[XLNX_ZYNQMP_NUM_GEMS ] = {0xFF0B0000 ,0xFF0C0000 ,0xFF0D0000 ,0xFF0E0000 , };
@@ -90,6 +96,11 @@ static void xlnx_zynqmp_init(Object *obj)object_initialize (&s->uart[i],sizeof (s->uart[i]),TYPE_CADENCE_UART );qdev_set_parent_bus (DEVICE (&s->uart[i]),sysbus_get_default ()); } + +object_initialize (&s->dp,sizeof (s->dp),TYPE_XLNX_DP ); +qdev_set_parent_bus (DEVICE (&s->dp),sysbus_get_default ()); +object_initialize (&s->dpdma,sizeof (s->dpdma),TYPE_XLNX_DPDMA ); +qdev_set_parent_bus (DEVICE (&s->dpdma),sysbus_get_default ()); }static void xlnx_zynqmp_realize (DeviceState *dev,Error **errp)
@@ -233,6 +244,15 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->uart[i]),0 , gic_spi[uart_intr[i]]); } + +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dp),0 ,DP_ADDR ); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->dp),0 , gic_spi[DP_IRQ ]); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dpdma),0 ,DPDMA_ADDR ); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->dpdma),0 , gic_spi[DPDMA_IRQ ]); +object_property_set_bool (OBJECT (&s->dp), true,"realized" , &err); +object_property_set_bool (OBJECT (&s->dpdma), true,"realized" , &err); +object_property_set_link (OBJECT (&s->dp),OBJECT (&s->dpdma),"dpdma" , + &error_abort); }static Property xlnx_zynqmp_props[] = {
include/hw/arm/xlnx-zynqmp.h +5 -0
@@ -22,6 +22,8 @@#include "hw/intc/arm_gic.h" #include "hw/net/cadence_gem.h" #include "hw/char/cadence_uart.h" +#include "hw/dma/xlnx_dpdma.h" +#include "hw/display/xlnx_dp.h" #define TYPE_XLNX_ZYNQMP "xlnx,zynqmp"#define XLNX_ZYNQMP (obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \
@@ -57,6 +59,9 @@ typedef struct XlnxZynqMPState {char *boot_cpu;ARMCPU *boot_cpu_ptr; + +XlnxDPState dp; +XlnxDPDMAState dpdma; } XlnxZynqMPState;#define XLNX_ZYNQMP_H
Signature · 1 line
1.9.0