summaryrefslogtreecommitdiff
path: root/extra/xf86-video-intel/0003-uxa-Remove-hook-for-CompositeRectangles.patch
blob: c1c4d55e87ba4c054231c8b8f51feb8ddc61158a (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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
From b669f171adece9df7f0c340c664b70e94118a55e Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Fri, 23 Mar 2012 14:56:06 +0000
Subject: [PATCH 3/5] uxa: Remove hook for CompositeRectangles

It was broken and not flushing damage correctly. With the
improvements made to the kernel, it is no longer a significant advantage
per se and not worth its additional complexity.

Reported-by: Tilman Sauerbeck <tilman@code-monkey.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32547
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 uxa/uxa-priv.h   |    1 -
 uxa/uxa-render.c |  189 ------------------------------------------------------
 uxa/uxa.c        |    4 --
 3 files changed, 194 deletions(-)

diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index 0de45f5..b24ec4f 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -123,7 +123,6 @@ typedef struct {
 	BitmapToRegionProcPtr SavedBitmapToRegion;
 #ifdef RENDER
 	CompositeProcPtr SavedComposite;
-	CompositeRectsProcPtr SavedCompositeRects;
 	TrianglesProcPtr SavedTriangles;
 	GlyphsProcPtr SavedGlyphs;
 	TrapezoidsProcPtr SavedTrapezoids;
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 877b286..1e88c5d 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -947,195 +947,6 @@ uxa_acquire_mask(ScreenPtr screen,
 				    out_x, out_y);
 }
 
-static Bool
-_pixman_region_init_rectangles(pixman_region16_t *region,
-			       int num_rects,
-			       xRectangle *rects,
-			       int tx, int ty)
-{
-	pixman_box16_t stack_boxes[64], *boxes = stack_boxes;
-	pixman_bool_t ret;
-	int i;
-
-	if (num_rects > sizeof(stack_boxes) / sizeof(stack_boxes[0])) {
-		boxes = malloc(sizeof(pixman_box16_t) * num_rects);
-		if (boxes == NULL)
-			return FALSE;
-	}
-
-	for (i = 0; i < num_rects; i++) {
-		boxes[i].x1 = rects[i].x + tx;
-		boxes[i].y1 = rects[i].y + ty;
-		boxes[i].x2 = rects[i].x + tx + rects[i].width;
-		boxes[i].y2 = rects[i].y + ty + rects[i].height;
-	}
-
-	ret = pixman_region_init_rects(region, boxes, num_rects);
-
-	if (boxes != stack_boxes)
-		free(boxes);
-
-	return ret;
-}
-
-void
-uxa_solid_rects (CARD8		op,
-		 PicturePtr	dst,
-		 xRenderColor  *color,
-		 int		num_rects,
-		 xRectangle    *rects)
-{
-	ScreenPtr screen = dst->pDrawable->pScreen;
-	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
-	PixmapPtr dst_pixmap, src_pixmap = NULL;
-	pixman_region16_t region;
-	pixman_box16_t *boxes, *extents;
-	PicturePtr src;
-	int dst_x, dst_y;
-	int num_boxes;
-
-	if (!pixman_region_not_empty(dst->pCompositeClip))
-		return;
-
-	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
-		int ok;
-
-		uxa_picture_prepare_access(dst, UXA_GLAMOR_ACCESS_RW);
-		ok = glamor_composite_rects_nf(op, dst, color,
-					       num_rects, rects);
-		uxa_picture_finish_access(dst, UXA_GLAMOR_ACCESS_RW);
-
-		if (!ok)
-			goto fallback;
-
-		return;
-	}
-
-	if (dst->alphaMap)
-		goto fallback;
-
-	dst_pixmap = uxa_get_offscreen_pixmap(dst->pDrawable, &dst_x, &dst_y);
-	if (!dst_pixmap)
-		goto fallback;
-
-	if (!_pixman_region_init_rectangles(&region,
-					    num_rects, rects,
-					    dst->pDrawable->x, dst->pDrawable->y))
-		goto fallback;
-
-	if (!pixman_region_intersect(&region, &region, dst->pCompositeClip)) {
-		pixman_region_fini(&region);
-		return;
-	}
-
-	pixman_region_translate(&region, dst_x, dst_y);
-	boxes = pixman_region_rectangles(&region, &num_boxes);
-	extents = pixman_region_extents (&region);
-
-	if (op == PictOpClear)
-		color->red = color->green = color->blue = color->alpha = 0;
-	if (color->alpha >= 0xff00 && op == PictOpOver) {
-		color->alpha = 0xffff;
-		op = PictOpSrc;
-	}
-
-	/* Using GEM, the relocation costs outweigh the advantages of the blitter */
-	if (num_boxes == 1 && (op == PictOpSrc || op == PictOpClear)) {
-		CARD32 pixel;
-
-try_solid:
-		if (uxa_screen->info->check_solid &&
-		    !uxa_screen->info->check_solid(&dst_pixmap->drawable, GXcopy, FB_ALLONES))
-			goto err_region;
-
-		if (!uxa_get_pixel_from_rgba(&pixel,
-					     color->red,
-					     color->green,
-					     color->blue,
-					     color->alpha,
-					     dst->format))
-			goto err_region;
-
-		if (!uxa_screen->info->prepare_solid(dst_pixmap, GXcopy, FB_ALLONES, pixel))
-			goto err_region;
-
-		while (num_boxes--) {
-			uxa_screen->info->solid(dst_pixmap,
-						boxes->x1, boxes->y1,
-						boxes->x2, boxes->y2);
-			boxes++;
-		}
-
-		uxa_screen->info->done_solid(dst_pixmap);
-	} else {
-		int error;
-
-		src = CreateSolidPicture(0, color, &error);
-		if (!src)
-			goto err_region;
-
-		if (!uxa_screen->info->check_composite(op, src, NULL, dst,
-						       extents->x2 - extents->x1,
-						       extents->y2 - extents->y1)) {
-			if (op == PictOpSrc || op == PictOpClear) {
-				FreePicture(src, 0);
-				goto try_solid;
-			}
-
-			goto err_src;
-		}
-
-		if (!uxa_screen->info->check_composite_texture ||
-		    !uxa_screen->info->check_composite_texture(screen, src)) {
-			PicturePtr solid;
-			int src_off_x, src_off_y;
-
-			solid = uxa_acquire_solid(screen, src->pSourcePict);
-			if (!solid)
-				goto err_src;
-			FreePicture(src, 0);
-
-			src = solid;
-			src_pixmap = uxa_get_offscreen_pixmap(src->pDrawable,
-							      &src_off_x, &src_off_y);
-			if (!src_pixmap)
-				goto err_src;
-		}
-
-		if (!uxa_screen->info->prepare_composite(op, src, NULL, dst, src_pixmap, NULL, dst_pixmap))
-			goto err_src;
-
-		while (num_boxes--) {
-			uxa_screen->info->composite(dst_pixmap,
-						    0, 0, 0, 0,
-						    boxes->x1,
-						    boxes->y1,
-						    boxes->x2 - boxes->x1,
-						    boxes->y2 - boxes->y1);
-			boxes++;
-		}
-
-		uxa_screen->info->done_composite(dst_pixmap);
-		FreePicture(src, 0);
-	}
-
-	/* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must
-	 * manually append the damaged regions ourselves.
-	 */
-	pixman_region_translate(&region, -dst_x, -dst_y);
-	DamageRegionAppend(dst->pDrawable, &region);
-
-	pixman_region_fini(&region);
-	return;
-
-err_src:
-	FreePicture(src, 0);
-err_region:
-	pixman_region_fini(&region);
-fallback:
-	uxa_screen->SavedCompositeRects(op, dst, color, num_rects, rects);
-}
-
 static int
 uxa_try_driver_composite(CARD8 op,
 			 PicturePtr pSrc,
diff --git a/uxa/uxa.c b/uxa/uxa.c
index eb2ae03..b4a1da6 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -407,7 +407,6 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
 #ifdef RENDER
 	if (ps) {
 		ps->Composite = uxa_screen->SavedComposite;
-		ps->CompositeRects = uxa_screen->SavedCompositeRects;
 		ps->Glyphs = uxa_screen->SavedGlyphs;
 		ps->Trapezoids = uxa_screen->SavedTrapezoids;
 		ps->AddTraps = uxa_screen->SavedAddTraps;
@@ -536,9 +535,6 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
 			uxa_screen->SavedComposite = ps->Composite;
 			ps->Composite = uxa_composite;
 
-			uxa_screen->SavedCompositeRects = ps->CompositeRects;
-			ps->CompositeRects = uxa_solid_rects;
-
 			uxa_screen->SavedGlyphs = ps->Glyphs;
 			ps->Glyphs = uxa_glyphs;
 
-- 
1.7.10