Add an UploadToScreen implementation, for testing PutImage support, and
make the DownloadFromScreen more robust.
This commit is contained in:
parent
e799dd68e2
commit
3cf46cc1e3
|
@ -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>
|
2006-03-29 Eric Anholt <anholt@FreeBSD.org>
|
||||||
|
|
||||||
* exa/exa_accel.c: (exaGetImage):
|
* exa/exa_accel.c: (exaGetImage):
|
||||||
|
|
|
@ -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
|
static Bool
|
||||||
ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
|
ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
|
||||||
int dst_pitch)
|
int dst_pitch)
|
||||||
{
|
{
|
||||||
/* Only "accelerate" it if we can hand it off to fbGetImage, which expects
|
KdScreenPriv(pSrc->drawable.pScreen);
|
||||||
* the dst pitch to match the width of the image.
|
KdScreenInfo *screen = pScreenPriv->screen;
|
||||||
*/
|
EphyrScrPriv *scrpriv = screen->driver;
|
||||||
if (dst_pitch != PixmapBytePad(&pSrc->drawable, w))
|
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
|
||||||
|
char *src;
|
||||||
|
int src_pitch, cpp;
|
||||||
|
|
||||||
|
if (pSrc->drawable.bitsPerPixel < 8)
|
||||||
return FALSE;
|
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);
|
exaMarkSync(pSrc->drawable.pScreen);
|
||||||
|
|
||||||
return TRUE;
|
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
|
* 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
|
* "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->DoneComposite = ephyrDoneComposite;
|
||||||
|
|
||||||
fakexa->exa->DownloadFromScreen = ephyrDownloadFromScreen;
|
fakexa->exa->DownloadFromScreen = ephyrDownloadFromScreen;
|
||||||
|
fakexa->exa->UploadToScreen = ephyrUploadToScreen;
|
||||||
|
|
||||||
fakexa->exa->MarkSync = ephyrMarkSync;
|
fakexa->exa->MarkSync = ephyrMarkSync;
|
||||||
fakexa->exa->WaitMarker = ephyrWaitMarker;
|
fakexa->exa->WaitMarker = ephyrWaitMarker;
|
||||||
|
|
Loading…
Reference in New Issue