[libcamera-devel,RFC,0/3] Add an option to enable rendering YUV frame by OpenGL shader
mbox series

Message ID 20200320085029.17875-1-show.liu@linaro.org
Headers show
Series
  • Add an option to enable rendering YUV frame by OpenGL shader
Related show

Message

Show Liu March 20, 2020, 8:50 a.m. UTC
Hi all,
  I would like to share my adventure on qcam. 
I added an option to enable rendering YUV frame by OpenGL shader for qcam.
Honestly, it's still in progress, and only support NV12 format at present. 
However the improvement is obviously. I logged the messages below when qcam running.
https://pastebin.linaro.org/view/20d91f21
In 1280x800 mode:
format convert by CPU is around ~4 fps, rendering by GPU up to ~30.0 fps
In 1920x1080 mode:
format convert by CPU is around ~2 fps, rendering by GPU still up to ~30.0 fps

  The improvement still in progress, including more YUV formats support ... etc.
And some parts I added are not in good shape, I am trying to make it better. 
So I appreciate any review conments and suggestion.

It's also available on below.
https://github.com/showliu/libcamera/commits/qcam_opengl_hack2

I tested with kernel 5.5rc5 + Panfrost GPU driver on Rock Pi 4B platform.

Show Liu (3):
  qcam: Added statusbar to show the camera stream configuration
  qcam: Added opengl widget class for qcam
  qcam: added an option to enable rendering via OpenGL shader

 src/qcam/glwidget.cpp    | 213 +++++++++++++++++++++++++++++++++++++++
 src/qcam/glwidget.h      |  76 ++++++++++++++
 src/qcam/main.cpp        |   2 +
 src/qcam/main_window.cpp |  36 ++++++-
 src/qcam/main_window.h   |   3 +
 src/qcam/meson.build     |   4 +-
 6 files changed, 330 insertions(+), 4 deletions(-)
 create mode 100644 src/qcam/glwidget.cpp
 create mode 100644 src/qcam/glwidget.h

Comments

Niklas Söderlund March 20, 2020, 1:50 p.m. UTC | #1
Hi Show,

Thanks for your work!

On 2020-03-20 16:50:26 +0800, Show Liu wrote:
> Hi all,
>   I would like to share my adventure on qcam. 
> I added an option to enable rendering YUV frame by OpenGL shader for qcam.
> Honestly, it's still in progress, and only support NV12 format at present. 
> However the improvement is obviously. I logged the messages below when qcam running.
> https://pastebin.linaro.org/view/20d91f21
> In 1280x800 mode:
> format convert by CPU is around ~4 fps, rendering by GPU up to ~30.0 fps
> In 1920x1080 mode:
> format convert by CPU is around ~2 fps, rendering by GPU still up to ~30.0 fps

I have tested this and I get similar result on different device using 
Panfrost GPU, really nice work!

One general observation is that I do get a graphic artifact in the qcam 
GUI, covering about half the dropdown box for camera selection. If I 
specify --opengl the artifact is filled with black, without --opengl 
it's filled with white. If I run without the OpenGL patches I get no 
artifact. I'm not sure if this is an effect of the panfrost driver or 
not.

I first tried applying the patches to latest libcamera master, but they 
did not apply. It was easy to solve but you might want to pull in the 
latest changes to qcam so you don't have to solve conflicts later.

I will review the individual patches but just wanted to let you know how 
happy I am seeing and testing this series ;-)

> 
>   The improvement still in progress, including more YUV formats support ... etc.
> And some parts I added are not in good shape, I am trying to make it better. 
> So I appreciate any review conments and suggestion.
> 
> It's also available on below.
> https://github.com/showliu/libcamera/commits/qcam_opengl_hack2
> 
> I tested with kernel 5.5rc5 + Panfrost GPU driver on Rock Pi 4B platform.
> 
> Show Liu (3):
>   qcam: Added statusbar to show the camera stream configuration
>   qcam: Added opengl widget class for qcam
>   qcam: added an option to enable rendering via OpenGL shader
> 
>  src/qcam/glwidget.cpp    | 213 +++++++++++++++++++++++++++++++++++++++
>  src/qcam/glwidget.h      |  76 ++++++++++++++
>  src/qcam/main.cpp        |   2 +
>  src/qcam/main_window.cpp |  36 ++++++-
>  src/qcam/main_window.h   |   3 +
>  src/qcam/meson.build     |   4 +-
>  6 files changed, 330 insertions(+), 4 deletions(-)
>  create mode 100644 src/qcam/glwidget.cpp
>  create mode 100644 src/qcam/glwidget.h
> 
> -- 
> 2.20.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Niklas Söderlund March 20, 2020, 2:48 p.m. UTC | #2
On 2020-03-20 14:50:38 +0100, Niklas Söderlund wrote:
> Hi Show,
> 
> Thanks for your work!
> 
> On 2020-03-20 16:50:26 +0800, Show Liu wrote:
> > Hi all,
> >   I would like to share my adventure on qcam. 
> > I added an option to enable rendering YUV frame by OpenGL shader for qcam.
> > Honestly, it's still in progress, and only support NV12 format at present. 
> > However the improvement is obviously. I logged the messages below when qcam running.
> > https://pastebin.linaro.org/view/20d91f21
> > In 1280x800 mode:
> > format convert by CPU is around ~4 fps, rendering by GPU up to ~30.0 fps
> > In 1920x1080 mode:
> > format convert by CPU is around ~2 fps, rendering by GPU still up to ~30.0 fps
> 
> I have tested this and I get similar result on different device using 
> Panfrost GPU, really nice work!
> 
> One general observation is that I do get a graphic artifact in the qcam 
> GUI, covering about half the dropdown box for camera selection. If I 
> specify --opengl the artifact is filled with black, without --opengl 
> it's filled with white. If I run without the OpenGL patches I get no 
> artifact. I'm not sure if this is an effect of the panfrost driver or 
> not.

