26
26
#include "shadowfb.h"
27
27
#include "servermd.h"
29
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
30
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
30
33
NVRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
32
NVPtr pNv = NVPTR(pScrn);
33
int width, height, Bpp, FBPitch;
34
unsigned char *src, *dst;
35
NVPtr pNv = NVPTR(pScrn);
36
int x1, y1, x2, y2, width, height, cpp, FBPitch, max_height;
37
unsigned char *src, *dst;
36
Bpp = pScrn->bitsPerPixel >> 3;
37
FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel);
39
nouveau_bo_map(pNv->FB, NOUVEAU_BO_WR);
41
width = (pbox->x2 - pbox->x1) * Bpp;
42
height = pbox->y2 - pbox->y1;
43
src = pNv->ShadowPtr + (pbox->y1 * pNv->ShadowPitch) +
45
dst = pNv->FB->map + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp);
48
memcpy(dst, src, width);
50
src += pNv->ShadowPitch;
39
cpp = pScrn->bitsPerPixel >> 3;
40
FBPitch = pScrn->displayWidth * cpp;
41
max_height = pNv->FB->size/FBPitch;
43
nouveau_bo_map(pNv->FB, NOUVEAU_BO_WR);
45
x1 = MAX(pbox->x1, 0);
46
y1 = MAX(pbox->y1, 0);
47
x2 = MIN(pbox->x2, pScrn->displayWidth);
48
y2 = MIN(pbox->y2, max_height);
49
width = (x2 - x1) * cpp;
52
if (width > 0 && height > 0) {
53
src = pNv->ShadowPtr + (y1 * pNv->ShadowPitch) + (x1 * cpp);
54
dst = pNv->FB->map + (y1 * FBPitch) + (x1 * cpp);
57
memcpy(dst, src, width);
59
src += pNv->ShadowPitch;
55
nouveau_bo_unmap(pNv->FB);
65
nouveau_bo_unmap(pNv->FB);