Magellan Linux

Contents of /trunk/vnc/patches/vnc-render-2.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 637 - (show annotations) (download)
Tue Jun 3 20:32:55 2008 UTC (15 years, 11 months ago) by niro
File size: 7569 byte(s)
-added several new fixes from fedora

1 --- vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/vncHooks.cc.render 2007-06-07 15:50:16.000000000 +0200
2 +++ vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/vncHooks.cc 2007-06-07 15:57:54.000000000 +0200
3 @@ -20,6 +20,10 @@
4 #include "XserverDesktop.h"
5 #include "vncHooks.h"
6
7 +#ifdef HAVE_DIX_CONFIG_H
8 +#include <dix-config.h>
9 +#endif
10 +
11 extern "C" {
12 #define class c_class
13 #define private c_private
14 @@ -29,6 +33,9 @@ extern "C" {
15 #include "regionstr.h"
16 #include "dixfontstr.h"
17 #include "colormapst.h"
18 +#ifdef RENDER
19 +#include "../../render/picturestr.h"
20 +#endif
21
22 #ifdef GC_HAS_COMPOSITE_CLIP
23 #define COMPOSITE_CLIP(gc) ((gc)->pCompositeClip)
24 @@ -74,6 +81,10 @@ typedef struct {
25 StoreColorsProcPtr StoreColors;
26 DisplayCursorProcPtr DisplayCursor;
27 ScreenBlockHandlerProcPtr BlockHandler;
28 +#ifdef RENDER
29 + CompositeProcPtr Composite;
30 + GlyphsProcPtr Glyphs;
31 +#endif
32 } vncHooksScreenRec, *vncHooksScreenPtr;
33
34 typedef struct {
35 @@ -105,6 +116,15 @@ static Bool vncHooksDisplayCursor(Screen
36 static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout,
37 pointer pReadmask);
38
39 +// RENDER support
40 +static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
41 + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
42 + INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
43 +
44 +static void vncHooksGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
45 + PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
46 + GlyphListPtr list, GlyphPtr *glyphs);
47 +
48 // GC "funcs"
49
50 static void vncHooksValidateGC(GCPtr pGC, unsigned long changes,
51 @@ -230,6 +250,16 @@ Bool vncHooksInit(ScreenPtr pScreen, Xse
52 vncHooksScreen->DisplayCursor = pScreen->DisplayCursor;
53 vncHooksScreen->BlockHandler = pScreen->BlockHandler;
54
55 +#ifdef RENDER
56 + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
57 + if (ps) {
58 + vncHooksScreen->Composite = ps->Composite;
59 + vncHooksScreen->Glyphs = ps->Glyphs;
60 + ps->Composite = vncHooksComposite;
61 + ps->Glyphs = vncHooksGlyphs;
62 + }
63 +#endif
64 +
65 pScreen->CloseScreen = vncHooksCloseScreen;
66 pScreen->CreateGC = vncHooksCreateGC;
67 pScreen->PaintWindowBackground = vncHooksPaintWindowBackground;
68 @@ -1473,3 +1503,80 @@ static void vncHooksPushPixels(GCPtr pGC
69
70 vncHooksScreen->desktop->add_changed(changed.reg);
71 }
72 +
73 +#ifdef RENDER
74 +#define RENDER_MAKE_BOX(pDrawable,X,Y,W,H) { \
75 + box.x1 = X + pDrawable->x; \
76 + box.x2 = X + pDrawable->x + W; \
77 + box.y1 = Y + pDrawable->y; \
78 + box.y2 = Y + pDrawable->y + H; \
79 +}
80 +
81 +static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
82 + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
83 + INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
84 +{
85 + ScreenPtr pScreen = pDst->pDrawable->pScreen;
86 + vncHooksScreenPtr vncHooksScreen = \
87 + ((vncHooksScreenPtr)pScreen->devPrivates[vncHooksScreenIndex].ptr);
88 + PictureScreenPtr ps = GetPictureScreen(pScreen);
89 + BoxRec box;
90 +
91 + ps->Composite = vncHooksScreen->Composite;
92 + (*ps->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc,
93 + xMask, yMask, xDst, yDst, width, height);
94 + ps->Composite = vncHooksComposite;
95 +
96 + if (pDst->pDrawable->type == DRAWABLE_WINDOW) {
97 + RENDER_MAKE_BOX(pDst->pDrawable, xDst, yDst, width, height);
98 + RegionHelper changed(pScreen, &box, 0);
99 + vncHooksScreen->desktop->add_changed(changed.reg);
100 + }
101 +}
102 +
103 +
104 +static void vncHooksGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
105 + PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
106 + GlyphListPtr list, GlyphPtr *glyphs)
107 +{
108 + ScreenPtr pScreen = pDst->pDrawable->pScreen;
109 + vncHooksScreenPtr vncHooksScreen = \
110 + ((vncHooksScreenPtr)pScreen->devPrivates[vncHooksScreenIndex].ptr);
111 + PictureScreenPtr ps = GetPictureScreen(pScreen);
112 + int x, y;
113 + int n;
114 + GlyphPtr glyph;
115 + BoxRec box;
116 +
117 + ps->Glyphs = vncHooksScreen->Glyphs;
118 + (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc,
119 + nlist, list, glyphs);
120 + ps->Glyphs = vncHooksGlyphs;
121 +
122 + if (pDst->pDrawable->type == DRAWABLE_WINDOW)
123 + {
124 + x = xSrc;
125 + y = ySrc;
126 + while (nlist--)
127 + {
128 + x += list->xOff;
129 + y += list->yOff;
130 + n = list->len;
131 + while (n--)
132 + {
133 + glyph = *glyphs++;
134 + RENDER_MAKE_BOX(pDst->pDrawable,
135 + x - glyph->info.x, y - glyph->info.y,
136 + glyph->info.width, glyph->info.height);
137 + RegionHelper changed(pScreen, &box, 0);
138 + vncHooksScreen->desktop->add_changed(changed.reg);
139 +
140 + x += glyph->info.xOff;
141 + y += glyph->info.yOff;
142 + }
143 + list++;
144 + }
145 + }
146 +}
147 +#endif
148 +
149 --- vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc.render 2007-06-07 15:49:32.000000000 +0200
150 +++ vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2007-06-07 15:49:32.000000000 +0200
151 @@ -130,6 +130,7 @@ static vfbScreenInfo vfbScreens[MAXSCREE
152 static Bool vfbPixmapDepths[33];
153 static char needswap = 0;
154 static int lastScreen = -1;
155 +static Bool Render = TRUE;
156
157 static bool displaySpecified = false;
158 static bool wellKnownSocketsCreated = false;
159 @@ -221,6 +222,10 @@ extern "C" {
160 VENDOR_STRING);
161 ErrorF("-screen scrn WxHxD set screen's width, height, depth\n");
162 ErrorF("-pixdepths list-of-int support given pixmap depths\n");
163 +#ifdef RENDER
164 + ErrorF("+/-render turn on/off RENDER extension support"
165 + "(default on)\n");
166 +#endif
167 ErrorF("-linebias n adjust thin line pixelization\n");
168 ErrorF("-blackpixel n pixel value for black\n");
169 ErrorF("-whitepixel n pixel value for white\n");
170 @@ -317,6 +322,20 @@ int ddxProcessArgument(int argc, char *a
171 return ret;
172 }
173
174 +#ifdef RENDER
175 + if (strcmp (argv[i], "+render") == 0) /* +render */
176 + {
177 + Render = TRUE;
178 + return 1;
179 + }
180 +
181 + if (strcmp (argv[i], "-render") == 0) /* -render */
182 + {
183 + Render = FALSE;
184 + return 1;
185 + }
186 +#endif
187 +
188 if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */
189 {
190 Pixel pix;
191 @@ -817,7 +836,12 @@ static Bool vfbScreenInit(int index, Scr
192 if (!fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
193 dpi, dpi, pvfb->paddedWidth, pvfb->bitsPerPixel))
194 return FALSE;
195 -#else
196 +
197 +#ifdef RENDER
198 + if (ret && Render)
199 + fbPictureInit(pScreen, 0, 0);
200 +#endif /* RENDER */
201 +#else /* VNC_USE_FB */
202 switch (pvfb->bitsPerPixel)
203 {
204 case 1:
205 @@ -938,6 +962,19 @@ void InitOutput(ScreenInfo *screenInfo,
206 vfbPixmapDepths[vfbScreens[i].depth] = TRUE;
207 }
208
209 +#ifdef RENDER
210 + /* RENDER needs a good set of pixmaps. */
211 + if (Render) {
212 + vfbPixmapDepths[1] = TRUE;
213 + vfbPixmapDepths[4] = TRUE;
214 + vfbPixmapDepths[8] = TRUE;
215 +/* vfbPixmapDepths[15] = TRUE; */
216 + vfbPixmapDepths[16] = TRUE;
217 + vfbPixmapDepths[24] = TRUE;
218 + vfbPixmapDepths[32] = TRUE;
219 + }
220 +#endif
221 +
222 for (i = 1; i <= 32; i++)
223 {
224 if (vfbPixmapDepths[i])