~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to debian/patches/linaro/0046-dsi-add-transfer-done-callback.patch

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2014-02-04 12:13:08 UTC
  • mfrom: (10.1.45 sid)
  • Revision ID: package-import@ubuntu.com-20140204121308-1xq92lrfs75agw2g
Tags: 1.7.0+dfsg-3ubuntu1~ppa1
* Merge 1.7.0+dfsg-3 from debian.  Remaining changes:
  - debian/patches/ubuntu:
    * expose-vmx_qemu64cpu.patch
    * linaro (omap3) and arm64 patches
    * ubuntu/target-ppc-add-stubs-for-kvm-breakpoints: fix FTBFS
      on ppc
    * ubuntu/CVE-2013-4377.patch: fix denial of service via virtio
  - debian/qemu-system-x86.modprobe: set kvm_intel nested=1 options
  - debian/control:
    * add arm64 to Architectures
    * add qemu-common and qemu-system-aarch64 packages
  - debian/qemu-system-common.install: add debian/tmp/usr/lib
  - debian/qemu-system-common.preinst: add kvm group
  - debian/qemu-system-common.postinst: remove acl placed by udev,
    and add udevadm trigger.
  - qemu-system-x86.links: add eepro100.rom, remove pxe-virtio,
    pxe-e1000 and pxe-rtl8139.
  - add qemu-system-x86.qemu-kvm.upstart and .default
  - qemu-user-static.postinst-in: remove arm64 binfmt
  - debian/rules:
    * allow parallel build
    * add aarch64 to system_targets and sys_systems
    * add qemu-kvm-spice links
    * install qemu-system-x86.modprobe
  - add debian/qemu-system-common.links for OVMF.fd link
* Remove kvm-img, kvm-nbd, kvm-ifup and kvm-ifdown symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From a066656aa4dc45280bfa94c8cf3b155ebb1623e0 Mon Sep 17 00:00:00 2001
2
 
From: =?UTF-8?q?Juha=20Riihim=C3=A4ki?= <juha.riihimaki@nokia.com>
3
 
Date: Mon, 18 Feb 2013 16:58:31 +0000
4
 
Subject: [PATCH 46/70] dsi: add transfer done callback
5
 
MIME-Version: 1.0
6
 
Content-Type: text/plain; charset=UTF-8
7
 
Content-Transfer-Encoding: 8bit
8
 
 
9
 
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
10
 
---
11
 
 hw/display/dsi.c      | 15 +++++++++++++++
12
 
 hw/display/omap_dss.c | 35 ++++++++++++++++++++++++++++++-----
13
 
 include/hw/dsi.h      |  3 +++
14
 
 3 files changed, 48 insertions(+), 5 deletions(-)
15
 
 
16
 
diff --git a/hw/display/dsi.c b/hw/display/dsi.c
17
 
index 3347398..595a572 100644
18
 
--- a/hw/display/dsi.c
19
 
+++ b/hw/display/dsi.c
20
 
@@ -130,6 +130,21 @@ int dsi_blt(DSIHost *host, int vc, void *data, int width, int height,
21
 
     return 0;
22
 
 }
23
 
 
24
 
+void dsi_bltdone(DSIHost *host, int vc)
25
 
+{
26
 
+    if (vc >=0 && vc < 4) {
27
 
+        DSIDevice *dev = host->device[vc];
28
 
+        if (dev) {
29
 
+            DSIDeviceClass *dc = DSI_DEVICE_GET_CLASS(dev);
30
 
+            dc->bltdone(dev);
31
 
+        } else {
32
 
+            DSI_ERROR_NODEVICE(vc);
33
 
+        }
34
 
+    } else {
35
 
+        hw_error("%s: invalid virtual channel id (%d)\n", __FUNCTION__, vc);
36
 
+    }
37
 
+}
38
 
+
39
 
 void dsi_te_trigger(const DSIDevice *dev)
