msm: mdss: Prevent excessive logging during rotation set failure

Changing the error log to debug log in case SMP reserve fails
for rotation. The use case falls back to GPU. Same is being
done in  case of mdp interface set path.

Change-Id: I00a9e05b3a04a87e354fd0e60ad900f4f71cdfc1
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
msm: mdss: Remove init phase programming

Init phase should only be programmed to a non zero value only through
a user program. Default value of zero is programmed by the driver to
avoid hardware hangs

Change-Id: Iff99394d2f3a937c5bb4456c2f7ca5669a5c732b
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_overlay.c
msm: mdss: prevent dereferencing of user space pointer

We were dereferencing a userspace pointer in kernel.

Change-Id: I128455904cd396690350fc6b784a8844d594539c
Signed-off-by: Terence Hampson <thampson@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_overlay.c
msm: mdss: Hold MDP clock Ref count in pan_display path

If handoff fails, the clock ref count becomes 0 and iommu
will get detached. In pan display path, since at that
particular instant iommu gets detached, we use physical
address. After this if iommu is again attached and physical
address is fetched, it can result in continuous IOMMU page
faults. To address this hold MDP clock ref count
in pan display path.

Change-Id: I2370b276acdced2cf22083eb80fcad1b2e454315
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_overlay.c
msm: mdss: Add update notify for backlight change in static screen

Previously, the change of backlight sysfs node value will not trigger
notify updates if display is in static screen case. This will cause
delay or wrong configuration for assertive display. This patch fixes
the above issue by adding an update notify if backlight changes when
there are no display updates.

Change-Id: I1475896214a50dc1fa71739aa751b2e626d27adb
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: disable irq to enforce mutex within dsi_event_thread

Mdp spin lock is used in dsi_event_thread and in irq context.
Disable irq while holding spinlock to avoid context switching
into irq context and cause spinlock recursion

CRs-fixed: 652850
Change-Id: I4bd8cadb1f5d83acc7e866344b7585e7944e08ac
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm: mdss: Clear the previous state of pipe during SOLID_FILL

Clear the previous state of pipe when it is being used in SOLID_FILL
operation to prevent wrong register configuration. For ex: Use case
when DMA pipe was used in BLOCK mode in previous frame, then it is
being used in LINE mode for SOLID_FILL operation in current frame.

CRs-Fixed: 655993
Change-Id: I0ed257276428b96c10a92457a16df4dfdc42c1f8
Signed-off-by: Sushil Chauhan <sushilchauhan@codeaurora.org>
msm: mdss: refactor pipe retrieval and ref count logic

Allow only retrieval of pipes that are on particular framebuffer device
used list. This ensures that pipe is not modified from a different fb
device node and cause potential issues.

Also, modify the ref count logic to use kref and ensure pipe is freed
only while holding mutex in case there could be race condition that
pipe is allocated while being freed.

Change-Id: I626323b5df981a7ed1e03196126cd4376b5ba6a6
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Anusha Koduru <kanusha@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_pipe.c
Revert "Revert "msm: mdss: refactor pipe list management""

This reverts commit 38a91163f5f56613e1b980441c8fe17e74218d01.

Change-Id: I28c2767aadcbcbf89ac78206d467d35aa329e0fe
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_fb.h
msm: mdss: fix multiple overlay release sequence

Overlay release allows multiple releases to happen by having
multiple bits set in overlay unset call. Fix logic to find
all pipes which match the bitmap.

Change-Id: I6a25a81fe4c437b5546537d48e250055357682f0
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>
msm: mdss: Allow DMA pipe sharing only on WB mixer

DMA pipe can only be shared on the writeback mixer for
concurrent line and block mode operations. Only allow
sharing if the mixer attached to the pipe is already a
writeback mixer.

Change-Id: I9a0e5144fdf87f681493cd92d9cc809836ab1a5c
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: remove extra lock for ctl calls

Some ctl functions need only protection for mixer programming changes,
since all of these calls are made within ov_lock there is no need for
additional protection. Specially since ctl->lock is still held when
mixer configuration is safe to be changed.

