Add an UploadToScreen implementation, for testing PutImage support, and

make the DownloadFromScreen more robust.
This commit is contained in:
Eric Anholt 2006-03-30 05:15:58 +00:00
parent e799dd68e2
commit 3cf46cc1e3
2 changed files with 60 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2006-03-29 Eric Anholt <anholt@FreeBSD.org>
* hw/kdrive/ephyr/ephyr_draw.c: (ephyrDownloadFromScreen),
(ephyrUploadToScreen), (ephyrDrawInit):
Add an UploadToScreen implementation, for testing PutImage support, and
make the DownloadFromScreen more robust.
2006-03-29 Eric Anholt <anholt@FreeBSD.org>
* exa/exa_accel.c: (exaGetImage):

View File

@ -227,25 +227,71 @@ ephyrDoneComposite(PixmapPtr pDst)
}
/**
* Does an fbGetImage to pull image data from a pixmap.
* Does fake acceleration of DownloadFromScren using memcpy.
*/
static Bool
ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
int dst_pitch)
{
/* Only "accelerate" it if we can hand it off to fbGetImage, which expects
* the dst pitch to match the width of the image.
*/
if (dst_pitch != PixmapBytePad(&pSrc->drawable, w))
KdScreenPriv(pSrc->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
char *src;
int src_pitch, cpp;
if (pSrc->drawable.bitsPerPixel < 8)
return FALSE;
fbGetImage(&pSrc->drawable, x, y, w, h, ZPixmap, FB_ALLONES, dst);
cpp = pSrc->drawable.bitsPerPixel / 8;
src_pitch = exaGetPixmapPitch(pSrc);
src = fakexa->exa->memoryBase + exaGetPixmapOffset(pSrc);
src += y * src_pitch + x * cpp;
for (; h > 0; h--) {
memcpy(dst, src, w * cpp);
dst += dst_pitch;
src += src_pitch;
}
exaMarkSync(pSrc->drawable.pScreen);
return TRUE;
}
/**
* Does fake acceleration of DownloadFromScren using memcpy.
*/
static Bool
ephyrUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
int src_pitch)
{
KdScreenPriv(pDst->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
char *dst;
int dst_pitch, cpp;
if (pDst->drawable.bitsPerPixel < 8)
return FALSE;
cpp = pDst->drawable.bitsPerPixel / 8;
dst_pitch = exaGetPixmapPitch(pDst);
dst = fakexa->exa->memoryBase + exaGetPixmapOffset(pDst);
dst += y * dst_pitch + x * cpp;
for (; h > 0; h--) {
memcpy(dst, src, w * cpp);
dst += dst_pitch;
src += src_pitch;
}
exaMarkSync(pDst->drawable.pScreen);
return TRUE;
}
/**
* In fakexa, we currently only track whether we have synced to the latest
* "accelerated" drawing that has happened or not. This will be used by an
@ -331,6 +377,7 @@ ephyrDrawInit(ScreenPtr pScreen)
fakexa->exa->DoneComposite = ephyrDoneComposite;
fakexa->exa->DownloadFromScreen = ephyrDownloadFromScreen;
fakexa->exa->UploadToScreen = ephyrUploadToScreen;
fakexa->exa->MarkSync = ephyrMarkSync;
fakexa->exa->WaitMarker = ephyrWaitMarker;