Skip to contentSkip to conversation

Initial driver support for Xilinx M2M Video Scaler

PATCH NAK Rohit Athavale 5 participants 10 messages Feb 21, 2018 – Mar 20, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Initial driver support for Xilinx M2M Video Scaler

This patch series has three commits :
- Driver support for the Xilinx M2M Video Scaler IP
- TODO document
- DT binding doc

Changes in HW register map is expected as the IP undergoes changes. This is a first attempt at the driver as an early prototype.

This is a M2M Video Scaler IP that uses polyphases filters to perform video scaling. The driver will be used by an application like a gstreamer plugin.

Change Log:

v2
- Cc'ing linux-media mailing list as suggested by Dan Carpenter. Dan wanted to see if someone from linux-media can review the driver interface in xm2m_vscale.c to see if it makes sense.
- Another question would be the right place to keep the driver, in drivers/staging/media or drivers/staging/
- Dropped empty mmap_open, mmap_close ops.
- Removed incorrect DMA_SHARED_BUFFER select from Kconfig
v1 - Initial version

Rohit Athavale (3):
staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler
staging: xm2mvscale: Add TODO for the driver
Documentation: devicetree: bindings: Add DT binding doc for xm2mvsc
driver

 drivers/staging/Kconfig                            |   2 +
 drivers/staging/Makefile                           |   1 +
 .../devicetree/bindings/xm2mvscaler.txt            |  25 +
 drivers/staging/xm2mvscale/Kconfig                 |  11 +
 drivers/staging/xm2mvscale/Makefile                |   3 +
 drivers/staging/xm2mvscale/TODO                    |  18 +
 drivers/staging/xm2mvscale/ioctl_xm2mvsc.h         | 134 +++
 drivers/staging/xm2mvscale/scaler_hw_xm2m.c        | 945 +++++++++++++++++++++
 drivers/staging/xm2mvscale/scaler_hw_xm2m.h        | 152 ++++
 drivers/staging/xm2mvscale/xm2m_vscale.c           | 768 +++++++++++++++++
 drivers/staging/xm2mvscale/xvm2mvsc_hw_regs.h      | 204 +++++
 11 files changed, 2263 insertions(+)
 create mode 100644 drivers/staging/xm2mvscale/Documentation/devicetree/bindings/xm2mvscaler.txt
 create mode 100644 drivers/staging/xm2mvscale/Kconfig
 create mode 100644 drivers/staging/xm2mvscale/Makefile
 create mode 100644 drivers/staging/xm2mvscale/TODO
 create mode 100644 drivers/staging/xm2mvscale/ioctl_xm2mvsc.h
 create mode 100644 drivers/staging/xm2mvscale/scaler_hw_xm2m.c
 create mode 100644 drivers/staging/xm2mvscale/scaler_hw_xm2m.h
 create mode 100644 drivers/staging/xm2mvscale/xm2m_vscale.c
 create mode 100644 drivers/staging/xm2mvscale/xvm2mvsc_hw_regs.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/3 staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler

This commit adds driver support for the pre-release Xilinx M2M Video Scaler IP. There are three parts to this driver :

- The Hardware/IP layer that reads and writes register of the IP contained in the scaler_hw_xm2m.c
- The set of ioctls that applications would need to know contained in ioctl_xm2mvsc.h
- The char driver that consumes the IP layer in xm2m_vscale.c

