Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1675413 > unrolled thread

Re: [PATCH 1/5] [media] rockchip/rga: v4l2 m2m support

Started byTomasz Figa <tfiga@chromium.org>
First post2017-06-27 10:40 +0200
Last post2017-06-28 02:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/5] [media] rockchip/rga: v4l2 m2m support Tomasz Figa <tfiga@chromium.org> - 2017-06-27 10:40 +0200
    Re: [PATCH 1/5] [media] rockchip/rga: v4l2 m2m support Jacob Chen <jacobchen110@gmail.com> - 2017-06-27 17:50 +0200
    Re: [PATCH 1/5] [media] rockchip/rga: v4l2 m2m support Jacob Chen <jacobchen110@gmail.com> - 2017-06-28 02:40 +0200

#1675413 — Re: [PATCH 1/5] [media] rockchip/rga: v4l2 m2m support

FromTomasz Figa <tfiga@chromium.org>
Date2017-06-27 10:40 +0200
SubjectRe: [PATCH 1/5] [media] rockchip/rga: v4l2 m2m support
Message-ID<tWUcq-6mA-19@gated-at.bofh.it>
Hi Jacob,

Please see my comments inline.

On Mon, Jun 26, 2017 at 11:51 PM, Jacob Chen <jacob-chen@iotwrt.com> 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

[toc] | [next] | [standalone]


#1675927

FromJacob Chen <jacobchen110@gmail.com>
Date2017-06-27 17:50 +0200
Message-ID<tX0Uy-2xM-17@gated-at.bofh.it>
In reply to#1675413
Hi Tomasz,
Yeah, the comments are wrong, i will correct it

>> +        */
>> +       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?
>

Thx for pointing it out ! : )

I looked RGA drvier used in rockchip android and i find it use
kmalloc, so i think it might support separate pages.
I will test it.


> Best regards,
> Tomasz

[toc] | [prev] | [next] | [standalone]


#1676292

FromJacob Chen <jacobchen110@gmail.com>
Date2017-06-28 02:40 +0200
Message-ID<tX9bs-86t-5@gated-at.bofh.it>
In reply to#1675413
Hi,

2017-06-27 16:39 GMT+08:00 Tomasz Figa <tfiga@chromium.org>:
> Hi Jacob,
>
> Please see my comments inline.
>
> On Mon, Jun 26, 2017 at 11:51 PM, Jacob Chen <jacob-chen@iotwrt.com> 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...
>

I decide to alloc a page pool when driver probe and get page from that poll.

> 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web