Skip to content

Commit d3566e9

Browse files
committed
Rewrite render support in composite wrapper to (almost) work. FIXME:
PaintWindowBackground/CopyWindow is still broken. Remove mfb from Xvfb. Use standard visual formats so Render actually works.
1 parent 6ff8c33 commit d3566e9

File tree

5 files changed

+554
-291
lines changed

5 files changed

+554
-291
lines changed

hw/vfb/InitOutput.c

+22-84
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ from The Open Group.
4545
#include "gcstruct.h"
4646
#include "input.h"
4747
#include "mipointer.h"
48+
#include "micmap.h"
4849
#include <sys/types.h>
4950
#ifdef HAS_MMAP
5051
#include <sys/mman.h>
@@ -64,7 +65,6 @@ from The Open Group.
6465
#endif /* HAS_SHM */
6566
#include "dix.h"
6667
#include "miline.h"
67-
#include "mfb.h"
6868

6969
#define VFB_DEFAULT_WIDTH 1280
7070
#define VFB_DEFAULT_HEIGHT 1024
@@ -442,60 +442,6 @@ GetTimeInMillis()
442442
}
443443
#endif
444444

445-
446-
static Bool
447-
vfbMultiDepthCreateGC(GCPtr pGC)
448-
{
449-
switch (vfbBitsPerPixel(pGC->depth))
450-
{
451-
case 1: return mfbCreateGC (pGC);
452-
case 8:
453-
case 16:
454-
case 32: return fbCreateGC (pGC);
455-
default: return FALSE;
456-
}
457-
}
458-
459-
static void
460-
vfbMultiDepthGetSpans(
461-
DrawablePtr pDrawable, /* drawable from which to get bits */
462-
int wMax, /* largest value of all *pwidths */
463-
register DDXPointPtr ppt, /* points to start copying from */
464-
int *pwidth, /* list of number of bits to copy */
465-
int nspans, /* number of scanlines to copy */
466-
char *pdstStart) /* where to put the bits */
467-
{
468-
switch (pDrawable->bitsPerPixel) {
469-
case 1:
470-
mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
471-
break;
472-
case 8:
473-
case 16:
474-
case 32:
475-
fbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
476-
break;
477-
}
478-
return;
479-
}
480-
481-
static void
482-
vfbMultiDepthGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
483-
unsigned int format, unsigned long planeMask,
484-
char *pdstLine)
485-
{
486-
switch (pDrawable->bitsPerPixel)
487-
{
488-
case 1:
489-
mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
490-
break;
491-
case 8:
492-
case 16:
493-
case 32:
494-
fbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
495-
break;
496-
}
497-
}
498-
499445
static ColormapPtr InstalledMaps[MAXSCREENS];
500446

501447
static int
@@ -922,39 +868,38 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
922868
pbits = vfbAllocateFramebufferMemory(pvfb);
923869
if (!pbits) return FALSE;
924870

925-
/* miSetPixmapDepths ();*/
871+
miSetPixmapDepths ();
926872

927-
switch (pvfb->bitsPerPixel)
928-
{
929-
case 1:
930-
ret = mfbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
931-
dpix, dpiy, pvfb->paddedWidth);
873+
switch (pvfb->depth) {
874+
case 15:
875+
miSetVisualTypesAndMasks (15, (1 << TrueColor), 8, TrueColor,
876+
0x7c00, 0x03e0, 0x001f);
932877
break;
933-
case 8:
934878
case 16:
935-
case 32:
936-
ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
937-
dpix, dpiy, pvfb->paddedWidth,pvfb->bitsPerPixel);
938-
#ifdef RENDER
939-
if (ret && Render)
940-
fbPictureInit (pScreen, 0, 0);
941-
#endif
879+
miSetVisualTypesAndMasks (16, (1 << TrueColor), 8, TrueColor,
880+
0xf800, 0x07e0, 0x001f);
881+
break;
882+
case 24:
883+
miSetVisualTypesAndMasks (24, (1 << TrueColor), 8, TrueColor,
884+
0xff0000, 0x00ff00, 0x0000ff);
942885
break;
943-
default:
944-
return FALSE;
945886
}
887+
888+
ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
889+
dpix, dpiy, pvfb->paddedWidth,pvfb->bitsPerPixel);
890+
#ifdef RENDER
891+
if (ret && Render)
892+
fbPictureInit (pScreen, 0, 0);
893+
#endif
946894