---
 drivers/staging/Kconfig                       |   2 +
 drivers/staging/Makefile                      |   1 +
 drivers/staging/xm2mvscale/Kconfig            |  11 +
 drivers/staging/xm2mvscale/Makefile           |   3 +
 drivers/staging/xm2mvscale/ioctl_xm2mvsc.h    | 134 ++++
 drivers/staging/xm2mvscale/scaler_hw_xm2m.c   | 945 ++++++++++++++++++++++++++
 drivers/staging/xm2mvscale/scaler_hw_xm2m.h   | 152 +++++
 drivers/staging/xm2mvscale/xm2m_vscale.c      | 768 +++++++++++++++++++++
 drivers/staging/xm2mvscale/xvm2mvsc_hw_regs.h | 204 ++++++
 9 files changed, 2220 insertions(+)
 create mode 100644 drivers/staging/xm2mvscale/Kconfig
 create mode 100644 drivers/staging/xm2mvscale/Makefile
 create mode 100644 drivers/staging/xm2mvscale/ioctl_xm2mvsc.h
 create mode 100644 drivers/staging/xm2mvscale/scaler_hw_xm2m.c
 create mode 100644 drivers/staging/xm2mvscale/scaler_hw_xm2m.h
 create mode 100644 drivers/staging/xm2mvscale/xm2m_vscale.c
 create mode 100644 drivers/staging/xm2mvscale/xvm2mvsc_hw_regs.h
drivers/staging/Kconfig +2 -0
index e95ab68..3ee3a3e 100644
@@ -122,4 +122,6 @@ source "drivers/staging/vboxvideo/Kconfig"
 
 source "drivers/staging/pi433/Kconfig"
 
+source "drivers/staging/xm2mvscale/Kconfig"
+
 endif # STAGING
drivers/staging/Makefile +1 -0
index af8cd6a..29ce417 100644
@@ -52,3 +52,4 @@ obj-$(CONFIG_BCM2835_VCHIQ)	+= vc04_services/
 obj-$(CONFIG_CRYPTO_DEV_CCREE)	+= ccree/
 obj-$(CONFIG_DRM_VBOXVIDEO)	+= vboxvideo/
 obj-$(CONFIG_PI433)		+= pi433/
+obj-$(CONFIG_XILINX_M2M_VSC)	+= xm2mvscale/
drivers/staging/xm2mvscale/Kconfig new file +11 -0
new file mode 100644
index 0000000..949a8e4
@@ -0,0 +1,11 @@
+config XILINX_M2M_VSC
+	tristate "Xilinx M2M Video Scaler"
+	depends on ARCH_ZYNQMP && OF
+	---help---
+	  This driver is developed for Xilinx M2M Video Scaler IP,
+	  designed to allow passage of frame buffers from the source
+	  kernel sub-system, apply video scaling and forward to the
+	  sink kernel sub-system.
+
+	  To compile this driver as a module, choose M here.
+	  If unsure, choose N.
drivers/staging/xm2mvscale/Makefile new file +3 -0
new file mode 100644
index 0000000..ec777e1
@@ -0,0 +1,3 @@
+xm2m_vscale_drv-y := scaler_hw_xm2m.o
+xm2m_vscale_drv-y += xm2m_vscale.o
+obj-$(CONFIG_XILINX_M2M_VSC) += xm2m_vscale_drv.o
drivers/staging/xm2mvscale/ioctl_xm2mvsc.h new file +134 -0

134 lines not on this page · raw message

drivers/staging/xm2mvscale/scaler_hw_xm2m.c new file +945 -0

945 lines not on this page · raw message

drivers/staging/xm2mvscale/scaler_hw_xm2m.h new file +152 -0

152 lines not on this page · raw message

drivers/staging/xm2mvscale/xm2m_vscale.c new file +768 -0

768 lines not on this page · raw message

drivers/staging/xm2mvscale/xvm2mvsc_hw_regs.h new file +204 -0

204 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#2 lore raw

Re: [PATCH v2 1/3] staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler

Quoted 11 lines · Rohit Athavale

This commit adds driver support for the pre-release Xilinx M2M Video Scaler IP. There are three parts to this driver :

- The Hardware/IP layer that reads and writes register of the IP contained in the scaler_hw_xm2m.c
- The set of ioctls that applications would need to know contained in ioctl_xm2mvsc.h
- The char driver that consumes the IP layer in xm2m_vscale.c

---

I need an ack from the linux-media maintainers before I can consider this for staging, as this really looks like an "odd" video driver...

thanks,

greg k-h

Nacked-by NAK
#3 lore raw

Re: [PATCH v2 1/3] staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler

Quoted 10 lines · Greg KH
Quoted 9 lines · Rohit Athavale

