diff --git a/fb/fbcompose.c b/fb/fbcompose.c index 6ea9483..d976cd1 100644 --- a/fb/fbcompose.c +++ b/fb/fbcompose.c @@ -51,6 +51,49 @@ typedef FASTCALL void (*fetchProc)(const FbBits *bits, int x, int width, CARD32 */ static FASTCALL void +fbFetch_a2r10g10b10 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + MEMCPY_WRAPPED(buffer, (const CARD32 *)bits + x, width*sizeof(CARD32)); +} + +static FASTCALL void +fbFetch_x2r10g10b10 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD32 *pixel = (const CARD32 *)bits + x; + const CARD32 *end = pixel + width; + while (pixel < end) { + WRITE(buffer++, READ(pixel++) | 0xc0000000); + } +} + +static FASTCALL void +fbFetch_a2b10g10r10 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD32 *pixel = (CARD32 *)bits + x; + const CARD32 *end = pixel + width; + while (pixel < end) { + WRITE(buffer++, ((READ(pixel) & 0xc00ffc00) | + ((READ(pixel) >> 20) & 0x3ff) | + ((READ(pixel) & 0x3ff) << 20))); + ++pixel; + } +} + +static FASTCALL void +fbFetch_x2b10g10r10 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD32 *pixel = (CARD32 *)bits + x; + const CARD32 *end = pixel + width; + while (pixel < end) { + WRITE(buffer++, 0xc0000000 | + ((READ(pixel) & 0x000ffc00) | + ((READ(pixel) >> 20) & 0x3ff) | + ((READ(pixel) & 0x3ff) << 20))); + ++pixel; + } +} + +static FASTCALL void fbFetch_a8r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { MEMCPY_WRAPPED(buffer, (const CARD32 *)bits + x, width*sizeof(CARD32)); @@ -532,6 +575,11 @@ static fetchProc fetchProcForPicture (PicturePtr pict) case PICT_a8b8g8r8: return fbFetch_a8b8g8r8; case PICT_x8b8g8r8: return fbFetch_x8b8g8r8; + case PICT_a2r10g10b10: return fbFetch_a2r10g10b10; + case PICT_x2r10g10b10: return fbFetch_x2r10g10b10; + case PICT_a2b10g10r10: return fbFetch_a2b10g10r10; + case PICT_x2b10g10r10: return fbFetch_x2b10g10r10; + /* 24bpp formats */ case PICT_r8g8b8: return fbFetch_r8g8b8; case PICT_b8g8r8: return fbFetch_b8g8r8; @@ -583,6 +631,40 @@ static fetchProc fetchProcForPicture (PicturePtr pict) typedef FASTCALL CARD32 (*fetchPixelProc)(const FbBits *bits, int offset, miIndexedPtr indexed); static FASTCALL CARD32 +fbFetchPixel_a2r10g10b10 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + return READ((CARD32 *)bits + offset); +} + +static FASTCALL CARD32 +fbFetchPixel_x2r10g10b10 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + return READ((CARD32 *)bits + offset) | 0xc0000000; +} + +static FASTCALL CARD32 +fbFetchPixel_a2b10g10r10 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = READ((CARD32 *)bits + offset); + + return ((pixel & 0xc0000000) | + ((pixel >> 20) & 0x3ff) | + (pixel & 0x000ffc00) | + ((pixel & 0x3ff) << 20)); +} + +static FASTCALL CARD32 +fbFetchPixel_x2b10g10r10 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = READ((CARD32 *)bits + offset); + + return ((0xc0000000) | + ((pixel >> 20) & 0x3ff) | + (pixel & 0x000ffc00) | + ((pixel & 0x3ff) << 20)); +} + +static FASTCALL CARD32 fbFetchPixel_a8r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) { return READ((CARD32 *)bits + offset); @@ -969,6 +1051,11 @@ static fetchPixelProc fetchPixelProcForPicture (PicturePtr pict) case PICT_a8b8g8r8: return fbFetchPixel_a8b8g8r8; case PICT_x8b8g8r8: return fbFetchPixel_x8b8g8r8; + case PICT_a2r10g10b10: return fbFetchPixel_a2r10g10b10; + case PICT_x2r10g10b10: return fbFetchPixel_x2r10g10b10; + case PICT_a2b10g10r10: return fbFetchPixel_a2b10g10r10; + case PICT_x2b10g10r10: return fbFetchPixel_x2b10g10r10; + /* 24bpp formats */ case PICT_r8g8b8: return fbFetchPixel_r8g8b8; case PICT_b8g8r8: return fbFetchPixel_b8g8r8; @@ -1025,6 +1112,39 @@ typedef FASTCALL void (*storeProc) (FbBits *bits, const CARD32 *values, int x, i #define Split(v) CARD32 r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff static FASTCALL void +fbStore_a2r10g10b10 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + MEMCPY_WRAPPED(((CARD32 *)bits) + x, values, width*sizeof(CARD32)); +} + +static FASTCALL void +fbStore_x2r10g10b10 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD32 *pixel = (CARD32 *)bits + x; + for (i = 0; i < width; ++i) + WRITE(pixel++, READ(values + i) & 0x3fffffff); +} + +static FASTCALL void +fbStore_a2b10g10r10 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD32 *pixel = (CARD32 *)bits + x; + for (i = 0; i < width; ++i) + WRITE(pixel++, (READ(values + i) & 0xc00ffc00) | ((READ(values + i) >> 20) & 0x3ff) | ((READ(values + i) & 0x3ff) << 20)); +} + +static FASTCALL void +fbStore_x2b10g10r10 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD32 *pixel = (CARD32 *)bits + x; + for (i = 0; i < width; ++i) + WRITE(pixel++, (READ(values + i) & 0x000ffc00) | ((READ(values + i) >> 20) & 0x3ff) | ((READ(values + i) & 0x3ff) << 20)); +} + +static FASTCALL void fbStore_a8r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { MEMCPY_WRAPPED(((CARD32 *)bits) + x, values, width*sizeof(CARD32)); @@ -1418,6 +1538,11 @@ static storeProc storeProcForPicture (PicturePtr pict) case PICT_a8b8g8r8: return fbStore_a8b8g8r8; case PICT_x8b8g8r8: return fbStore_x8b8g8r8; + case PICT_a2r10g10b10: return fbStore_a2r10g10b10; + case PICT_x2r10g10b10: return fbStore_x2r10g10b10; + case PICT_a2b10g10r10: return fbStore_a2b10g10r10; + case PICT_x2b10g10r10: return fbStore_x2b10g10r10; + /* 24bpp formats */ case PICT_r8g8b8: return fbStore_r8g8b8; case PICT_b8g8r8: return fbStore_b8g8r8; diff --git a/render/picture.h b/render/picture.h index 1b62234..dd88179 100644 --- a/render/picture.h +++ b/render/picture.h @@ -73,6 +73,11 @@ typedef enum _PictFormatShort { PICT_a8b8g8r8 = PICT_FORMAT(32,PICT_TYPE_ABGR,8,8,8,8), PICT_x8b8g8r8 = PICT_FORMAT(32,PICT_TYPE_ABGR,0,8,8,8), + PICT_a2r10g10b10 = PICT_FORMAT(32,PICT_TYPE_ARGB,2,10,10,10), + PICT_x2r10g10b10 = PICT_FORMAT(32,PICT_TYPE_ARGB,0,10,10,10), + PICT_a2b10g10r10 = PICT_FORMAT(32,PICT_TYPE_ABGR,2,10,10,10), + PICT_x2b10g10r10 = PICT_FORMAT(32,PICT_TYPE_ABGR,0,10,10,10), + /* 24bpp formats */ PICT_r8g8b8 = PICT_FORMAT(24,PICT_TYPE_ARGB,0,8,8,8), PICT_b8g8r8 = PICT_FORMAT(24,PICT_TYPE_ABGR,0,8,8,8),