Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1966638imu; Thu, 24 Jan 2019 05:11:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN4U2v8BIeNBAx/DQ7Eg6rQqvkNuxlkEdPNxtNpxOxVJpfM6vzg3FuWr23O34xkcZYNdLhqV X-Received: by 2002:a63:2d2:: with SMTP id 201mr5894283pgc.14.1548335461871; Thu, 24 Jan 2019 05:11:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548335461; cv=none; d=google.com; s=arc-20160816; b=WHrVDs/6eNJNC9ybLgcxwjiugHMp5nusvtkPWFsbzMxypii7gqKkIZt621uyyNRvd5 5raOziYvtBPZ4IPXbqcvp68hs7fCgsGePbFxx5JpG1T/ZH0RllkkQWsppJJIrJdtg5Cc 6UydmZT8BuXmaBIL/4bILUpQc+MCrAqK2FGgftDZbIvjUCb6wXUxxV5P7wJUxofNF+s/ LempfnN1ovzruy1tcgXlAeuezb2b4x44/ikKQthNI5Y2UT2PCIk9OWA7XlS22rTFVdWI SrCJdD1exFUQh6ltwXuRkei1UsxhDTK0YCK9xElWcha3kHJ2nI7V/gdZlP9Hb6ipuOeE vMFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=QSHt900CycGzflrnFb4qEtkf0GCy4UXkAPSwjN4p0Nw=; b=CqSUuGop51KnVDVSRvmgGqT+49cVPCPlOhij8I+LJ74KAZfjB6PLK668cXOdjJ1nBk YATLFwocL5Ndyu1+Jo0srzKN7Yx3tapP+QUBsjVI7qRKy33Z8P7qr0tDHwKlmrUPpdB7 PtvE+WVBkW2mnfAFQGaIdGslUz5W0sFxoYbZINJGA84kjD3THbE67wpynzCwwXQHYNZU EL0weUKZedmO2k8MumPsf8Hl56Xycu1qrC0Hpq5uRMmiHwWXmpLOhOY5seXSeas30KXd ilS/sBKoY75uAQ9FIKh8BDidZ5LGJb8RqAjpAkuTT5cFfgmbUh8pJAMc+2UhslvXUJmV WF3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c65si21575896pfa.148.2019.01.24.05.10.43; Thu, 24 Jan 2019 05:11:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727902AbfAXNKi (ORCPT + 99 others); Thu, 24 Jan 2019 08:10:38 -0500 Received: from mail.bootlin.com ([62.4.15.54]:37276 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726105AbfAXNKi (ORCPT ); Thu, 24 Jan 2019 08:10:38 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 2B14D209B6; Thu, 24 Jan 2019 14:10:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from aptenodytes (aaubervilliers-681-1-87-206.w90-88.abo.wanadoo.fr [90.88.29.206]) by mail.bootlin.com (Postfix) with ESMTPSA id AB8DC20654; Thu, 24 Jan 2019 14:10:24 +0100 (CET) Message-ID: <4f25de5bbcb7bf196fe4925f54e3335b50670bd2.camel@bootlin.com> Subject: Re: [PATCH v2 2/2] media: cedrus: Add HEVC/H.265 decoding support From: Paul Kocialkowski To: Maxime Ripard Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org, Mauro Carvalho Chehab , linux-sunxi@googlegroups.com, Randy Li , Hans Verkuil , Ezequiel Garcia , Tomasz Figa , Alexandre Courbot , Thomas Petazzoni Date: Thu, 24 Jan 2019 14:10:25 +0100 In-Reply-To: <20181127082119.xdemdwgclai7kj3r@flea> References: <20181123130209.11696-1-paul.kocialkowski@bootlin.com> <20181123130209.11696-3-paul.kocialkowski@bootlin.com> <20181127082119.xdemdwgclai7kj3r@flea> Organization: Bootlin Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.4 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, 2018-11-27 at 09:21 +0100, Maxime Ripard wrote: > Hi! > > On Fri, Nov 23, 2018 at 02:02:09PM +0100, Paul Kocialkowski wrote: > > This introduces support for HEVC/H.265 to the Cedrus VPU driver, with > > both uni-directional and bi-directional prediction modes supported. > > > > Field-coded (interlaced) pictures, custom quantization matrices and > > 10-bit output are not supported at this point. > > > > Signed-off-by: Paul Kocialkowski > > Output from checkpatch: > total: 0 errors, 68 warnings, 14 checks, 999 lines checked Looks like many of the "line over 80 chars" are due to macros. I don't think it would be a good idea to break them down or to change the macros names since they are directly inherited from the bitstream elements. What do you think? > > +/* > > + * Note: Neighbor info buffer size is apparently doubled for H6, which may be > > + * related to 10 bit H265 support. > > + */ > > +#define CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE (397 * SZ_1K) > > +#define CEDRUS_H265_ENTRY_POINTS_BUF_SIZE (4 * SZ_1K) > > +#define CEDRUS_H265_MV_COL_BUF_UNIT_CTB_SIZE 160 > > Having some information on where this is coming from would be useful. Yes, definitely. > > +static void cedrus_h265_sram_write_data(struct cedrus_dev *dev, u32 *data, > > Since the data pointer is pretty much an opaque structure, you should > have a void pointer here, that would avoid the type casting you're > doing when calling that function. Sure, that would make more sense. [...] > > + /* Output frame. */ > > + > > + output_pic_list_index = V4L2_HEVC_DPB_ENTRIES_NUM_MAX; > > + pic_order_cnt[0] = pic_order_cnt[1] = slice_params->slice_pic_order_cnt; > > + mv_col_buf_addr[0] = cedrus_h265_frame_info_mv_col_buf_addr(ctx, > > + run->dst->vb2_buf.index, 0) - PHYS_OFFSET; > > + mv_col_buf_addr[1] = cedrus_h265_frame_info_mv_col_buf_addr(ctx, > > + run->dst->vb2_buf.index, 1) - PHYS_OFFSET; > > + dst_luma_addr = cedrus_dst_buf_addr(ctx, run->dst->vb2_buf.index, 0) - > > + PHYS_OFFSET; > > + dst_chroma_addr = cedrus_dst_buf_addr(ctx, run->dst->vb2_buf.index, 1) - > > + PHYS_OFFSET; > > + > > + cedrus_h265_frame_info_write_single(dev, output_pic_list_index, > > + slice_params->pic_struct != 0, > > + pic_order_cnt, mv_col_buf_addr, > > + dst_luma_addr, dst_chroma_addr); > > You can only pass the run and slice_params pointers to that function. The point is to make it independent from the context, so that the same function can be called with either the slice_params or the dpb info. I don't think making two variants or even two wrappers would bring any significant benefit. > > + > > + cedrus_write(dev, VE_DEC_H265_OUTPUT_FRAME_IDX, output_pic_list_index); > > + > > + /* Reference picture list 0 (for P/B frames). */ > > + if (slice_params->slice_type != V4L2_HEVC_SLICE_TYPE_I) { > > + cedrus_h265_ref_pic_list_write(dev, slice_params->ref_idx_l0, > > + slice_params->num_ref_idx_l0_active_minus1 + 1, > > + slice_params->dpb, slice_params->num_active_dpb_entries, > > + VE_DEC_H265_SRAM_OFFSET_REF_PIC_LIST0); > > + > > slice_params is enough. The rationale is similar to the one above: being able to use the same helper with either L0 or L1, which implies passing the relevant elements directly. > > + if (pps->weighted_pred_flag || pps->weighted_bipred_flag) > > + cedrus_h265_pred_weight_write(dev, > > + pred_weight_table->delta_luma_weight_l0, > > + pred_weight_table->luma_offset_l0, > > + pred_weight_table->delta_chroma_weight_l0, > > + pred_weight_table->chroma_offset_l0, > > + slice_params->num_ref_idx_l0_active_minus1 + 1, > > + VE_DEC_H265_SRAM_OFFSET_PRED_WEIGHT_LUMA_L0, > > + VE_DEC_H265_SRAM_OFFSET_PRED_WEIGHT_CHROMA_L0); > > Ditto, that function should only take the pred_weight_table and > slice_params pointers And same rational as well. > > + } > > + > > + /* Reference picture list 1 (for B frames). */ > > + if (slice_params->slice_type == V4L2_HEVC_SLICE_TYPE_B) { > > + cedrus_h265_ref_pic_list_write(dev, slice_params->ref_idx_l1, > > + slice_params->num_ref_idx_l1_active_minus1 + 1, > > + slice_params->dpb, > > + slice_params->num_active_dpb_entries, > > + VE_DEC_H265_SRAM_OFFSET_REF_PIC_LIST1); > > + > > + if (pps->weighted_bipred_flag) > > + cedrus_h265_pred_weight_write(dev, > > + pred_weight_table->delta_luma_weight_l1, > > + pred_weight_table->luma_offset_l1, > > + pred_weight_table->delta_chroma_weight_l1, > > + pred_weight_table->chroma_offset_l1, > > + slice_params->num_ref_idx_l1_active_minus1 + 1, > > + VE_DEC_H265_SRAM_OFFSET_PRED_WEIGHT_LUMA_L1, > > + VE_DEC_H265_SRAM_OFFSET_PRED_WEIGHT_CHROMA_L1); > > + } > > Ditto > > Looks good otherwise, thanks! Thanks for the review! Cheers, Paul -- Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com