This commit adds driver support for the pre-release Xilinx M2M Video Scaler IP. There are three parts to this driver :

- The Hardware/IP layer that reads and writes register of the IP contained in the scaler_hw_xm2m.c
- The set of ioctls that applications would need to know contained in ioctl_xm2mvsc.h
- The char driver that consumes the IP layer in xm2m_vscale.c

Quoted 5 lines
Quoted 2 lines

---

I need an ack from the linux-media maintainers before I can consider this for staging, as this really looks like an "odd" video driver...

This should definitely use the V4L2 API. I guess it could be added to staging/media with a big fat TODO that this should be converted to the V4L2 mem2mem framework.

But it makes no sense to re-invent the V4L2 streaming API :-)

drivers/media/platform/mx2_emmaprp.c does something similar to this. It's a little bit outdated (not using the latest m2m helper functions) but it is a good starting point.

So for this series:

If this was added to drivers/staging/media instead and with an updated TODO, then we can accept it, but we need to see some real effort afterwards to switch this to the right API. Otherwise it will be removed again after a few kernel cycles.

Regards,

Hans

#4 lore raw

RE: [PATCH v2 1/3] staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler

Hi Hans,

Thanks for taking the time to take a look at this.

Quoted 9 lines

This should definitely use the V4L2 API. I guess it could be added to staging/media with a big fat TODO that this should be converted to the V4L2 mem2mem framework.

But it makes no sense to re-invent the V4L2 streaming API :-)

drivers/media/platform/mx2_emmaprp.c does something similar to this. It's a little bit outdated (not using the latest m2m helper functions) but it is a good starting point.

I looked at the mx2_emmaprp.c and the Samsung G-Scaler M2M driver. IMHO, the main difference between the Hardware registers/capabilities is that mx2_emmaprp driver or the gsc driver, have one scaling "channel" if we might call it. Whereas the HW/IP I have in mind has 4-8 scaling channels.

By a scaling channel, I mean an entity of the HW or IP, that can take the following parameters :
- Input height, stride , width, color format, input Y and Cb/Cr physically contiguous memory pointers
- Output height, stride, width, color format, output Y and Cb/Cr physically contiguous memory pointers

Based on the above parameters, when the above are provided and the IP is started, we get an interrupt on completion. I'm sure you are familiar with this model. However, in the case of this IP, there could be 4-8 such channels and a single interrupt on the completion of the all 4-8 scaling operations.

In this IP, we are trying to have 4-8 input sources being scaled by this single piece of hardware, by time multiplexing.

An example use case is :

Four applications (sources) will feed (enqueue) 4 input buffers to the scaler, the scaler driver will synchronize the programming of these buffers, when the number of buffers received by the driver meets our batch size (say a batch size of 4), it will kick start the IP. The four applications will poll on the fd, upon receiving an interrupt from the hardware the poll will unblock. And all four applications can dequeue their respective buffers and display them on a sink.

But each "channel" can be set to do accept its own individual input and output formats. When I went through :
https://www.kernel.org/doc/html/v4.14/media/uapi/v4l/open.html#multiple-opens

It appears, once an application has invoked VIDIOC_REQBUFS or VIDIOC_CREATE_BUFS, other applications cannot VIDIOC_S_FMT on them. However to maximize the available number of channels, it would be necessary to allow several applications to be able to perform VIDIOC_S_FMT on the device node in the case of this hardware as different channels can be expected to deal with different scaling operations.

One option is to create a logical /dev/videoX node for each such channel, and have a parent driver perform the interrupt handling, batch size setting and other such common functionalities. Is there a way to allow multiple applications talk to the same video device node/file handle without creating logical video nodes for each channel ?

Please let me know if the description of HW is not clear. I will look forward to hear comments from you.

Quoted 10 lines

So for this series:

If this was added to drivers/staging/media instead and with an updated TODO, then we can accept it, but we need to see some real effort afterwards to switch this to the right API. Otherwise it will be removed again after a few kernel cycles.

