Epic hackery to deal with DSS overlay numbers

OMAP4 has up to five overlays, OMAP3 only has 3.  This appears to lead
to a bit of confusion between the PVR userspace, PVR kernelspace, and
DSSCOMP; work around this by adding a check in one place and deleting
one in another.
OMAPFB: Asynchronous vsync notification

Enabled and disabled through new OMAPFB_ENABLEVSYNC ioctl.  Events delivered
as switch events.

Change-Id: I3a40523d35e2eff3510892a4adcd6a4821c883a5
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
OMAPLFB: Dont foward compositions to DSSCOMP if overlay is Zero

Do not foward compositions to DSSCOMP in case overlay number
passed by HWC is zero. The dsscomp->num_overlay = 0 means
that there is no primary display and no rendering is required.

Change-Id: If7b582efeb55ce84878d0bfbd19eabd2ebd3afaa
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
Signed-off-by: Dandawate Saket <dsaket@ti.com>
Revert "OMAP:DSS: SW workaround for HW scaler overread issue"

This reverts commit 0e11c5b311d2c7436756f80c35c8aef4cd0d911b.

The SW workaround is no longer needed as a hardware workaround
exists, and the SW workaround created artifacts.

Change-Id: I5d8a601b24502a3ac5d4c1f17fcb3936ba8e7e10
Signed-off-by: Sathya Prakash M R <a0393677@ti.com>
Signed-off-by: Lajos Molnar <lajos@ti.com>
OMAPDSS: DSSCOMP: efficiency improvement.

This change adds 3 local caches of objects, which are used at each flip buffer
action. In original variant kzalloc()/kfree() functions are called each time
dsscomp_gralloc_queue() function is called. This meens that slab|slob|slub
common cache is used at each frame draw action. Call to kzalloc()/kfree()
result in synchronization with other code, which uses common cache, and can
result in dips in FPS, when other code allocates/frees memory.
This change improves reliability, autonomy and efficiency of DSSCOMP module.

Change-Id: Id50778f4579309fb71318a32820b9d6441a6dac1
Signed-off-by: Mykhailo Denysiuk <x0172934@ti.com>
OMAPDSS: DISPC: more precise scale limits checking

Use division with rounding-up when checking if maximum downscale ratio
was reached. This allows to avoid SYNC_LOST errors in case when small
amount of extra pixels or lines (usually 1-3) not taken into account

Change-Id: Id8f88c64671146a64738cfd820378bb7a28c1455
Signed-off-by: Sergiy Kibrik <sergiy.kibrik@globallogic.com>
OMAPDSS: DISPC: Use FIR filters other than M19

Pass correct arguments to FIR filter selection.  Previously we
always ended up selecting M19 5-tap filter.

This should improve image quality of scaled layers.

Change-Id: Iabe3219df7dcfd62c713fd92ee9c3d12221bc382
Signed-off-by: Lajos Molnar <lajos@ti.com>
OMAP4: DSI: DSI reset removal during enabling

DSI module is made wake up capable in its HWMOD flags but in
The function omapdss_dsi_display_enable(), DSI module is
reset thus values set in DSI_SYSCONFIG is lost because of which
DSI is no longer wakeup capable. This prevents any interrupt from
DSI to be permeated to A9 when A9 sleeping.this reset is not
required while enabling the display thus now it is removed.so it
retains the HWMOD settings.

Now with this fix, the mdelay() within dsi_vc_send_bta_sync(), is removed
and a proper interrupt based implementation is done.

Change-Id: If6c3d25a5ba8003a0bd7732af0fcd81a839293aa
Signed-off-by: Sujeet Kumar Baranwal <s-baranwal@ti.com>
OMAPDSS: DSS: Complete callbacks on mgr->blank if not wait_for_go

Disabled panels do not clear GO automatically, therefore, we
assume no wait_for_go on disabled panels.

When not waiting for GO, complete all pending composition
callbacks regardless of dirty state, as dirty state will not
be propagated.

Change-Id: Ic5ddd81414bab56d136a716907fd8e6dfa0f795f
Signed-off-by: Lajos Molnar <lajos@ti.com>
OMAPDSS: DSS: Fix wait_for_go support on mgr->blank() for manual update panels

Manual update panels do not clear GO automatically.  For these panels we need
to call update so that GO gets cleared.

Change-Id: Idb446af8c77553cec8baf7af893d180cfbaa7582
Signed-off-by: Lajos Molnar <lajos@ti.com>
OMAP DSI: Fix consecutive bus unlocks for manual mode panel.