Change-Id: I4f39e28f40ef18789a653d02346358b7ca7590c6
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: Fix rgb_565 format for 90 degree rotation

Make rotator output format for rgb_565 and bgr_565
as rgb_888 for 90 degree rotation as expected by
MDSS.

Change-Id: I0865b5688fa662d1e88d1efebef26a38d4abfd61
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>

msm: mdss: Swap RGBA format to BGRA with bwc rotation

When BWC is enabled, rotator format needs to be swapped from
RGBA to BGRA to avoid color mismatch on the ouput image.
This is specially needed with a GPU composed FB.

Change-Id: I956a354f3fe605e2c7bda4c4331cfe5bcd6417c7
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>

msm: mdss: synchronize formats across rotator output and pipe setup

The rules applied to switch formats must be the same across
rotator output and the following pipe setup. Also, yuv rotator
output format should always be set to pseudo planar for MDP
hardware optimality.

Change-Id: I3f5f09bcc599627e47495fab253ec0d9d8d5fa1c
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
mdss: msm_fb: Allocate fb memory during mmap

Current design of display driver (overlay) is no more
using the physically contiguous memory for normal display
functionality.

However, we still need to be backward compatible for any client
using the legacy implementation (eg. pan display) functionality.
As soon as there is a mmap call, the allocation happens from
system heap and gets removed once the references to frame buffer
driver becomes NULL.

With this change one can remove the physically contiguous memory
which gets allocated at the boot time and the usage of physically
contiguous memory is optimized.

Change-Id: I1b6040187bda8095007faa4d9df7dc046aa30c6e
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_fb.c
	drivers/video/msm/mdss/mdss_fb.h
	drivers/video/msm/mdss/mdss_mdp_overlay.c
mdss: fb: Add backward compatibility to fb memory

In the current implementation, contiguous memory allocation
during bootup is removed and related changes were made in
frame buffer driver which is not backward compatible. With this
change, add backward compatibility to map to physically contiguous
memory when available which is allocated at bootup.

Change-Id: Ib1a595f2426dda8d3e1c5e50c71c35d3f45854b6
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm: mdss: Move splash thread functionality

framebuffer and overlay drivers are tightly coupled with
splash thread functionality. This adds lots of code
related to continuous splash screen handling in
both drivers. Moving them to separate file cleans up
both drivers and allows to handle continuous splash screen
cases efficiently.

CRs-fixed: 605934
Change-Id: Id89bb281dbbf22e726cf5fd97e93f891e5c73f60
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_fb.c
	drivers/video/msm/mdss/mdss_fb.h
	drivers/video/msm/mdss/mdss_mdp.h
	drivers/video/msm/mdss/mdss_mdp_intf_video.c
	drivers/video/msm/mdss/mdss_mdp_overlay.c
msm: mdss: update pipe params on first update after suspend

Whenever panel is turned off, need to ensure that pipe is reprogrammed
fully when turned back on in case the pipes are not properly unset.

Change-Id: I6242b8f90695dd713c87924eb15306767b62803e
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: Don't call pan_idle for MSMFB_OVERLAY_PREPARE ioctl

We keep calling MSMFB_OVERLAY_PREPARE for each composition
cycle, even if there are no changes in params. Because of this
we can hit performance degradation due to pan idle wait.
This change removes pan_idle wait for prepare call.

CRs-Fixed: 600539
CRs-Fixed: 608848
Change-Id: Ie99f4dbc4671caf9bfbd49bd9b200c3180002d56
Signed-off-by: Radhika Ranjan Soni <rrsoni@codeaurora.org>
msm: display: Add pipe type selection in overlay request

Allow user to specify the type when requesting an overlay pipe.
If field is set the pipe type indication in the flags will be
ignored.
Change-Id: Iee51d24b96c7a2a987dc70a439342e6548dfc8fa
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
msm: mdss: use one dma pipe during block mode transaction

Use one dma pipe during block mode transaction instead of two pipes
for the buffer resolution greater than max mixer width

Change-Id: I2a9f1bba95bfb66d1c0168aa9b99b8b9de57cd6a
Signed-off-by: Ramkumar Radhakrishnan <ramkumar@codeaurora.org>