sunxi-disp: ignore invalid arguments for FBIOPUTCMAP

Just do nothing and return 0 for the unsupported palette indexes
instead of returning -EINVAL. The vesafb and uvesafb drivers do
the same.

Otherwise xf86-video-fbdev or anything else derived from it writes
a lot of "FBIOPUTCMAP: Invalid argument" spam to /var/log/Xorg.0.log
when the X server starts. And apparently also when the screensaver
and/or screen blanking/unblanking kicks in. These error messages
are scaring the users and also distracting attention when doing
real troubleshooting. Not to mention slowing down the X server
startup and wasting extra disk space for storing logs.

Yes, it is ugly to ignore errors. And the right solution would
be to fix the userland code not to use this ioctl with wrong
arguments. But frankly speaking, I don't want to touch the
prehistoric paletted formats in the X server as long as we don't
have a real use case where they can be tested.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
sunxi-disp: fix UMP framebuffer wrappers when fb0_framebuffer_num > 2

The ioctls GET_UMP_SECURE_ID_BUF1, GET_UMP_SECURE_ID_BUF2 and
GET_UMP_SECURE_ID_SUNXI_FB exist to provide UMP wrappers for the
framebuffer. These ioctls are only used by the x11 flavour of
mali drivers.

In the case if "fb0_framebuffer_num" variable is set to more
than 2 in the fex file, currently we get a misleading
"UMP: Double-buffering not enabled" warning in dmesg.
But with xf86-video-sunxifb it is actually necessary to set
fb0_framebuffer_num to at least 3 for getting real tear-free
zero-copy double buffering for OpenGL ES applications.

The point is that we need space for at least 2 buffers in
the offscreen area to flip between them using the sunxi disp
layers. And the standard x11 desktop also needs some framebuffer
memory, increasing the total number of buffers to 3. For example,
we may have a fullscreen GLES application running with 2 buffers
allocated in the offscreen area, and then suddenly need to show
a popup dialog on top of it. This simply can't be handled
efficiently with fb0_framebuffer_num set to only 2.

Additionally, it turns out that xf86-video-mali actually wants
both GET_UMP_SECURE_ID_BUF1 and GET_UMP_SECURE_ID_BUF2 to
point at the start of the framebuffer (because setting the
second DRI2 buffer to the beginning of the offscreen framebuffer
area is already accomplished by setting the offset in the
DRI2BUFFER structure). The older GET_UMP_SECURE_ID_BUF2 behavior
was unnecessarily changing the base address.

After this patch, GET_UMP_SECURE_ID_BUF1, GET_UMP_SECURE_ID_BUF2
and GET_UMP_SECURE_ID_SUNXI_FB are now all providing
wrappers for the whole framebuffer. And the misleading
"UMP: Double-buffering not enabled" warning is removed.

GET_UMP_SECURE_ID_BUF1 gets assigned secure id 1
GET_UMP_SECURE_ID_BUF2 gets assigned secure id 2
GET_UMP_SECURE_ID_SUNXI_FB gets assigned secure id 3

GET_UMP_SECURE_ID_BUF1 and GET_UMP_SECURE_ID_BUF2 have been
originally used by xf86-video-mali. GET_UMP_SECURE_ID_SUNXI_FB was
earlier added for xf86-video-sunxifb as an extra UMP buffer, which
is not seen as the framebuffer by the Mali blob (the mali blob has
special treatment for secure id 1 and secure id 2 just simply based
on their numbers).

Also for xf86-video-sunxifb we really need two UMP buffers, which
cover the whole framebuffer. So that one of the buffers has
secure id < 3, and another one has secure id >= 3. This secure id
numbers magic is needed to trick the Mali blob in the client process
into requesting the DRI2 buffers again if we detect the back and
front buffers size mismatch. More details can be found in this
commit message:

    https://github.com/ssvb/xf86-video-sunxifb/commit/9e0a87319b90e3e3

V2:
 - GET_UMP_SECURE_ID_BUF2 now also wraps the whole framebuffer as
   this is the right thing to do for xf86-video-mali

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>