summaryrefslogtreecommitdiff
blob: 9435f06ddd7bb5dcff6d729276e8b563557230ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
From 0945bea5fc32eacb7bf42639efbd45dcd43e7ab5 Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Mon, 10 Jun 2013 17:31:31 +0000
Subject: vmwgfx: update for XA API changes

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Tested-by: Jakob Bornecrantz <jakob@vmware.com>
---
diff --git a/configure.ac b/configure.ac
index 0631bcc..dccfb27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,7 +118,7 @@ if test x$BUILD_VMWGFX = xyes; then
 	PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no])
 fi
 if test x$BUILD_VMWGFX = xyes; then
-	PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0],[],[BUILD_VMWGFX=no])
+	PKG_CHECK_MODULES([XATRACKER], [xatracker >= 2.0.0],[],[BUILD_VMWGFX=no])
 fi
 
 DRIVER_NAME=vmware
diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c
index 7de0772..2f007f0 100644
--- a/vmwgfx/vmwgfx_dri2.c
+++ b/vmwgfx/vmwgfx_dri2.c
@@ -201,7 +201,8 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for
     }
 
     private->srf = srf;
-    if (xa_surface_handle(srf, &buffer->name, &buffer->pitch) != 0)
+    if (xa_surface_handle(srf, xa_handle_type_shared,
+	    &buffer->name, &buffer->pitch) != 0)
 	return FALSE;
 
     buffer->cpp = xa_format_depth(xa_surface_format(srf)) / 8;
@@ -222,7 +223,7 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
     struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(private->pPixmap);
 
     if (--private->refcount == 0 && srf) {
-	xa_surface_destroy(srf);
+	xa_surface_unref(srf);
     }
 
     /*
diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
index 7863ba2..3002285 100644
--- a/vmwgfx/vmwgfx_driver.c
+++ b/vmwgfx/vmwgfx_driver.c
@@ -617,7 +617,8 @@ vmwgfx_scanout_present(ScreenPtr pScreen, int drm_fd,
 	return FALSE;
     }
 
-    if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0) {
+    if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
+	    &handle, &dummy) != 0) {
 	LogMessage(X_ERROR, "Could not get present surface handle.\n");
 	return FALSE;
     }
diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
index 63df3a1..ed3c1ee 100644
--- a/vmwgfx/vmwgfx_saa.c
+++ b/vmwgfx/vmwgfx_saa.c
@@ -140,7 +140,7 @@ vmwgfx_pixmap_free_storage(struct vmwgfx_saa_pixmap *vpix)
 	vpix->malloc = NULL;
     }
     if (!(vpix->backing & VMWGFX_PIX_SURFACE) && vpix->hw) {
-	xa_surface_destroy(vpix->hw);
+	xa_surface_unref(vpix->hw);
 	vpix->hw = NULL;
     }
     if (!(vpix->backing & VMWGFX_PIX_GMR) && vpix->gmr) {
@@ -286,7 +286,8 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa,
     if (vpix->gmr && vsaa->can_optimize_dma) {
 	uint32_t handle, dummy;
 
-	if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0)
+	if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
+		 &handle, &dummy) != 0)
 	    goto out_err;
 	if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle,
 		       to_hw) != 0)
@@ -305,6 +306,8 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa,
 			     (int) to_hw,
 			     (struct xa_box *) REGION_RECTS(reg),
 			     REGION_NUM_RECTS(reg));
+	if (to_hw)
+	    xa_context_flush(vsaa->xa_ctx);
 	if (vpix->gmr)
 	    vmwgfx_dmabuf_unmap(vpix->gmr);
 	if (ret)
@@ -441,7 +444,7 @@ vmwgfx_hw_kill(struct vmwgfx_saa *vsaa,
 				 &spix->dirty_hw))
 	return FALSE;
 
-    xa_surface_destroy(vpix->hw);
+    xa_surface_unref(vpix->hw);
     vpix->hw = NULL;
 
     /*
@@ -683,7 +686,8 @@ vmwgfx_present_prepare(struct vmwgfx_saa *vsaa,
 
     (void) pScreen;
     if (src_vpix == dst_vpix || !src_vpix->hw ||
-	xa_surface_handle(src_vpix->hw, &vsaa->src_handle, &dummy) != 0)
+	xa_surface_handle(src_vpix->hw, xa_handle_type_shared,
+		&vsaa->src_handle, &dummy) != 0)
 	return FALSE;
 
     REGION_NULL(pScreen, &vsaa->present_region);
@@ -784,7 +788,7 @@ vmwgfx_create_hw(struct vmwgfx_saa *vsaa,
     return TRUE;
 
 out_no_damage:
-    xa_surface_destroy(hw);
+    xa_surface_unref(hw);
     return FALSE;
 }
 
@@ -929,6 +933,7 @@ vmwgfx_copy_prepare(struct saa_driver *driver,
 
 	if (!vmwgfx_hw_validate(src_pixmap, src_reg)) {
 	    xa_copy_done(vsaa->xa_ctx);
+	    xa_context_flush(vsaa->xa_ctx);
 	    return FALSE;
 	}
 
@@ -1029,6 +1034,7 @@ vmwgfx_copy_done(struct saa_driver *driver)
 	return;
     }
     xa_copy_done(vsaa->xa_ctx);
+    xa_context_flush(vsaa->xa_ctx);
 }
 
 static Bool
@@ -1175,6 +1181,7 @@ vmwgfx_composite_done(struct saa_driver *driver)
    struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
 
    xa_composite_done(vsaa->xa_ctx);
+   xa_context_flush(vsaa->xa_ctx);
 }
 
 static void
@@ -1436,7 +1443,8 @@ vmwgfx_scanout_ref(struct vmwgfx_screen_entry  *entry)
 	     */
 	    if (!vmwgfx_hw_accel_validate(pixmap, 0, XA_FLAG_SCANOUT, 0, NULL))
 		goto out_err;
-	    if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0)
+	    if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
+			 &handle, &dummy) != 0)
 		goto out_err;
 	    depth = xa_format_depth(xa_surface_format(vpix->hw));
 
diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c
index 449266b..2971ed7 100644
--- a/vmwgfx/vmwgfx_tex_video.c
+++ b/vmwgfx/vmwgfx_tex_video.c
@@ -199,7 +199,7 @@ stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
 
        for (i=0; i<3; ++i) {
 	   if (priv->yuv[i]) {
-	       xa_surface_destroy(priv->yuv[i]);
+	       xa_surface_unref(priv->yuv[i]);
 	       priv->yuv[i] = NULL;
 	   }
 	   for (j=0; j<2; ++j) {
@@ -539,7 +539,8 @@ copy_packed_data(ScrnInfoPtr pScrn,
 	       REGION_RESET(pScrn->pScreen, &reg, &box);
 	   }
 
-	   if (xa_surface_handle(srf, &handle, &stride) != 0) {
+	   if (xa_surface_handle(srf, xa_handle_type_shared,
+			&handle, &stride) != 0) {
 	       ret = BadAlloc;
 	       break;
 	   }
--
cgit v0.9.0.2-2-gbebe