Many thanks for providing a pathway to get this into drivers/staging/media

I will drop this series, and re-send with the driver being placed in drivers/staging/media. I'll add some references to this conversation, so a new reviewer gets some context of what was discussed. In the meanwhile I will look into re-writing this to utilize the M2M V4L2 API.

Quoted 3 lines

Regards,

Hans

Best Regards,
Rohit

Quoted 48 lines

-----Original Message-----
From: Hans Verkuil [mailto:[email protected]]
Sent: Friday, March 09, 2018 3:58 AM
To: Greg KH <[email protected]>; Rohit Athavale <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/3] staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler

Quoted 10 lines · Greg KH
Quoted 9 lines · Rohit Athavale

This commit adds driver support for the pre-release Xilinx M2M Video Scaler IP. There are three parts to this driver :

- The Hardware/IP layer that reads and writes register of the IP contained in the scaler_hw_xm2m.c
- The set of ioctls that applications would need to know contained in ioctl_xm2mvsc.h
- The char driver that consumes the IP layer in xm2m_vscale.c

Quoted 5 lines
Quoted 2 lines

---

I need an ack from the linux-media maintainers before I can consider this for staging, as this really looks like an "odd" video driver...

This should definitely use the V4L2 API. I guess it could be added to staging/media with a big fat TODO that this should be converted to the V4L2 mem2mem framework.

But it makes no sense to re-invent the V4L2 streaming API :-)

drivers/media/platform/mx2_emmaprp.c does something similar to this. It's a little bit outdated (not using the latest m2m helper functions) but it is a good starting point.

So for this series:

If this was added to drivers/staging/media instead and with an updated TODO, then we can accept it, but we need to see some real effort afterwards to switch this to the right API. Otherwise it will be removed again after a few kernel cycles.

Regards,

Hans

#5 lore raw

Re: [PATCH v2 1/3] staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler

Quoted 42 lines · Rohit Athavale

Hi Hans,

Thanks for taking the time to take a look at this.

Quoted 5 lines

This should definitely use the V4L2 API. I guess it could be added to staging/media with a big fat TODO that this should be converted to
the V4L2 mem2mem framework.

Quoted 7 lines

But it makes no sense to re-invent the V4L2 streaming API :-)

drivers/media/platform/mx2_emmaprp.c does something similar to this.
It's a little bit outdated (not using the latest m2m helper functions)
but it is a good starting point.

I looked at the mx2_emmaprp.c and the Samsung G-Scaler M2M driver. IMHO, the main difference between
the Hardware registers/capabilities is that mx2_emmaprp driver or the gsc driver, have one scaling "channel"
if we might call it. Whereas the HW/IP I have in mind has 4-8 scaling channels.

By a scaling channel, I mean an entity of the HW or IP, that can take the following parameters :
- Input height, stride , width, color format, input Y and Cb/Cr
physically contiguous memory pointers
- Output height, stride, width, color format, output Y and Cb/Cr
physically contiguous memory pointers

Based on the above parameters, when the above are provided and the IP is started, we get an interrupt on completion.
I'm sure you are familiar with this model. However, in the case of this IP, there could be 4-8 such channels and a single interrupt on the completion of the all 4-8 scaling operations.

In this IP, we are trying to have 4-8 input sources being scaled by this single piece of hardware, by time multiplexing.

An example use case is :

Quoted 8 lines

Four applications (sources) will feed (enqueue) 4 input buffers to the scaler, the scaler driver will synchronize the programming of these buffers, when the number of buffers received by the driver meets our batch size (say a batch size of 4), it will kick start the IP. The four applications will poll on the fd, upon receiving an interrupt from the hardware the poll will unblock. And all four applications can dequeue their respective buffers and display them on a sink.

You should think of a better scheduling model, it will be really hard to design userspace that collaborate in order to optimize the IP usage. I think a better approach would be to queue while the IP is busy. These queues can then be sorted and prioritized.

Quoted 6 lines

But each "channel" can be set to do accept its own individual input and output formats. When I went through :
https://www.kernel.org/doc/html/v4.14/media/uapi/v4l/open.html#multip
le-opens

