Linux Media Controller development
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>,
	linux-media@vger.kernel.org
Cc: nicolas.dufresne@collabora.com,
	laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl,
	kernel@collabora.com, dafna3@gmail.com,
	sakari.ailus@linux.intel.com, mchehab@kernel.org
Subject: Re: [PATCH v2] media: rkisp1: fix grey format iommu page faults
Date: Sun, 23 Jan 2022 11:50:26 +0200	[thread overview]
Message-ID: <1f8350f4-a2dc-5405-b48b-e657124f119d@collabora.com> (raw)
In-Reply-To: <164241927947.10801.12217816997308426483@Monstersaurus>



On 17.01.22 13:34, Kieran Bingham wrote:
> Hi Dafna,
> 
> Quoting Dafna Hirschfeld (2021-12-07 11:59:23)
>> Currently capturing grey format produces page faults
>> on both selfpath and mainpath. To support greyscale
>> we can capture YUV422 planar format and configure the U, V
>> buffers to the dummy buffer.
>>
>> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
>> ---
>> This is v2 of the patch "media: rkisp1: remove support for V4L2_PIX_FMT_GREY"
>> In v1 I removed the grey format. In this version it is 'fixed'
>>
>>   .../platform/rockchip/rkisp1/rkisp1-capture.c | 28 ++++++++++++++-----
>>   1 file changed, 21 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
>> index 768987d5f2dd..8e982dd0c740 100644
>> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
>> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
>> @@ -249,7 +249,7 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_sp_fmts[] = {
>>                  .fourcc = V4L2_PIX_FMT_GREY,
>>                  .uv_swap = 0,
>>                  .write_format = RKISP1_MI_CTRL_SP_WRITE_PLA,
>> -               .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV400,
>> +               .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422,
>>                  .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
>>          },
>>          /* rgb */
>> @@ -631,12 +631,26 @@ static void rkisp1_set_next_buf(struct rkisp1_capture *cap)
>>                  rkisp1_write(cap->rkisp1,
>>                               buff_addr[RKISP1_PLANE_Y],
>>                               cap->config->mi.y_base_ad_init);
>> -               rkisp1_write(cap->rkisp1,
>> -                            buff_addr[RKISP1_PLANE_CB],
>> -                            cap->config->mi.cb_base_ad_init);
>> -               rkisp1_write(cap->rkisp1,
>> -                            buff_addr[RKISP1_PLANE_CR],
>> -                            cap->config->mi.cr_base_ad_init);
>> +               /*
>> +                * In order to support grey format we capture
>> +                * YUV422 planar format from the camera and
>> +                * set the U and V planes to the dummy buffer
>> +                */
>> +               if (cap->pix.cfg->fourcc == V4L2_PIX_FMT_GREY) {
>> +                       rkisp1_write(cap->rkisp1,
>> +                                    cap->buf.dummy.dma_addr,
>> +                                    cap->config->mi.cb_base_ad_init);
>> +                       rkisp1_write(cap->rkisp1,
>> +                                    cap->buf.dummy.dma_addr,
>> +                                    cap->config->mi.cr_base_ad_init);
>> +               } else {
>> +                       rkisp1_write(cap->rkisp1,
>> +                                    buff_addr[RKISP1_PLANE_CB],
>> +                                    cap->config->mi.cb_base_ad_init);
>> +                       rkisp1_write(cap->rkisp1,
>> +                                    buff_addr[RKISP1_PLANE_CR],
>> +                                    cap->config->mi.cr_base_ad_init);
>> +               }
>>          } else {
> 
> Looking at this function, I think I would have initialised a local array
> of addresses (either to zero, or to the dummy address?) to then set
> values when appropriate, and reduce the number of calls to
> rkisp1_write() to a single set of three after the processing.
> 
> It might make the function simpler, and more readable, but it's more
> effort, and this does look like it will solve the greyscale format issue
> as discussed in earlier threads so I'd leave it up to you if you want to
> refactor.

Hi,
Yes, I'll do that.
Interestingly I found out that the patch causing the iommu page fault is

https://www.spinics.net/lists/linux-media/msg176089.html

Before that patch there are no iommu page faults but the video is corrupted.

I can't explain how I didn't find it before, I clearly remember testing the grey format.

Thanks,
Dafna




> 
> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> 
> 
>>                  /*
>>                   * Use the dummy space allocated by dma_alloc_coherent to
>> -- 
>> 2.17.1
>>

  reply	other threads:[~2022-01-23  9:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 11:59 [PATCH v2] media: rkisp1: fix grey format iommu page faults Dafna Hirschfeld
2022-01-17 11:34 ` Kieran Bingham
2022-01-23  9:50   ` Dafna Hirschfeld [this message]
2022-01-23 14:32     ` Laurent Pinchart
2022-01-23 16:31       ` Dafna Hirschfeld
2022-01-23 16:55         ` Dafna Hirschfeld
2022-01-31 15:31           ` Dafna Hirschfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f8350f4-a2dc-5405-b48b-e657124f119d@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=dafna3@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox