1 --- xf86-video-i128-1.4.1/src/i128IBMDAC.c.vanilla 2024-03-11 20:43:14.656487238 +0100
2 +++ xf86-video-i128-1.4.1/src/i128IBMDAC.c 2024-03-11 21:14:45.336305063 +0100
4 static void I128IBMSetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
5 static void I128IBMSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
6 static void I128IBMLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src);
7 +#if X_BYTE_ORDER != X_BIG_ENDIAN
8 +static unsigned char *I128IBMRealizeCursor(xf86CursorInfoPtr infoPtr,
11 static Bool I128IBMUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs);
16 #if X_BYTE_ORDER == X_BIG_ENDIAN
17 infoPtr->Flags |= HARDWARE_CURSOR_NIBBLE_SWAPPED;
19 + infoPtr->RealizeCursor = I128IBMRealizeCursor;
22 return(xf86InitCursor(pScreen, infoPtr));
25 +#if X_BYTE_ORDER != X_BIG_ENDIAN
28 + * Convert the cursor from server-format to hardware-format. The IBMRGB
29 + * has two planes, plane 0 selects cursor color 0 or 1 and plane 1
30 + * selects transparent or display cursor. The bits of these planes
31 + * are packed together so that one byte has 4 pixels. The organization
33 + * Byte 0x000 - 0x00F top scan line, left to right
36 + * 0x3F0 - 0x3FF bottom scan line
38 + * Byte/bit map - D7D6,D5D4,D3D2,D1D0 four pixels, two planes each
39 + * Pixel/bit map - P1P0 (plane 1) == 1 maps to cursor color
40 + * (plane 1) == 0 maps to transparent
41 + * (plane 0) maps to cursor colors 0 and 1
44 +static unsigned char *
45 +I128IBMRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
48 + unsigned char *pServMsk;
49 + unsigned char *pServSrc;
51 + unsigned char *mem, *dst;
53 + mem = (unsigned char *)calloc(1,1024); /* 64x64x2 bits */
59 + pServSrc = (unsigned char *)pCurs->bits->source;
60 + pServMsk = (unsigned char *)pCurs->bits->mask;
62 + h = pCurs->bits->height;
63 + if (h > infoPtr->MaxHeight)
64 + h = infoPtr->MaxHeight;
66 + wsrc = PixmapBytePad(pCurs->bits->width, 1); /* bytes per line */
68 + for (i = 0; i < infoPtr->MaxHeight; i++,mem+=16) {
69 + for (j = 0; j < infoPtr->MaxWidth / 8; j++) {
70 + register unsigned char mask, source;
72 + if (i < h && j < wsrc) {
74 + * mask byte ABCDEFGH and source byte 12345678 map to two byte
75 + * cursor data H8G7F6E5 D4C3B2A1
78 + source = *pServSrc++ & mask;
80 + /* map 1 byte source and mask into two byte cursor data */
81 + mem[j*2] = ((mask&0x01) << 7) | ((source&0x01) << 6) |
82 + ((mask&0x02) << 4) | ((source&0x02) << 3) |
83 + ((mask&0x04) << 1) | (source&0x04) |
84 + ((mask&0x08) >> 2) | ((source&0x08) >> 3) ;
85 + mem[(j*2)+1] = ((mask&0x10) << 3) | ((source&0x10) << 2) |
86 + (mask&0x20) | ((source&0x20) >> 1) |
87 + ((mask&0x40) >> 3) | ((source&0x40) >> 4) |
88 + ((mask&0x80) >> 6) | ((source&0x80) >> 7) ;
91 + mem[(j*2)+1] = 0x00;
95 + * if we still have more bytes on this line (j < wsrc),
96 + * we have to ignore the rest of the line.
98 + while (j++ < wsrc) pServMsk++,pServSrc++;
106 I128IBMShowCursor(ScrnInfoPtr pScrn)