udlpim: hold buffer mutex in get_fb and get_cursor

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
v4l2pim: hold buffer mutex in get_fb and get_cursor

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
vcrtcm: add virgin flag to the push buffer

Virgin push buffer is the buffer that has the backing
store memory, it is perfectly usable, but it has never been
pushed to. Such a buffer would contain random data.

When a new buffer is created, its virgin flag is set to 1,
and when it is first pushed to, its virgin flag is set to 0.
PIMs can use this flag to avoid using garbage data (typically
in the first frame or first cursor sprite).

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
udlpim: do not display virgin push buffer

This patch prevents displaying garbage data in first
frame or first appearance of a cursor. UDLPIM uses two
push buffers, one to read the displayed data from and
one to push the next frame data into. In the initial state
both buffers are virgin, and we push to the first buffer
followed by calling the function that copies the other push
buffer to the UDL device on USB interface. The problem
is that this other buffer is still virgin and thus contains
random data. In other words, the pipeline has not been
fully established, so the first frame or a first appearance
of the cursor can be garbage.

This patch fixes a bug that manifested itself in a momentary
appearance of a big white square when cursor was first time
entering the screen.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
udlpim: remove some useless code

udlpim_info->main_buffer and udlpim_info->cursor is used
at only one place and is always set before it is used.
Setting these fileds to NULL on detach doesn't do anything
useful.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
udlpim: various fixes to scratch memory mapping

Fixes for a few minor goofs and general improvements:

* after memory is mapped, first check if the mapping
  succeeded and then memset the block to zero
* do not force the pointer to mappings to NULL on detach
  because they may still be valid, so strictly speaking
  that's a memory leak. Instead, set them to NULL
  immediately after they have been unmapped, so throughout
  the code we always preserve the semantic that NULL means
  not mapped and non-NULL means mapped
* cleanup the code flow a little bit, so that we have fewer
  gotos

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
udlpim: remove unecessary argument from a function

char *front argument in udlpim_render_hline is
unecessary, because the same pointer is already embedded into
udlpim_info structure that we have to pass anyway.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
v4l2pim: do not send a virgin push buffer to v4l2

This patch prevents sending garbage data to video 4 linux
subsystem (cursor or frame). This can happen for the first
frame or when the cursor is displayed for the first time.

After first push, pipeline is not fully established and
the back-buffer (the one that is sent to v4l2 subsystem)
is still virgin and therefore contains random data. Such a
buffer should not be sent.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
pimmgr/vcrtcm: merge pimmgr module into vcrtcm

This commit only merges the modules.  Further commits will unify the APIs
and the naming conventions.

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
vcrtcm: change pimmgr_ filename prefixes

All of the former pimmgr files are now prefixed with vcrtcm_ or else merged
into existing vcrtcm files.

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
udlpim: remove unneeded include of old pimmgr header file

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
v4l2pim: remove unneeded include of old pimmgr header file

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
vcrtcm: remove unneeded pimmgr header file

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
vcrtcm: change pimmgr prefix on internal identifiers

This commit is the first in a sequence of commits that unifies the
implementation of vcrtcm and the old pimmgr.  This commit simply
changes the prefix of a number of identifiers that are internal
to the implementation of vcrtcm.

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
vcrtcm: remove pimmgr_debug variable

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
vcrtcm: rename pimmgr_pcon_properties to vcrtcm_pcon_properties

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
udlpim: switch to new name for pcon_properties

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
v4l2pim: switch to new name for pcon_properties

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
vcrtcm: remove no-longer-needed define

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
vcrtcm: change prefix of pim functions

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>