summaryrefslogtreecommitdiff
path: root/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r100.patch
blob: 2397d083ef7a218b943777fa049a474d03fff7b3 (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 a7754b076e355fef3aea082b6e2d3aefbb8e7a9b Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Fri, 13 Apr 2012 17:24:46 +0000
Subject: EXA: Support acceleration of solid pictures on R1xx.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
---
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
index b6cc9e4..451a625 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -338,17 +338,8 @@ static Bool R100CheckCompositeTexture(PicturePtr pPict,
 				      int unit)
 {
     unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
-    int w = pPict->pDrawable->width;
-    int h = pPict->pDrawable->height;
     int i;
 
-    /* r100 limit should be 2048, there are issues with 2048
-     * see 197a62704742a4a19736c2637ac92d1dc5ab34ed
-     */
-
-    if ((w > 2047) || (h > 2047))
-	RADEON_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
-
     for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++) {
 	if (R100TexFormats[i].fmt == pPict->format)
 	    break;
@@ -357,7 +348,7 @@ static Bool R100CheckCompositeTexture(PicturePtr pPict,
 	RADEON_FALLBACK(("Unsupported picture format 0x%x\n",
 			(int)pPict->format));
 
-    if (!RADEONCheckTexturePOT(pPict, unit == 0))
+    if (pPict->pDrawable && !RADEONCheckTexturePOT(pPict, unit == 0))
 	return FALSE;
 
     if (pPict->filter != PictFilterNearest &&
@@ -392,15 +383,24 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
 {
     RINFO_FROM_SCREEN(pPix->drawable.pScreen);
     uint32_t txfilter, txformat, txoffset, txpitch;
-    int w = pPict->pDrawable->width;
-    int h = pPict->pDrawable->height;
-    unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
-    Bool repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) &&
-	!(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
-    int i;
+    unsigned int repeatType;
+    Bool repeat;
+    int i, w, h;
     struct radeon_exa_pixmap_priv *driver_priv;
     ACCEL_PREAMBLE();
 
+    if (pPict->pDrawable) {
+	w = pPict->pDrawable->width;
+	h = pPict->pDrawable->height;
+	repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
+    } else {
+	w = h = 1;
+	repeatType = RepeatNormal;
+    }
+
+    repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) &&
+	!(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
+
     txpitch = exaGetPixmapPitch(pPix);
     txoffset = 0;
 
@@ -510,22 +510,6 @@ static Bool R100CheckComposite(int op, PicturePtr pSrcPicture,
     if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
 	RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op));
 
-    if (!pSrcPicture->pDrawable)
-	RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
-
-    /* r100 limit should be 2048, there are issues with 2048
-     * see 197a62704742a4a19736c2637ac92d1dc5ab34ed
-     */
-
-    pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
-
-    if (pSrcPixmap->drawable.width > 2047 ||
-	pSrcPixmap->drawable.height > 2047) {
-	RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
-			 pSrcPixmap->drawable.width,
-			 pSrcPixmap->drawable.height));
-    }
-
     pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable);
 
     if (pDstPixmap->drawable.width > 2047 ||
@@ -535,20 +519,35 @@ static Bool R100CheckComposite(int op, PicturePtr pSrcPicture,
 			 pDstPixmap->drawable.height));
     }
 
+    if (pSrcPicture->pDrawable) {
+	/* r100 limit should be 2048, there are issues with 2048
+	 * see 197a62704742a4a19736c2637ac92d1dc5ab34ed
+	 */
+	pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
+
+	if (pSrcPixmap->drawable.width > 2047 ||
+	    pSrcPixmap->drawable.height > 2047) {
+	    RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
+			     pSrcPixmap->drawable.width,
+			     pSrcPixmap->drawable.height));
+	}
+    } else if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
+	RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
+
     if (pMaskPicture) {
 	PixmapPtr pMaskPixmap;
 
-	if (!pMaskPicture->pDrawable)
-	    RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
-
-	pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
+	if (pMaskPicture->pDrawable) {
+	    pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
 
-	if (pMaskPixmap->drawable.width > 2047 ||
-	    pMaskPixmap->drawable.height > 2047) {
-	    RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
-			     pMaskPixmap->drawable.width,
-			     pMaskPixmap->drawable.height));
-	}
+	    if (pMaskPixmap->drawable.width > 2047 ||
+		pMaskPixmap->drawable.height > 2047) {
+		RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
+				 pMaskPixmap->drawable.width,
+				 pMaskPixmap->drawable.height));
+	    }
+	} else if (pMaskPicture->pSourcePict->type != SourcePictTypeSolidFill)
+	    RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
 
 	if (pMaskPicture->componentAlpha) {
 	    /* Check if it's component alpha that relies on a source alpha and
@@ -624,7 +623,8 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
 					    PixmapPtr pMask,
 					    PixmapPtr pDst)
 {
-    RINFO_FROM_SCREEN(pDst->drawable.pScreen);
+    ScreenPtr pScreen = pDst->drawable.pScreen;
+    RINFO_FROM_SCREEN(pScreen);
     uint32_t dst_format, dst_pitch, colorpitch;
     uint32_t pp_cntl, blendcntl, cblend, ablend;
     int pixel_shift;
@@ -648,12 +648,27 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
 
     CHECK_OFFSET(pDst, 0x0f, "destination");
 
+    if (!pSrc) {
+	pSrc = RADEONSolidPixmap(pScreen, cpu_to_le32(pSrcPicture->pSourcePict->solidFill.color));
+	if (!pSrc)
+	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
+    }
+
     if (((dst_pitch >> pixel_shift) & 0x7) != 0)
 	RADEON_FALLBACK(("Bad destination pitch 0x%x\n", (int)dst_pitch));
 
     if (!RADEONSetupSourceTile(pSrcPicture, pSrc, FALSE, TRUE))
 	return FALSE;
 
+    if (pMaskPicture && !pMask) {
+	pMask = RADEONSolidPixmap(pScreen, cpu_to_le32(pMaskPicture->pSourcePict->solidFill.color));
+	if (!pMask) {
+	    if (!pSrcPicture->pDrawable)
+		pScreen->DestroyPixmap(pSrc);
+	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
+	}
+    }
+
     RADEONPrepareCompositeCS(op, pSrcPicture, pMaskPicture, pDstPicture,
 			     pSrc, pMask, pDst);
 
--
cgit v0.9.0.2-2-gbebe