* MDSS5 supports Polynomial Color Correction. Use this to implement
a simple sysfs API for adjusting RGB scaling values. This can be
used to implement color temperature and other controls.
* Why use this when we have KCAL? This code is dead simple, the
interface is in the right place, and it allows for 128X accuracy.
Change-Id: Ie17c84ee3c1092ea65804566bdf05326a34a6d4d
video: mdss: Report PCC values from pp registers
Other drivers write to these regs (KCAL, Sony) and other developers may
implement more than one driver. Make sure we are always reporting the correct
PCC values.
Change-Id: Id4a28602d6678d8032f1328c49163b52c15d52b1
When multiple panel timings are available and enumerating videomode
list, pixclock is calculated using htotal, vtotal and refresh rate.
But fb var struct is populated with actual pixclock value calculated
by DSI. This pixclock mismatch would cause issues, when usermode
does GET_VSCREENINFO/PUT_VSCREENINFO. Fix by using the same pixclock
calculation for both structures.
Change-Id: I42bfc40b5904ec80f20b296e3b4610ca3b2c5ee0
[veeras@codeaurora.org: Resolved conflicts in mdss_fb.c]
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
A previous change caused the release fence to not be installed
when the retire fence was skipped. Install the release fence
regardless of the retire fence status.
Change-Id: I13fa1e98984867d8a7d9d318ece8c1a2f1c726ed
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
If userspace closes the fd after an error on copying to
userspace, the fences may be freed incorrectly. Make sure fences
are installed after all checks pass.
Bug: 32402303
Change-Id: Ieb50296c87e09549db2734bd70bb6ee8d311ad40
CRs-Fixed: 2000664
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
for printing kernel pointers which should be hidden from unprivileged
users, use %pK which evaluates whether kptr_restrict is set.
CRs-Fixed: 987021
Change-Id: Ie49eee9478f4657cfb2a994ba60da1ec4c356339
Signed-off-by: Abhijit Kulkarni <kabhijit@codeaurora.org>
In FB registration, free allocated memory
if an error condition is hit. Also free
allocated memory in FB remove.
Change-Id: I533e2d6a760ebd52047c521c1a1e85bfc754fce1
Signed-off-by: Krishna Srinivas <krisrini@codeaurora.org>
Notify backlight change to pp_bl_event in update backlight
function without condition. This helps certain daemons like
PPD to not miss the backlight update event upon resume.
Change-Id: I18bdef65c1242dc0e02de94b954c3d49ebaf3c22
Signed-off-by: Archana Sriram <apsrir@codeaurora.org>
In many parts of the code the sscanf function was getting
an unsigned integer with a wrong format specifier. Changed
the format specifiers appropriately. Single variable sscanf
were replaced by kstrtouint at reported places.
CRs-Fixed: 1024872
Change-Id: I03ce718b0456d437d31d701586965d0aa7443b51
Signed-off-by: Shalini Krishnamoorthi <shakri@codeaurora.org>
The backlight update between unblank and kickoff
call may result in garbage/snow screen on panel
based on panel ram initialized status.
For ex:
-> Unblank the panel - black frame transfer start,
panel is on but ram is still
uninitialized.
-> backlight update - turn on the backlight. It will show
data from uninitialized ram because
frame transfer is not complete yet.
This can be avoided by blocking the backlight update
request between unblank and first frame kickoff. This
gives guarantee that panel has valid data to display
when backlight was turned on.
Change-Id: I09c707cd10acd53bd6aa0935885269ffc5aec649
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Raghavendra Ambadas <rambad@codeaurora.org>
For a few panels where the Post Init Delay DT property is set,
the backlight is not updated during unblank since it needs to be
done after frame commit. But, for ESD recovery cases, the framework
might not update backlight after a frame commit. Add change to make
sure backlight is updated during ESD recovery in unblank path.
Change-Id: Id6cec15bda0b05d2fe8e158d605d79a8fd423ceb
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
Trigger an idle fallback with a reasonable timeout value when
there is no update despite of a touch event. This will reset
the refresh rate to min fps.
Change-Id: Icfeba52da7fe950525258723d6475e7dede3f631
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
Store the continuous splash state in the fb var struct,
so that recovery/other processes can check if the continuous
splash is enabled or not before perfroming a blank/unblank.
Change-Id: Ieee9a7450c607666c2888df95ed3fc6a0ad286ae
Signed-off-by: Krishna Chaitanya Devarakonda <kdevarak@codeaurora.org>
During idle fallback, mdss driver will configure min fps
to the panel and in the next composition cycle it will
reset it to the requested fps, this will result in latency
for first frame update.
For the usecase, where touch triggers the update, this
latency can be alleviated by updating the fps during touch
so that there is no extra wait during commit.
Change-Id: I625785d27da0b485877488e4586f6a9336081a47
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
Expose pingpong split info to userspace via sysfs. This info
can be used to do ROI alignment for Partial update use cases.
Change-Id: Ifb165944b1725f4299e34068b67926785def032c
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>
Some panel don't require backlight to be updated during
unblank and only require update upon first commit. Based
on panel parameter perform the backlight update.
Change-Id: I43f33505be5151640ad7dc2ee1a14df8a55a6dfe
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
On framework reboot the backlight scale variables are not reset.
Hence after the framework reboot when backlight altering modules
restart there can be a very likely scenario for a flicker. Hence
reset the scale variables prior to shutdown. This would allow
the variables to be in reset state if case is a framework reboot
and not shutdown.
Change-Id: I9796c8b7abc34daca4ce0ee0ff1641517fb3d06f
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
For dual DSI board configurations with independent displays,
the debugfs directory needs to be created for both panels.
Use unique directory names for the debugfs node.
Also add a NULL check before dereferencing debugfs_info in
debugfs initialization function to avoid crash, if in case due to
some reason creation of debugfs directory fails. With this change,
the debugfs directory will have the following structure:
For Split-DSI:
/sys/kernel/debug/mdss_panel_fb0/intf0 (assuming fb0 device node)
/sys/kernel/debug/mdss_panel_fb0/intf1 (assuming fb0 device node)
For Dual-DSI with independent displays:
/sys/kernel/debug/mdss_panel_fb0/intf0 (assuming fb0 device node)
/sys/kernel/debug/mdss_panel_fb1/intf0 (assuming fb1 device node)
For Single-DSI:
/sys/kernel/debug/mdss_panel_fb0/intf0 (assuming fb0 device node)
Change-Id: Ic98d0d662932223828c41511c51cb4a0dda42bb2
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Define CEC on/enable functions in DBA (Display Bridge Abstract) so that
clients can enable disable CEC based on other dependent CEC modules.
Provide CEC supported flag in panel information data so that different
display modules can identify if a particular interface supports CEC
or not.
Separate out CEC abstract data with CEC driver data and initialize and
release corresponding modules properly.
Change-Id: I84f53d99547dcd4ce0b8275401b03ed8e96e14d5
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
In charging mode if charging code is not updating
the backlight then backlight will be turned off in
blank call and will not be turned on again on unblank.
Same is seen during ESD recovery. Set the unset
backlight level to the current backlight level during
blank so that after unblank, on first commit the
backlight value is restored. Also initialize the
brightness level to half of the max brightness.
Change-Id: Iee29b00a5e0fbbd4fee9d2c0dae1a40222b43939
Signed-off-by: Shivaraj Shetty <shivaraj@codeaurora.org>
The notify update ioctl implementation is being switched to a
sysfs based interfaces. The show_blank_event sysfs can be used
to check the update and suspend cases. The no-update case is
no longer required by userspace hence removing it. The power
off completion can also make use of the suspend case of sysfs.
A new backlight notification for ad_bl_level and bl_level is
being added to support polling for their updates from userspace.
Change-Id: Ib7a27d8057037067b4c2eb416c696e4a5ebe5f1d
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Histogram collection needs to be tied to commit. Clients utilizing
histogram collection would program the PA LUT after software
processing of the histogram. The PA LUT would only take effect
over a CTL flush, which needs to be done over a commit call. So
histogram collection is now also tied to commit.
Histogram irq is enabled and disabled as per following:
1. Histogram irq enablement and disablement to tie it to commit
is only done if that particular histogram block was first
enabled using call to start histogram.
2. Histogram irq is set during commit to get the interrupt.
3. Histogram irq is disabled during the second consecutive
interrupt handler call for a particular block without any
commit call in between the two interrupt handler calls. This
is due to the following.
Fig: Timeline of vsyncs, commits and histogram collections
h0 h1 h2 h3
|------:-----|-^----:-----|-^----------|-^----:-----|-x----
v0 c1 v1 c2 v2 v3 c4 v4
<----f0----> <----f1----> <----f2----> <----f3----> <--f4-
v0 - v4 are vsyncs,
c1 - c4 are commits,
h0 - h3 are histogram collections
f0 - f4 are frames being fetched in pipes over the timeline.
The frame f0 is being fetched through the pipe after v0 till v1,
because of which histogram for it is collected at h0 after v1.
Similarly for frame f1 the histogram h1 is collected after v2.
If we were to disable histogram irq right after histogram interrupt
say h0, then we will not be able to re-enable it till v2 (next
vsync in timeline). So we would not be able to collect the h1
histogram for frame f1 being fetched during v1 to v2. So we will
be collecting alternative frames at best.
If instead we disable histogram irq after two consecutive
interrupts without a commit in between then we would not miss h1,
and would disable after h2. After h2, c4 would arrive but that
re-enables irqs at v4. However the frame being fetched during
this time (from v3 to v4) is f3, which is same as f2 as no commit
came in between. So we would miss out on h3 for f3 which is
correctly omitted.
Change-Id: I75be1651a3842f004c07f2ce8a5ea2bed476b64e
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
When ESD related panel failures are detected, the recovery process
involves blanking and unblanking the panel. In such cases, it is
required to restore the backlight level as there may not be an explicit
call from the userspace to update the backlight.
Change-Id: Idd84a628cf2a1e37121b94d3c5cc11d45a78fdab
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Add pluggable information into panel info to let other modules
know that this interface supports HPD (Hot Plug Detect) and can
be dynamically connected or disconnected.
Change-Id: I8322b60c337cd2f46a4a500ad1a6083875f6206b
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
In case of rotator buf sync ioctl, the ioctl could be called on
frame buffer device for which panel is off. However rotator sessions
may still be active. In such cases the call shouldn't fail, thus move
check for panel off only when the target sync fence timeline is for
the panel.
Change-Id: Ice4557fcbe82df2761c65f67a0bf81a2d72fde75
CRs-Fixed: 837945
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Due to various reasons wait4pingpong timeout can be observed and
this usually results in split screen behaviour for the end user.
Split screen is manifested because for a given frame only half of
the pixel data was sent and then some kind of hang was observed.
So unless the panel and display pipeline is restarted, next frames
will start from the location where it hanged. Improve user behavior
by reseting the display pipeline including panel by sending panel
dead event to user-space. Upon receiving this event user-space should
issue blank and un-blank which should recover the display pipeline.
Change-Id: Iec674a61229cbc037d24cf4f62ceb02a977b219c
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
In the current implementation, DSI1 device is always mapped
to frame buffer 0. For dual DSI configuration, we need to
register DSI1 device to a separate frame buffer. Add driver
and dtsi support to register DSI1 device on primary/secondary
frame buffer runtime based on the DSI configuration.
Change-Id: Iac872723711c5d0264088c4f3b53d1385fd9ffe0
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
The queued work for an iteration of pp_ad_calc_worker might run
post the final fb release call. This can cause NULL pointer
dereferences. Now cancelling the pending AD calc work and
destroying the workqueue upon shutdown call to prevent any
such scenarios.
The vsync handler would continue to work until a call for
POWERDOWN arrives from userspace post shutdown notification.
So vsync handler might continue to queue work regardless of
existence of AD workqueue. Preventing this by checking the
ad state to see if shutdown has been set. If shutdown is set
then we do not queue AD calc work. The shutdown mask will be
set in state during a call to fb shutdown.
Change-Id: I10b6f3001b49b010eb4ca52d3b0dc03b2f7c190c
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Current mixer allocation logic does initialization only if the mixer is
part of the mixer pool, however code has additional path for alternative
mixer which is not being initialized. Also don't need to reallocate the
mixer if it's already allocated in case of split display.
Change-Id: I1dbbbb86096c4825d214755d9cc7bf81b2abbbc8
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
When continuous splash is on blank call from recovery
module returns early. But AFE/touch driver on getting
blank event can go ahead with disp enable and reset GPIO
toggling which will result in bad DSI state.
To fix this, expose an API from display to return continuous
splash flag.
Change-Id: I6ecc9b969fb74bddacb86277e24500b7f215fdd4
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
mdss_fb_pan_idle and mdss_fb_wait_for_kickoff are used to hold the
current context until it is safe to proceed. Unless shutdown is going on,
these contexts are woken up by corresponding display thread responsible
for committing a frame to display. Display thread has various delays like
waiting for fences to be signalled, waiting for previous frame to finish
or waiting for a vsync etc. Under normal circumstances, these delays are
very negligible and different threads work in good harmony. However in a
heavily loaded system or some bad thread which disables interrupts for a
long time, these delays can become very large. Increase timeout to
arbitrarily derived value and add error messaging when the timeout is
observed. Remove panic from the timeout to let the system recover by
itself.
Change-Id: I58fe4c0d8b0c43998f87384035a1eacc24d7230a
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
There could be multiple references to the framebuffer, when
releasing the last one the panel should be blanked. When blanking the
panel we should make sure that panel update has finished (wait for panel
idle), however this wait should be done only if it will lead to a
change in the panel. Avoid this wait if there are more than one ref
counts which means that panel won't be blanked.
Change-Id: I22ffd25cfc6d0512d006a979613610314772a27e
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
In the current framebuffer driver, user context may be put to sleep
to serialize certain operations. These contexts are woken up on certain
conditions, one of which is system shutdown notification. Current api
used, wait_event_timeout, relies on wait queue to be woken up if any
variable that could change the result of the sleep condition. So when
shutdown context is active, it needs to wake up threads waiting on
shutdown notification else they will timeout and may delay the shutdown
process.
Change-Id: I11b97e4c65b434c5f35d455a5040f407a1460516
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Currently, there is only one type of backlight notification for
post-processing and it is completed only when AD is enabled and the
AD attenuated backlight changes. The PPDaemon needs a notification
for general backlight updates for CABL. This change adds separate
backlight notify updates for AD attenuated bl changes and regular
bl changes.
Change-Id: Ie35cdcf3f9f58d9678774e0d976c662fc4ea739f
Signed-off-by: Benet Clark <benetc@codeaurora.org>
If, for some reason, DSI probe gets deferred, then WB/HDMI gets
FB0. Userspace operates thinking FB0 as primary and gets stuck
in bad state. Fix this by deferring the probes for WFD/HDMI also
in case of DSI Probe deferral.
Change-Id: If793ce22aeffafc64df5e56b76a0f27c38e6240d
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
Fix ret value for error case in framebuffer
allocation api and use integer instead of
unsigned int for sscanf api.
CRs-fixed: 790640
Change-Id: Ib7fa217334365b8194571e220740a769597636e0
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>