947895
if (!ret) return FALSE;
948896

949-
miInitializeBackingStore(pScreen);
897+
/* miInitializeBackingStore(pScreen); */
950898

951899
/*
952900
* Circumvent the backing store that was just initialised. This amounts
953901
* to a truely bizarre way of initialising SaveDoomedAreas and friends.
954902
*/
955-
pScreen->CreateGC = vfbMultiDepthCreateGC;
956-
pScreen->GetImage = vfbMultiDepthGetImage;
957-
pScreen->GetSpans = vfbMultiDepthGetSpans;
958903

959904
pScreen->InstallColormap = vfbInstallColormap;
960905
pScreen->UninstallColormap = vfbUninstallColormap;
@@ -970,14 +915,7 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
970915
pScreen->blackPixel = pvfb->blackPixel;
971916
pScreen->whitePixel = pvfb->whitePixel;
972917

973-
if (pvfb->bitsPerPixel == 1)
974-
{
975-
ret = mfbCreateDefColormap(pScreen);
976-
}
977-
else
978-
{
979-
ret = fbCreateDefColormap(pScreen);
980-
}
918+
ret = fbCreateDefColormap(pScreen);
981919

982920
miSetZeroLineBias(pScreen, pvfb->lineBias);
983921

@@ -1008,7 +946,7 @@ InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
1008946
vfbPixmapDepths[1] = TRUE;
1009947
vfbPixmapDepths[4] = TRUE;
1010948
vfbPixmapDepths[8] = TRUE;
1011-
vfbPixmapDepths[15] = TRUE;
949+
/* vfbPixmapDepths[15] = TRUE; */
1012950
vfbPixmapDepths[16] = TRUE;
1013951
vfbPixmapDepths[24] = TRUE;
1014952
vfbPixmapDepths[32] = TRUE;

miext/cw/cw.c

+19-31
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040

4141
int cwGCIndex;
4242
int cwScreenIndex;
43+
#ifdef RENDER
44+
int cwPictureIndex;
45+
#endif
4346
static unsigned long cwGeneration = 0;
4447
extern GCOps cwGCOps;
4548

@@ -96,22 +99,10 @@ static GCFuncs cwCheapGCFuncs = {
9699
cwCheapCopyClip,
97100
};
98101

