/[gentoo-x86]/x11-base/xorg-server/files/03-tfp-damage.patch
Gentoo

Contents of /x11-base/xorg-server/files/03-tfp-damage.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Sep 9 10:34:45 2007 UTC (6 years, 10 months ago) by dberkholz
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Drop 1.1, everyone's stable on 1.2 or 1.3.
(Portage version: 2.1.3.8)

1 --- ./GL/glx/glxdrawable.h.tfp-damage 2006-03-11 19:11:33.000000000 -0500
2 +++ ./GL/glx/glxdrawable.h 2006-06-20 20:33:53.000000000 -0400
3 @@ -41,6 +41,8 @@
4 **
5 */
6
7 +#include <damage.h>
8 +
9 typedef struct {
10
11 DrawablePtr pDraw;
12 @@ -49,7 +51,7 @@
13 ScreenPtr pScreen;
14 Bool idExists;
15 int refcnt;
16 -
17 + DamagePtr pDamage;
18 } __GLXpixmap;
19
20 struct __GLXdrawable {
21 --- ./GL/glx/glxcmds.c.tfp-damage 2006-05-09 13:44:26.000000000 -0400
22 +++ ./GL/glx/glxcmds.c 2006-06-20 20:33:53.000000000 -0400
23 @@ -1271,6 +1271,7 @@
24 pGlxPixmap->pGlxScreen = pGlxScreen;
25 pGlxPixmap->pScreen = pScreen;
26 pGlxPixmap->idExists = True;
27 + pGlxPixmap->pDamage = NULL;
28 pGlxPixmap->refcnt = 0;
29
30 pGlxPixmap->modes = modes;
31 --- ./GL/glx/glxdri.c.tfp-damage 2006-04-02 21:25:21.000000000 -0400
32 +++ ./GL/glx/glxdri.c 2006-06-21 00:39:40.000000000 -0400
33 @@ -296,24 +296,18 @@
34 }
35
36 static void
37 -glxFillAlphaChannel (PixmapPtr pixmap)
38 +glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height)
39 {
40 - int i, j;
41 - CARD32 *pixels = (CARD32 *)pixmap->devPrivate.ptr;
42 + int i;
43 + CARD32 *p, *end, *pixels = (CARD32 *)pixmap->devPrivate.ptr;
44 CARD32 rowstride = pixmap->devKind / 4;
45 - CARD32 x, y;
46 -
47 - x = pixmap->drawable.x;
48 - y = pixmap->drawable.y;
49
50 - for (i = y; i < pixmap->drawable.height + y; ++i)
51 + for (i = y; i < y + height; i++)
52 {
53 - for (j = x; j < pixmap->drawable.width + x; ++j)
54 - {
55 - int index = i * rowstride + j;
56 -
57 - pixels[index] |= 0xFF000000;
58 - }
59 + p = &pixels[i * rowstride + x];
60 + end = p + width;
61 + while (p < end)
62 + *p++ |= 0xFF000000;
63 }
64 }
65
66 @@ -326,7 +320,6 @@
67 * - No fbconfig handling for TEXTURE_TARGET
68 * - No fbconfig exposure of Y inversion state
69 * - No GenerateMipmapEXT support (due to no FBO support)
70 - * - No damage tracking between binds
71 * - No support for anything but 16bpp and 32bpp-sparse pixmaps
72 */
73
74 @@ -335,38 +328,97 @@
75 int buffer,
76 __GLXpixmap *glxPixmap)
77 {
78 + RegionPtr pRegion;
79 PixmapPtr pixmap;
80 int bpp;
81 - Bool npot;
82 + GLenum target, format, type;
83
84 pixmap = (PixmapPtr) glxPixmap->pDraw;
85 - bpp = pixmap->drawable.depth >= 24 ? 4 : 2; /* XXX 24bpp packed, 8, etc */
86 -
87 + if (!glxPixmap->pDamage) {
88 + glxPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
89 + TRUE, glxPixmap->pScreen, NULL);
90 + if (!glxPixmap->pDamage)
91 + return BadAlloc;
92 +
93 + DamageRegister ((DrawablePtr) pixmap, glxPixmap->pDamage);
94 + pRegion = NULL;
95 + } else {
96 + pRegion = DamageRegion(glxPixmap->pDamage);
97 + if (REGION_NIL(pRegion))
98 + return Success;
99 + }
100 +
101 + /* XXX 24bpp packed, 8, etc */
102 + if (pixmap->drawable.depth >= 24) {
103 + bpp = 4;
104 + format = GL_BGRA;
105 + type = GL_UNSIGNED_BYTE;
106 + } else {
107 + bpp = 2;
108 + format = GL_RGB;
109 + type = GL_UNSIGNED_SHORT_5_6_5;
110 + }
111 +
112 + target = GL_TEXTURE_RECTANGLE_ARB;
113 +
114 CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
115 - pixmap->devKind / bpp) );
116 - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS,
117 - pixmap->drawable.y) );
118 - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS,
119 - pixmap->drawable.x) );
120 -
121 - if (pixmap->drawable.depth == 24)
122 - glxFillAlphaChannel(pixmap);
123 -
124 - npot = !(glxCountBits(pixmap->drawable.width) == 1 &&
125 - glxCountBits(pixmap->drawable.height) == 1) /* ||
126 - strstr(CALL_GetString(GL_EXTENSIONS,
127 - "GL_ARB_texture_non_power_of_two")) */ ;
128 -
129 - CALL_TexImage2D( GET_DISPATCH(),
130 - ( npot ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D,
131 - 0,
132 - bpp == 4 ? 4 : 3,
133 - pixmap->drawable.width,
134 - pixmap->drawable.height,
135 - 0,
136 - bpp == 4 ? GL_BGRA : GL_RGB,
137 - bpp == 4 ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT_5_6_5,
138 - pixmap->devPrivate.ptr ) );
139 + pixmap->devKind / bpp) );
140 + if (pRegion == NULL)
141 + {
142 + if (pixmap->drawable.depth == 24)
143 + glxFillAlphaChannel(pixmap,
144 + pixmap->drawable.x,
145 + pixmap->drawable.y,
146 + pixmap->drawable.width,
147 + pixmap->drawable.height);
148 +
149 + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS,
150 + pixmap->drawable.x) );
151 + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS,
152 + pixmap->drawable.y) );
153 +
154 + CALL_TexImage2D( GET_DISPATCH(),
155 + (target,
156 + 0,
157 + bpp == 4 ? 4 : 3,
158 + pixmap->drawable.width,
159 + pixmap->drawable.height,
160 + 0,
161 + format,
162 + type,
163 + pixmap->devPrivate.ptr) );
164 + } else {
165 + int i, numRects;
166 + BoxPtr p;
167 +
168 + numRects = REGION_NUM_RECTS (pRegion);
169 + p = REGION_RECTS (pRegion);
170 + for (i = 0; i < numRects; i++)
171 + {
172 + if (pixmap->drawable.depth == 24)
173 + glxFillAlphaChannel(pixmap,
174 + pixmap->drawable.x + p[i].x1,
175 + pixmap->drawable.y + p[i].y1,
176 + p[i].x2 - p[i].x1,
177 + p[i].y2 - p[i].y1);
178 +
179 + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS,
180 + pixmap->drawable.x + p[i].x1) );
181 + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS,
182 + pixmap->drawable.y + p[i].y1) );
183 +
184 + CALL_TexSubImage2D( GET_DISPATCH(),
185 + (target,
186 + 0,
187 + p[i].x1, p[i].y1,
188 + p[i].x2 - p[i].x1, p[i].y2 - p[i].y1,
189 + format,
190 + type,
191 + pixmap->devPrivate.ptr) );
192 + }
193 + }
194 +
195 + DamageEmpty(glxPixmap->pDamage);
196
197 return Success;
198 }
199 --- ./GL/glx/glxext.c.tfp-damage 2006-03-16 20:47:25.000000000 -0500
200 +++ ./GL/glx/glxext.c 2006-06-20 20:33:53.000000000 -0400
201 @@ -141,6 +141,10 @@
202
203 pGlxPixmap->idExists = False;
204 if (!pGlxPixmap->refcnt) {
205 + if (pGlxPixmap->pDamage) {
206 + DamageUnregister (pGlxPixmap->pDraw, pGlxPixmap->pDamage);
207 + DamageDestroy(pGlxPixmap->pDamage);
208 + }
209 /*
210 ** The DestroyPixmap routine should decrement the refcount and free
211 ** only if it's zero.

  ViewVC Help
Powered by ViewVC 1.1.20