summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2014-03-06 12:48:25 -0500
committerAdam Jackson <ajax@redhat.com>2014-10-14 12:24:13 -0400
commit4d6d9342bb3c7381875ae4b81a87ce2eba283cb4 (patch)
tree0fe858892cef724f3da79cb50d66b4d19706a6ba
parent61a292adf45405641de1c522a04c148e0a152acd (diff)
vfb: Add -ifr and -miifr (incomplete)vfb-ifr
Two different infinitely fast renderers, ie, renderers that don't actually draw anything. miifr has null span hooks but otherwise calls through mi; ifr has null hooks for everything. Known bugs: - probably missing at least one window hook in the screen? Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--hw/vfb/InitOutput.c309
1 files changed, 309 insertions, 0 deletions
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index bcaaa85e4..b0dc43578 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -46,6 +46,7 @@ from The Open Group.
#include "input.h"
#include "mipointer.h"
#include "micmap.h"
+#include "mipict.h"
#include <sys/types.h>
#ifdef HAVE_MMAP
#include <sys/mman.h>
@@ -124,6 +125,14 @@ static fbMemType fbmemtype = NORMAL_MEMORY_FB;
static char needswap = 0;
static Bool Render = TRUE;
+/*
+ * infinitely-fast renderer modes:
+ * 0: normal
+ * 1: mi: infinitely fast span hooks, mi decomposition
+ * 2: ifr: all hooks infinitely fast
+ */
+static int vfbIFR = 0;
+
#define swapcopy16(_dst, _src) \
if (needswap) { CARD16 _s = _src; cpswaps(_s, _dst); } \
else _dst = _src;
@@ -241,6 +250,8 @@ ddxUseMsg(void)
ErrorF("-linebias n adjust thin line pixelization\n");
ErrorF("-blackpixel n pixel value for black\n");
ErrorF("-whitepixel n pixel value for white\n");
+ ErrorF("-ifr Infinitely fast renderer\n");
+ ErrorF("-miifr Infinitely fast renderer (mi version)\n");
#ifdef HAVE_MMAP
ErrorF
@@ -355,6 +366,16 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 2;
}
+ if (strcmp(argv[i], "-miifr") == 0) { /* -miifr */
+ vfbIFR = 1;
+ return 1;
+ }
+
+ if (strcmp(argv[i], "-ifr") == 0) { /* -ifr */
+ vfbIFR = 2;
+ return 1;
+ }
+
if (strcmp(argv[i], "-linebias") == 0) { /* -linebias n */
CHECK_FOR_REQUIRED_ARGUMENTS(1);
currentScreen->lineBias = atoi(argv[++i]);
@@ -721,6 +742,291 @@ static miPointerScreenFuncRec vfbPointerCursorFuncs = {
miPointerWarpCursor
};
+static void
+ifrCopyWindow(WindowPtr pWin, DDXPointRec old, RegionPtr src)
+{
+}
+
+static void
+ifrFillSpans(DrawablePtr draw, GCPtr gc, int n, DDXPointPtr ppt,
+ int *width, int sorted)
+{
+}
+
+static void
+ifrSetSpans(DrawablePtr draw, GCPtr gc, char *src, DDXPointPtr pt,
+ int *width, int n, int sorted)
+{
+}
+
+static void
+ifrPutImage(DrawablePtr draw, GCPtr gc, int d, int x, int y, int w, int h,
+ int left, int format, char *bits)
+{
+}
+
+static RegionPtr
+ifrCopyArea(DrawablePtr src, DrawablePtr dst, GCPtr gc, int sx, int sy,
+ int w, int h, int dx, int dy)
+{
+ return NULL;
+}
+
+static RegionPtr
+ifrCopyPlane(DrawablePtr src, DrawablePtr dst, GCPtr gc, int sx, int sy,
+ int w, int h, int dx, int dy, unsigned long plane)
+{
+ return NULL;
+}
+
+static void
+ifrPolyPoint(DrawablePtr draw, GCPtr gc, int mode, int n, DDXPointPtr p)
+{
+}
+
+static void
+ifrPolyLine(DrawablePtr draw, GCPtr gc, int mode, int n, DDXPointPtr p)
+{
+}
+
+static void
+ifrPolySegment(DrawablePtr draw, GCPtr gc, int n, xSegment *s)
+{
+}
+
+static void
+ifrPolyRectangle(DrawablePtr draw, GCPtr gc, int n, xRectangle *r)
+{
+}
+
+static void
+ifrPolyArc(DrawablePtr draw, GCPtr gc, int n, xArc *a)
+{
+}
+
+static void
+ifrFillPolygon(DrawablePtr draw, GCPtr gc, int shape, int mode, int n,
+ DDXPointPtr p)
+{
+}
+
+static void
+ifrPolyFillRect(DrawablePtr draw, GCPtr gc, int n, xRectangle *r)
+{
+}
+
+static void
+ifrPolyFillArc(DrawablePtr draw, GCPtr gc, int n, xArc *a)
+{
+}
+
+static int
+ifrPolyText8(DrawablePtr draw, GCPtr gc, int x, int y, int n, char *c)
+{
+ return 0;
+}
+
+static int
+ifrPolyText16(DrawablePtr draw, GCPtr gc, int x, int y, int n,
+ unsigned short *c)
+{
+ return 0;
+}
+
+static void
+ifrImageText8(DrawablePtr draw, GCPtr gc, int x, int y, int n, char *c)
+{
+}
+
+static void
+ifrImageText16(DrawablePtr draw, GCPtr gc, int x, int y, int n,
+ unsigned short *c)
+{
+}
+
+static void
+ifrImageGlyphBlt(DrawablePtr draw, GCPtr gc, int x, int y, unsigned n,
+ CharInfoPtr *p, void *base)
+{
+}
+
+static void
+ifrPolyGlyphBlt(DrawablePtr draw, GCPtr gc, int x, int y, unsigned n,
+ CharInfoPtr *p, void *base)
+{
+}
+
+static void
+ifrPushPixels(GCPtr gc, PixmapPtr p, DrawablePtr dst, int x, int y,
+ int w, int h)
+{
+}
+
+static const GCOps ifrOps = {
+ ifrFillSpans,
+ ifrSetSpans,
+ ifrPutImage,
+ ifrCopyArea,
+ ifrCopyPlane,
+ ifrPolyPoint,
+ ifrPolyLine,
+ ifrPolySegment,
+ ifrPolyRectangle,
+ ifrPolyArc,
+ ifrFillPolygon,
+ ifrPolyFillRect,
+ ifrPolyFillArc,
+ ifrPolyText8,
+ ifrPolyText16,
+ ifrImageText8,
+ ifrImageText16,
+ ifrImageGlyphBlt,
+ ifrPolyGlyphBlt,
+ ifrPushPixels,
+};
+
+static const GCOps miifrOps = {
+ ifrFillSpans,
+ ifrSetSpans,
+ miPutImage,
+ miCopyArea,
+ miCopyPlane,
+ miPolyPoint,
+ miWideDash, /* XXX ick? */
+ miPolySegment,
+ miPolyRectangle,
+ miPolyArc,
+ miFillPolygon,
+ miPolyFillRect,
+ miPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ miImageGlyphBlt,
+ miPolyGlyphBlt,
+ ifrPushPixels,
+};
+
+static void
+ifrValidateGC(GCPtr gc, unsigned long changes, DrawablePtr pDraw)
+{
+}
+
+static const GCFuncs ifrFuncs = {
+ ifrValidateGC,
+ miChangeGC,
+ miCopyGC,
+ miDestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip,
+};
+
+static Bool
+ifrCreateGC(GCPtr gc)
+{
+ if (vfbIFR == 2)
+ gc->ops = &ifrOps;
+ if (vfbIFR == 1)
+ gc->ops = &miifrOps;
+ gc->funcs = &ifrFuncs;
+
+ /* set gc bits like fb just in case */
+ gc->miTranslate = 1;
+ gc->fExpose = 1;
+
+ return TRUE;
+}
+
+static void
+ifrGetSpans(DrawablePtr pDraw, int wmax, DDXPointPtr p, int *w, int n,
+ char *dst)
+{
+}
+
+static void
+ifrGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h, unsigned int f,
+ unsigned long pm, char *dst)
+{
+}
+
+static void
+ifrComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 sx, INT16 sy, INT16 mx, INT16 my, INT16 dx, INT16 dy,
+ CARD16 w, CARD16 h)
+{
+}
+
+static void
+ifrGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr format,
+ INT16 sx, INT16 sy, int n, GlyphListPtr l, GlyphPtr *g)
+{
+}
+
+static void
+ifrCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *c, int n,
+ xRectangle *r)
+{
+}
+
+static void
+ifrCompositeTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr format, INT16 sx, INT16 sy, int n,
+ xTrapezoid *t)
+{
+}
+
+static void
+ifrCompositeTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr format, INT16 sx, INT16 sy, int n,
+ xTriangle *t)
+{
+}
+
+static void
+ifrCompositeTriStripFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr format, INT16 sx, INT16 sy, int n,
+ xPointFixed *p)
+{
+}
+
+static void
+ifrAddTraps(PicturePtr pPict, INT16 x, INT16 y, int n, xTrap *t)
+{
+}
+
+static void
+vfbIFRInit(ScreenPtr pScreen)
+{
+ PictureScreenPtr ps;
+
+ pScreen->CopyWindow = ifrCopyWindow;
+ pScreen->CreateGC = ifrCreateGC;
+ pScreen->GetSpans = ifrGetSpans;
+ if (vfbIFR == 2)
+ pScreen->GetImage = ifrGetImage;
+ else
+ pScreen->GetImage = miGetImage;
+
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps) {
+ ps->Composite = ifrComposite;
+ ps->Trapezoids = ifrCompositeTrapezoids;
+ ps->Triangles = ifrCompositeTriangles;
+ ps->TriStrip = ifrCompositeTriStripFan;
+ ps->TriFan = ifrCompositeTriStripFan;
+ ps->AddTraps = ifrAddTraps;
+ if (vfbIFR == 2) {
+ ps->Glyphs = ifrGlyphs;
+ ps->CompositeRects = ifrCompositeRects;
+ } else {
+ ps->Glyphs = miGlyphs;
+ ps->CompositeRects = miCompositeRects;
+ }
+ }
+}
+
static Bool
vfbCloseScreen(ScreenPtr pScreen)
{
@@ -811,6 +1117,9 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
if (!ret)
return FALSE;
+ if (vfbIFR)
+ vfbIFRInit(pScreen);
+
pScreen->InstallColormap = vfbInstallColormap;
pScreen->SaveScreen = vfbSaveScreen;