The purpose of xf86HandleColormaps in xf86-video-fbdev?

Siarhei Siamashka siarhei.siamashka at gmail.com
Fri Feb 8 14:39:35 PST 2013


Hello,

I have tried to look into the root cause of the case when
xf86-video-fbdev DDX is spamming the /var/log/Xorg.0.log
with lots of bogus error messages like:

    FBDEV(0): FBIOPUTCMAP: Invalid argument

Searching a bit on the Internet, looks like lots of people have
encountered this problem, this ubuntu bug can be used as an example:
    https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-fbdev/+bug/573668

The spamming is done by the following code:
    http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/fbdevhw/fbdevhw.c?id=xorg-server-1.13.2#n768

The FBIOPUTCMAP ioctl starts failing when cmap.start >= 16 which makes
sense because it tries to set pseudo_palette in the kernel fbdev
drivers. And this palette normally has just 16 elements. The return
code for this failed ioctl is inconsistent in different drivers. For
example, have a look at
    http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=drivers/video/uvesafb.c;h=b0e2a4261afe;hb=v3.4.29#l1003
    http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=drivers/video/i740fb.c;h=fe574d84ed99;hb=v3.4.29#l888
    http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=drivers/video/cirrusfb.c;h=738c8ce7d132;hb=v3.4.29#l1314

Most of the drivers (including uvesafb) just ignore this error and
return 0. Some of the drivers return -EINVAL, some of the drivers
return 1.

The fbdev documentation at http://www.linux-fbdev.org/HOWTO/4.html
indeed specifies 16 elements for pseudo_palette (and one more for
the cursor?) but I still don't have a clear understanding about how
exactly it is supposed to be used. The
    http://comments.gmane.org/gmane.linux.fbdev.devel/1363
post suggests that the pseudo_palette has something to do with the
penguin logo drawing, which kind of makes some sense (have a paletted
image to save memory, but show it on a truecolor framebuffer) :-)

In xf86-video-fbdev the call to xf86HandleColormaps() function, which
sets 256 elements for the colormap, is done from here:
    http://cgit.freedesktop.org/xorg/driver/xf86-video-fbdev/tree/src/fbdev.c?id=xf86-video-fbdev-0.4.3#n887

So how all this stuff is supposed to work? What would be the use case
when this colormap is used for real? Can anything bad happen because
of these failed ioctls (silent for uvesafb, very noisy for some other
drivers)?

-- 
Best regards,
Siarhei Siamashka


More information about the xorg-devel mailing list