Skip to content

Commit

Permalink
osd: add viu2 fence support [1/1]
Browse files Browse the repository at this point in the history
PD#SWPL-6384

Problem:
viu2 not support fence

Solution:
add viu2 fence support.

Verify:
test pass on tl1

Change-Id: I94a5e483c88cace79b7386bb918c203ada6b8274
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
  • Loading branch information
Pengcheng Chen authored and jianxinpan committed Apr 2, 2019
1 parent 867de9c commit 6862fb2
Show file tree
Hide file tree
Showing 6 changed files with 689 additions and 578 deletions.
21 changes: 11 additions & 10 deletions drivers/amlogic/media/osd/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ enum color_index_e {
#define FBIOPUT_OSD_CURSOR \
_IOWR(FB_IOC_MAGIC, 0x0, struct fb_cursor_user)


/* OSD color definition */
#define KEYCOLOR_FLAG_TARGET 1
#define KEYCOLOR_FLAG_ONHOLD 2
#define KEYCOLOR_FLAG_CURRENT 4

#define HW_OSD_COUNT 4
#define OSD_BLEND_LAYERS 4
#define VIU_COUNT 2

/* OSD block definition */
#define HW_OSD_BLOCK_COUNT 4
#define HW_OSD_BLOCK_REG_COUNT (HW_OSD_BLOCK_COUNT*2)
Expand Down Expand Up @@ -706,7 +707,7 @@ struct hw_para_s {
u32 scan_mode[HW_OSD_COUNT];
u32 order[HW_OSD_COUNT];
u32 premult_en[HW_OSD_COUNT];
struct display_flip_info_s disp_info;
struct display_flip_info_s disp_info[VIU_COUNT];
struct osd_3d_mode_s mode_3d[HW_OSD_COUNT];
u32 updated[HW_OSD_COUNT];
/* u32 block_windows[HW_OSD_COUNT][HW_OSD_BLOCK_REG_COUNT]; */
Expand All @@ -721,7 +722,7 @@ struct hw_para_s {
int use_h_filter_mode[HW_OSD_COUNT];
int use_v_filter_mode[HW_OSD_COUNT];
struct hw_list_s reg[HW_REG_INDEX_MAX];
u32 field_out_en;
u32 field_out_en[VIU_COUNT];
u32 scale_workaround;
u32 fb_for_4k2k;
u32 antiflicker_mode;
Expand All @@ -733,21 +734,21 @@ struct hw_para_s {
struct osd_device_data_s osd_meson_dev;
u32 urgent[HW_OSD_COUNT];
u32 osd_deband_enable;
u32 osd_fps;
u32 osd_fps_start;
u32 osd_fps[VIU_COUNT];
u32 osd_fps_start[VIU_COUNT];
u32 osd_display_debug;
ulong screen_base[HW_OSD_COUNT];
ulong screen_size[HW_OSD_COUNT];
ulong screen_base_backup[HW_OSD_COUNT];
ulong screen_size_backup[HW_OSD_COUNT];
u32 vinfo_width;
u32 vinfo_height;
u32 vinfo_width[VIU_COUNT];
u32 vinfo_height[VIU_COUNT];
u32 fb_drvier_probe;
u32 afbc_force_reset;
u32 afbc_regs_backup;
u32 afbc_status_err_reset;
u32 afbc_use_latch;
u32 hwc_enable;
u32 hwc_enable[VIU_COUNT];
u32 osd_use_latch[HW_OSD_COUNT];
u32 hw_cursor_en;
u32 hw_rdma_en;
Expand All @@ -760,8 +761,8 @@ struct hw_para_s {
u32 viu_type;
u32 line_n_rdma;
struct hw_debug_s osd_debug;
int out_fence_fd;
int out_fence_fd[VIU_COUNT];
int in_fd[HW_OSD_COUNT];
struct osd_fence_fun_s osd_fence[2];
struct osd_fence_fun_s osd_fence[VIU_COUNT][2];
};
#endif /* _OSD_H_ */
4 changes: 3 additions & 1 deletion drivers/amlogic/media/osd/osd_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ static void osd_debug_dump_value(void)

osd_log_info("--- OSD ---\n");
osd_log_info("bot_type: %d\n", hwpara->bot_type);
osd_log_info("field_out_en: %d\n", hwpara->field_out_en);
osd_log_info("field_out_en: %d\n", hwpara->field_out_en[VIU1]);
if (osd_hw.osd_meson_dev.has_viu2)
osd_log_info("field_out_en: %d\n", hwpara->field_out_en[VIU2]);

if (hwpara->osd_meson_dev.osd_ver == OSD_HIGH_ONE) {
struct hw_osd_blending_s *blend_para = NULL;
Expand Down
12 changes: 9 additions & 3 deletions drivers/amlogic/media/osd/osd_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,13 @@ static ssize_t osd_hwc_enable_read_file(struct file *file,
char __user *userbuf,
size_t count, loff_t *ppos)
{
struct seq_file *s = file->private_data;
int osd_id = *(int *)s;
char buf[128];
ssize_t len;
unsigned int hwc_enable = 0;

osd_get_hwc_enable(&hwc_enable);
osd_get_hwc_enable(osd_id, &hwc_enable);
len = snprintf(buf, 128, "%d\n", hwc_enable);
return simple_read_from_buffer(userbuf, count, ppos, buf, len);
}
Expand All @@ -576,6 +578,8 @@ static ssize_t osd_hwc_enable_write_file(struct file *file,
const char __user *userbuf,
size_t count, loff_t *ppos)
{
struct seq_file *s = file->private_data;
int osd_id = *(int *)s;
char buf[128];
unsigned int hwc_enable = 0;
int ret = 0;
Expand All @@ -586,14 +590,16 @@ static ssize_t osd_hwc_enable_write_file(struct file *file,
buf[count] = 0;
ret = kstrtoint(buf, 0, &hwc_enable);
osd_log_info("hwc enable: %d\n", hwc_enable);
osd_set_hwc_enable(hwc_enable);
osd_set_hwc_enable(osd_id, hwc_enable);
return count;
}

static ssize_t osd_do_hwc_write_file(struct file *file,
const char __user *userbuf,
size_t count, loff_t *ppos)
{
struct seq_file *s = file->private_data;
int osd_id = *(int *)s;
char buf[128];
unsigned int do_hwc = 0;
int ret = 0;
Expand All @@ -605,7 +611,7 @@ static ssize_t osd_do_hwc_write_file(struct file *file,
ret = kstrtoint(buf, 0, &do_hwc);
osd_log_info("do_hwc: %d\n", do_hwc);
if (do_hwc)
osd_do_hwc();
osd_do_hwc(osd_id);
return count;
}

Expand Down
Loading

0 comments on commit 6862fb2

Please sign in to comment.