mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 11:35:07 +07:00
[media] solo6x10: Reduce OSD writes to the minimum necessary
Instead of unconditionally writing SOLO_EOSD_EXT_SIZE() bytes to the OSD area (which is 64 or 128 kB depending on the PCI board) we only write the actual amount of data needed which is 16 * OSD_TEXT_MAX (= 16 * 44). Signed-off-by: Ismael Luceno <ismael.luceno@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
85ac1a1772
commit
3a4d339fe8
@ -134,51 +134,48 @@ static void solo_capture_config(struct solo_dev *solo_dev)
|
||||
kfree(buf);
|
||||
}
|
||||
|
||||
#define SOLO_OSD_WRITE_SIZE (16 * OSD_TEXT_MAX)
|
||||
|
||||
/* Should be called with enable_lock held */
|
||||
int solo_osd_print(struct solo_enc_dev *solo_enc)
|
||||
{
|
||||
struct solo_dev *solo_dev = solo_enc->solo_dev;
|
||||
unsigned char *str = solo_enc->osd_text;
|
||||
u8 *buf = solo_enc->osd_buf;
|
||||
u32 reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH);
|
||||
u32 reg;
|
||||
const struct font_desc *vga = find_font("VGA8x16");
|
||||
const unsigned char *vga_data;
|
||||
int len;
|
||||
int i, j;
|
||||
|
||||
if (WARN_ON_ONCE(!vga))
|
||||
return -ENODEV;
|
||||
|
||||
len = strlen(str);
|
||||
|
||||
if (len == 0) {
|
||||
reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH);
|
||||
if (!*str) {
|
||||
/* Disable OSD on this channel */
|
||||
reg &= ~(1 << solo_enc->ch);
|
||||
solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg);
|
||||
return 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(buf, 0, SOLO_EOSD_EXT_SIZE_MAX);
|
||||
memset(buf, 0, SOLO_OSD_WRITE_SIZE);
|
||||
vga_data = (const unsigned char *)vga->data;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
unsigned char c = str[i];
|
||||
|
||||
for (i = 0; *str; i++, str++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
buf[(j * 2) + (i % 2) + (i / 2 * 32)] =
|
||||
bitrev8(vga_data[(c * 16) + j]);
|
||||
buf[(j << 1) | (i & 1) | ((i & ~1) << 4)] =
|
||||
bitrev8(vga_data[(*str << 4) | j]);
|
||||
}
|
||||
}
|
||||
|
||||
solo_p2m_dma(solo_dev, 1, buf,
|
||||
SOLO_EOSD_EXT_ADDR +
|
||||
(solo_enc->ch * SOLO_EOSD_EXT_SIZE(solo_dev)),
|
||||
SOLO_EOSD_EXT_SIZE(solo_dev), 0, 0);
|
||||
SOLO_EOSD_EXT_ADDR_CHAN(solo_dev, solo_enc->ch),
|
||||
SOLO_OSD_WRITE_SIZE, 0, 0);
|
||||
|
||||
/* Enable OSD on this channel */
|
||||
reg |= (1 << solo_enc->ch);
|
||||
solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg);
|
||||
|
||||
out:
|
||||
solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@
|
||||
#define SOLO_EOSD_EXT_SIZE_MAX 0x20000
|
||||
#define SOLO_EOSD_EXT_AREA(__solo) \
|
||||
(SOLO_EOSD_EXT_SIZE(__solo) * 32)
|
||||
#define SOLO_EOSD_EXT_ADDR_CHAN(__solo, ch) \
|
||||
(SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_SIZE(__solo) * (ch))
|
||||
|
||||
#define SOLO_MOTION_EXT_ADDR(__solo) \
|
||||
(SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_AREA(__solo))
|
||||
|
Loading…
Reference in New Issue
Block a user