media:staging/intel-ipu3: parameter buffer refactoring
Subsystems (3)
PATCH v2 1/1 media:staging/intel-ipu3: parameter buffer refactoring
From: Bingbu Cao <[email protected]>
Current ImgU driver processes and releases the parameter buffer immediately after queued from user. This does not align with other image buffers which are grouped in sets and used for the same frame. If user queues multiple parameter buffers continuously, only the last one will take effect.
To make consistent buffers usage, this patch changes the parameter buffer handling and group parameter buffer with other image buffers for each frame.
Each time driver will queue one more group of buffers when previous frame processed and buffers consumed by css.
--- drivers/staging/media/ipu3/ipu3-css.c | 5 ---- drivers/staging/media/ipu3/ipu3-v4l2.c | 46 ++++++++++++---------------------- drivers/staging/media/ipu3/ipu3.c | 30 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 35 deletions(-)
---
changes since v1:
- add payload check for parameter buffer
- queue buffer only when previous buffer consumed
---
drivers/staging/media/ipu3/ipu3-css.c +0 -5
@@ -2160,11 +2160,6 @@ int imgu_css_set_parameters(struct imgu_css *css, unsigned int pipe, obgrid_size =imgu_css_fw_obgrid_size (bi); stripes = bi->info.isp.sp.iterator.num_stripes ? :1 ; -/* -* TODO(b/118782861): If userspace queues more than 4 buffers, the -* parameters from previous buffers will be overwritten. Fix the driver -* not to allow this. -*/ imgu_css_pool_get (&css_pipe->pool.parameter_set_info); param_set =imgu_css_pool_last (&css_pipe->pool.parameter_set_info,0 )->vaddr;
drivers/staging/media/ipu3/ipu3-v4l2.c +16 -30
66 lines not on this page · raw message
drivers/staging/media/ipu3/ipu3.c +30 -0
@@ -236,6 +236,11 @@ int imgu_queue_buffers(struct imgu_device *imgu, bool initial, unsigned int pipedev_dbg (&imgu->pci_dev->dev,"Queue buffers to pipe %d" , pipe);mutex_lock (&imgu->lock); +if (!imgu_css_pipe_queue_empty (&imgu->css, pipe)) { +mutex_unlock (&imgu->lock); +return 0 ; + } +/* Buffer set is queued to FW only when input buffer is ready */ for (node = IMGU_NODE_NUM - 1; imgu_queue_getbuf(imgu, IMGU_NODE_IN, pipe);
@@ -246,6 +251,31 @@ int imgu_queue_buffers(struct imgu_device *imgu, bool initial, unsigned int pipedev_warn (&imgu->pci_dev->dev,"Vf not enabled, ignore queue" );continue ; + }else if (node ==IMGU_NODE_PARAMS && + imgu_pipe->nodes[node].enabled) { +struct vb2_buffer *vb; +struct imgu_vb2_buffer *ivb; + +/* No parameters for this frame */ +if (list_empty (&imgu_pipe->nodes[node].buffers)) +continue ; + + ivb =list_first_entry (&imgu_pipe->nodes[node].buffers, + struct imgu_vb2_buffer, list); + vb = &ivb->vbb.vb2_buf; + r =imgu_css_set_parameters (&imgu->css, pipe, +vb2_plane_vaddr (vb,0 )); +if (r) { +vb2_buffer_done (vb,VB2_BUF_STATE_ERROR ); +dev_warn (&imgu->pci_dev->dev, +"set parameters failed." ); +continue ; + } + +vb2_buffer_done (vb,VB2_BUF_STATE_DONE ); +dev_dbg (&imgu->pci_dev->dev, +"queue user parameters %d to css." , vb->index); +list_del (&ivb->list); }else if (imgu_pipe->queue_enabled[node]) {struct imgu_css_buffer *buf =imgu_queue_getbuf (imgu, node, pipe);
Signature · 1 line
1.9.1
Hi Bingbu,
Quoted 22 lines · On Fri, Mar 22, 2019 at 8:00 PM <[email protected]> wrote:
From: Bingbu Cao <[email protected]>
Current ImgU driver processes and releases the parameter buffer immediately after queued from user. This does not align with other image buffers which are grouped in sets and used for the same frame. If user queues multiple parameter buffers continuously, only the last one will take effect.
To make consistent buffers usage, this patch changes the parameter buffer handling and group parameter buffer with other image buffers for each frame.
Each time driver will queue one more group of buffers when previous frame processed and buffers consumed by css.Signed-off-by Tianshu Qiu <[email protected]>Signed-off-by Bingbu Cao <[email protected]>--- drivers/staging/media/ipu3/ipu3-css.c | 5 ---- drivers/staging/media/ipu3/ipu3-v4l2.c | 46 ++++++++++++---------------------- drivers/staging/media/ipu3/ipu3.c | 30 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 35 deletions(-)
Quoted 5 lines
---
changes since v1:
- add payload check for parameter buffer
- queue buffer only when previous buffer consumed
---
Thanks for the patch. With the issues pointed by Sakari fixed (+/- those for follow up patches):
By the way, has this been tested on an applicable platform with applicable platform (e.g. Pixel Slate with Chrome OS) and found no performance or functional regressions?
Best regards,
Tomasz
Quoted 31 lines · Tomasz Figa
Hi Bingbu,
Quoted 22 lines · On Fri, Mar 22, 2019 at 8:00 PM <[email protected]> wrote:
From: Bingbu Cao <[email protected]>
Current ImgU driver processes and releases the parameter buffer immediately after queued from user. This does not align with other image buffers which are grouped in sets and used for the same frame. If user queues multiple parameter buffers continuously, only the last one will take effect.
To make consistent buffers usage, this patch changes the parameter buffer handling and group parameter buffer with other image buffers for each frame.
Each time driver will queue one more group of buffers when previous frame processed and buffers consumed by css.Signed-off-by Tianshu Qiu <[email protected]>Signed-off-by Bingbu Cao <[email protected]>--- drivers/staging/media/ipu3/ipu3-css.c | 5 ---- drivers/staging/media/ipu3/ipu3-v4l2.c | 46 ++++++++++++---------------------- drivers/staging/media/ipu3/ipu3.c | 30 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 35 deletions(-)Quoted 5 lines
---
changes since v1:
- add payload check for parameter buffer
- queue buffer only when previous buffer consumed
---
Quoted 8 lines
Thanks for the patch. With the issues pointed by Sakari fixed (+/- those for follow up patches):
Reviewed-by Tomasz Figa <[email protected]>By the way, has this been tested on an applicable platform with applicable platform (e.g. Pixel Slate with Chrome OS) and found no performance or functional regressions?
Hi, Tomasz
Yes, same change was verified in our own integration process with full test, validation team did not find functional regressions. However, if you have some extra tests which can check the performance, I will add them into the test cases list.
Quoted 4 lines
Best regards,
Tomasz
Hi Bingbu,
Quoted 43 lines · Bingbu Cao
Quoted 31 lines · Tomasz Figa
Hi Bingbu,
Quoted 22 lines · On Fri, Mar 22, 2019 at 8:00 PM <[email protected]> wrote:
From: Bingbu Cao <[email protected]>
Current ImgU driver processes and releases the parameter buffer immediately after queued from user. This does not align with other image buffers which are grouped in sets and used for the same frame. If user queues multiple parameter buffers continuously, only the last one will take effect.
To make consistent buffers usage, this patch changes the parameter buffer handling and group parameter buffer with other image buffers for each frame.
Each time driver will queue one more group of buffers when previous frame processed and buffers consumed by css.Signed-off-by Tianshu Qiu <[email protected]>Signed-off-by Bingbu Cao <[email protected]>--- drivers/staging/media/ipu3/ipu3-css.c | 5 ---- drivers/staging/media/ipu3/ipu3-v4l2.c | 46 ++++++++++++---------------------- drivers/staging/media/ipu3/ipu3.c | 30 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 35 deletions(-)Quoted 5 lines
---
changes since v1:
- add payload check for parameter buffer
- queue buffer only when previous buffer consumed
---Quoted 8 lines
Thanks for the patch. With the issues pointed by Sakari fixed (+/- those for follow up patches):
Reviewed-by Tomasz Figa <[email protected]>By the way, has this been tested on an applicable platform with applicable platform (e.g. Pixel Slate with Chrome OS) and found no performance or functional regressions?
Quoted 6 lines
Hi, Tomasz
Yes, same change was verified in our own integration process with full test, validation team did not find functional regressions. However, if you have some extra tests which can check the performance, I will add them into the test cases list.
For example, the camera_HAL3Perf test on Chrome OS could be used to measure various latencies, with a side note that some of them depend on environment lighting, so should be run in good lighting conditions.
Best regards,
Tomasz