I get same behavior of the artifact on other systems as well so it's 
somehow related the this series I think.

> 
> I first tried applying the patches to latest libcamera master, but they 
> did not apply. It was easy to solve but you might want to pull in the 
> latest changes to qcam so you don't have to solve conflicts later.
> 
> I will review the individual patches but just wanted to let you know how 
> happy I am seeing and testing this series ;-)
> 
> > 
> >   The improvement still in progress, including more YUV formats support ... etc.
> > And some parts I added are not in good shape, I am trying to make it better. 
> > So I appreciate any review conments and suggestion.
> > 
> > It's also available on below.
> > https://github.com/showliu/libcamera/commits/qcam_opengl_hack2
> > 
> > I tested with kernel 5.5rc5 + Panfrost GPU driver on Rock Pi 4B platform.
> > 
> > Show Liu (3):
> >   qcam: Added statusbar to show the camera stream configuration
> >   qcam: Added opengl widget class for qcam
> >   qcam: added an option to enable rendering via OpenGL shader
> > 
> >  src/qcam/glwidget.cpp    | 213 +++++++++++++++++++++++++++++++++++++++
> >  src/qcam/glwidget.h      |  76 ++++++++++++++
> >  src/qcam/main.cpp        |   2 +
> >  src/qcam/main_window.cpp |  36 ++++++-
> >  src/qcam/main_window.h   |   3 +
> >  src/qcam/meson.build     |   4 +-
> >  6 files changed, 330 insertions(+), 4 deletions(-)
> >  create mode 100644 src/qcam/glwidget.cpp
> >  create mode 100644 src/qcam/glwidget.h
> > 
> > -- 
> > 2.20.1
> > 
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel
> 
> -- 
> Regards,
> Niklas Söderlund
Show Liu March 23, 2020, 7:25 a.m. UTC | #3
Hi Niklas,

Thanks for your review and comments.
I will have the next version soon according to your suggestions.

On Fri, Mar 20, 2020 at 10:48 PM Niklas Söderlund <
niklas.soderlund@ragnatech.se> wrote:

> On 2020-03-20 14:50:38 +0100, Niklas Söderlund wrote:
> > Hi Show,
> >
> > Thanks for your work!
> >
> > On 2020-03-20 16:50:26 +0800, Show Liu wrote:
> > > Hi all,
> > >   I would like to share my adventure on qcam.
> > > I added an option to enable rendering YUV frame by OpenGL shader for
> qcam.
> > > Honestly, it's still in progress, and only support NV12 format at
> present.
> > > However the improvement is obviously. I logged the messages below when
> qcam running.
> > > https://pastebin.linaro.org/view/20d91f21
> > > In 1280x800 mode:
> > > format convert by CPU is around ~4 fps, rendering by GPU up to ~30.0
> fps
> > > In 1920x1080 mode:
> > > format convert by CPU is around ~2 fps, rendering by GPU still up to
> ~30.0 fps
> >
> > I have tested this and I get similar result on different device using
> > Panfrost GPU, really nice work!

>
> > One general observation is that I do get a graphic artifact in the qcam
> > GUI, covering about half the dropdown box for camera selection. If I
> > specify --opengl the artifact is filled with black, without --opengl
> > it's filled with white. If I run without the OpenGL patches I get no
> > artifact. I'm not sure if this is an effect of the panfrost driver or
> > not.
>
> I get same behavior of the artifact on other systems as well so it's
> somehow related the this series I think.
>
I will try to fix this problem in the next version.

>
> >
> > I first tried applying the patches to latest libcamera master, but they
> > did not apply. It was easy to solve but you might want to pull in the
> > latest changes to qcam so you don't have to solve conflicts later.
> >
> > I will review the individual patches but just wanted to let you know how
> > happy I am seeing and testing this series ;-)
> >
> > >
> > >   The improvement still in progress, including more YUV formats
> support ... etc.
> > > And some parts I added are not in good shape, I am trying to make it
> better.
> > > So I appreciate any review conments and suggestion.
> > >
> > > It's also available on below.
> > > https://github.com/showliu/libcamera/commits/qcam_opengl_hack2
> > >
> > > I tested with kernel 5.5rc5 + Panfrost GPU driver on Rock Pi 4B
> platform.
> > >
> > > Show Liu (3):
> > >   qcam: Added statusbar to show the camera stream configuration
> > >   qcam: Added opengl widget class for qcam
> > >   qcam: added an option to enable rendering via OpenGL shader
> > >
> > >  src/qcam/glwidget.cpp    | 213 +++++++++++++++++++++++++++++++++++++++
> > >  src/qcam/glwidget.h      |  76 ++++++++++++++
> > >  src/qcam/main.cpp        |   2 +
> > >  src/qcam/main_window.cpp |  36 ++++++-
> > >  src/qcam/main_window.h   |   3 +
> > >  src/qcam/meson.build     |   4 +-
> > >  6 files changed, 330 insertions(+), 4 deletions(-)
> > >  create mode 100644 src/qcam/glwidget.cpp
> > >  create mode 100644 src/qcam/glwidget.h
> > >
> > > --
> > > 2.20.1
> > >
> > > _______________________________________________
> > > libcamera-devel mailing list
> > > libcamera-devel@lists.libcamera.org
> > > https://lists.libcamera.org/listinfo/libcamera-devel
> >
> > --
> > Regards,
> > Niklas Söderlund
>
> --
> Regards,
> Niklas Söderlund
>

BR,
Show Liu