]> nv-tegra.nvidia Code Review - linux-4.9.git/commit
video: fbdev: add support for storing pixclk in hz
authorNaveen Kumar S <nkumars@nvidia.com>
Mon, 27 Aug 2018 06:42:17 +0000 (12:12 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Thu, 25 Oct 2018 03:05:49 +0000 (20:05 -0700)
commit6d8560f27a781ac7e0e0f88d0d2a61547d419bc2
tree834b899e78dbe2a542af045aa91931c516990c01
parent84f31179a0512b48d513fbb59a486d680b7e57eb
video: fbdev: add support for storing pixclk in hz

fbdev framework stores pixelclock in pico seconds. Since monitors
advertize pixclock in hz, we need to convert it from Hz to pico
seconds when creating mode database. During modeset, it again needs
to be converted back to Hz. These conversions cause precision loss,
because of which the final pixclock value does not match the original
value advertized by the sink.

This issue is prominently seen in case of non-CEA modes.

Most of the monitors handle this slight variation in pixclock without
complaining. But, there are a few monitors that fail when the exact
pixclock is not programmed. Hence, interoperability is affected.

Avoiding the pixclock conversion helps in avoiding the precision loss
issue. But, the idea of updating the core kernel fbdev driver to use
pixel clock in hz intead of pico seconds was rejected because it might
cause ABI compatibility issues.

The finalized solution is to store the original pixclock in hz along
with the pixclock in pico seconds, and use the hz pixclock during
modeset instead of the converted one.

Implementation Details:

fb_var_screeninfo is the  structure used by userspace clients to specify
their chosen mode timings to kernel. To avoid breaking the current fbdev
ABI, we avoided making any changes to this structure.

A new variable, pixclock_hz, has been added to the existing fb_videomode
structure. It is used to store the original pixclock value in hz during
mode database creation. As part of modeset, this value is used instead of
the one that went through conversion between hz and pico seconds. This
in-turn helps in setting accurate pixel clock advertized by sinks.

New defconfig option introduced:

To make it easy to enable/disable this feature, the whole implementation
has been wrapped under a new defconfig option, CONFIG_FB_MODE_PIXCLOCK_HZ.
Any updates to existing data structures has also been isolated under this
defconfig option.

bug 2045478

Change-Id: Id3ef39a0d50beee95b9eaba32afa65a7aa28c53a
Signed-off-by: Naveen Kumar S <nkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1812545
(cherry picked from commit 09877297e4f43aa8844c009a6a30c70033ac664e)
Reviewed-on: https://git-master.nvidia.com/r/1932350
GVS: Gerrit_Virtual_Submit
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
arch/arm64/configs/tegra_defconfig
drivers/video/fbdev/Kconfig
drivers/video/fbdev/core/fbmon.c
drivers/video/fbdev/core/modedb.c
include/linux/fb.h