Quoted 7 lines

It appears, once an application has invoked VIDIOC_REQBUFS or VIDIOC_CREATE_BUFS, other applications cannot VIDIOC_S_FMT on them. However to maximize the available number of channels, it would be necessary to allow several applications to be able to perform VIDIOC_S_FMT on the device node in the case of this hardware as different channels can be expected to deal with different scaling operations.

This does not apply to M2M devices. Each time userspace open an M2M device, it will get a different instance (unless there is no more resource available). What drivers like Samsung FIMC, GSCALER, MFC. etc. do, is that they limit the number of instances (open calls) to the number of streams they can handle in parallel. They don't seem to share an IRQ when doing batch though.

Quoted 7 lines

One option is to create a logical /dev/videoX node for each such channel, and have a parent driver perform the interrupt handling, batch size setting and other such common functionalities. Is there a way to allow multiple applications talk to the same video device node/file handle without creating logical video nodes for each channel ?

FIMC used to expose a node per instance and it was terribly hard to use. I don't think this is a good idea.

Quoted 95 lines

Please let me know if the description of HW is not clear. I will look forward to hear comments from you.

Quoted 12 lines

So for this series:

If this was added to drivers/staging/media instead and with an updated
TODO, then we can accept it, but we need to see some real effort afterwards
to switch this to the right API. Otherwise it will be removed again after a few kernel cycles.

Many thanks for providing a pathway to get this into drivers/staging/media

I will drop this series, and re-send with the driver being placed in drivers/staging/media.
I'll add some references to this conversation, so a new reviewer gets some context of what
was discussed. In the meanwhile I will look into re-writing this to utilize the M2M V4L2 API.

Quoted 3 lines

Regards,

Hans

Best Regards,
Rohit

Quoted 59 lines

-----Original Message-----
From: Hans Verkuil [mailto:[email protected]]
Sent: Friday, March 09, 2018 3:58 AM
To: Greg KH <[email protected]>; Rohit Athavale <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/3] staging: xm2mvscale: Driver support for Xilinx M2M
Video Scaler

Quoted 13 lines · Greg KH
Quoted 12 lines · Rohit Athavale

This commit adds driver support for the pre-release Xilinx M2M Video
Scaler IP. There are three parts to this driver :

- The Hardware/IP layer that reads and writes register of the
IP
contained in the scaler_hw_xm2m.c
- The set of ioctls that applications would need to know
contained
in ioctl_xm2mvsc.h
- The char driver that consumes the IP layer in xm2m_vscale.c

Quoted 7 lines
Quoted 2 lines

---

I need an ack from the linux-media maintainers before I can consider
this for staging, as this really looks like an "odd" video driver...

This should definitely use the V4L2 API. I guess it could be added to staging/media with a big fat TODO that this should be converted to
the V4L2 mem2mem framework.

But it makes no sense to re-invent the V4L2 streaming API :-)

drivers/media/platform/mx2_emmaprp.c does something similar to this.
It's a little bit outdated (not using the latest m2m helper functions)
but it is a good starting point.

So for this series:

If this was added to drivers/staging/media instead and with an updated
TODO, then we can accept it, but we need to see some real effort afterwards
to switch this to the right API. Otherwise it will be removed again after a few kernel cycles.

Regards,

Hans

#6 lore raw

Re: [PATCH v2 1/3] staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler

Quoted 86 lines · Nicolas Dufresne
Quoted 42 lines · Rohit Athavale

Hi Hans,

Thanks for taking the time to take a look at this.

Quoted 5 lines

This should definitely use the V4L2 API. I guess it could be added to staging/media with a big fat TODO that this should be converted to
the V4L2 mem2mem framework.

Quoted 7 lines

But it makes no sense to re-invent the V4L2 streaming API :-)

drivers/media/platform/mx2_emmaprp.c does something similar to this.
It's a little bit outdated (not using the latest m2m helper functions)
but it is a good starting point.

