From patchwork Sun May 18 19:44:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ismael Luceno X-Patchwork-Id: 4198701 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 94024BEEAB for ; Sun, 18 May 2014 19:45:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA4E32020F for ; Sun, 18 May 2014 19:44:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 87C26201BB for ; Sun, 18 May 2014 19:44:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbaERToy (ORCPT ); Sun, 18 May 2014 15:44:54 -0400 Received: from mail-yh0-f46.google.com ([209.85.213.46]:61583 "EHLO mail-yh0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751689AbaERToy (ORCPT ); Sun, 18 May 2014 15:44:54 -0400 Received: by mail-yh0-f46.google.com with SMTP id 29so6127123yhl.33 for ; Sun, 18 May 2014 12:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=I2dBrTz5ZDH4QG5aale0bPUQjl6Z6GB/9JY8O80iyjM=; b=XjyjLEwdtbzrsPdng+blQzt/YySfnxt7qT0a5+UC32qD2XB7v6iA1CJDpYFTW0d9y9 VgegKN/TM4KjG6Yeg6R5T+iuMcWG4fGE+gtbudA0ctK4d5PpApPyHS1ZiniBrMLCU6yk Sj6AGLeq9OMmYt0plb/s0uNZVzRbvDbU9XmOzf9k3yXw++8xu5FHfTdtwJFuAgOwgqBF VKkzkKgtjVes3qAccfnl+Pc3zcAfp0igoI5K94Z/jpzUr8P3a13xKgTDsinIZMExGfAY JbviUm7LH5wAYuxsMwAnruEoG8wc7r7tIRJEBpdD1a7neXlBt4sigLwf+AX+64Bj3NLV 230w== X-Received: by 10.236.26.72 with SMTP id b48mr45905752yha.59.1400442293229; Sun, 18 May 2014 12:44:53 -0700 (PDT) Received: from pirotess.bf.iodev.co.uk ([201.219.187.227]) by mx.google.com with ESMTPSA id i1sm21938163yhq.12.2014.05.18.12.44.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 18 May 2014 12:44:52 -0700 (PDT) From: Ismael Luceno To: linux-media@vger.kernel.org Cc: Hans Verkuil , Ismael Luceno Subject: [PATCH] solo6x10: Reduce OSD writes to the minimum necessary Date: Sun, 18 May 2014 16:44:11 -0300 Message-Id: <1400442251-7548-1-git-send-email-ismael.luceno@corp.bluecherry.net> X-Mailer: git-send-email 1.9.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ismael Luceno --- drivers/staging/media/solo6x10/solo6x10-enc.c | 31 ++++++++++------------- drivers/staging/media/solo6x10/solo6x10-offsets.h | 2 ++ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/staging/media/solo6x10/solo6x10-enc.c b/drivers/staging/media/solo6x10/solo6x10-enc.c index 94d5735..2db53b6 100644 --- a/drivers/staging/media/solo6x10/solo6x10-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-enc.c @@ -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; } diff --git a/drivers/staging/media/solo6x10/solo6x10-offsets.h b/drivers/staging/media/solo6x10/solo6x10-offsets.h index f005dca..13eeb44 100644 --- a/drivers/staging/media/solo6x10/solo6x10-offsets.h +++ b/drivers/staging/media/solo6x10/solo6x10-offsets.h @@ -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))