From patchwork Fri Jun 21 07:55:32 2013
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Zabel
X-Patchwork-Id: 2760891
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 9C81CC0AB1
for ;
Fri, 21 Jun 2013 07:55:48 +0000 (UTC)
Received: from mail.kernel.org (localhost [127.0.0.1])
by mail.kernel.org (Postfix) with ESMTP id 8AAB120200
for ;
Fri, 21 Jun 2013 07:55:47 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by mail.kernel.org (Postfix) with ESMTP id 8B550201FB
for ;
Fri, 21 Jun 2013 07:55:46 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1161500Ab3FUHzo (ORCPT
);
Fri, 21 Jun 2013 03:55:44 -0400
Received: from metis.ext.pengutronix.de ([92.198.50.35]:35558 "EHLO
metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1161505Ab3FUHzk (ORCPT
);
Fri, 21 Jun 2013 03:55:40 -0400
Received: from dude.hi.pengutronix.de ([10.1.0.7] helo=dude.pengutronix.de)
by metis.ext.pengutronix.de with esmtp (Exim 4.72)
(envelope-from )
id 1UpwC2-0005nU-9c; Fri, 21 Jun 2013 09:55:38 +0200
From: Philipp Zabel
To: linux-media@vger.kernel.org
Cc: Kamil Debski ,
Javier Martin ,
Sylwester Nawrocki ,
=?UTF-8?q?Ga=C3=ABtan=20Carlier?= ,
Wei Yongjun , Philipp Zabel
Subject: [PATCH v2 6/8] [media] coda: dynamic IRAM setup for decoder
Date: Fri, 21 Jun 2013 09:55:32 +0200
Message-Id: <1371801334-22324-7-git-send-email-p.zabel@pengutronix.de>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1371801334-22324-1-git-send-email-p.zabel@pengutronix.de>
References: <1371801334-22324-1-git-send-email-p.zabel@pengutronix.de>
X-SA-Exim-Connect-IP: 10.1.0.7
X-SA-Exim-Mail-From: p.zabel@pengutronix.de
X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de);
SAEximRunCond expanded to false
X-PTX-Original-Recipient: linux-media@vger.kernel.org
Sender: linux-media-owner@vger.kernel.org
Precedence: bulk
List-ID:
X-Mailing-List: linux-media@vger.kernel.org
X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI,
RP_MATCHES_RCVD, 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: Philipp Zabel
---
drivers/media/platform/coda.c | 50 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 48 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 1f3bd43..856a93e 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -1212,6 +1212,7 @@ static void coda_setup_iram(struct coda_ctx *ctx)
int ipacdc_size;
int bitram_size;
int dbk_size;
+ int ovl_size;
int mb_width;
int me_size;
int size;
@@ -1273,7 +1274,47 @@ static void coda_setup_iram(struct coda_ctx *ctx)
size -= ipacdc_size;
}
- /* OVL disabled for encoder */
+ /* OVL and BTP disabled for encoder */
+ } else if (ctx->inst_type == CODA_INST_DECODER) {
+ struct coda_q_data *q_data_dst;
+ int mb_height;
+
+ q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
+ mb_width = DIV_ROUND_UP(q_data_dst->width, 16);
+ mb_height = DIV_ROUND_UP(q_data_dst->height, 16);
+
+ dbk_size = round_up(256 * mb_width, 1024);
+ if (size >= dbk_size) {
+ iram_info->axi_sram_use |= CODA7_USE_HOST_DBK_ENABLE;
+ iram_info->buf_dbk_y_use = dev->iram_paddr;
+ iram_info->buf_dbk_c_use = dev->iram_paddr +
+ dbk_size / 2;
+ size -= dbk_size;
+ } else {
+ goto out;
+ }
+
+ bitram_size = round_up(128 * mb_width, 1024);
+ if (size >= bitram_size) {
+ iram_info->axi_sram_use |= CODA7_USE_HOST_BIT_ENABLE;
+ iram_info->buf_bit_use = iram_info->buf_dbk_c_use +
+ dbk_size / 2;
+ size -= bitram_size;
+ } else {
+ goto out;
+ }
+
+ ipacdc_size = round_up(128 * mb_width, 1024);
+ if (size >= ipacdc_size) {
+ iram_info->axi_sram_use |= CODA7_USE_HOST_IP_ENABLE;
+ iram_info->buf_ip_ac_dc_use = iram_info->buf_bit_use +
+ bitram_size;
+ size -= ipacdc_size;
+ } else {
+ goto out;
+ }
+
+ ovl_size = round_up(80 * mb_width, 1024);
}
out:
@@ -1300,7 +1341,12 @@ out:
if (dev->devtype->product == CODA_7541) {
/* TODO - Enabling these causes picture errors on CODA7541 */
- if (ctx->inst_type == CODA_INST_ENCODER) {
+ if (ctx->inst_type == CODA_INST_DECODER) {
+ /* fw 1.4.50 */
+ iram_info->axi_sram_use &= ~(CODA7_USE_HOST_IP_ENABLE |
+ CODA7_USE_IP_ENABLE);
+ } else {
+ /* fw 13.4.29 */
iram_info->axi_sram_use &= ~(CODA7_USE_HOST_IP_ENABLE |
CODA7_USE_HOST_DBK_ENABLE |
CODA7_USE_IP_ENABLE |