[Spice-devel,spice-protocol,44/46] qxlhw: qxl_surface: use qxlhw_get_mm_time

Submitted by Alon Levy on April 10, 2012, 11:50 a.m.

Details

Message ID 1334058642-12274-45-git-send-email-alevy@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Alon Levy April 10, 2012, 11:50 a.m.
---
 src/qxl_surface.c |    3 +--
 src/qxlhw.c       |    5 +++++
 src/qxlhw.h       |    4 ++++
 src/qxlhw_pci.c   |    9 +++++++++
 4 files changed, 19 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index 25ace13..3394158 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -384,7 +384,6 @@  init_drawable (struct QXLDrawable *drawable,
 	       const struct QXLRect *rect
 	       /* , pRegion clip */)
 {
-    struct QXLRom *rom = qxlhw_pci_get_rom(qxl->hw);
     int i;
 
     drawable->type = type;
@@ -411,7 +410,7 @@  init_drawable (struct QXLDrawable *drawable,
     if (rect)
 	drawable->bbox = *rect;
 
-    drawable->mm_time = rom->mm_clock;
+    drawable->mm_time = qxlhw_get_mm_time(qxl->hw);
 }
 
 static void
diff --git a/src/qxlhw.c b/src/qxlhw.c
index a5c17c6..81b6a1d 100644
--- a/src/qxlhw.c
+++ b/src/qxlhw.c
@@ -104,6 +104,11 @@  void qxlhw_push_surface_cmd(struct qxlhw *base, QXLSurfaceCmd* base_cmd)
         base->push_surface_cmd(base, base_cmd);
 }
 
+uint32_t qxlhw_get_mm_time(struct qxlhw *base)
+{
+        return base->get_mm_time(base);
+}
+
 void qxlhw_update_area(struct qxlhw *base, int surface_id, struct QXLRect rect)
 {
         base->update_area(base, surface_id, rect);
diff --git a/src/qxlhw.h b/src/qxlhw.h
index f59649d..67affaf 100644
--- a/src/qxlhw.h
+++ b/src/qxlhw.h
@@ -21,6 +21,7 @@  struct qxlhw {
 
     /* capabilities check / accessors */
     int (*get_n_surfaces)(struct qxlhw *base);
+    uint32_t (*get_mm_time)(struct qxlhw *base);
 
     /* memory handling callbacks */
     void *(*data_alloc)(struct qxlhw *base, unsigned long size);
@@ -96,6 +97,9 @@  int qxlhw_get_n_surfaces(struct qxlhw *base);
  * and not visible in qxl_surface.c */
 void qxlhw_push_surface_cmd(struct qxlhw *base, QXLSurfaceCmd *base_cmd);
 
+uint32_t qxlhw_get_mm_time(struct qxlhw *base);
+
+
 struct QXLImage *qxlhw_image_alloc(struct qxlhw *base, const uint8_t *data,
                                    int x, int y, int width, int height,
                                    int stride, int Bpp, uint32_t *hash);
diff --git a/src/qxlhw_pci.c b/src/qxlhw_pci.c
index 8613e1c..e1918c8 100644
--- a/src/qxlhw_pci.c
+++ b/src/qxlhw_pci.c
@@ -754,6 +754,14 @@  qxlhw_pci_push_surface_cmd (struct qxlhw *base, struct QXLSurfaceCmd *base_cmd)
     qxl_ring_push (hw->command_ring, &command);
 }
 
+static uint32_t
+qxlhw_pci_get_mm_time (struct qxlhw *base)
+{
+    struct qxlhw_pci *hw = (struct qxlhw_pci *)base;
+
+    return hw->rom->mm_clock;
+}
+
 static struct QXLDrawable *
 qxlhw_make_drawable (struct qxlhw_pci *hw, QXLDrawable *base, QXLImage *image)
 {
@@ -979,6 +987,7 @@  struct qxlhw *create_qxlhw_pci(qxl_screen_t *qxl, ScrnInfoPtr pScrn)
     base->surface_alloc = qxlhw_pci_surface_alloc;
     base->surface_free = qxlhw_pci_surface_free;
     base->push_surface_cmd = qxlhw_pci_push_surface_cmd;
+    base->get_mm_time = qxlhw_pci_get_mm_time;
     base->update_area = qxlhw_pci_update_area;
     base->push_cursor = qxlhw_pci_push_cursor;
     base->image_alloc = qxlhw_pci_image_alloc;