Commit 3a4d339f authored by Ismael Luceno's avatar Ismael Luceno Committed by Mauro Carvalho Chehab

[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: default avatarIsmael Luceno <ismael.luceno@corp.bluecherry.net>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 85ac1a17
...@@ -134,51 +134,48 @@ static void solo_capture_config(struct solo_dev *solo_dev) ...@@ -134,51 +134,48 @@ static void solo_capture_config(struct solo_dev *solo_dev)
kfree(buf); kfree(buf);
} }
#define SOLO_OSD_WRITE_SIZE (16 * OSD_TEXT_MAX)
/* Should be called with enable_lock held */ /* Should be called with enable_lock held */
int solo_osd_print(struct solo_enc_dev *solo_enc) int solo_osd_print(struct solo_enc_dev *solo_enc)
{ {
struct solo_dev *solo_dev = solo_enc->solo_dev; struct solo_dev *solo_dev = solo_enc->solo_dev;
unsigned char *str = solo_enc->osd_text; unsigned char *str = solo_enc->osd_text;
u8 *buf = solo_enc->osd_buf; 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 struct font_desc *vga = find_font("VGA8x16");
const unsigned char *vga_data; const unsigned char *vga_data;
int len;
int i, j; int i, j;
if (WARN_ON_ONCE(!vga)) if (WARN_ON_ONCE(!vga))
return -ENODEV; return -ENODEV;
len = strlen(str); reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH);
if (!*str) {
if (len == 0) {
/* Disable OSD on this channel */ /* Disable OSD on this channel */
reg &= ~(1 << solo_enc->ch); reg &= ~(1 << solo_enc->ch);
solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg); goto out;
return 0;
} }
memset(buf, 0, SOLO_EOSD_EXT_SIZE_MAX); memset(buf, 0, SOLO_OSD_WRITE_SIZE);
vga_data = (const unsigned char *)vga->data; vga_data = (const unsigned char *)vga->data;
for (i = 0; i < len; i++) { for (i = 0; *str; i++, str++) {
unsigned char c = str[i];
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
buf[(j * 2) + (i % 2) + (i / 2 * 32)] = buf[(j << 1) | (i & 1) | ((i & ~1) << 4)] =
bitrev8(vga_data[(c * 16) + j]); bitrev8(vga_data[(*str << 4) | j]);
} }
} }
solo_p2m_dma(solo_dev, 1, buf, solo_p2m_dma(solo_dev, 1, buf,
SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_ADDR_CHAN(solo_dev, solo_enc->ch),
(solo_enc->ch * SOLO_EOSD_EXT_SIZE(solo_dev)), SOLO_OSD_WRITE_SIZE, 0, 0);
SOLO_EOSD_EXT_SIZE(solo_dev), 0, 0);
/* Enable OSD on this channel */ /* Enable OSD on this channel */
reg |= (1 << solo_enc->ch); 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; return 0;
} }
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#define SOLO_EOSD_EXT_SIZE_MAX 0x20000 #define SOLO_EOSD_EXT_SIZE_MAX 0x20000
#define SOLO_EOSD_EXT_AREA(__solo) \ #define SOLO_EOSD_EXT_AREA(__solo) \
(SOLO_EOSD_EXT_SIZE(__solo) * 32) (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) \ #define SOLO_MOTION_EXT_ADDR(__solo) \
(SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_AREA(__solo)) (SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_AREA(__solo))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment