* update cleaner doxygen.*dot related .cache
[t2sde.git] / package / xorg / xf86-video-i128 / hotfix-cursor-endianess.patch
blob30e562f224b1083af1aebcb027e0371476033bb7
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
3 @@ -42,6 +42,10 @@
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,
9 + CursorPtr pCurs);
10 +#endif
11 static Bool I128IBMUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs);
14 @@ -73,11 +75,92 @@
16 #if X_BYTE_ORDER == X_BIG_ENDIAN
17 infoPtr->Flags |= HARDWARE_CURSOR_NIBBLE_SWAPPED;
18 +#else
19 + infoPtr->RealizeCursor = I128IBMRealizeCursor;
20 #endif
22 return(xf86InitCursor(pScreen, infoPtr));
25 +#if X_BYTE_ORDER != X_BIG_ENDIAN
27 +/*
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
32 + * looks like:
33 + * Byte 0x000 - 0x00F top scan line, left to right
34 + * 0x010 - 0x01F
35 + * . .
36 + * 0x3F0 - 0x3FF bottom scan line
37 + *
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
42 + */
44 +static unsigned char *
45 +I128IBMRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
47 + register int i, j;
48 + unsigned char *pServMsk;
49 + unsigned char *pServSrc;
50 + int wsrc, h;
51 + unsigned char *mem, *dst;
53 + mem = (unsigned char *)calloc(1,1024); /* 64x64x2 bits */
54 + dst = mem;
56 + if (!mem)
57 + return NULL;
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) {
73 + /*
74 + * mask byte ABCDEFGH and source byte 12345678 map to two byte
75 + * cursor data H8G7F6E5 D4C3B2A1
76 + */
77 + mask = *pServMsk++;
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) ;
89 + } else {
90 + mem[j*2] = 0x00;
91 + mem[(j*2)+1] = 0x00;
92 + }
93 + }
94 + /*
95 + * if we still have more bytes on this line (j < wsrc),
96 + * we have to ignore the rest of the line.
97 + */
98 + while (j++ < wsrc) pServMsk++,pServSrc++;
99 + }
100 + return dst;
103 +#endif
105 static void
106 I128IBMShowCursor(ScrnInfoPtr pScrn)