diff options
author | Stijn Tintel <stijn@linux-ipv6.be> | 2018-11-10 13:03:18 +0200 |
---|---|---|
committer | Stijn Tintel <stijn@linux-ipv6.be> | 2018-12-18 23:19:21 +0200 |
commit | f5919b65d4c671fd5083838c7a445f319f9a13c8 (patch) | |
tree | 2c791d2a5dea5bbbb0b85f86f74afce2647c0726 /target/linux/brcm2708/patches-4.14/950-0368-staging-bcm2835-camera-Allocate-context-once-per-buf.patch | |
parent | 822b4c3b250a254e74407056ccfd5c6aa38da162 (diff) | |
download | upstream-f5919b65d4c671fd5083838c7a445f319f9a13c8.tar.gz upstream-f5919b65d4c671fd5083838c7a445f319f9a13c8.tar.bz2 upstream-f5919b65d4c671fd5083838c7a445f319f9a13c8.zip |
brcm2708: add kernel 4.14 support
Patch generation process:
- rebase rpi/rpi-4.14.y on v4.14.89 from linux-stable
- git format-patch v4.14.89
Patches skipped during rebase:
- lan78xx: Read MAC address from DT if present
- lan78xx: Enable LEDs and auto-negotiation
- Revert "softirq: Let ksoftirqd do its job"
- sc16is7xx: Fix for multi-channel stall
- lan78xx: Ignore DT MAC address if already valid
- lan78xx: Simple patch to prevent some crashes
- tcp_write_queue_purge clears all the SKBs in the write queue
- Revert "lan78xx: Simple patch to prevent some crashes"
- lan78xx: Connect phy early
- Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro
- Revert "Revert "softirq: Let ksoftirqd do its job""
- ASoC: cs4265: SOC_SINGLE register value error fix
- Revert "ASoC: cs4265: SOC_SINGLE register value error fix"
- Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"
- Revert "Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends""
Patches dropped after rebase:
- net: Add non-mainline source for rtl8192cu wlan
- net: Fix rtl8192cu build errors on other platforms
- brcm: adds support for BCM43341 wifi
- brcmfmac: Mute expected startup 'errors'
- ARM64: Fix build break for RTL8187/RTL8192CU wifi
- ARM64: Enable RTL8187/RTL8192CU wifi in build config
- This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator
- brcmfmac: add CLM download support
- brcmfmac: request_firmware_direct is quieter
- Sets the BCDC priority to constant 0
- brcmfmac: Disable ARP offloading when promiscuous
- brcmfmac: Avoid possible out-of-bounds read
- brcmfmac: Delete redundant length check
- net: rtl8192cu: Normalize indentation
- net: rtl8192cu: Fix implicit fallthrough warnings
- Revert "Sets the BCDC priority to constant 0"
- media: cxd2880: Bump to match 4.18.y version
- media: cxd2880-spi: Bump to match 4.18.y version
- Revert "mm: alloc_contig: re-allow CMA to compact FS pages"
- Revert "Revert "mm: alloc_contig: re-allow CMA to compact FS pages""
- cxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with
MEDIA_SUBDRV_AUTOSELECT
- 950-0421-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch
- 950-0453-Add-hid-bigbenff-to-list-of-have_special_driver-for-.patch
Make I2C built-in instead of modular as in upstream defconfig; also the
easiest way to get MFD_ARIZONA enabled, which is required by
kmod-sound-soc-rpi-cirrus.
Add missing compatible strings from
4.9/960-add-rasbperrypi-compatible.patch, using upstream names for
compute modules.
Add extra patch to enable the LEDs on lan78xx.
Compile-tested: bcm2708, bcm2709, bcm2710 (with CONFIG_ALL_KMODS=y)
Runtime-tested: bcm2708, bcm2710
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Diffstat (limited to 'target/linux/brcm2708/patches-4.14/950-0368-staging-bcm2835-camera-Allocate-context-once-per-buf.patch')
-rw-r--r-- | target/linux/brcm2708/patches-4.14/950-0368-staging-bcm2835-camera-Allocate-context-once-per-buf.patch | 192 |
1 files changed, 192 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.14/950-0368-staging-bcm2835-camera-Allocate-context-once-per-buf.patch b/target/linux/brcm2708/patches-4.14/950-0368-staging-bcm2835-camera-Allocate-context-once-per-buf.patch new file mode 100644 index 0000000000..c933bcc7a2 --- /dev/null +++ b/target/linux/brcm2708/patches-4.14/950-0368-staging-bcm2835-camera-Allocate-context-once-per-buf.patch @@ -0,0 +1,192 @@ +From f36097b9766ff3f61c21d1fd29e75ddd3844a533 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <dave.stevenson@raspberrypi.org> +Date: Thu, 10 May 2018 12:42:08 -0700 +Subject: [PATCH 368/454] staging: bcm2835-camera: Allocate context once per + buffer + +commit 96b7e81ab6b74e7cefdac0d7a90b746ef7f8597d upstream. + +The struct mmal_msg_context was being allocated for every message +being sent to the VPU, and freed when it came back. Whilst that is +required behaviour for some messages (mainly the synchronous ones), it +is wasteful for the video buffers that make up the majority of the +traffic. + +Add to the buffer_init/cleanup hooks that it allocates/frees the +msg_context required. + +v2: changes by anholt from the downstream tree: clean up indentation, + pass an error value through, forward-declare the struct so we have + less void * + +Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> +Signed-off-by: Eric Anholt <eric@anholt.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + .../bcm2835-camera/bcm2835-camera.c | 30 +++++++++++++-- + .../bcm2835-camera/mmal-common.h | 4 ++ + .../vc04_services/bcm2835-camera/mmal-vchiq.c | 38 ++++++++++++++----- + .../vc04_services/bcm2835-camera/mmal-vchiq.h | 3 ++ + 4 files changed, 62 insertions(+), 13 deletions(-) + +--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c ++++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +@@ -280,6 +280,20 @@ static int queue_setup(struct vb2_queue + return 0; + } + ++static int buffer_init(struct vb2_buffer *vb) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); ++ struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb); ++ struct mmal_buffer *buf = container_of(vb2, struct mmal_buffer, vb); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p, vb %p\n", ++ __func__, dev, vb); ++ buf->buffer = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); ++ buf->buffer_size = vb2_plane_size(&buf->vb.vb2_buf, 0); ++ ++ return mmal_vchi_buffer_init(dev->instance, buf); ++} ++ + static int buffer_prepare(struct vb2_buffer *vb) + { + struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); +@@ -302,6 +316,17 @@ static int buffer_prepare(struct vb2_buf + return 0; + } + ++static void buffer_cleanup(struct vb2_buffer *vb) ++{ ++ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); ++ struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb); ++ struct mmal_buffer *buf = container_of(vb2, struct mmal_buffer, vb); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p, vb %p\n", ++ __func__, dev, vb); ++ mmal_vchi_buffer_cleanup(buf); ++} ++ + static inline bool is_capturing(struct bm2835_mmal_dev *dev) + { + return dev->capture.camera_port == +@@ -497,9 +522,6 @@ static void buffer_queue(struct vb2_buff + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, + "%s: dev:%p buf:%p\n", __func__, dev, buf); + +- buf->buffer = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); +- buf->buffer_size = vb2_plane_size(&buf->vb.vb2_buf, 0); +- + ret = vchiq_mmal_submit_buffer(dev->instance, dev->capture.port, buf); + if (ret < 0) + v4l2_err(&dev->v4l2_dev, "%s: error submitting buffer\n", +@@ -665,7 +687,9 @@ static void bm2835_mmal_unlock(struct vb + + static const struct vb2_ops bm2835_mmal_video_qops = { + .queue_setup = queue_setup, ++ .buf_init = buffer_init, + .buf_prepare = buffer_prepare, ++ .buf_cleanup = buffer_cleanup, + .buf_queue = buffer_queue, + .start_streaming = start_streaming, + .stop_streaming = stop_streaming, +--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-common.h ++++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-common.h +@@ -22,6 +22,8 @@ + /** Special value signalling that time is not known */ + #define MMAL_TIME_UNKNOWN (1LL<<63) + ++struct mmal_msg_context; ++ + /* mapping between v4l and mmal video modes */ + struct mmal_fmt { + char *name; +@@ -46,6 +48,8 @@ struct mmal_buffer { + + void *buffer; /* buffer pointer */ + unsigned long buffer_size; /* size of allocated buffer */ ++ ++ struct mmal_msg_context *msg_context; + }; + + /* */ +--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c ++++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +@@ -324,8 +324,6 @@ static void buffer_work_cb(struct work_s + msg_context->u.bulk.dts, + msg_context->u.bulk.pts); + +- /* release message context */ +- release_msg_context(msg_context); + } + + /* enqueue a bulk receive for a given message context */ +@@ -506,11 +504,13 @@ buffer_from_host(struct vchiq_mmal_insta + return -EINTR; + + /* get context */ +- msg_context = get_msg_context(instance); +- if (IS_ERR(msg_context)) { +- ret = PTR_ERR(msg_context); ++ if (!buf->msg_context) { ++ pr_err("%s: msg_context not allocated, buf %p\n", __func__, ++ buf); ++ ret = -EINVAL; + goto unlock; + } ++ msg_context = buf->msg_context; + + /* store bulk message context for when data arrives */ + msg_context->u.bulk.instance = instance; +@@ -560,11 +560,6 @@ buffer_from_host(struct vchiq_mmal_insta + sizeof(struct mmal_msg_header) + + sizeof(m.u.buffer_from_host)); + +- if (ret != 0) { +- release_msg_context(msg_context); +- /* todo: is this correct error value? */ +- } +- + vchi_service_release(instance->handle); + + unlock: +@@ -1779,6 +1774,29 @@ int vchiq_mmal_submit_buffer(struct vchi + + return 0; + } ++ ++int mmal_vchi_buffer_init(struct vchiq_mmal_instance *instance, ++ struct mmal_buffer *buf) ++{ ++ struct mmal_msg_context *msg_context = get_msg_context(instance); ++ ++ if (IS_ERR(msg_context)) ++ return (PTR_ERR(msg_context)); ++ ++ buf->msg_context = msg_context; ++ return 0; ++} ++ ++int mmal_vchi_buffer_cleanup(struct mmal_buffer *buf) ++{ ++ struct mmal_msg_context *msg_context = buf->msg_context; ++ ++ if (msg_context) ++ release_msg_context(msg_context); ++ buf->msg_context = NULL; ++ ++ return 0; ++} + + /* Initialise a mmal component and its ports + * +--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h ++++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h +@@ -171,4 +171,7 @@ int vchiq_mmal_submit_buffer(struct vchi + struct vchiq_mmal_port *port, + struct mmal_buffer *buf); + ++int mmal_vchi_buffer_init(struct vchiq_mmal_instance *instance, ++ struct mmal_buffer *buf); ++int mmal_vchi_buffer_cleanup(struct mmal_buffer *buf); + #endif /* MMAL_VCHIQ_H */ |