99-
static __inline__ Bool
100-
DrawableIsRedirWindow(DrawablePtr pDrawable)
101-
{
102-
if (pDrawable->type != DRAWABLE_WINDOW)
103-
return FALSE;
104-
if (!((WindowPtr)pDrawable)->redirectDraw)
105-
return FALSE;
106-
107-
ErrorF("yes!\n");
108-
return TRUE;
109-
}
110-
111102
DrawablePtr
112103
cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off)
113104
{
114-
if (DrawableIsRedirWindow(pDrawable)) {
105+
if (cwDrawableIsRedirWindow(pDrawable)) {
115106
WindowPtr pWin = (WindowPtr)pDrawable;
116107
PixmapPtr pPixmap = (*pDrawable->pScreen->GetWindowPixmap)(pWin);
117108
*x_off = -pPixmap->screen_x;
@@ -154,22 +145,21 @@ cwCreateGCPrivate(GCPtr pGC, DrawablePtr pDrawable)
154145
pPriv->wrapFuncs = pGC->funcs;
155146
pGC->funcs = &cwGCFuncs;
156147
pGC->ops = &cwGCOps;
157-
pGC->devPrivates[cwGCIndex].ptr = (pointer)pPriv;
148+
setCwGC (pGC, pPriv);
158149
return TRUE;
159150
}
160151

161152
static void
162153
cwDestroyGCPrivate(GCPtr pGC)
163154
{
164-
cwGCRec *pPriv;
155+
cwGCPtr pPriv;
165156

166-
pPriv = (cwGCRec *)pGC->devPrivates[cwGCIndex].ptr;
167-
pGC->devPrivates[cwGCIndex].ptr = (pointer)pPriv->wrapFuncs;
157+
pPriv = (cwGCPtr) getCwGC (pGC);
168158
pGC->funcs = &cwCheapGCFuncs;
169159
pGC->ops = pPriv->wrapOps;
170160
if (pPriv->pBackingGC)
171161
FreeGC(pPriv->pBackingGC, (XID)0);
172-
pGC->devPrivates[cwGCIndex].ptr = pPriv->wrapFuncs;
162+
setCwGC (pGC, pPriv->wrapFuncs);
173163
xfree((pointer)pPriv);
174164
}
175165

@@ -193,12 +183,12 @@ cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
193183
DrawablePtr pBackingDrawable;
194184
int x_off, y_off;
195185

196-
pPriv = (cwGCPtr)pGC->devPrivates[cwGCIndex].ptr;
186+
pPriv = (cwGCPtr) getCwGC (pGC);
197187

198188
FUNC_PROLOGUE(pGC, pPriv);
199189

200190
if (pDrawable->serialNumber != pPriv->serialNumber &&
201-
!DrawableIsRedirWindow(pDrawable))
191+
!cwDrawableIsRedirWindow(pDrawable))
202192
{
203193
/* The drawable is no longer a window with backing store, so kill the
204194
* private and go back to cheap functions.
@@ -350,7 +340,7 @@ cwCheapValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
350340
* re-wrap on return.
351341
*/
352342
if (pDrawable->type == DRAWABLE_WINDOW &&
353-
DrawableIsRedirWindow(pDrawable) &&
343+
cwDrawableIsRedirWindow(pDrawable) &&
354344
cwCreateGCPrivate(pGC, pDrawable))
355345
{
356346
(*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable);
@@ -511,16 +501,16 @@ void
511501
miInitializeCompositeWrapper(ScreenPtr pScreen)
512502
{
513503
cwScreenPtr pScreenPriv;
514-
#ifdef RENDER
515-
PictureScreenPtr ps = GetPictureScreen(pScreen);
516-
#endif
517504

518505
if (cwGeneration != serverGeneration)
519506
{
520507
cwScreenIndex = AllocateScreenPrivateIndex();
521508
if (cwScreenIndex < 0)
522509
return;
523510
cwGCIndex = AllocateGCPrivateIndex();
511+
#ifdef RENDER
512+
cwPictureIndex = AllocatePicturePrivateIndex();
513+
#endif
524514
cwGeneration = serverGeneration;
525515
}
526516
if (!AllocateGCPrivate(pScreen, cwGCIndex, 0))
@@ -539,19 +529,17 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
539529
pScreen->GetSpans = cwGetSpans;
540530
pScreen->CreateGC = cwCreateGC;
541531

532+
pScreen->devPrivates[cwScreenIndex].ptr = (pointer)pScreenPriv;
533+
542534
#ifdef RENDER
543-
if (ps)
535+
if (GetPictureScreen (pScreen))
544536
{
545-
pScreenPriv->Composite = ps->Composite;
546-
ps->Composite = cwComposite;
547-
pScreenPriv->Glyphs = ps->Glyphs;
548-
ps->Glyphs = cwGlyphs;
537+
if (!cwInitializeRender (pScreen))
538+
/* FIXME */;
549539
}
550540
#endif
551541

552542
ErrorF("Initialized composite wrapper\n");
553-
554-
pScreen->devPrivates[cwScreenIndex].ptr = (pointer)pScreenPriv;
555543
}
556544

557545
static Bool

0 commit comments

Comments
 (0)