Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752677AbdF0Ijg (ORCPT ); Tue, 27 Jun 2017 04:39:36 -0400 Received: from mail-yw0-f182.google.com ([209.85.161.182]:36048 "EHLO mail-yw0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752648AbdF0Ijc (ORCPT ); Tue, 27 Jun 2017 04:39:32 -0400 MIME-Version: 1.0 In-Reply-To: <1498488673-27900-1-git-send-email-jacob-chen@iotwrt.com> References: <1498488673-27900-1-git-send-email-jacob-chen@iotwrt.com> From: Tomasz Figa Date: Tue, 27 Jun 2017 17:39:09 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/5] [media] rockchip/rga: v4l2 m2m support To: Jacob Chen Cc: "linux-kernel@vger.kernel.org" , "open list:ARM/Rockchip SoC..." , "linux-arm-kernel@lists.infradead.org" , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Linux Media Mailing List , Mauro Carvalho Chehab , Hans Verkuil Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1725 Lines: 46 Hi Jacob, Please see my comments inline. On Mon, Jun 26, 2017 at 11:51 PM, Jacob Chen wrote: > Rockchip RGA is a separate 2D raster graphic acceleration unit. It > accelerates 2D graphics operations, such as point/line drawing, image > scaling, rotation, BitBLT, alpha blending and image blur/sharpness. [snip] > +static int rga_buf_init(struct vb2_buffer *vb) > +{ > + struct rga_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); > + struct rockchip_rga *rga = ctx->rga; > + struct sg_table *sgt; > + struct scatterlist *sgl; > + unsigned int *pages; > + struct rga_buf *buf; > + unsigned int address, len, i, p; > + unsigned int mapped_size = 0; > + > + /* Create local MMU table for RGA */ > + sgt = vb2_plane_cookie(vb, 0); > + > + /* > + * Alloc (2^3 * 4K) = 32K byte for storing pages, those space could > + * cover 32K * 4K = 128M ram address. Unless I'm missing something, there is 1024 32-bit values in one 4K page, which can point to 4 MB of memory. The code allocates 8 of them, which in total allows at most 32 MB per buffer. > + */ > + pages = (unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3); This is rather unfortunate and you should expect failures here on actively used systems with uptime longer than few hours. Changing this to dma_alloc_coherent() and enabling CMA _might_ give you a bit better success rate, but... Normally, this kind of (scatter-gather capable) hardware would allow some kind of linking of separate pages, e.g. last entry in the page would point to the next page, or something like that. Doesn't this RGA block have something similar? Best regards, Tomasz