40
 
 {
41
 
     if (dev && dev->host && dev->host->te_trigger) {
42
 
diff --git a/hw/display/omap_dss.c b/hw/display/omap_dss.c
43
 
index 888f2ef..2c74384 100644
44
 
--- a/hw/display/omap_dss.c
45
 
+++ b/hw/display/omap_dss.c
46
 
@@ -188,6 +188,7 @@ struct omap_dss_s {
47
 
     
48
 
     struct {
49
 
         DSIHost *host;
50
 
+        QEMUTimer *xfer_timer;
51
 
         qemu_irq drq[4];
52
 
         /* protocol engine registers */
53
 
         uint32_t sysconfig;
54
 
@@ -403,12 +404,28 @@ static void omap_rfbi_transfer_start(struct omap_dss_s *s)
55
 
     omap_dss_framedone(s);
56
 
 }
57
 
 
58
 
+static void omap_dsi_transfer_stop(void *opaque)
59
 
+{
60
 
+    struct omap_dss_s *s = opaque;
61
 
+    int i;
62
 
+    timer_del(s->dsi.xfer_timer);
63
 
+    for (i = 0; i < 4; i++) {
64
 
+        if ((s->dsi.vc[i].ctrl & 1) &&       /* VC_EN */
65
 
+            ((s->dsi.vc[i].te >> 30) & 3)) { /* TE_START | TE_EN */
66
 
+            TRACEDSI("TE data transfer ready, signaling framedone");
67
 
+            s->dsi.vc[i].te = 0; /* transfer complete */
68
 
+            omap_dss_framedone(s);
69
 
+            dsi_bltdone(s->dsi.host, i);
70
 
+        }
71
 
+    }
72
 
+}
73
 
+
74
 
 static void omap_dsi_transfer_start(struct omap_dss_s *s, int ch)
75
 
 {
76
 
     if (((s->dispc.control >> 11) & 1) && /* STALLMODE */
77
 
         (s->dsi.ctrl & 1) &&              /* IF_EN */
78
 
         (s->dsi.vc[ch].ctrl & 1) &&       /* VC_EN */
79
 
-        (s->dsi.vc[ch].te >> 30) & 3) {   /* TE_START | TE_EN */
80
 
+        ((s->dsi.vc[ch].te >> 30) & 3)) { /* TE_START | TE_EN */
81
 
         TRACEDSI("start TE data transfer on channel %d for %d bytes",
82
 
                  ch, s->dsi.vc[ch].te & 0xffffff);
83
 
         TRACEDSI("vc%d   irqenable=0x%08x", ch, s->dsi.vc[ch].irqen);
84
 
@@ -420,9 +437,9 @@ static void omap_dsi_transfer_start(struct omap_dss_s *s, int ch)
85
 
         } else {
86
 
             const int format = (s->dispc.plane[0].attr >> 1) & 0xf;
87
 
             const int col_pitch = omap_lcd_Bpp[format] +
88
 
-            (s->dispc.plane[0].colinc - 1);
89
 
+                                  (s->dispc.plane[0].colinc - 1);
90
 
             const int row_pitch = (s->dispc.plane[0].nx * col_pitch) +
91
 
-            (s->dispc.plane[0].rowinc - 1);
92
 
+                                  (s->dispc.plane[0].rowinc - 1);
93
 
             hwaddr len = row_pitch * s->dispc.plane[0].ny;
94
 
             void *data = cpu_physical_memory_map(s->dispc.plane[0].addr[0],
95
 
                                                  &len, 0);
96
 
@@ -436,8 +453,14 @@ static void omap_dsi_transfer_start(struct omap_dss_s *s, int ch)
97
 
             if (data) {
98
 
                 cpu_physical_memory_unmap(data, len, 0, 0);
99
 
             }
100
 
-            s->dsi.vc[ch].te = 0; /* transfer complete */
101
 
-            omap_dss_framedone(s);
102
 
+            /* We cannot signal transfer complete immediately since some
103
 
+             * display drivers assume transfer takes some time. Instead,
104
 
+             * setup a small delay and report transfer complete a bit
105
 
+             * later. */
106
 
+            s->dsi.vc[ch].ctrl &= ~(0x11 << 16); /* TX/RX fifo not full */
107
 
+            timer_mod(s->dsi.xfer_timer,
108
 
+                      qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)
109
 
+                      + get_ticks_per_sec() / 1000);
110
 
         }
111
 
     }
112
 
 }
113
 
@@ -2495,6 +2518,8 @@ static int omap_dss_init(SysBusDevice *dev)
114
 
         s->dsi.host = dsi_init_host(DEVICE(s), "omap3_dsi",
115
 
                                     omap_dsi_te_trigger,
116
 
                                     omap_dss_linefn);
117
 
+        s->dsi.xfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_dsi_transfer_stop,
118
 
+                                           s);
119
 
         memory_region_init_io(&s->iomem_dsi, obj, &omap_dsi_ops, s,
120
 
                               "omap.dsi", 0x400);
121
 
         sysbus_init_mmio(dev, &s->iomem_dsi);
122
 
diff --git a/include/hw/dsi.h b/include/hw/dsi.h
123
 
index 2714ed2..d35fdb5 100644
124
 
--- a/include/hw/dsi.h
125
 
+++ b/include/hw/dsi.h
126
 
@@ -54,6 +54,7 @@ typedef void (*dsi_write_cb)(DSIDevice *dev, uint32_t data, int len);
127
 
 typedef uint32_t (*dsi_read_cb)(DSIDevice *dev, uint32_t data, int len);
128
 
 typedef int (*dsi_blt_cb)(DSIDevice *dev, void *data, int width, int height,
129
 
                           int col_pitch, int row_pitch, int format);
130
 
+typedef void (*dsi_bltdone_cb)(DSIDevice *dev);
131
 
 
132
 
 /* common device callbacks */
133
 
 typedef void (*dsi_common_write_cb)(DSICommonDevice *dev, uint32_t data,
134
 
@@ -75,6 +76,7 @@ typedef struct {
135
 
     dsi_write_cb write;
136
 
     dsi_read_cb read;
137
 
     dsi_blt_cb blt;
138
 
+    dsi_bltdone_cb bltdone;
139
 
 } DSIDeviceClass;
140
 
 
141
 
 typedef struct {
142
 
@@ -126,6 +128,7 @@ void dsi_long_write(DSIHost *host, uint32_t header, uint32_t payload,
143
 
                     uint32_t counter);
144
 
 int dsi_blt(DSIHost *host, int vc, void *data, int width, int height,
145
 
             int col_pitch, int row_pitch, int format);
146
 
+void dsi_bltdone(DSIHost *host, int vc);
147
 
 
148
 
 /* device -> host functions */
149
 
 void dsi_te_trigger(const DSIDevice *dev);
150
 
1.8.5.2
151