From patchwork Wed Nov 6 22:34:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 11231287 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 719B51747 for ; Wed, 6 Nov 2019 22:34:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FC1B2187F for ; Wed, 6 Nov 2019 22:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732603AbfKFWeZ convert rfc822-to-8bit (ORCPT ); Wed, 6 Nov 2019 17:34:25 -0500 Received: from mail-oln040092064089.outbound.protection.outlook.com ([40.92.64.89]:1540 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727196AbfKFWeY (ORCPT ); Wed, 6 Nov 2019 17:34:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TKuAAqqErqVSIIsX42VVD2yIxIpsHRb7chTY8nddYT6aDvbFkHvAZwpyiLmgb4xkQeuVq8c7o4Uz+KGiHvBOrOM+SOIWGeQTMy7H7NwNa6mUQQoJEZmzLFeO4y4OcD/bJ5ayv8A4OiAIcg+CkCUkQ1yb4dmTmOyCg3MYN1dLxLyVHXDqfj0z+s/VydNai1d1fFxWrlHTBu4mr/xtLS4GDtOOohth3XMIVC2fq7N8H8uQbI9sS8xMjq9SJxc8TcI27WhcI7clzEZZKhH7Fmznr4dGDrY+Q4pkCYj/iJSBuQy75aNbHALwX7oqx0rkmJ334F5E6FgLImpnAMZ1b4+qhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uAj2ozVkjfB+JihtA9gKeRVdQ+3AHZIj4mAcf8+U6YE=; b=SKMyCuNZl2xfLa9XPkMq9q07YpQ3Ao5veFO1gALOr0wjmlezvnLGCxv09Q5cefYYl5a3mhcRv+/0nlIOxuKCqMsL5YThe6cKpE2WNu277vlrLNJKtsp+nQqWKH7UBkeVycrUaotWkaThbaV/1nycNwre/qA2+BxlSC/YZUPKTuyq2MfNuxMEVoTh0XlM7ijExtC6xwcpEArvCE01mqyIjI7c+j8GeIfjFBniagYwCNS8kuKT5e9Wz0lufq4TyAm/dUUHkeXIQtTuz/j7+rJM9FzclYxYLcIWe9V9OD8LoaCdnmfeu2jgp2t55iL2EkbYNsJ2FfwdqphQUyqnIojUaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from HE1EUR01FT023.eop-EUR01.prod.protection.outlook.com (10.152.0.57) by HE1EUR01HT227.eop-EUR01.prod.protection.outlook.com (10.152.1.190) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20; Wed, 6 Nov 2019 22:34:20 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com (10.152.0.53) by HE1EUR01FT023.mail.protection.outlook.com (10.152.0.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20 via Frontend Transport; Wed, 6 Nov 2019 22:34:20 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc]) by HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc%7]) with mapi id 15.20.2408.028; Wed, 6 Nov 2019 22:34:20 +0000 From: Jonas Karlman To: Mauro Carvalho Chehab , Ezequiel Garcia CC: Jonas Karlman , Hans Verkuil , Boris Brezillon , Tomasz Figa , Philipp Zabel , "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v3 1/5] media: hantro: Fix H264 motion vector buffer offset Thread-Topic: [PATCH v3 1/5] media: hantro: Fix H264 motion vector buffer offset Thread-Index: AQHVlPJVAc/IWZZA0kesy7QMFtzL3A== Date: Wed, 6 Nov 2019 22:34:20 +0000 Message-ID: References: In-Reply-To: Accept-Language: sv-SE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0402CA0025.eurprd04.prod.outlook.com (2603:10a6:7:7c::14) To HE1PR06MB4011.eurprd06.prod.outlook.com (2603:10a6:7:9c::32) x-incomingtopheadermarker: OriginalChecksum:FAB4DE15588B8F08381DEF91E847964DE794E6CD0206A3A4874E30D7BF6C8870;UpperCasedChecksum:6B31A0C61A6ED227BE4E0679102D0404143C600FB4954111DEA6EC49DD80B949;SizeAsReceived:7610;Count:49 x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-tmn: [05Dsyv6BcSqygptF2ciYDCl7/HNZWGFQ] x-microsoft-original-message-id: <20191106223408.2176-1-jonas@kwiboo.se> x-ms-publictraffictype: Email x-incomingheadercount: 49 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: ac046653-4039-416c-c75c-08d763097746 x-ms-traffictypediagnostic: HE1EUR01HT227: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Uqn6+QLkvNLqXT71aUOUcBzjiPEW/yxOn/J78xF2z0Bl7zuig4yJ19dqNWtl5GXhtPT08/d+mw6iPdKylUhekbD4C3F9nYGlqrIEQPC7/YqyrnPIRH8x/KwGKpWR7qeGVDt/KUSyPEoAa5xaNwgEAhlXlwG0E2MejZM7P/uKxwVkKlQmen4gTG03Jfr0z6OT x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: ac046653-4039-416c-c75c-08d763097746 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 22:34:20.8054 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT227 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org A decoded 8-bit 4:2:0 frame need memory for up to 448 bytes per macroblock and is laid out in memory as follow: +---------------------------+ | Y-plane 256 bytes x MBs | +---------------------------+ | UV-plane 128 bytes x MBs | +---------------------------+ | MV buffer 64 bytes x MBs | +---------------------------+ The motion vector buffer offset is currently correct for 4:2:0 because the extra space for motion vectors is overallocated with an extra 64 bytes x MBs. Wrong offset for both destination and motion vector buffer are used for the bottom field of field encoded content, wrong offset is also used for 4:0:0 (monochrome) content. Fix this by setting the motion vector address to the expected 384 bytes x MBs offset for 4:2:0 and 256 bytes x MBs offset for 4:0:0 content. Also use correct destination and motion vector buffer offset for the bottom field of field encoded content. While at it also extend the check for 4:0:0 (monochrome) to include an additional check for High Profile (100). Fixes: dea0a82f3d22 ("media: hantro: Add support for H264 decoding on G1") Signed-off-by: Jonas Karlman Reviewed-by: Boris Brezillon --- Changes in v3: * address remarks from Boris - use src_fmt instead of dst_fmt Changes in v2: * address remarks from Philipp and Ezequiel - update commit message - rename offset to bytes_per_mb - remove MV_OFFSET macros - move PIC_MB_WIDTH/HEIGHT_P change to separate patch --- .../staging/media/hantro/hantro_g1_h264_dec.c | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c index 70a6b5b26477..30d977c3d529 100644 --- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c @@ -81,7 +81,7 @@ static void set_params(struct hantro_ctx *ctx) reg |= G1_REG_DEC_CTRL4_CABAC_E; if (sps->flags & V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE) reg |= G1_REG_DEC_CTRL4_DIR_8X8_INFER_E; - if (sps->chroma_format_idc == 0) + if (sps->profile_idc >= 100 && sps->chroma_format_idc == 0) reg |= G1_REG_DEC_CTRL4_BLACKWHITE_E; if (pps->flags & V4L2_H264_PPS_FLAG_WEIGHTED_PRED) reg |= G1_REG_DEC_CTRL4_WEIGHT_PRED_E; @@ -234,6 +234,7 @@ static void set_buffers(struct hantro_ctx *ctx) struct vb2_v4l2_buffer *src_buf, *dst_buf; struct hantro_dev *vpu = ctx->dev; dma_addr_t src_dma, dst_dma; + size_t offset = 0; src_buf = hantro_get_src_buf(ctx); dst_buf = hantro_get_dst_buf(ctx); @@ -244,18 +245,30 @@ static void set_buffers(struct hantro_ctx *ctx) /* Destination (decoded frame) buffer. */ dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0); - vdpu_write_relaxed(vpu, dst_dma, G1_REG_ADDR_DST); + /* Adjust dma addr to start at second line for bottom field */ + if (ctrls->slices[0].flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD) + offset = ALIGN(ctx->src_fmt.width, MB_DIM); + vdpu_write_relaxed(vpu, dst_dma + offset, G1_REG_ADDR_DST); /* Higher profiles require DMV buffer appended to reference frames. */ if (ctrls->sps->profile_idc > 66 && ctrls->decode->nal_ref_idc) { - size_t pic_size = ctx->h264_dec.pic_size; - size_t mv_offset = round_up(pic_size, 8); - + unsigned int bytes_per_mb = 384; + + /* DMV buffer for monochrome start directly after Y-plane */ + if (ctrls->sps->profile_idc >= 100 && + ctrls->sps->chroma_format_idc == 0) + bytes_per_mb = 256; + offset = bytes_per_mb * MB_WIDTH(ctx->src_fmt.width) * + MB_HEIGHT(ctx->src_fmt.height); + + /* + * DMV buffer is split in two for field encoded frames, + * adjust offset for bottom field + */ if (ctrls->slices[0].flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD) - mv_offset += 32 * MB_WIDTH(ctx->dst_fmt.width); - - vdpu_write_relaxed(vpu, dst_dma + mv_offset, - G1_REG_ADDR_DIR_MV); + offset += 32 * MB_WIDTH(ctx->src_fmt.width) * + MB_HEIGHT(ctx->src_fmt.height); + vdpu_write_relaxed(vpu, dst_dma + offset, G1_REG_ADDR_DIR_MV); } /* Auxiliary buffer prepared in hantro_g1_h264_dec_prepare_table(). */ From patchwork Wed Nov 6 22:34:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 11231285 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 653661747 for ; Wed, 6 Nov 2019 22:34:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41C8621848 for ; Wed, 6 Nov 2019 22:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732707AbfKFWe0 convert rfc822-to-8bit (ORCPT ); Wed, 6 Nov 2019 17:34:26 -0500 Received: from mail-oln040092064030.outbound.protection.outlook.com ([40.92.64.30]:63302 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727295AbfKFWe0 (ORCPT ); Wed, 6 Nov 2019 17:34:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YbCd/jqbCMLrLbUAXxXKsQLSWStfKuG1+2hqGzMSf3lVOkyc6ReHLsUIgmKFO2IMd2qjPYw9Z+6N2hFxpJPpyWpkMy5uV7e/Mgq1iS59IOxYWj9mcZhy4BuiNhjXUk0H42d6Qtp/NYW6ikliYUhi4uv7CEis9jxkBEY9GmrAlvpgH6+lwSdew7mSd+wGn7CcYrLkav5Nso+6wzwDOZOIslAcHzua0Di/NzKLeRLjbi2Mio9dsp54gwTzUUGEYZwKAcdSO9tKxm3r6cZX7L1X9fvE40yKPQ8UEr7chjgB1Kbcws9OC+89zxv83D4okhKFKeuKGSFgpqTBjfdiQcG4Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/Z/DbCNA0HKcJJbeiit76tQEXESJJ6W+etRZNRa1dP8=; b=cdGtbpoC/V1RNRt0UzliDVBeY2/FHNi64Yvj9nKtQBDII3x2pE9jeIg0WuKoTL3VO6j0RNKkq79RPbCJzo1FsUvrFIZn/QmJQ0v/ZNLbI0D1YLasYK9WTNv8qlFnKxTn5l76lWHSuP5POWZbBh4wQY54kTfwfbItN2oeEXFFcTTEEyK8lhh1a2TyScIbX4Zu0rOWl18rlYHOYmscUkaUDWCOxv+CRUjp+ZzVlTuNkgqJe1rR/ev5FduXLN3qNjl5DGCXO/slqm9ef3lhXm1BYMv/OYakPXDoDKaMlkd+ZPOjodx5hWbSIFJxgQA2s+ycbDz9AGTVvtzU+/LKj81Ljw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from HE1EUR01FT023.eop-EUR01.prod.protection.outlook.com (10.152.0.53) by HE1EUR01HT148.eop-EUR01.prod.protection.outlook.com (10.152.0.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2387.20; Wed, 6 Nov 2019 22:34:21 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com (10.152.0.53) by HE1EUR01FT023.mail.protection.outlook.com (10.152.0.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20 via Frontend Transport; Wed, 6 Nov 2019 22:34:21 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc]) by HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc%7]) with mapi id 15.20.2408.028; Wed, 6 Nov 2019 22:34:21 +0000 From: Jonas Karlman To: Mauro Carvalho Chehab , Ezequiel Garcia CC: Jonas Karlman , Hans Verkuil , Boris Brezillon , Tomasz Figa , Philipp Zabel , "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v3 2/5] media: hantro: Reduce H264 extra space for motion vectors Thread-Topic: [PATCH v3 2/5] media: hantro: Reduce H264 extra space for motion vectors Thread-Index: AQHVlPJVZ936l8/120Gju1K8MGGoAA== Date: Wed, 6 Nov 2019 22:34:21 +0000 Message-ID: References: <20191106223408.2176-1-jonas@kwiboo.se> In-Reply-To: <20191106223408.2176-1-jonas@kwiboo.se> Accept-Language: sv-SE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0402CA0025.eurprd04.prod.outlook.com (2603:10a6:7:7c::14) To HE1PR06MB4011.eurprd06.prod.outlook.com (2603:10a6:7:9c::32) x-incomingtopheadermarker: OriginalChecksum:4431E710FC8B7AA902B43480A0F327D3C2AEE2F00E233BD68ECD68FFAB9517A0;UpperCasedChecksum:FCA02FB32EFD1856BF9C2821DD0D8D5530699A64FB342215CB564A5F9683D3C5;SizeAsReceived:7640;Count:49 x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-tmn: [4waR297pjFE6rBd6s39yeErM6q8pH/st] x-microsoft-original-message-id: <20191106223408.2176-2-jonas@kwiboo.se> x-ms-publictraffictype: Email x-incomingheadercount: 49 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 064d899d-de47-4aca-4e4e-08d7630977c2 x-ms-traffictypediagnostic: HE1EUR01HT148: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nj6hr1NfnlhOfctausY9Rh8vpUSUS1Ynn03J/KTxPDb25+70jVcdGienmnsu1LGdQ8aVFQIQ20JQfq+gn51H0eSN+3MNukLx+m8SOCQW2OwtTuoH9dZzgeVsiWeYVqwqLkMNyvx/ptkgBrsohcOCLJr/6i+B7X8lsbP6HO8ILp1EAXwOOEQXRxwGqb+bqR5E x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 064d899d-de47-4aca-4e4e-08d7630977c2 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 22:34:21.5880 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT148 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org A decoded 8-bit 4:2:0 frame need memory for up to 448 bytes per macroblock with additional 32 bytes on multi-core variants. Memory layout is as follow: +---------------------------+ | Y-plane 256 bytes x MBs | +---------------------------+ | UV-plane 128 bytes x MBs | +---------------------------+ | MV buffer 64 bytes x MBs | +---------------------------+ | MC sync 32 bytes | +---------------------------+ Reduce the extra space allocated now that motion vector buffer offset no longer is based on the extra space. Only allocate extra space for 64 bytes x MBs of motion vector buffer and 32 bytes for multi-core sync. Fixes: a9471e25629b ("media: hantro: Add core bits to support H264 decoding") Signed-off-by: Jonas Karlman Reviewed-by: Boris Brezillon --- Changes in v3: - add memory layout to code comment (Boris) Changes in v2: - updated commit message --- drivers/staging/media/hantro/hantro_v4l2.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c index 3dae52abb96c..c8c896a06f58 100644 --- a/drivers/staging/media/hantro/hantro_v4l2.c +++ b/drivers/staging/media/hantro/hantro_v4l2.c @@ -240,14 +240,30 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f, v4l2_fill_pixfmt_mp(pix_mp, fmt->fourcc, pix_mp->width, pix_mp->height); /* + * A decoded 8-bit 4:2:0 NV12 frame may need memory for up to + * 448 bytes per macroblock with additional 32 bytes on + * multi-core variants. + * * The H264 decoder needs extra space on the output buffers * to store motion vectors. This is needed for reference * frames. + * + * Memory layout is as follow: + * + * +---------------------------+ + * | Y-plane 256 bytes x MBs | + * +---------------------------+ + * | UV-plane 128 bytes x MBs | + * +---------------------------+ + * | MV buffer 64 bytes x MBs | + * +---------------------------+ + * | MC sync 32 bytes | + * +---------------------------+ */ if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE) pix_mp->plane_fmt[0].sizeimage += - 128 * DIV_ROUND_UP(pix_mp->width, 16) * - DIV_ROUND_UP(pix_mp->height, 16); + 64 * MB_WIDTH(pix_mp->width) * + MB_WIDTH(pix_mp->height) + 32; } else if (!pix_mp->plane_fmt[0].sizeimage) { /* * For coded formats the application can specify From patchwork Wed Nov 6 22:34:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 11231283 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8BC6F1747 for ; Wed, 6 Nov 2019 22:34:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 68E3F21A49 for ; Wed, 6 Nov 2019 22:34:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732743AbfKFWea convert rfc822-to-8bit (ORCPT ); Wed, 6 Nov 2019 17:34:30 -0500 Received: from mail-oln040092065083.outbound.protection.outlook.com ([40.92.65.83]:64750 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727328AbfKFWe0 (ORCPT ); Wed, 6 Nov 2019 17:34:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XG5tsi1+AiVelHxMftl5sPWzSpFNkymAEXMr/3OwzOT4YEObsJpNNPfQDR/pBFGJTShNtZBaCDM+TqUU2r21z8+pFLY4al284+0i86JKWgNijJluSTxPKNKW4vNxVZtB3TwxRiU5vroW05WysU3IbinCbeU0YUQBInPBMxIQbwoxcwbd0IibcuzLtrdRAvfg2+1kKfvbvmwSaYf6H+da3MlhNNrYIXzqc79CE7XL8tsksiG8/RzjZl1qDHm1yoz1scOe6KT3qGLK5onyeCKMtqqv7lLtGEdgugNVyejQsJXvJgF6phU2RODExY8RxSY/SwX0MCRj5h1HeQ87iRUE0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bNk3WKd42Sb5gX2E/4nBiJcOd16+VmQYgqISr4csOVc=; b=Sbc16n6SQ8qAmnjKnNAbG5i1Kr6cZazSDNPiTiCHwG0lXenGpfW8d7ngtRBjxB5gVIngtJaKidhH2BRIsv8s3yGV7ZtpJPP8/IJXTFHkS+WhTSz7ej0j62Cx6TaxgH1DDYRjJyzJYICCccj35I29t4O45exul+AEQRF7SKOFvPxMXldnwehGPHtTDWNAc6Rw0pSfk0cTh3jH0bgwAGTMjN0Smx81+G5sGcaymDEMM9I/Mtv0YDtbbp5SGYkaK2VcQG5UVkAZadiB8AbfW8Lik1gk/WMER3chZo9vDum5Gg/Alq7KpRM3U6BNKSacIp7Inq097FU9i1afhxzpZh5jlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from HE1EUR01FT023.eop-EUR01.prod.protection.outlook.com (10.152.0.57) by HE1EUR01HT125.eop-EUR01.prod.protection.outlook.com (10.152.0.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2387.20; Wed, 6 Nov 2019 22:34:22 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com (10.152.0.53) by HE1EUR01FT023.mail.protection.outlook.com (10.152.0.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20 via Frontend Transport; Wed, 6 Nov 2019 22:34:22 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc]) by HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc%7]) with mapi id 15.20.2408.028; Wed, 6 Nov 2019 22:34:22 +0000 From: Jonas Karlman To: Mauro Carvalho Chehab , Ezequiel Garcia CC: Jonas Karlman , Hans Verkuil , Boris Brezillon , Tomasz Figa , Philipp Zabel , "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v3 3/5] media: hantro: Use output buffer width and height for H264 decoding Thread-Topic: [PATCH v3 3/5] media: hantro: Use output buffer width and height for H264 decoding Thread-Index: AQHVlPJVagG3x/gBBEusb21b5/5jpg== Date: Wed, 6 Nov 2019 22:34:22 +0000 Message-ID: References: <20191106223408.2176-1-jonas@kwiboo.se> In-Reply-To: <20191106223408.2176-1-jonas@kwiboo.se> Accept-Language: sv-SE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0402CA0025.eurprd04.prod.outlook.com (2603:10a6:7:7c::14) To HE1PR06MB4011.eurprd06.prod.outlook.com (2603:10a6:7:9c::32) x-incomingtopheadermarker: OriginalChecksum:FC86266FB41A1F49C46E1D9F9EEED5328166F2367B4FD3262DA403DD1064FA8B;UpperCasedChecksum:BFF902FCD1DAED98C6AEABF56F5ABD4745FF114983D392DD7F0B217E1C2C1A3D;SizeAsReceived:7659;Count:49 x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-tmn: [L5pv19f9XqodnBsgP5iFjhY2HUbUL0U7] x-microsoft-original-message-id: <20191106223408.2176-3-jonas@kwiboo.se> x-ms-publictraffictype: Email x-incomingheadercount: 49 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 846aed8c-0087-49a6-4a60-08d76309783e x-ms-traffictypediagnostic: HE1EUR01HT125: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8wpzH42w9e5m09u4m9Eg5QWvNLgNAy+9nGfrTTullAfULhNbHMnBMk0reEsyJJU3K4QbaGZngIWTIWu8/3C4IYndgo5KILbE0FmwYZvHqTKK4DPGelCa8pLZbx/dX/51/zBSXEKaGdpXEBrtrP+nEkAoKV6YCoVhTs7gBrQYbW4t9YSIe63Jn0TpfZzTIDz5 x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 846aed8c-0087-49a6-4a60-08d76309783e X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 22:34:22.3745 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT125 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Calculations for motion vector buffer offset is based on width and height from the configured output format, lets use the same values for macroblock width and height hw regs. Fixes: dea0a82f3d22 ("media: hantro: Add support for H264 decoding on G1") Signed-off-by: Jonas Karlman Reviewed-by: Boris Brezillon --- Changes in v3: - change to use src_fmt instead of dst_fmt (Boris) Changes in v2: - new patch split from "media: hantro: Fix H264 motion vector buffer offset" --- drivers/staging/media/hantro/hantro_g1_h264_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c index 30d977c3d529..27d40d8d3728 100644 --- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c @@ -51,8 +51,8 @@ static void set_params(struct hantro_ctx *ctx) vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL0); /* Decoder control register 1. */ - reg = G1_REG_DEC_CTRL1_PIC_MB_WIDTH(sps->pic_width_in_mbs_minus1 + 1) | - G1_REG_DEC_CTRL1_PIC_MB_HEIGHT_P(sps->pic_height_in_map_units_minus1 + 1) | + reg = G1_REG_DEC_CTRL1_PIC_MB_WIDTH(MB_WIDTH(ctx->src_fmt.width)) | + G1_REG_DEC_CTRL1_PIC_MB_HEIGHT_P(MB_HEIGHT(ctx->src_fmt.height)) | G1_REG_DEC_CTRL1_REF_FRAMES(sps->max_num_ref_frames); vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL1); From patchwork Wed Nov 6 22:35:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 11231291 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D26816B1 for ; Wed, 6 Nov 2019 22:35:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 421FE218AE for ; Wed, 6 Nov 2019 22:35:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732704AbfKFWfO convert rfc822-to-8bit (ORCPT ); Wed, 6 Nov 2019 17:35:14 -0500 Received: from mail-oln040092066068.outbound.protection.outlook.com ([40.92.66.68]:25767 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726817AbfKFWfO (ORCPT ); Wed, 6 Nov 2019 17:35:14 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bj/2W6dBnX9pmVSDMxEmH0wS2Myl7AllBkfYlIP3MCDzn0udqP8GCMeot189Gf+KLvz9PVDJRREW3VrNjgjSKSK2m6mCJZBGyv3Bqe4NLeg2Qy8UIsb4XuHzFFmCM/womD9upsrRnfR5yL7O77mS6xjapsWEbNMJzToDJ099hRw+GVpr/qgFreefyg05VhZ2YEhvGMuglBEJjWYaMArzdZgLuSHNlShQ9oR1Ny63Wy9ZM4sa0voxeC1k7pzrjJ08Sn1kFRIt5ZqFOWt29etk2kvsAgCdFEF2qgem33GyvlL0CVM4HJckp5zdQjF+PMbdeQTp3F3U+TDZ360ejmwPrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KsBpexsyKw6BXJAqCMkBPQhOWuqmNJ/8OoDhePT0nvg=; b=Hfo3aPVwuK9H8ogyXfB5L9l/bLjkEKb8dhsS04I3lZxSfDdHR3z0g8QF8rPdXwJ/TmLft8cMAyp7uyrQWIqqhtQFuYkQOZP+vJBpDgotKTAhWJRqbao5D6aMp73ChoimV92lxxdLDheyeLW3rM2h1ez42lqkaQ5YiHd94fv3Lc4TSGqL89uWGbttwELP8sqcwaB5r596PPkPRUozg68mGSGvWKb5p+fh1hASqnEUyL1mRlEaVtbdgOCqp5M+ckcIeBOcq+hXs1PIWf0fzayabQQ7E5yI2dIpVgt390lyKV9mHX4di+/ps3+BghIghbZoA5nLmNVm3KWsJGC5USUlEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from HE1EUR01FT023.eop-EUR01.prod.protection.outlook.com (10.152.0.54) by HE1EUR01HT107.eop-EUR01.prod.protection.outlook.com (10.152.0.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2387.20; Wed, 6 Nov 2019 22:35:10 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com (10.152.0.53) by HE1EUR01FT023.mail.protection.outlook.com (10.152.0.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20 via Frontend Transport; Wed, 6 Nov 2019 22:35:10 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc]) by HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc%7]) with mapi id 15.20.2408.028; Wed, 6 Nov 2019 22:35:10 +0000 From: Jonas Karlman To: Mauro Carvalho Chehab , Ezequiel Garcia CC: Jonas Karlman , Hans Verkuil , Boris Brezillon , Tomasz Figa , Philipp Zabel , "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v3 4/5] media: hantro: Remove now unused H264 pic_size Thread-Topic: [PATCH v3 4/5] media: hantro: Remove now unused H264 pic_size Thread-Index: AQHVlPJy2NHdaG7jCEe3VRcs+EOxMw== Date: Wed, 6 Nov 2019 22:35:10 +0000 Message-ID: References: In-Reply-To: Accept-Language: sv-SE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0011.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::21) To HE1PR06MB4011.eurprd06.prod.outlook.com (2603:10a6:7:9c::32) x-incomingtopheadermarker: OriginalChecksum:BFDCAEF492AF37A0F06B337CE238938FB5A52ECB6D05F246CA369CAE3B125038;UpperCasedChecksum:FCAD9F7EC7CFF1985DDFB07246F8BD5F56FCDB7B8CD1309E5CAEDD35F6AA66D0;SizeAsReceived:7585;Count:49 x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-tmn: [HGWCUkckwjlwcd01mHSOEmw8yKPFrP2P] x-microsoft-original-message-id: <20191106223456.2231-1-jonas@kwiboo.se> x-ms-publictraffictype: Email x-incomingheadercount: 49 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 212f4cad-133e-4435-387e-08d7630994da x-ms-traffictypediagnostic: HE1EUR01HT107: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wO6AtUeqbMXSPLQYlJOQyynDSMzLc/zX+IwvqIPa1gtzeF++YQfqtSrExVncgAZIIbF7SRdoLc4koJCQmQuPSj35hJguO1xoxYhk+lUE9rNIVCJ/gN95ZC7gmcHGSr0qWt+E9pYDowTegOHl4nXjNli2UcbfYwPAi3yjmve0thvypeSWaFJzj/sjF4lWynhG x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 212f4cad-133e-4435-387e-08d7630994da X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 22:35:10.2917 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT107 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org pic_size in hantro_h264_dec_hw_ctx struct is no longer used, lets remove it. Signed-off-by: Jonas Karlman Reviewed-by: Boris Brezillon --- drivers/staging/media/hantro/hantro_h264.c | 5 ----- drivers/staging/media/hantro/hantro_hw.h | 3 --- 2 files changed, 8 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c index 694a330f508e..568640eab3a6 100644 --- a/drivers/staging/media/hantro/hantro_h264.c +++ b/drivers/staging/media/hantro/hantro_h264.c @@ -618,7 +618,6 @@ int hantro_h264_dec_init(struct hantro_ctx *ctx) struct hantro_h264_dec_hw_ctx *h264_dec = &ctx->h264_dec; struct hantro_aux_buf *priv = &h264_dec->priv; struct hantro_h264_dec_priv_tbl *tbl; - struct v4l2_pix_format_mplane pix_mp; priv->cpu = dma_alloc_coherent(vpu->dev, sizeof(*tbl), &priv->dma, GFP_KERNEL); @@ -629,9 +628,5 @@ int hantro_h264_dec_init(struct hantro_ctx *ctx) tbl = priv->cpu; memcpy(tbl->cabac_table, h264_cabac_table, sizeof(tbl->cabac_table)); - v4l2_fill_pixfmt_mp(&pix_mp, ctx->dst_fmt.pixelformat, - ctx->dst_fmt.width, ctx->dst_fmt.height); - h264_dec->pic_size = pix_mp.plane_fmt[0].sizeimage; - return 0; } diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index 69b88f4d3fb3..fa91dd1848b7 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -80,15 +80,12 @@ struct hantro_h264_dec_reflists { * @dpb: DPB * @reflists: P/B0/B1 reflists * @ctrls: V4L2 controls attached to a run - * @pic_size: Size in bytes of decoded picture, this is needed - * to pass the location of motion vectors. */ struct hantro_h264_dec_hw_ctx { struct hantro_aux_buf priv; struct v4l2_h264_dpb_entry dpb[HANTRO_H264_DPB_SIZE]; struct hantro_h264_dec_reflists reflists; struct hantro_h264_dec_ctrls ctrls; - size_t pic_size; }; /** From patchwork Wed Nov 6 22:35:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 11231293 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF06D13BD for ; Wed, 6 Nov 2019 22:35:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B7CD21929 for ; Wed, 6 Nov 2019 22:35:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732791AbfKFWfP convert rfc822-to-8bit (ORCPT ); Wed, 6 Nov 2019 17:35:15 -0500 Received: from mail-oln040092064088.outbound.protection.outlook.com ([40.92.64.88]:28165 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727328AbfKFWfP (ORCPT ); Wed, 6 Nov 2019 17:35:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dwifi2WHenyUWZUFnMZcujqZLMuRxKAyvETGvkdnFFi6uS+u88X1LPh9IPAhk+H+GkNODmp0K0YajEFUIkMi7oduCLedXnwk9SAqamS8plArmlNG8qJEOV+7DNMd+L9nBOykDD7xyUE8vY1KDSUfWWRU4Hf2jx9Qj9fDmC5nsHLhSf4Qh8iJcsLzeRsjzN2JQSEL7OPX08JxCNjwRC0qoYYR9pn/lXHaXYOWfble54xQxYf4ft8jG5PH/oe5pi0RHPI8F9+ZrhnAtTroUZH59E3fGJKcKmJ/XNKYZeLKhSjHwDAXTzEg48yTD1qwkvsipXykY0cdkEp60diOSQFg4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1OPe+fb97oluh+t9hbwEkniByC1FC63cXM4fZqXncXQ=; b=eznjEPhLh4p5wskj4svgGT7eSVVkrigsEUyepDvi6XuuzcuTxe8wA+Y1nqxZpvKMzI8SxNstDHDy5s07ajWCY22S+P9I8NrLqfDVRezUcB9UkvEmc8kPEKhPikyOUOzmHUau3qQ2vSSTiLOGn/Vnv1H8byxAlBS88Af3BIf2kjTZ/sqEwIhZprF82fa5S6qd8FzBUa6T1DEcRvXGCP/7+blrgywA+etVX6uQXMLiBLnPcjcuTLMqPekiX9TAaDAZyQ/fQHqh3Z9ytkykmZP2EgI6r8NNvZQmqO+Dtqn+liDNr7Q7rL1sw2aHsp9FZUSZIZeaTTULGBz0xpMx7L/ZsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from HE1EUR01FT023.eop-EUR01.prod.protection.outlook.com (10.152.0.51) by HE1EUR01HT196.eop-EUR01.prod.protection.outlook.com (10.152.1.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20; Wed, 6 Nov 2019 22:35:11 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com (10.152.0.53) by HE1EUR01FT023.mail.protection.outlook.com (10.152.0.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20 via Frontend Transport; Wed, 6 Nov 2019 22:35:11 +0000 Received: from HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc]) by HE1PR06MB4011.eurprd06.prod.outlook.com ([fe80::b1cf:db6f:95fc:84cc%7]) with mapi id 15.20.2408.028; Wed, 6 Nov 2019 22:35:11 +0000 From: Jonas Karlman To: Mauro Carvalho Chehab , Ezequiel Garcia CC: Jonas Karlman , Hans Verkuil , Boris Brezillon , Tomasz Figa , Philipp Zabel , "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v3 5/5] media: hantro: Set H264 FIELDPIC_FLAG_E flag correctly Thread-Topic: [PATCH v3 5/5] media: hantro: Set H264 FIELDPIC_FLAG_E flag correctly Thread-Index: AQHVlPJzwQY9pzF2rE6i7nBwc3b4fQ== Date: Wed, 6 Nov 2019 22:35:11 +0000 Message-ID: References: <20191106223456.2231-1-jonas@kwiboo.se> In-Reply-To: <20191106223456.2231-1-jonas@kwiboo.se> Accept-Language: sv-SE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0011.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::21) To HE1PR06MB4011.eurprd06.prod.outlook.com (2603:10a6:7:9c::32) x-incomingtopheadermarker: OriginalChecksum:7A9562009A8B0CFA8ECB4EEBEA733DEA74AADFEDAA30AF7EB6AAE8BB6879FBEC;UpperCasedChecksum:10FD2EF91D6F598D1E1723089999768EF23398A1230DE31A40DD434EAD160D73;SizeAsReceived:7611;Count:49 x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-tmn: [oS3SogeI94SO73Q6naetwVMvFASxWXfs] x-microsoft-original-message-id: <20191106223456.2231-2-jonas@kwiboo.se> x-ms-publictraffictype: Email x-incomingheadercount: 49 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 6d1ea9ed-32e4-41d3-1797-08d763099540 x-ms-traffictypediagnostic: HE1EUR01HT196: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WHNDBMUDpqIzdC+81JDr/cTZRrtqaB6v1P8R2b+cGmRGlmVZktfze2+FIN0OLkBYNH6A3iXsLt+/lFpLt3s6zVT94O/AcNW3b0+ibaCO7qCIpWHtZEKi2fwzzX7MRc4baVxAxZWaGgvD9i/oq05R4rkhjJUtP1jvcmqql1X3NWb5XVXuBn7t8hQHONJPrdLB x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 6d1ea9ed-32e4-41d3-1797-08d763099540 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 22:35:11.2471 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT196 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The FIELDPIC_FLAG_E bit should be set when field_pic_flag exists in stream, it is currently set based on field_pic_flag of current frame. The PIC_FIELDMODE_E bit is correctly set based on the field_pic_flag. Fix this by setting the FIELDPIC_FLAG_E bit when frame_mbs_only is not set. Fixes: dea0a82f3d22 ("media: hantro: Add support for H264 decoding on G1") Signed-off-by: Jonas Karlman Reviewed-by: Boris Brezillon --- drivers/staging/media/hantro/hantro_g1_h264_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c index 27d40d8d3728..3cd40a8f0daa 100644 --- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c @@ -63,7 +63,7 @@ static void set_params(struct hantro_ctx *ctx) /* always use the matrix sent from userspace */ reg |= G1_REG_DEC_CTRL2_TYPE1_QUANT_E; - if (slices[0].flags & V4L2_H264_SLICE_FLAG_FIELD_PIC) + if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY)) reg |= G1_REG_DEC_CTRL2_FIELDPIC_FLAG_E; vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL2);