Description: In manual mode panels, a semphore is used to keep track
of display queue and release. Upon the condition of framedone timeout
error the semaphore is released once by the callback handler before exiting.
If framedone for the timed-out frame arrives after 250 msec and before
next frame queuing, it releases the semaphore second time in the callback handler.
This results in warnon assert later.

This patch puts in proper check before releasing the semaphore.
This way we prevent multiple unlocks of the bus..

Change-Id: I7db034de1a286f58a7fb9187b4ff356d7ad4731b
Signed-off-by: Sreenidhi Koti <sreenidhi@ti.com>
Signed-off-by: Sujeet Barnawal <s-baranwal@ti.com>
OMAP4: DSI: Reset required disable-enable sequence

During the initialization of DSI,some times BTA
sent by OMAP DSI, was not receiving an BTA ACK.
To rectify this, we need to reset the DSI module
whenever we diable-enable the DSI module.

Change-Id: Ic2542970da06a121559a8cc700222881c60c025c
Signed-off-by: Sujeet Kumar Baranwal <s-baranwal@ti.com>
OMAPDSS:DSI: dispose of static bpp definition

Calculation of bytes per pixel in dispc_to_dsi_clock() is not precise,
based on static value definition.
Instead, it should be calculated in-place, based on actual pixel size,
which produce more accurate numbers in situations where remainder appears
(e.g. 18-bit pixel size).

Change-Id: I4c90b2ec5e1d6139d84cbdc55af3f2a484785968
Signed-off-by: Sergiy Kibrik <sergiy.kibrik@globallogic.com>
OMAP4 DSS: Fix to return 24bit as the recommended bpp for 18bit panels

Display driver logic to calculate the recommended bpp for FB has been modified
to recommend 24bit for all panels above 16bit mode.

DRT# OMAPS00259536 - ICS R0: App Tray disappears on Hi Res display (1920x1200)

Change-Id: I16aad396083d0ad416e035c59a93089df20d6d82
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
OMAPDSS: DSSCOMP: Fix klocworks errors

Change-Id: If2ed914c738e28c9b5b19b67353bd367d612e91b
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
OMAPDSS: DSSCOMP: Handle DSI manual mode update errors

Description: Upon errors returned from manually updated panels,
previous compositions needs to be cleared to ensure SGX won't
block on commandcomplete function indefinitely.

Change-Id: I3a09018ce0c971a5978de7b178e07137ed320948
Signed-off-by: Sreenidhi Koti <sreenidhi@ti.com>
OMAPDSS: DSI: fix debug messages

Routine names in debug messages of dsi_vc_gen_read_2() and dsi_vc_dcs_read()
are set to same "dsi_vc_rcs_read". Fix routine names in these messages.

Change-Id: I9cceca5711932ba2c2ea3f2919baf461e30ddd8b
Signed-off-by: Sergiy Kibrik <sergiy.kibrik@globallogic.com>
OMAPDSS: DISPC: fix pclk divisor limits

According to TRM, minimal pixel clock divisor value can be 1.
Fix corresponding checks, as high resolution panels use undivided
pixel clock frequency.

Also certain scaler unit constraint must be met: in case DISPC_CLK
and pixel clock frequencies are equal, set IPC to work on rising edge.

Change-Id: Iabeac2ad81f6909213cb81f4e16b1d0762369b53
Signed-off-by: Sergiy Kibrik <sergiy.kibrik@globallogic.com>
Signed-off-by: Lajos Molnar <lajos@ti.com>
Signed-off-by: Dima Svetlov <svetlov@ti.com>
OMAPDSS: DSSCOMP: Skip manager set to overlay if manager is currently blank.

This is done to prevent call of dispc_set_channel_out when manager
is blanked. And to prevent changes to dispc registers, when dispc
is disabled (all managers blanked).

Change-Id: I0887abd3a9e883c09e75ef0a5f0632c40754d24d
Signed-off-by: Volodymyr Frolov <volodymyr.frolov@ti.com>
Signed-off-by: Kostiantyn Luzan <x0166170@ti.com>
[steven@steven676.net: make apply to p-android-omap3-3.0]
OMAPDSS: DSS: Handle configure_dispc error in dss_setup_partial_planes for manual mode

Description: Upon errors returned from configure_dispc for manually
updated panels in dss_setup_partial_planes, previous compositions
needs to be cleared to ensure SGX won't block on commandcomplete
function indefinitely.

This patch depends on http://review.omapzoom.org/#/c/20659/
Can not be merged without it.

Change-Id: Id125a7a7d83e317af868472ba62297b7673ccb47
Signed-off-by: Kostiantyn Luzan <x0166170@ti.com>