I looked at the mx2_emmaprp.c and the Samsung G-Scaler M2M driver. IMHO, the main difference between
the Hardware registers/capabilities is that mx2_emmaprp driver or the gsc driver, have one scaling "channel"
if we might call it. Whereas the HW/IP I have in mind has 4-8 scaling channels.

By a scaling channel, I mean an entity of the HW or IP, that can take the following parameters :
- Input height, stride , width, color format, input Y and Cb/Cr
physically contiguous memory pointers
- Output height, stride, width, color format, output Y and Cb/Cr
physically contiguous memory pointers

Based on the above parameters, when the above are provided and the IP is started, we get an interrupt on completion.
I'm sure you are familiar with this model. However, in the case of this IP, there could be 4-8 such channels and a single interrupt on the completion of the all 4-8 scaling operations.

In this IP, we are trying to have 4-8 input sources being scaled by this single piece of hardware, by time multiplexing.

An example use case is :

Quoted 8 lines

Four applications (sources) will feed (enqueue) 4 input buffers to the scaler, the scaler driver will synchronize the programming of these buffers, when the number of buffers received by the driver meets our batch size (say a batch size of 4), it will kick start the IP. The four applications will poll on the fd, upon receiving an interrupt from the hardware the poll will unblock. And all four applications can dequeue their respective buffers and display them on a sink.

You should think of a better scheduling model, it will be really hard to design userspace that collaborate in order to optimize the IP usage. I think a better approach would be to queue while the IP is busy. These queues can then be sorted and prioritized.

Quoted 6 lines

But each "channel" can be set to do accept its own individual input and output formats. When I went through :
https://www.kernel.org/doc/html/v4.14/media/uapi/v4l/open.html#multip
le-opens

Quoted 7 lines

It appears, once an application has invoked VIDIOC_REQBUFS or VIDIOC_CREATE_BUFS, other applications cannot VIDIOC_S_FMT on them. However to maximize the available number of channels, it would be necessary to allow several applications to be able to perform VIDIOC_S_FMT on the device node in the case of this hardware as different channels can be expected to deal with different scaling operations.

This does not apply to M2M devices. Each time userspace open an M2M device, it will get a different instance (unless there is no more resource available). What drivers like Samsung FIMC, GSCALER, MFC. etc. do, is that they limit the number of instances (open calls) to the number of streams they can handle in parallel. They don't seem to share an IRQ when doing batch though.

Quoted 7 lines

One option is to create a logical /dev/videoX node for each such channel, and have a parent driver perform the interrupt handling, batch size setting and other such common functionalities. Is there a way to allow multiple applications talk to the same video device node/file handle without creating logical video nodes for each channel ?

Quoted 2 lines

FIMC used to expose a node per instance and it was terribly hard to use. I don't think this is a good idea.

See Nicolas' answers. The mem2mem framework should work well for you, I think. The job_ready callback can be used to signal when enough buffers are queued to satisfy your IP requirements.

BTW, those requirements sound really weird. Is this really how Xilinx wants to implement this? It's not how scalers are used 'in the real world'. This whole 'batching' thing is strange.

Regards,

Hans

Quoted 96 lines
Quoted 96 lines

Please let me know if the description of HW is not clear. I will look forward to hear comments from you.

Quoted 12 lines

So for this series:

If this was added to drivers/staging/media instead and with an updated
TODO, then we can accept it, but we need to see some real effort afterwards
to switch this to the right API. Otherwise it will be removed again after a few kernel cycles.

Many thanks for providing a pathway to get this into drivers/staging/media

I will drop this series, and re-send with the driver being placed in drivers/staging/media.
I'll add some references to this conversation, so a new reviewer gets some context of what
was discussed. In the meanwhile I will look into re-writing this to utilize the M2M V4L2 API.

Quoted 3 lines

Regards,

Hans

Best Regards,
Rohit

Quoted 59 lines

-----Original Message-----
From: Hans Verkuil [mailto:[email protected]]
Sent: Friday, March 09, 2018 3:58 AM
To: Greg KH <[email protected]>; Rohit Athavale <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/3] staging: xm2mvscale: Driver support for Xilinx M2M
Video Scaler

