diff options
author | Dave Airlie <airlied@gmail.com> | 2012-04-12 16:29:24 +0100 |
---|---|---|
committer | Dave Airlie <airlied@gmail.com> | 2012-04-12 16:29:24 +0100 |
commit | 2eb83b75c72d9fa9034eda0c64fca96b57b35a1b (patch) | |
tree | 6519fa7d7bc76b32df129b3733435b541f5da7ee | |
parent | af0dbaa5bb648afb9e11897a2c13116dd9be0057 (diff) |
2 hacks but we get xlogo
so X -wr + xlogo works with nested now
-rw-r--r-- | drv/imped.h | 13 | ||||
-rw-r--r-- | drv/imped_scrn.c | 75 | ||||
-rw-r--r-- | fb/fbscreen.c | 2 | ||||
-rw-r--r-- | include/scrnintstr.h | 1 | ||||
-rw-r--r-- | mi/miscrinit.c | 16 |
5 files changed, 94 insertions, 13 deletions
diff --git a/drv/imped.h b/drv/imped.h index f86e73acc..047e9b809 100644 --- a/drv/imped.h +++ b/drv/imped.h @@ -47,6 +47,19 @@ impedDetachAllSlaves(ScreenPtr pScreen); extern _X_EXPORT void impedMigrateOutputSlaves(ScreenPtr pOldMaster, ScreenPtr pNewMaster); +extern _X_EXPORT void +impedCopyNtoN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure); + static inline void impedGetDrawableDeltas(DrawablePtr pDrawable, PixmapPtr pPixmap, int *x_off, int *y_off) { diff --git a/drv/imped_scrn.c b/drv/imped_scrn.c index 8c2e1d949..88c8052dd 100644 --- a/drv/imped_scrn.c +++ b/drv/imped_scrn.c @@ -17,6 +17,13 @@ #include "mi.h" #include "micmap.h" +#define impedWindowEnabled(pWin) \ + RegionNotEmpty(&(pWin)->drawable.pScreen->root->borderClip) + +#define impedDrawableEnabled(pDrawable) \ + ((pDrawable)->type == DRAWABLE_PIXMAP ? \ + TRUE : impedWindowEnabled((WindowPtr) pDrawable)) + static DevPrivateKeyRec impedWinPrivateKeyRec; static DevPrivateKey impedGetWinPrivateKey (void) @@ -56,7 +63,7 @@ impedCreateScreenResources(ScreenPtr pScreen) pPixmap = pScreen->GetScreenPixmap(pScreen); i = 0; xorg_list_for_each_entry(iter, &pScreen->gpu_screen_list, gpu_screen_head) { - iter->SetScreenPixmap(pPixmap->gpu[i]); + iter->omghack = pPixmap->gpu[i]; i++; } @@ -104,7 +111,30 @@ impedUnmapWindow(WindowPtr pWindow) static void impedCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { + ScreenPtr pScreen = pWin->drawable.pScreen; + PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin); + RegionRec rgnDst; + int dx, dy; + + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + RegionTranslate(prgnSrc, -dx, -dy); + RegionNull(&rgnDst); + RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); +#ifdef COMPOSITE + if (pPixmap->screen_x || pPixmap->screen_y) { + int xoff = 0, yoff = 0; + + xoff = -pPixmap->screen_x; + yoff = -pPixmap->screen_y; + RegionTranslate(&rgnDst, xoff, yoff); + } +#endif + + miCopyRegion(&pWin->drawable, &pWin->drawable, NULL, + &rgnDst, dx, dy, impedCopyNtoN, 0, 0); + RegionUninit(&rgnDst); } static Bool @@ -135,7 +165,21 @@ impedGetImage (DrawablePtr pDrawable, unsigned long planeMask, char *d) { + ScreenPtr pScreen = pDrawable->pScreen; + RegionRec img_region; + PixmapPtr pPixmap = GetDrawablePixmap(pDrawable); + int x_off, y_off; + + if (!impedDrawableEnabled(pDrawable)) + return; + impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off); + x += x_off; + y += y_off; + + pScreen->gpu[0]->GetImage(&pPixmap->gpu[0]->drawable, x, y, w, h, + format, planeMask, d); + /* TODO shatter*/ } static void @@ -168,7 +212,7 @@ impedCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, pPixmap->drawable.y = 0; pPixmap->drawable.width = width; pPixmap->drawable.height = height; - pPixmap->devKind = width; + pPixmap->devKind = (width * (BitsPerPixel(depth)/8)); pPixmap->refcnt = 1; #ifdef COMPOSITE @@ -194,26 +238,47 @@ static Bool impedModifyPixmapHeader(PixmapPtr pPixmap, int w, int h, int d, int bpp, int devKind, pointer pPixData) { + ScreenPtr iter; + int i; + if (!pPixmap) + return FALSE; + + miModifyPixmapHeader(pPixmap, w, h, d, bpp, devKind, pPixData); + + i = 0; + xorg_list_for_each_entry(iter, &pPixmap->drawable.pScreen->gpu_screen_list, gpu_screen_head) { + iter->ModifyPixmapHeader(pPixmap->gpu[i], w, h, d, bpp, devKind, pPixData); + } return TRUE; } + static void impedQueryBestSize (int class, unsigned short *width, unsigned short *height, ScreenPtr pScreen) { - + pScreen->gpu[0]->QueryBestSize(class, width, height, pScreen->gpu[0]); } static RegionPtr impedBitmapToRegion(PixmapPtr pPix) { - return NULL; + return pPix->drawable.pScreen->gpu[0]->BitmapToRegion(pPix->gpu[0]); } static Bool impedDestroyPixmap(PixmapPtr pPixmap) { - return FALSE; + int i; + ScreenPtr pScreen = pPixmap->drawable.pScreen; + if (--pPixmap->refcnt) + return TRUE; + + for (i = 0; i < pScreen->num_gpu; i++) { + pScreen->gpu[i]->DestroyPixmap(pPixmap->gpu[i]); + } + FreePixmap(pPixmap); + return TRUE; } Bool diff --git a/fb/fbscreen.c b/fb/fbscreen.c index 2bb9c3926..708d4ed48 100644 --- a/fb/fbscreen.c +++ b/fb/fbscreen.c @@ -227,6 +227,8 @@ fbFinishScreenInit(ScreenPtr pScreen, &defaultVisual, ((unsigned long) 1 << (imagebpp - 1)), 8)) return FALSE; + } else { + rootdepth = 32; // HACK THE GIBSON } if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootdepth, ndepths, depths, diff --git a/include/scrnintstr.h b/include/scrnintstr.h index 22038f91b..b41c032a2 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -517,6 +517,7 @@ typedef struct _Screen { GetCopyAreaFunctionProcPtr GetCopyAreaFunction; GetCopyPlaneFunctionProcPtr GetCopyPlaneFunction; + PixmapPtr omghack; } ScreenRec; static inline RegionPtr diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 74648af2d..b05c19b1c 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -148,10 +148,13 @@ miCreateScreenResources(ScreenPtr pScreen) /* create a pixmap with no data, then redirect it to point to * the screen */ - pPixmap = - (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0); - if (!pPixmap) - return FALSE; + if (!pScreen->isDrv) { + pPixmap = + (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0); + if (!pPixmap) + return FALSE; + } else + pPixmap = pScreen->omghack; if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width, pScreen->height, @@ -230,10 +233,7 @@ miScreenInit(ScreenPtr pScreen, pointer pbits, /* pointer to screen bits */ pScreen->saveUnderSupport = NotUseful; /* whitePixel, blackPixel */ pScreen->ModifyPixmapHeader = miModifyPixmapHeader; - if (pScreen->isDrv) - pScreen->CreateScreenResources = NoopDDA; - else - pScreen->CreateScreenResources = miCreateScreenResources; + pScreen->CreateScreenResources = miCreateScreenResources; pScreen->GetScreenPixmap = miGetScreenPixmap; pScreen->SetScreenPixmap = miSetScreenPixmap; pScreen->numVisuals = numVisuals; |