ODROID-COMMON: media/osd: add new kernel parameter 'overscan='

The new kernel parameter 'overscan=' is to set the ratio to control the overscan
ratio in percent.

Change-Id: I0fc667ccf20349247d4e10196d7acdbc6e5a1fb2
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
This commit is contained in:
Dongjin Kim
2019-02-20 18:21:57 +09:00
parent 05e8bced71
commit ad5225bace

View File

@@ -383,6 +383,8 @@ struct ion_handle *fb_ion_handle[OSD_COUNT][OSD_MAX_BUF_NUM];
static int osd_cursor(struct fb_info *fbi, struct fb_cursor *var);
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
static int overscan_ratio = 100; /* at % */
static int osd_set_fb_var(int index, const struct vinfo_s *vinfo)
{
if ((vinfo->width < 0) || (vinfo->height < 0)) {
@@ -399,15 +401,56 @@ static int osd_set_fb_var(int index, const struct vinfo_s *vinfo)
return 0;
}
static void overscan_window(const struct vinfo_s *vinfo, int percent,
int *left, int *top, int *width, int *height)
{
const int step = 2;
*left = (100 - percent) * vinfo->width / (100 * 2 * step);
*top = (100 - percent) * vinfo->height / (100 * 2 * step);
*width = (vinfo->width - *left) - *left - 1;
*height = (vinfo->height - *top) - *top - 1;
}
static void osd_set_fb_parameters(int index, const struct vinfo_s *vinfo)
{
int left, top, width, height;
osd_set_free_scale_enable_hw(index, 0);
osd_set_free_scale_mode_hw(index, 1);
osd_set_free_scale_axis_hw(index, 0, 0, vinfo->width, vinfo->height);
osd_set_window_axis_hw(index, 0, 0, vinfo->width, vinfo->height);
/* OVERSCAN */
overscan_window(vinfo, overscan_ratio, &left, &top, &width, &height);
osd_set_window_axis_hw(index, left, top, width, height);
osd_set_free_scale_enable_hw(index, 0x10001);
osd_enable_hw(index, 1);
}
static int __init overscan_setup(char *str)
{
int ratio;
int ret;
if (str == NULL)
return -EINVAL;
ret = kstrtoint(str, 0, &ratio);
if (ratio > 100)
ratio = 100;
else
if (ratio < 80)
ratio = 80;
overscan_ratio = ratio;
return 0;
}
__setup("overscan=", overscan_setup);
#endif /* CONFIG_ARCH_MESON64_ODROID_COMMON */
phys_addr_t get_fb_rmem_paddr(int index)