Quoted 13 lines · Greg KH
Quoted 12 lines · Rohit Athavale

This commit adds driver support for the pre-release Xilinx M2M Video
Scaler IP. There are three parts to this driver :

- The Hardware/IP layer that reads and writes register of the
IP
contained in the scaler_hw_xm2m.c
- The set of ioctls that applications would need to know
contained
in ioctl_xm2mvsc.h
- The char driver that consumes the IP layer in xm2m_vscale.c

Quoted 7 lines
Quoted 2 lines

---

I need an ack from the linux-media maintainers before I can consider
this for staging, as this really looks like an "odd" video driver...

This should definitely use the V4L2 API. I guess it could be added to staging/media with a big fat TODO that this should be converted to
the V4L2 mem2mem framework.

But it makes no sense to re-invent the V4L2 streaming API :-)

drivers/media/platform/mx2_emmaprp.c does something similar to this.
It's a little bit outdated (not using the latest m2m helper functions)
but it is a good starting point.

So for this series:

If this was added to drivers/staging/media instead and with an updated
TODO, then we can accept it, but we need to see some real effort afterwards
to switch this to the right API. Otherwise it will be removed again after a few kernel cycles.

Regards,

Hans

#7 lore raw

PATCH v2 2/3 staging: xm2mvscale: Add TODO for the driver

In reply to Rohit Athavale

This commit highlights the key functionalities that will be improved upon in a future patch set.

---
 drivers/staging/xm2mvscale/TODO | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 drivers/staging/xm2mvscale/TODO
