2 * Copyright © 1999 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
24 #include <kdrive-config.h>
27 #include <sys/ioctl.h>
31 extern int KdTsPhyScreen
;
33 const char *fbdevDevicePath
= NULL
;
36 fbdevInitialize(KdCardInfo
* card
, FbdevPriv
* priv
)
40 if (fbdevDevicePath
== NULL
)
41 fbdevDevicePath
= "/dev/fb0";
43 if ((priv
->fd
= open(fbdevDevicePath
, O_RDWR
)) < 0) {
44 ErrorF("Error opening framebuffer %s: %s\n",
45 fbdevDevicePath
, strerror(errno
));
50 memset(&priv
->fix
, '\0', sizeof(priv
->fix
));
51 if (ioctl(priv
->fd
, FBIOGET_FSCREENINFO
, &priv
->fix
) < 0) {
52 perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO");
57 memset(&priv
->var
, '\0', sizeof(priv
->var
));
58 if (ioctl(priv
->fd
, FBIOGET_VSCREENINFO
, &priv
->var
) < 0) {
59 perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO");
64 priv
->fb_base
= (char *) mmap((caddr_t
) NULL
,
66 PROT_READ
| PROT_WRITE
,
67 MAP_SHARED
, priv
->fd
, 0);
69 if (priv
->fb_base
== (char *) -1) {
70 perror("ERROR: mmap framebuffer fails!");
74 off
= (unsigned long) priv
->fix
.smem_start
% (unsigned long) getpagesize();
75 priv
->fb
= priv
->fb_base
+ off
;
80 fbdevCardInit(KdCardInfo
* card
)
84 priv
= (FbdevPriv
*) malloc(sizeof(FbdevPriv
));
88 if (!fbdevInitialize(card
, priv
)) {
98 fbdevMakeContig(Pixel orig
, Pixel others
)
102 low
= lowbit(orig
) >> 1;
103 while (low
&& (others
& low
) == 0) {
111 fbdevModeSupported(KdScreenInfo
* screen
, const KdMonitorTiming
* t
)
117 fbdevConvertMonitorTiming(const KdMonitorTiming
* t
,
118 struct fb_var_screeninfo
*var
)
120 memset(var
, 0, sizeof(struct fb_var_screeninfo
));
122 var
->xres
= t
->horizontal
;
123 var
->yres
= t
->vertical
;
124 var
->xres_virtual
= t
->horizontal
;
125 var
->yres_virtual
= t
->vertical
;
128 var
->pixclock
= t
->clock
? 1000000000 / t
->clock
: 0;
129 var
->left_margin
= t
->hbp
;
130 var
->right_margin
= t
->hfp
;
131 var
->upper_margin
= t
->vbp
;
132 var
->lower_margin
= t
->vfp
;
133 var
->hsync_len
= t
->hblank
- t
->hfp
- t
->hbp
;
134 var
->vsync_len
= t
->vblank
- t
->vfp
- t
->vbp
;
139 if (t
->hpol
== KdSyncPositive
)
140 var
->sync
|= FB_SYNC_HOR_HIGH_ACT
;
141 if (t
->vpol
== KdSyncPositive
)
142 var
->sync
|= FB_SYNC_VERT_HIGH_ACT
;
146 fbdevScreenInitialize(KdScreenInfo
* screen
, FbdevScrPriv
* scrpriv
)
148 FbdevPriv
*priv
= screen
->card
->driver
;
152 struct fb_var_screeninfo var
;
153 const KdMonitorTiming
*t
;
156 k
= ioctl(priv
->fd
, FBIOGET_VSCREENINFO
, &var
);
158 if (!screen
->width
|| !screen
->height
) {
160 screen
->width
= var
.xres
;
161 screen
->height
= var
.yres
;
164 screen
->width
= 1024;
165 screen
->height
= 768;
167 screen
->rate
= 103; /* FIXME: should get proper value from fb driver */
169 if (!screen
->fb
.depth
) {
171 screen
->fb
.depth
= var
.bits_per_pixel
;
173 screen
->fb
.depth
= 16;
176 if ((screen
->width
!= var
.xres
) || (screen
->height
!= var
.yres
)) {
177 t
= KdFindMode(screen
, fbdevModeSupported
);
178 screen
->rate
= t
->rate
;
179 screen
->width
= t
->horizontal
;
180 screen
->height
= t
->vertical
;
182 /* Now try setting the mode */
183 if (k
< 0 || (t
->horizontal
!= var
.xres
|| t
->vertical
!= var
.yres
))
184 fbdevConvertMonitorTiming(t
, &var
);
187 var
.activate
= FB_ACTIVATE_NOW
;
188 var
.bits_per_pixel
= screen
->fb
.depth
;
192 k
= ioctl(priv
->fd
, FBIOPUT_VSCREENINFO
, &var
);
195 fprintf(stderr
, "error: %s\n", strerror(errno
));
199 /* Re-get the "fixed" parameters since they might have changed */
200 k
= ioctl(priv
->fd
, FBIOGET_FSCREENINFO
, &priv
->fix
);
202 perror("FBIOGET_FSCREENINFO");
204 /* Now get the new screeninfo */
205 ioctl(priv
->fd
, FBIOGET_VSCREENINFO
, &priv
->var
);
206 depth
= priv
->var
.bits_per_pixel
;
207 gray
= priv
->var
.grayscale
;
209 /* Calculate fix.line_length if it's zero */
210 if (!priv
->fix
.line_length
)
211 priv
->fix
.line_length
= (priv
->var
.xres_virtual
* depth
+ 7) / 8;
213 switch (priv
->fix
.visual
) {
214 case FB_VISUAL_MONO01
:
215 case FB_VISUAL_MONO10
:
216 screen
->fb
.visuals
= (1 << StaticGray
);
218 case FB_VISUAL_PSEUDOCOLOR
:
219 screen
->fb
.visuals
= (1 << StaticGray
);
220 if (priv
->var
.bits_per_pixel
== 1) {
221 /* Override to monochrome, to have preallocated black/white */
222 priv
->fix
.visual
= FB_VISUAL_MONO01
;
224 /* could also support GrayScale, but what's the point? */
226 screen
->fb
.visuals
= ((1 << StaticGray
) |
230 (1 << TrueColor
) | (1 << DirectColor
));
232 screen
->fb
.blueMask
= 0x00;
233 screen
->fb
.greenMask
= 0x00;
234 screen
->fb
.redMask
= 0x00;
236 case FB_VISUAL_STATIC_PSEUDOCOLOR
:
238 screen
->fb
.visuals
= (1 << StaticGray
);
241 screen
->fb
.visuals
= (1 << StaticColor
);
243 screen
->fb
.blueMask
= 0x00;
244 screen
->fb
.greenMask
= 0x00;
245 screen
->fb
.redMask
= 0x00;
247 case FB_VISUAL_TRUECOLOR
:
248 case FB_VISUAL_DIRECTCOLOR
:
249 screen
->fb
.visuals
= (1 << TrueColor
);
250 #define Mask(o,l) (((1 << l) - 1) << o)
251 screen
->fb
.redMask
= Mask (priv
->var
.red
.offset
, priv
->var
.red
.length
);
252 screen
->fb
.greenMask
=
253 Mask (priv
->var
.green
.offset
, priv
->var
.green
.length
);
254 screen
->fb
.blueMask
=
255 Mask (priv
->var
.blue
.offset
, priv
->var
.blue
.length
);
258 * This is a kludge so that Render will work -- fill in the gaps
261 screen
->fb
.redMask
= fbdevMakeContig(screen
->fb
.redMask
,
262 screen
->fb
.greenMask
|
263 screen
->fb
.blueMask
);
265 screen
->fb
.greenMask
= fbdevMakeContig(screen
->fb
.greenMask
,
267 screen
->fb
.blueMask
);
269 screen
->fb
.blueMask
= fbdevMakeContig(screen
->fb
.blueMask
,
271 screen
->fb
.greenMask
);
274 screen
->fb
.redMask
| screen
->fb
.greenMask
| screen
->fb
.blueMask
;
276 while (depth
&& !(allbits
& (1 << (depth
- 1))))
283 screen
->fb
.depth
= depth
;
284 screen
->fb
.bitsPerPixel
= priv
->var
.bits_per_pixel
;
286 scrpriv
->randr
= screen
->randr
;
288 return fbdevMapFramebuffer(screen
);
292 fbdevScreenInit(KdScreenInfo
* screen
)
294 FbdevScrPriv
*scrpriv
;
296 scrpriv
= calloc(1, sizeof(FbdevScrPriv
));
299 screen
->driver
= scrpriv
;
300 if (!fbdevScreenInitialize(screen
, scrpriv
)) {
309 fbdevWindowLinear(ScreenPtr pScreen
,
311 CARD32 offset
, int mode
, CARD32
*size
, void *closure
)
313 KdScreenPriv(pScreen
);
314 FbdevPriv
*priv
= pScreenPriv
->card
->driver
;
316 if (!pScreenPriv
->enabled
)
318 *size
= priv
->fix
.line_length
;
319 return (CARD8
*) priv
->fb
+ row
* priv
->fix
.line_length
+ offset
;
323 fbdevWindowAfb(ScreenPtr pScreen
,
325 CARD32 offset
, int mode
, CARD32
*size
, void *closure
)
327 KdScreenPriv(pScreen
);
328 FbdevPriv
*priv
= pScreenPriv
->card
->driver
;
330 if (!pScreenPriv
->enabled
)
332 /* offset to next plane */
333 *size
= priv
->var
.yres_virtual
* priv
->fix
.line_length
;
334 return (CARD8
*) priv
->fb
+ row
* priv
->fix
.line_length
+ offset
;
338 fbdevMapFramebuffer(KdScreenInfo
* screen
)
340 FbdevScrPriv
*scrpriv
= screen
->driver
;
342 FbdevPriv
*priv
= screen
->card
->driver
;
344 if (scrpriv
->randr
!= RR_Rotate_0
||
345 priv
->fix
.type
!= FB_TYPE_PACKED_PIXELS
)
346 scrpriv
->shadow
= TRUE
;
348 scrpriv
->shadow
= FALSE
;
350 KdComputePointerMatrix(&m
, scrpriv
->randr
, screen
->width
, screen
->height
);
352 KdSetPointerMatrix(&m
);
354 screen
->width
= priv
->var
.xres
;
355 screen
->height
= priv
->var
.yres
;
357 if (scrpriv
->shadow
) {
358 if (!KdShadowFbAlloc(screen
,
359 scrpriv
->randr
& (RR_Rotate_90
| RR_Rotate_270
)))
363 screen
->fb
.byteStride
= priv
->fix
.line_length
;
364 screen
->fb
.pixelStride
= (priv
->fix
.line_length
* 8 /
365 priv
->var
.bits_per_pixel
);
366 screen
->fb
.frameBuffer
= (CARD8
*) (priv
->fb
);
373 fbdevSetScreenSizes(ScreenPtr pScreen
)
375 KdScreenPriv(pScreen
);
376 KdScreenInfo
*screen
= pScreenPriv
->screen
;
377 FbdevScrPriv
*scrpriv
= screen
->driver
;
378 FbdevPriv
*priv
= screen
->card
->driver
;
380 if (scrpriv
->randr
& (RR_Rotate_0
| RR_Rotate_180
)) {
381 pScreen
->width
= priv
->var
.xres
;
382 pScreen
->height
= priv
->var
.yres
;
383 pScreen
->mmWidth
= screen
->width_mm
;
384 pScreen
->mmHeight
= screen
->height_mm
;
387 pScreen
->width
= priv
->var
.yres
;
388 pScreen
->height
= priv
->var
.xres
;
389 pScreen
->mmWidth
= screen
->height_mm
;
390 pScreen
->mmHeight
= screen
->width_mm
;
395 fbdevUnmapFramebuffer(KdScreenInfo
* screen
)
397 KdShadowFbFree(screen
);
402 fbdevSetShadow(ScreenPtr pScreen
)
404 KdScreenPriv(pScreen
);
405 KdScreenInfo
*screen
= pScreenPriv
->screen
;
406 FbdevScrPriv
*scrpriv
= screen
->driver
;
407 FbdevPriv
*priv
= screen
->card
->driver
;
408 ShadowUpdateProc update
;
409 ShadowWindowProc window
;
413 /* Use variant copy routines that always read left to right in the
414 shadow framebuffer. Reading vertical strips is exceptionally
415 slow on XScale due to cache effects. */
419 window
= fbdevWindowLinear
;
421 switch (priv
->fix
.type
) {
422 case FB_TYPE_PACKED_PIXELS
:
424 if (priv
->var
.bits_per_pixel
== 16) {
425 switch (scrpriv
->randr
) {
428 update
= shadowUpdateRotate16_90YX
;
430 update
= shadowUpdateRotate16_90
;
433 update
= shadowUpdateRotate16_180
;
437 update
= shadowUpdateRotate16_270YX
;
439 update
= shadowUpdateRotate16_270
;
442 update
= shadowUpdateRotate16
;
447 update
= shadowUpdateRotatePacked
;
449 update
= shadowUpdatePacked
;
453 window
= fbdevWindowAfb
;
454 switch (priv
->var
.bits_per_pixel
) {
456 update
= shadowUpdateAfb4
;
460 update
= shadowUpdateAfb8
;
464 FatalError("Bitplanes with bpp %u are not yet supported\n",
465 priv
->var
.bits_per_pixel
);
469 case FB_TYPE_INTERLEAVED_PLANES
:
470 if (priv
->fix
.type_aux
== 2) {
471 switch (priv
->var
.bits_per_pixel
) {
473 update
= shadowUpdateIplan2p4
;
477 update
= shadowUpdateIplan2p8
;
481 FatalError("Atari interleaved bitplanes with bpp %u are not yet supported\n",
482 priv
->var
.bits_per_pixel
);
485 FatalError("Interleaved bitplanes with interleave %u are not yet supported\n",
491 FatalError("Text frame buffers are not yet supported\n");
494 case FB_TYPE_VGA_PLANES
:
495 FatalError("VGA planes are not yet supported\n");
499 FatalError("Unsupported frame buffer type %u\n", priv
->fix
.type
);
503 return KdShadowSet(pScreen
, scrpriv
->randr
, update
, window
);
508 fbdevRandRGetInfo(ScreenPtr pScreen
, Rotation
* rotations
)
510 KdScreenPriv(pScreen
);
511 KdScreenInfo
*screen
= pScreenPriv
->screen
;
512 FbdevScrPriv
*scrpriv
= screen
->driver
;
513 RRScreenSizePtr pSize
;
517 *rotations
= RR_Rotate_All
| RR_Reflect_All
;
519 for (n
= 0; n
< pScreen
->numDepths
; n
++)
520 if (pScreen
->allowedDepths
[n
].numVids
)
522 if (n
== pScreen
->numDepths
)
525 pSize
= RRRegisterSize(pScreen
,
527 screen
->height
, screen
->width_mm
, screen
->height_mm
);
529 randr
= KdSubRotation(scrpriv
->randr
, screen
->randr
);
531 RRSetCurrentConfig(pScreen
, randr
, 0, pSize
);
537 fbdevRandRSetConfig(ScreenPtr pScreen
,
538 Rotation randr
, int rate
, RRScreenSizePtr pSize
)
540 KdScreenPriv(pScreen
);
541 KdScreenInfo
*screen
= pScreenPriv
->screen
;
542 FbdevScrPriv
*scrpriv
= screen
->driver
;
543 Bool wasEnabled
= pScreenPriv
->enabled
;
549 int newwidth
, newheight
, newmmwidth
, newmmheight
;
551 if (screen
->randr
& (RR_Rotate_0
| RR_Rotate_180
)) {
552 newwidth
= pSize
->width
;
553 newheight
= pSize
->height
;
554 newmmwidth
= pSize
->mmWidth
;
555 newmmheight
= pSize
->mmHeight
;
558 newwidth
= pSize
->height
;
559 newheight
= pSize
->width
;
560 newmmwidth
= pSize
->mmHeight
;
561 newmmheight
= pSize
->mmWidth
;
565 KdDisableScreen(pScreen
);
569 oldwidth
= screen
->width
;
570 oldheight
= screen
->height
;
571 oldmmwidth
= pScreen
->mmWidth
;
572 oldmmheight
= pScreen
->mmHeight
;
575 * Set new configuration
578 scrpriv
->randr
= KdAddRotation(screen
->randr
, randr
);
579 pScreen
->width
= newwidth
;
580 pScreen
->height
= newheight
;
581 pScreen
->mmWidth
= newmmwidth
;
582 pScreen
->mmHeight
= newmmheight
;
584 fbdevUnmapFramebuffer(screen
);
586 if (!fbdevMapFramebuffer(screen
))
589 KdShadowUnset(screen
->pScreen
);
591 if (!fbdevSetShadow(screen
->pScreen
))
594 fbdevSetScreenSizes(screen
->pScreen
);
597 * Set frame buffer mapping
599 (*pScreen
->ModifyPixmapHeader
) (fbGetScreenPixmap(pScreen
),
603 screen
->fb
.bitsPerPixel
,
604 screen
->fb
.byteStride
,
605 screen
->fb
.frameBuffer
);
607 /* set the subpixel order */
609 KdSetSubpixelOrder(pScreen
, scrpriv
->randr
);
611 KdEnableScreen(pScreen
);
616 fbdevUnmapFramebuffer(screen
);
618 (void) fbdevMapFramebuffer(screen
);
619 pScreen
->width
= oldwidth
;
620 pScreen
->height
= oldheight
;
621 pScreen
->mmWidth
= oldmmwidth
;
622 pScreen
->mmHeight
= oldmmheight
;
625 KdEnableScreen(pScreen
);
630 fbdevRandRInit(ScreenPtr pScreen
)
632 rrScrPrivPtr pScrPriv
;
634 if (!RRScreenInit(pScreen
))
637 pScrPriv
= rrGetScrPriv(pScreen
);
638 pScrPriv
->rrGetInfo
= fbdevRandRGetInfo
;
639 pScrPriv
->rrSetConfig
= fbdevRandRSetConfig
;
645 fbdevCreateColormap(ColormapPtr pmap
)
647 ScreenPtr pScreen
= pmap
->pScreen
;
649 KdScreenPriv(pScreen
);
650 FbdevPriv
*priv
= pScreenPriv
->card
->driver
;
656 switch (priv
->fix
.visual
) {
657 case FB_VISUAL_MONO01
:
658 pScreen
->whitePixel
= 0;
659 pScreen
->blackPixel
= 1;
660 pmap
->red
[0].co
.local
.red
= 65535;
661 pmap
->red
[0].co
.local
.green
= 65535;
662 pmap
->red
[0].co
.local
.blue
= 65535;
663 pmap
->red
[1].co
.local
.red
= 0;
664 pmap
->red
[1].co
.local
.green
= 0;
665 pmap
->red
[1].co
.local
.blue
= 0;
667 case FB_VISUAL_MONO10
:
668 pScreen
->blackPixel
= 0;
669 pScreen
->whitePixel
= 1;
670 pmap
->red
[0].co
.local
.red
= 0;
671 pmap
->red
[0].co
.local
.green
= 0;
672 pmap
->red
[0].co
.local
.blue
= 0;
673 pmap
->red
[1].co
.local
.red
= 65535;
674 pmap
->red
[1].co
.local
.green
= 65535;
675 pmap
->red
[1].co
.local
.blue
= 65535;
677 case FB_VISUAL_STATIC_PSEUDOCOLOR
:
678 pVisual
= pmap
->pVisual
;
679 nent
= pVisual
->ColormapEntries
;
680 pdefs
= malloc(nent
* sizeof(xColorItem
));
683 for (i
= 0; i
< nent
; i
++)
685 fbdevGetColors(pScreen
, nent
, pdefs
);
686 for (i
= 0; i
< nent
; i
++) {
687 pmap
->red
[i
].co
.local
.red
= pdefs
[i
].red
;
688 pmap
->red
[i
].co
.local
.green
= pdefs
[i
].green
;
689 pmap
->red
[i
].co
.local
.blue
= pdefs
[i
].blue
;
694 return fbInitializeColormap(pmap
);
699 fbdevInitScreen(ScreenPtr pScreen
)
702 KdTsPhyScreen
= pScreen
->myNum
;
705 pScreen
->CreateColormap
= fbdevCreateColormap
;
710 fbdevFinishInitScreen(ScreenPtr pScreen
)
712 if (!shadowSetup(pScreen
))
716 if (!fbdevRandRInit(pScreen
))
724 fbdevCreateResources(ScreenPtr pScreen
)
726 return fbdevSetShadow(pScreen
);
730 fbdevPreserve(KdCardInfo
* card
)
735 fbdevUpdateFbColormap(FbdevPriv
* priv
, int minidx
, int maxidx
)
740 cmap
.len
= maxidx
- minidx
+ 1;
741 cmap
.red
= &priv
->red
[minidx
];
742 cmap
.green
= &priv
->green
[minidx
];
743 cmap
.blue
= &priv
->blue
[minidx
];
746 return ioctl(priv
->fd
, FBIOPUTCMAP
, &cmap
);
750 fbdevEnable(ScreenPtr pScreen
)
752 KdScreenPriv(pScreen
);
753 FbdevPriv
*priv
= pScreenPriv
->card
->driver
;
756 priv
->var
.activate
= FB_ACTIVATE_NOW
| FB_CHANGE_CMAP_VBL
;
758 /* display it on the LCD */
759 k
= ioctl(priv
->fd
, FBIOPUT_VSCREENINFO
, &priv
->var
);
761 perror("FBIOPUT_VSCREENINFO");
765 if (priv
->fix
.visual
== FB_VISUAL_DIRECTCOLOR
) {
769 i
< (1 << priv
->var
.red
.length
) ||
770 i
< (1 << priv
->var
.green
.length
) ||
771 i
< (1 << priv
->var
.blue
.length
); i
++) {
772 priv
->red
[i
] = i
* 65535 / ((1 << priv
->var
.red
.length
) - 1);
773 priv
->green
[i
] = i
* 65535 / ((1 << priv
->var
.green
.length
) - 1);
774 priv
->blue
[i
] = i
* 65535 / ((1 << priv
->var
.blue
.length
) - 1);
777 fbdevUpdateFbColormap(priv
, 0, i
);
783 fbdevDPMS(ScreenPtr pScreen
, int mode
)
785 KdScreenPriv(pScreen
);
786 FbdevPriv
*priv
= pScreenPriv
->card
->driver
;
787 static int oldmode
= -1;
791 #ifdef FBIOPUT_POWERMODE
792 if (ioctl(priv
->fd
, FBIOPUT_POWERMODE
, &mode
) >= 0) {
798 if (ioctl(priv
->fd
, FBIOBLANK
, mode
? mode
+ 1 : 0) >= 0) {
807 fbdevDisable(ScreenPtr pScreen
)
812 fbdevRestore(KdCardInfo
* card
)
817 fbdevScreenFini(KdScreenInfo
* screen
)
822 fbdevCardFini(KdCardInfo
* card
)
824 FbdevPriv
*priv
= card
->driver
;
826 munmap(priv
->fb_base
, priv
->fix
.smem_len
);
832 * Retrieve actual colormap and return selected n entries in pdefs.
835 fbdevGetColors(ScreenPtr pScreen
, int n
, xColorItem
* pdefs
)
837 KdScreenPriv(pScreen
);
838 FbdevPriv
*priv
= pScreenPriv
->card
->driver
;
846 for (k
= 0; k
< n
; k
++) {
847 if (pdefs
[k
].pixel
< min
)
848 min
= pdefs
[k
].pixel
;
849 if (pdefs
[k
].pixel
> max
)
850 max
= pdefs
[k
].pixel
;
853 cmap
.len
= max
- min
+ 1;
854 cmap
.red
= &priv
->red
[min
];
855 cmap
.green
= &priv
->green
[min
];
856 cmap
.blue
= &priv
->blue
[min
];
858 k
= ioctl(priv
->fd
, FBIOGETCMAP
, &cmap
);
860 perror("can't get colormap");
865 pdefs
->red
= priv
->red
[p
];
866 pdefs
->green
= priv
->green
[p
];
867 pdefs
->blue
= priv
->blue
[p
];
873 * Change colormap by updating n entries described in pdefs.
876 fbdevPutColors(ScreenPtr pScreen
, int n
, xColorItem
* pdefs
)
878 KdScreenPriv(pScreen
);
879 FbdevPriv
*priv
= pScreenPriv
->card
->driver
;
887 priv
->red
[p
] = pdefs
->red
;
888 priv
->green
[p
] = pdefs
->green
;
889 priv
->blue
[p
] = pdefs
->blue
;
897 fbdevUpdateFbColormap(priv
, min
, max
);