drivers/staging/xm2mvscale/TODO new file +18 -0
new file mode 100644
index 0000000..f0a0733
@@ -0,0 +1,18 @@
+* Fix checkpatch.pl complaints
+* Investigate if V4L2/Media framework can be used on top of HW Layer instead
+  of exisiting char driver.
+* Possible remaining coding style fix.
+* Add support for DMABUF.
+* This is an early prototype, hardware register map changes are expected.
+* Update driver for 64-bit DMA address once the new Xilinx M2M Scaler IP
+  has support for 64-bit DMA Addresses. Current IP supports 32-bit DMA addresses.
+* Remove deadcode.
+* Add documents in Documentation beyond the DT binding doc.
+* This needs a home  in the proper drivers area (example : drivers/misc/),
+  once the quality of the driver is improved. Suggestions about where
+  it should be placed are welcome.
+* The IOCTL header could be moved to an uapi/* area once this is out of staging.
+
+Please send any patches to:
+Greg Kroah-Hartman <[email protected]> and Rohit Athavale <[email protected]>
+
Signature · 1 line
1.9.1
#8 lore raw

PATCH v2 3/3 Documentation: devicetree: bindings: Add DT binding doc for xm2mvsc driver

In reply to Rohit Athavale

This commit adds the binding doc for the DT that the driver expects. Driver has been tested against Zynq US+ board.

---
 .../devicetree/bindings/xm2mvscaler.txt            | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 drivers/staging/xm2mvscale/Documentation/devicetree/bindings/xm2mvscaler.txt
drivers/staging/xm2mvscale/Documentation/devicetree/bindings/xm2mvscaler.txt new file +25 -0
new file mode 100644
index 0000000..1f3d805
@@ -0,0 +1,25 @@
+Xilinx M2M Video Scaler
+-----------------------
+This document describes the DT bindings required by the
+Xilinx M2M Video Scaler driver.
+
+Required Properties:
+- compatible		: Must be "xlnx,v-m2m-scaler"
+- reg			: Memory map for module access
+- reset-gpios		: Should contain GPIO reset phandle
+- interrupt-parent	: Interrupt controller the interrupt is routed through
+- interrupts		: Should contain DMA channel interrupt
+- xlnx,scaler-num-taps	: The number of filter taps for scaling filter
+- xlnx,scaler-max-chan	: The maximum number of supported scaling channels
+
+Examples
+---------
+	v_multi_scaler: v_multi_scaler@a0000000 {
+		compatible = "xlnx,v-m2m-scaler";
+		reg = <0x0 0xa0000000 0x0 0x10000>;
+		reset-gpios = <&gpio 78 1>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 89 4>;
+		xlnx,scaler-num-taps = <6>;
+		xlnx,scaler-max-chan = <4>;
+	};
Signature · 1 line
1.9.1
#9 lore raw
In reply to Rohit Athavale
Quoted 11 lines · Rohit Athavale

This patch series has three commits :
- Driver support for the Xilinx M2M Video Scaler IP
- TODO document
- DT binding doc

Changes in HW register map is expected as the IP undergoes changes. This is a first attempt at the driver as an early prototype.

This is a M2M Video Scaler IP that uses polyphases filters to perform video scaling. The driver will be used by an application like a gstreamer plugin.

I'm hoping you know all this already, but just in case, rebasing your driver on videobuf2-v4l2.h interface would be automatically supported by GStreamer, and likely a better proposal for upstreaming.

There few drivers already that could be use as an inspiration.

./drivers/media/platform/vim2m.c: Which demonstrate the API ./drivers/media/platform/exynos4-is/: Exynos4 imaging functions ./drivers/media/platform/exynos-gsc/: Exynos4 scaler (and more) ./drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c: MediaTek CSC/Scale ./drivers/media/platform/s5p-g2d/g2d.c: A 2D blitter iirc ? . . .

I don't know them all, I have developped the GStreamer code with the Exynos4/5 platform, but also had success report on IMX6 (not upstream yet apparently). With the framework, you'll gain DMABuf with very little code.

Quoted 46 lines

Change Log:

v2
- Cc'ing linux-media mailing list as suggested by Dan Carpenter. Dan wanted to see if someone from linux-media can review the driver interface in xm2m_vscale.c to see if it makes sense.
- Another question would be the right place to keep the driver, in drivers/staging/media or drivers/staging/
- Dropped empty mmap_open, mmap_close ops.
- Removed incorrect DMA_SHARED_BUFFER select from Kconfig
v1 - Initial version

Rohit Athavale (3):
staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler
staging: xm2mvscale: Add TODO for the driver
Documentation: devicetree: bindings: Add DT binding doc for xm2mvsc
driver

 drivers/staging/Kconfig                            |   2 +
 drivers/staging/Makefile                           |   1 +
 .../devicetree/bindings/xm2mvscaler.txt            |  25 +
 drivers/staging/xm2mvscale/Kconfig                 |  11 +
 drivers/staging/xm2mvscale/Makefile                |   3 +
 drivers/staging/xm2mvscale/TODO                    |  18 +
 drivers/staging/xm2mvscale/ioctl_xm2mvsc.h         | 134 +++
 drivers/staging/xm2mvscale/scaler_hw_xm2m.c        | 945
+++++++++++++++++++++
 drivers/staging/xm2mvscale/scaler_hw_xm2m.h        | 152 ++++
 drivers/staging/xm2mvscale/xm2m_vscale.c           | 768
+++++++++++++++++
 drivers/staging/xm2mvscale/xvm2mvsc_hw_regs.h      | 204 +++++
 11 files changed, 2263 insertions(+)
 create mode 100644
drivers/staging/xm2mvscale/Documentation/devicetree/bindings/xm2mvsca
ler.txt
 create mode 100644 drivers/staging/xm2mvscale/Kconfig
 create mode 100644 drivers/staging/xm2mvscale/Makefile
 create mode 100644 drivers/staging/xm2mvscale/TODO
 create mode 100644 drivers/staging/xm2mvscale/ioctl_xm2mvsc.h
 create mode 100644 drivers/staging/xm2mvscale/scaler_hw_xm2m.c
 create mode 100644 drivers/staging/xm2mvscale/scaler_hw_xm2m.h
 create mode 100644 drivers/staging/xm2mvscale/xm2m_vscale.c
 create mode 100644 drivers/staging/xm2mvscale/xvm2mvsc_hw_regs.h