From c7634180fc8104e2f770f2efbe77b5235514fd75 Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Mon, 29 Jul 2019 17:54:16 +0200 Subject: kernel: bump 4.19 to 4.19.62 Refreshed all patches. Remove upstreamed: - 023-0013-crypto-crypto4xx-fix-AES-CTR-blocksize-value.patch - 023-0014-crypto-crypto4xx-fix-blocksize-for-cfb-and-ofb.patch - 023-0015-crypto-crypto4xx-block-ciphers-should-only-accept-co.patch - 950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch - 950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch - 950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch - 950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch - 0021-ARM-dts-gemini-Fix-up-DNS-313-compatible-string.patch - 049-v4.20-mips-remove-superfluous-check-for-linux.patch - 100-MIPS-fix-build-on-non-linux-hosts.patch - 303-MIPS-Fix-bounds-check-virt_addr_valid.patch - 0002-usb-dwc2-use-a-longer-AHB-idle-timeout-in-dwc2_core_.patch Altered patches: - 950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch - 700-net-add-qualcomm-mdio-and-phy.patch Fixes: - CVE-2019-3846 New symbol: - AX88796B_PHY Compile-tested on: cns3xxx, imx6 Runtime-tested on: cns3xxx, imx6 Signed-off-by: Koen Vandeputte --- .../patches-4.19/950-0040-Add-dwc_otg-driver.patch | 2 +- ...4-mcp2515-Use-DT-supplied-interrupt-flags.patch | 2 +- ...b-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch | 2 +- ...benff-driver-for-BigBen-Interactive-PS3OF.patch | 2 +- ...cm2835-camera-Move-module-info-to-the-end.patch | 2 +- ...2835-camera-Provide-more-specific-probe-e.patch | 20 +- ...2835-camera-Add-hint-about-possible-fault.patch | 2 +- ...2835-Don-t-probe-if-no-camera-is-detected.patch | 4 +- ...2835-camera-Do-not-bulk-receive-from-serv.patch | 22 +- ...2835-camera-Ensure-H264-header-bytes-get-.patch | 6 +- ...2835-camera-Correctly-denote-key-frames-i.patch | 2 +- ...ing-bcm2835-camera-Return-early-on-errors.patch | 10 +- ...cm2835-camera-Reduce-length-of-enum-names.patch | 48 +- ...2835-camera-Fix-multiple-line-dereference.patch | 16 +- ...ing-bcm2835-camera-Fix-brace-style-issues.patch | 4 +- ...2835-camera-Fix-logical-continuation-spli.patch | 6 +- ...2835-camera-Fix-open-parenthesis-alignmen.patch | 14 +- ...2835_camera-Ensure-all-buffers-are-return.patch | 95 - ...2835-camera-Remove-check-of-the-number-of.patch | 39 - ...2835-camera-Handle-empty-EOS-buffers-whil.patch | 84 - ...4_services-Split-vchiq-mmal-into-a-module.patch | 1916 +------------------- ...l-vchiq-Allocate-and-free-components-as-r.patch | 14 +- ...mal-vchiq-Avoid-use-of-bool-in-structures.patch | 12 +- ...al-vchiq-Make-timeout-a-defined-parameter.patch | 2 +- ...l-vchiq-Make-a-mmal_buf-struct-for-passin.patch | 4 +- ...mal-vchiq-Add-support-for-event-callbacks.patch | 24 +- ...4_services-Support-sending-data-to-MMAL-p.patch | 2 +- ...4_services-Use-vc-sm-cma-to-support-zero-.patch | 10 +- ...eobuf2-Allow-exporting-of-a-struct-dmabuf.patch | 4 +- ...-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch | 4 +- ...l-vchiq-Fix-client_component-for-64-bit-k.patch | 6 +- ...sm-cma-Use-a-void-pointer-as-the-handle-w.patch | 2 +- ...l-vchiq-Always-return-the-param-size-from.patch | 2 +- ...l-vchiq-If-the-VPU-returns-an-error-don-t.patch | 2 +- ...2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch | 4 +- ...l-vchiq-Free-the-event-context-for-contro.patch | 2 +- ...l-vchiq-Replace-spinlock-protecting-conte.patch | 67 - ...enet-Better-coalescing-parameter-defaults.patch | 2 +- ...a-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch | 4 +- ...-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch | 2 +- 40 files changed, 141 insertions(+), 2326 deletions(-) delete mode 100644 target/linux/brcm2708/patches-4.19/950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch delete mode 100644 target/linux/brcm2708/patches-4.19/950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch delete mode 100644 target/linux/brcm2708/patches-4.19/950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch delete mode 100644 target/linux/brcm2708/patches-4.19/950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch (limited to 'target/linux/brcm2708/patches-4.19') diff --git a/target/linux/brcm2708/patches-4.19/950-0040-Add-dwc_otg-driver.patch b/target/linux/brcm2708/patches-4.19/950-0040-Add-dwc_otg-driver.patch index 8f0fe55966..d32a187b8a 100644 --- a/target/linux/brcm2708/patches-4.19/950-0040-Add-dwc_otg-driver.patch +++ b/target/linux/brcm2708/patches-4.19/950-0040-Add-dwc_otg-driver.patch @@ -917,7 +917,7 @@ Fixes https://github.com/raspberrypi/linux/issues/2408 } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5207,7 +5207,7 @@ static void port_event(struct usb_hub *h +@@ -5210,7 +5210,7 @@ static void port_event(struct usb_hub *h u16 status = 0, unused; port_dev->over_current_count++; diff --git a/target/linux/brcm2708/patches-4.19/950-0104-mcp2515-Use-DT-supplied-interrupt-flags.patch b/target/linux/brcm2708/patches-4.19/950-0104-mcp2515-Use-DT-supplied-interrupt-flags.patch index 14fe567977..51add31636 100644 --- a/target/linux/brcm2708/patches-4.19/950-0104-mcp2515-Use-DT-supplied-interrupt-flags.patch +++ b/target/linux/brcm2708/patches-4.19/950-0104-mcp2515-Use-DT-supplied-interrupt-flags.patch @@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c -@@ -951,6 +951,9 @@ static int mcp251x_open(struct net_devic +@@ -950,6 +950,9 @@ static int mcp251x_open(struct net_devic priv->tx_skb = NULL; priv->tx_len = 0; diff --git a/target/linux/brcm2708/patches-4.19/950-0129-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch b/target/linux/brcm2708/patches-4.19/950-0129-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch index 56d83405ad..08c38d7430 100644 --- a/target/linux/brcm2708/patches-4.19/950-0129-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch +++ b/target/linux/brcm2708/patches-4.19/950-0129-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch @@ -35,7 +35,7 @@ Signed-off-by: Phil Elwell gpiod_err(desc, "%s: tried to set a GPIO tied to an IRQ as output\n", __func__); -@@ -3311,7 +3313,7 @@ int gpiochip_lock_as_irq(struct gpio_chi +@@ -3312,7 +3314,7 @@ int gpiochip_lock_as_irq(struct gpio_chi } } diff --git a/target/linux/brcm2708/patches-4.19/950-0168-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch b/target/linux/brcm2708/patches-4.19/950-0168-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch index f249909704..840969667a 100644 --- a/target/linux/brcm2708/patches-4.19/950-0168-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch +++ b/target/linux/brcm2708/patches-4.19/950-0168-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch @@ -472,7 +472,7 @@ Signed-off-by: Jiri Kosina +MODULE_LICENSE("GPL"); --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h -@@ -232,6 +232,9 @@ +@@ -233,6 +233,9 @@ #define USB_VENDOR_ID_BETOP_2185V2PC 0x8380 #define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc diff --git a/target/linux/brcm2708/patches-4.19/950-0228-staging-bcm2835-camera-Move-module-info-to-the-end.patch b/target/linux/brcm2708/patches-4.19/950-0228-staging-bcm2835-camera-Move-module-info-to-the-end.patch index d743c6a99c..d3212a0067 100644 --- a/target/linux/brcm2708/patches-4.19/950-0228-staging-bcm2835-camera-Move-module-info-to-the-end.patch +++ b/target/linux/brcm2708/patches-4.19/950-0228-staging-bcm2835-camera-Move-module-info-to-the-end.patch @@ -26,7 +26,7 @@ Signed-off-by: Stefan Wahren int bcm2835_v4l2_debug; module_param_named(debug, bcm2835_v4l2_debug, int, 0644); MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2"); -@@ -1967,3 +1961,9 @@ static struct platform_driver bcm2835_ca +@@ -1980,3 +1974,9 @@ static struct platform_driver bcm2835_ca }; module_platform_driver(bcm2835_camera_driver) diff --git a/target/linux/brcm2708/patches-4.19/950-0235-staging-bcm2835-camera-Provide-more-specific-probe-e.patch b/target/linux/brcm2708/patches-4.19/950-0235-staging-bcm2835-camera-Provide-more-specific-probe-e.patch index e8e3c311ef..c346816db5 100644 --- a/target/linux/brcm2708/patches-4.19/950-0235-staging-bcm2835-camera-Provide-more-specific-probe-e.patch +++ b/target/linux/brcm2708/patches-4.19/950-0235-staging-bcm2835-camera-Provide-more-specific-probe-e.patch @@ -15,7 +15,7 @@ Signed-off-by: Stefan Wahren --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -@@ -1539,8 +1539,11 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1552,8 +1552,11 @@ static int mmal_init(struct bm2835_mmal_ struct vchiq_mmal_component *camera; ret = vchiq_mmal_init(&dev->instance); @@ -28,7 +28,7 @@ Signed-off-by: Stefan Wahren /* get the camera component ready */ ret = vchiq_mmal_component_init(dev->instance, "ril.camera", -@@ -1549,7 +1552,9 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1562,7 +1565,9 @@ static int mmal_init(struct bm2835_mmal_ goto unreg_mmal; camera = dev->component[MMAL_COMPONENT_CAMERA]; @@ -39,7 +39,7 @@ Signed-off-by: Stefan Wahren ret = -EINVAL; goto unreg_camera; } -@@ -1557,8 +1562,11 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1570,8 +1575,11 @@ static int mmal_init(struct bm2835_mmal_ ret = set_camera_parameters(dev->instance, camera, dev); @@ -52,7 +52,7 @@ Signed-off-by: Stefan Wahren /* There was an error in the firmware that meant the camera component * produced BGR instead of RGB. -@@ -1647,8 +1655,8 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1660,8 +1668,8 @@ static int mmal_init(struct bm2835_mmal_ if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) { ret = -EINVAL; @@ -63,7 +63,7 @@ Signed-off-by: Stefan Wahren goto unreg_preview; } -@@ -1661,8 +1669,8 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1674,8 +1682,8 @@ static int mmal_init(struct bm2835_mmal_ if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) { ret = -EINVAL; @@ -74,7 +74,7 @@ Signed-off-by: Stefan Wahren 1); goto unreg_image_encoder; } -@@ -1676,8 +1684,8 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1689,8 +1697,8 @@ static int mmal_init(struct bm2835_mmal_ if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) { ret = -EINVAL; @@ -85,7 +85,7 @@ Signed-off-by: Stefan Wahren 1); goto unreg_vid_encoder; } -@@ -1706,8 +1714,11 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1719,8 +1727,11 @@ static int mmal_init(struct bm2835_mmal_ sizeof(enable)); } ret = bm2835_mmal_set_all_camera_controls(dev); @@ -98,7 +98,7 @@ Signed-off-by: Stefan Wahren return 0; -@@ -1867,21 +1878,29 @@ static int bcm2835_mmal_probe(struct pla +@@ -1880,21 +1891,29 @@ static int bcm2835_mmal_probe(struct pla snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s", BM2835_MMAL_MODULE_NAME); ret = v4l2_device_register(NULL, &dev->v4l2_dev); @@ -132,7 +132,7 @@ Signed-off-by: Stefan Wahren /* initialize queue */ q = &dev->capture.vb_vidq; memset(q, 0, sizeof(*q)); -@@ -1899,16 +1918,19 @@ static int bcm2835_mmal_probe(struct pla +@@ -1912,16 +1931,19 @@ static int bcm2835_mmal_probe(struct pla /* initialise video devices */ ret = bm2835_mmal_init_device(dev, &dev->vdev); @@ -155,7 +155,7 @@ Signed-off-by: Stefan Wahren goto unreg_dev; } -@@ -1932,8 +1954,6 @@ cleanup_gdev: +@@ -1945,8 +1967,6 @@ cleanup_gdev: bcm2835_cleanup_instance(gdev[i]); gdev[i] = NULL; } diff --git a/target/linux/brcm2708/patches-4.19/950-0236-staging-bcm2835-camera-Add-hint-about-possible-fault.patch b/target/linux/brcm2708/patches-4.19/950-0236-staging-bcm2835-camera-Add-hint-about-possible-fault.patch index 8091ea01dd..4cf38bcf2d 100644 --- a/target/linux/brcm2708/patches-4.19/950-0236-staging-bcm2835-camera-Add-hint-about-possible-fault.patch +++ b/target/linux/brcm2708/patches-4.19/950-0236-staging-bcm2835-camera-Add-hint-about-possible-fault.patch @@ -16,7 +16,7 @@ Signed-off-by: Stefan Wahren --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -@@ -1624,8 +1624,11 @@ int vchiq_mmal_component_init(struct vch +@@ -1620,8 +1620,11 @@ int vchiq_mmal_component_init(struct vch component = &instance->component[instance->component_idx]; ret = create_component(instance, component, name); diff --git a/target/linux/brcm2708/patches-4.19/950-0237-staging-bcm2835-Don-t-probe-if-no-camera-is-detected.patch b/target/linux/brcm2708/patches-4.19/950-0237-staging-bcm2835-Don-t-probe-if-no-camera-is-detected.patch index 0b8f0dcfa7..4e13404f59 100644 --- a/target/linux/brcm2708/patches-4.19/950-0237-staging-bcm2835-Don-t-probe-if-no-camera-is-detected.patch +++ b/target/linux/brcm2708/patches-4.19/950-0237-staging-bcm2835-Don-t-probe-if-no-camera-is-detected.patch @@ -16,7 +16,7 @@ Signed-off-by: Stefan Wahren --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -@@ -1847,6 +1847,12 @@ static int bcm2835_mmal_probe(struct pla +@@ -1860,6 +1860,12 @@ static int bcm2835_mmal_probe(struct pla num_cameras = get_num_cameras(instance, resolutions, MAX_BCM2835_CAMERAS); @@ -29,7 +29,7 @@ Signed-off-by: Stefan Wahren if (num_cameras > MAX_BCM2835_CAMERAS) num_cameras = MAX_BCM2835_CAMERAS; -@@ -1955,6 +1961,9 @@ cleanup_gdev: +@@ -1968,6 +1974,9 @@ cleanup_gdev: gdev[i] = NULL; } diff --git a/target/linux/brcm2708/patches-4.19/950-0239-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch b/target/linux/brcm2708/patches-4.19/950-0239-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch index 99a960215c..0df004ca9a 100644 --- a/target/linux/brcm2708/patches-4.19/950-0239-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch +++ b/target/linux/brcm2708/patches-4.19/950-0239-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch @@ -32,7 +32,7 @@ Signed-off-by: Dave Stevenson /* mmal instance */ struct vchiq_mmal_instance *instance; /* mmal port */ -@@ -167,6 +169,9 @@ struct vchiq_mmal_instance { +@@ -168,6 +170,9 @@ struct vchiq_mmal_instance { /* component to use next */ int component_idx; struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; @@ -42,7 +42,7 @@ Signed-off-by: Dave Stevenson }; static struct mmal_msg_context * -@@ -248,7 +253,44 @@ static void buffer_work_cb(struct work_s +@@ -251,7 +256,44 @@ static void buffer_work_cb(struct work_s msg_context->u.bulk.mmal_flags, msg_context->u.bulk.dts, msg_context->u.bulk.pts); @@ -87,7 +87,7 @@ Signed-off-by: Dave Stevenson } /* enqueue a bulk receive for a given message context */ -@@ -257,7 +299,6 @@ static int bulk_receive(struct vchiq_mma +@@ -260,7 +302,6 @@ static int bulk_receive(struct vchiq_mma struct mmal_msg_context *msg_context) { unsigned long rd_len; @@ -95,7 +95,7 @@ Signed-off-by: Dave Stevenson rd_len = msg->u.buffer_from_host.buffer_header.length; -@@ -293,45 +334,10 @@ static int bulk_receive(struct vchiq_mma +@@ -294,45 +335,10 @@ static int bulk_receive(struct vchiq_mma msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts; msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts; @@ -144,16 +144,16 @@ Signed-off-by: Dave Stevenson } /* data in message, memcpy from packet into output buffer */ -@@ -379,6 +385,8 @@ buffer_from_host(struct vchiq_mmal_insta +@@ -380,6 +386,8 @@ buffer_from_host(struct vchiq_mmal_insta /* initialise work structure ready to schedule callback */ INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb); + INIT_WORK(&msg_context->u.bulk.buffer_to_host_work, + buffer_to_host_work_cb); - /* prep the buffer from host message */ - memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */ -@@ -459,7 +467,7 @@ static void buffer_to_host_cb(struct vch + atomic_inc(&port->buffers_with_vpu); + +@@ -465,7 +473,7 @@ static void buffer_to_host_cb(struct vch if (msg->u.buffer_from_host.buffer_header.flags & MMAL_BUFFER_HEADER_FLAG_EOS) { msg_context->u.bulk.status = @@ -162,7 +162,7 @@ Signed-off-by: Dave Stevenson if (msg_context->u.bulk.status == 0) return; /* successful bulk submission, bulk * completion will trigger callback -@@ -1793,6 +1801,9 @@ int vchiq_mmal_finalise(struct vchiq_mma +@@ -1789,6 +1797,9 @@ int vchiq_mmal_finalise(struct vchiq_mma mutex_unlock(&instance->vchiq_mutex); @@ -172,7 +172,7 @@ Signed-off-by: Dave Stevenson vfree(instance->bulk_scratch); idr_destroy(&instance->context_map); -@@ -1862,6 +1873,11 @@ int vchiq_mmal_init(struct vchiq_mmal_in +@@ -1858,6 +1869,11 @@ int vchiq_mmal_init(struct vchiq_mmal_in params.callback_param = instance; @@ -184,7 +184,7 @@ Signed-off-by: Dave Stevenson status = vchi_service_open(vchi_instance, ¶ms, &instance->handle); if (status) { pr_err("Failed to open VCHI service connection (status=%d)\n", -@@ -1876,8 +1892,9 @@ int vchiq_mmal_init(struct vchiq_mmal_in +@@ -1872,8 +1888,9 @@ int vchiq_mmal_init(struct vchiq_mmal_in return 0; err_close_services: diff --git a/target/linux/brcm2708/patches-4.19/950-0240-staging-bcm2835-camera-Ensure-H264-header-bytes-get-.patch b/target/linux/brcm2708/patches-4.19/950-0240-staging-bcm2835-camera-Ensure-H264-header-bytes-get-.patch index 1cf56b22d3..3322a7ba52 100644 --- a/target/linux/brcm2708/patches-4.19/950-0240-staging-bcm2835-camera-Ensure-H264-header-bytes-get-.patch +++ b/target/linux/brcm2708/patches-4.19/950-0240-staging-bcm2835-camera-Ensure-H264-header-bytes-get-.patch @@ -20,7 +20,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -@@ -360,8 +360,13 @@ static void buffer_cb(struct vchiq_mmal_ +@@ -363,8 +363,13 @@ static void buffer_cb(struct vchiq_mmal_ } } else { if (dev->capture.frame_count) { @@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson ktime_t timestamp; s64 runtime_us = pts - dev->capture.vc_start_timestamp; -@@ -374,10 +379,28 @@ static void buffer_cb(struct vchiq_mmal_ +@@ -377,10 +382,28 @@ static void buffer_cb(struct vchiq_mmal_ ktime_to_ns(timestamp)); buf->vb.vb2_buf.timestamp = ktime_to_ns(timestamp); } else { @@ -66,7 +66,7 @@ Signed-off-by: Dave Stevenson vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE); if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS && -@@ -543,6 +566,7 @@ static int start_streaming(struct vb2_qu +@@ -546,6 +569,7 @@ static int start_streaming(struct vb2_qu dev->capture.vc_start_timestamp, parameter_size); dev->capture.kernel_start_ts = ktime_get(); diff --git a/target/linux/brcm2708/patches-4.19/950-0241-staging-bcm2835-camera-Correctly-denote-key-frames-i.patch b/target/linux/brcm2708/patches-4.19/950-0241-staging-bcm2835-camera-Correctly-denote-key-frames-i.patch index 4e2269a667..df19dd3f8c 100644 --- a/target/linux/brcm2708/patches-4.19/950-0241-staging-bcm2835-camera-Correctly-denote-key-frames-i.patch +++ b/target/linux/brcm2708/patches-4.19/950-0241-staging-bcm2835-camera-Correctly-denote-key-frames-i.patch @@ -13,7 +13,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -@@ -398,6 +398,9 @@ static void buffer_cb(struct vchiq_mmal_ +@@ -401,6 +401,9 @@ static void buffer_cb(struct vchiq_mmal_ dev->capture.last_timestamp = buf->vb.vb2_buf.timestamp; vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length); diff --git a/target/linux/brcm2708/patches-4.19/950-0242-staging-bcm2835-camera-Return-early-on-errors.patch b/target/linux/brcm2708/patches-4.19/950-0242-staging-bcm2835-camera-Return-early-on-errors.patch index 5dc558a7e3..5ccb2850d5 100644 --- a/target/linux/brcm2708/patches-4.19/950-0242-staging-bcm2835-camera-Return-early-on-errors.patch +++ b/target/linux/brcm2708/patches-4.19/950-0242-staging-bcm2835-camera-Return-early-on-errors.patch @@ -24,10 +24,10 @@ Signed-off-by: Dave Stevenson + + if (length == 0) { /* stream ended */ - if (buf) { - /* this should only ever happen if the port is -@@ -358,71 +360,72 @@ static void buffer_cb(struct vchiq_mmal_ - /* signal frame completion */ + if (dev->capture.frame_count) { + /* empty buffer whilst capturing - expected to be an +@@ -361,71 +363,72 @@ static void buffer_cb(struct vchiq_mmal_ + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); complete(&dev->capture.frame_cmplt); } - } else { @@ -158,7 +158,7 @@ Signed-off-by: Dave Stevenson } static int enable_camera(struct bm2835_mmal_dev *dev) -@@ -802,27 +805,29 @@ static int vidioc_overlay(struct file *f +@@ -815,27 +818,29 @@ static int vidioc_overlay(struct file *f ret = vchiq_mmal_port_set_format(dev->instance, src); if (ret < 0) diff --git a/target/linux/brcm2708/patches-4.19/950-0246-staging-bcm2835-camera-Reduce-length-of-enum-names.patch b/target/linux/brcm2708/patches-4.19/950-0246-staging-bcm2835-camera-Reduce-length-of-enum-names.patch index 033086e566..b480aa442e 100644 --- a/target/linux/brcm2708/patches-4.19/950-0246-staging-bcm2835-camera-Reduce-length-of-enum-names.patch +++ b/target/linux/brcm2708/patches-4.19/950-0246-staging-bcm2835-camera-Reduce-length-of-enum-names.patch @@ -152,7 +152,7 @@ Signed-off-by: Dave Stevenson } static void buffer_cb(struct vchiq_mmal_instance *instance, -@@ -436,7 +436,7 @@ static int enable_camera(struct bm2835_m +@@ -439,7 +439,7 @@ static int enable_camera(struct bm2835_m if (!dev->camera_use_count) { ret = vchiq_mmal_port_parameter_set( dev->instance, @@ -161,7 +161,7 @@ Signed-off-by: Dave Stevenson MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, sizeof(dev->camera_num)); if (ret < 0) { -@@ -447,7 +447,7 @@ static int enable_camera(struct bm2835_m +@@ -450,7 +450,7 @@ static int enable_camera(struct bm2835_m ret = vchiq_mmal_component_enable( dev->instance, @@ -170,7 +170,7 @@ Signed-off-by: Dave Stevenson if (ret < 0) { v4l2_err(&dev->v4l2_dev, "Failed enabling camera, ret %d\n", ret); -@@ -479,7 +479,7 @@ static int disable_camera(struct bm2835_ +@@ -482,7 +482,7 @@ static int disable_camera(struct bm2835_ ret = vchiq_mmal_component_disable( dev->instance, @@ -179,7 +179,7 @@ Signed-off-by: Dave Stevenson if (ret < 0) { v4l2_err(&dev->v4l2_dev, "Failed disabling camera, ret %d\n", ret); -@@ -487,7 +487,7 @@ static int disable_camera(struct bm2835_ +@@ -490,7 +490,7 @@ static int disable_camera(struct bm2835_ } vchiq_mmal_port_parameter_set( dev->instance, @@ -188,7 +188,7 @@ Signed-off-by: Dave Stevenson MMAL_PARAMETER_CAMERA_NUM, &i, sizeof(i)); } -@@ -539,7 +539,7 @@ static int start_streaming(struct vb2_qu +@@ -542,7 +542,7 @@ static int start_streaming(struct vb2_qu /* if the preview is not already running, wait for a few frames for AGC * to settle down. */ @@ -197,7 +197,7 @@ Signed-off-by: Dave Stevenson msleep(300); /* enable the connection from camera to encoder (if applicable) */ -@@ -762,9 +762,9 @@ static int vidioc_s_fmt_vid_overlay(stru +@@ -775,9 +775,9 @@ static int vidioc_s_fmt_vid_overlay(stru vidioc_try_fmt_vid_overlay(file, priv, f); dev->overlay = f->fmt.win; @@ -209,7 +209,7 @@ Signed-off-by: Dave Stevenson } return 0; -@@ -777,13 +777,13 @@ static int vidioc_overlay(struct file *f +@@ -790,13 +790,13 @@ static int vidioc_overlay(struct file *f struct vchiq_mmal_port *src; struct vchiq_mmal_port *dst; @@ -227,7 +227,7 @@ Signed-off-by: Dave Stevenson if (!on) { /* disconnect preview ports and disable component */ -@@ -795,14 +795,14 @@ static int vidioc_overlay(struct file *f +@@ -808,14 +808,14 @@ static int vidioc_overlay(struct file *f if (ret >= 0) ret = vchiq_mmal_component_disable( dev->instance, @@ -244,7 +244,7 @@ Signed-off-by: Dave Stevenson ret = vchiq_mmal_port_set_format(dev->instance, src); if (ret < 0) -@@ -819,7 +819,7 @@ static int vidioc_overlay(struct file *f +@@ -832,7 +832,7 @@ static int vidioc_overlay(struct file *f ret = vchiq_mmal_component_enable( dev->instance, @@ -253,7 +253,7 @@ Signed-off-by: Dave Stevenson if (ret < 0) return ret; -@@ -840,8 +840,8 @@ static int vidioc_g_fbuf(struct file *fi +@@ -853,8 +853,8 @@ static int vidioc_g_fbuf(struct file *fi */ struct bm2835_mmal_dev *dev = video_drvdata(file); struct vchiq_mmal_port *preview_port = @@ -264,7 +264,7 @@ Signed-off-by: Dave Stevenson a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_GLOBAL_ALPHA; -@@ -1044,31 +1044,31 @@ static int mmal_setup_components(struct +@@ -1057,31 +1057,31 @@ static int mmal_setup_components(struct } /* format dependent port setup */ switch (mfmt->mmal_component) { @@ -311,7 +311,7 @@ Signed-off-by: Dave Stevenson break; default: break; -@@ -1110,13 +1110,12 @@ static int mmal_setup_components(struct +@@ -1123,13 +1123,12 @@ static int mmal_setup_components(struct if (!ret && camera_port == @@ -329,7 +329,7 @@ Signed-off-by: Dave Stevenson /* Preview and encode ports need to match on resolution */ if (overlay_enabled) { /* Need to disable the overlay before we can update -@@ -1147,7 +1146,7 @@ static int mmal_setup_components(struct +@@ -1160,7 +1159,7 @@ static int mmal_setup_components(struct ret = vchiq_mmal_port_connect_tunnel( dev->instance, preview_port, @@ -338,7 +338,7 @@ Signed-off-by: Dave Stevenson if (!ret) ret = vchiq_mmal_port_enable(dev->instance, preview_port, -@@ -1201,11 +1200,11 @@ static int mmal_setup_components(struct +@@ -1214,11 +1213,11 @@ static int mmal_setup_components(struct port->format.encoding_variant = 0; /* Set any encoding specific parameters */ switch (mfmt->mmal_component) { @@ -352,7 +352,7 @@ Signed-off-by: Dave Stevenson /* Could set EXIF parameters here */ break; default: -@@ -1580,14 +1579,14 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1593,14 +1592,14 @@ static int mmal_init(struct bm2835_mmal_ /* get the camera component ready */ ret = vchiq_mmal_component_init(dev->instance, "ril.camera", @@ -371,7 +371,7 @@ Signed-off-by: Dave Stevenson ret = -EINVAL; goto unreg_camera; } -@@ -1609,7 +1608,7 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1622,7 +1621,7 @@ static int mmal_init(struct bm2835_mmal_ dev->rgb_bgr_swapped = true; param_size = sizeof(supported_encodings); ret = vchiq_mmal_port_parameter_get(dev->instance, @@ -380,7 +380,7 @@ Signed-off-by: Dave Stevenson MMAL_PARAMETER_SUPPORTED_ENCODINGS, &supported_encodings, ¶m_size); -@@ -1630,7 +1629,7 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1643,7 +1642,7 @@ static int mmal_init(struct bm2835_mmal_ } } } @@ -389,7 +389,7 @@ Signed-off-by: Dave Stevenson format->encoding = MMAL_ENCODING_OPAQUE; format->encoding_variant = MMAL_ENCODING_I420; -@@ -1644,7 +1643,7 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1657,7 +1656,7 @@ static int mmal_init(struct bm2835_mmal_ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ format->es->video.frame_rate.den = 1; @@ -398,7 +398,7 @@ Signed-off-by: Dave Stevenson format->encoding = MMAL_ENCODING_OPAQUE; format->encoding_variant = MMAL_ENCODING_I420; -@@ -1658,7 +1657,7 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1671,7 +1670,7 @@ static int mmal_init(struct bm2835_mmal_ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ format->es->video.frame_rate.den = 1; @@ -407,7 +407,7 @@ Signed-off-by: Dave Stevenson format->encoding = MMAL_ENCODING_OPAQUE; -@@ -1682,28 +1681,28 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1695,28 +1694,28 @@ static int mmal_init(struct bm2835_mmal_ /* get the preview component ready */ ret = vchiq_mmal_component_init( dev->instance, "ril.video_render", @@ -442,7 +442,7 @@ Signed-off-by: Dave Stevenson 1); goto unreg_image_encoder; } -@@ -1711,21 +1710,21 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1724,21 +1723,21 @@ static int mmal_init(struct bm2835_mmal_ /* get the video encoder component ready */ ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode", &dev-> @@ -468,7 +468,7 @@ Signed-off-by: Dave Stevenson encoder_port->format.encoding = MMAL_ENCODING_H264; ret = vchiq_mmal_port_set_format(dev->instance, encoder_port); -@@ -1736,12 +1735,12 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1749,12 +1748,12 @@ static int mmal_init(struct bm2835_mmal_ vchiq_mmal_port_parameter_set( dev->instance, @@ -483,7 +483,7 @@ Signed-off-by: Dave Stevenson MMAL_PARAMETER_MINIMISE_FRAGMENTATION, &enable, sizeof(enable)); -@@ -1759,23 +1758,23 @@ unreg_vid_encoder: +@@ -1772,23 +1771,23 @@ unreg_vid_encoder: pr_err("Cleanup: Destroy video encoder\n"); vchiq_mmal_component_finalise( dev->instance, @@ -511,7 +511,7 @@ Signed-off-by: Dave Stevenson unreg_mmal: vchiq_mmal_finalise(dev->instance); -@@ -1831,21 +1830,21 @@ static void bcm2835_cleanup_instance(str +@@ -1844,21 +1843,21 @@ static void bcm2835_cleanup_instance(str dev->capture.encode_component); } vchiq_mmal_component_disable(dev->instance, diff --git a/target/linux/brcm2708/patches-4.19/950-0247-staging-bcm2835-camera-Fix-multiple-line-dereference.patch b/target/linux/brcm2708/patches-4.19/950-0247-staging-bcm2835-camera-Fix-multiple-line-dereference.patch index 217cce879b..8a34daa0b8 100644 --- a/target/linux/brcm2708/patches-4.19/950-0247-staging-bcm2835-camera-Fix-multiple-line-dereference.patch +++ b/target/linux/brcm2708/patches-4.19/950-0247-staging-bcm2835-camera-Fix-multiple-line-dereference.patch @@ -23,7 +23,7 @@ Signed-off-by: Dave Stevenson } static void buffer_cb(struct vchiq_mmal_instance *instance, -@@ -782,8 +781,7 @@ static int vidioc_overlay(struct file *f +@@ -795,8 +794,7 @@ static int vidioc_overlay(struct file *f return 0; /* already in requested state */ src = @@ -33,7 +33,7 @@ Signed-off-by: Dave Stevenson if (!on) { /* disconnect preview ports and disable component */ -@@ -840,8 +838,7 @@ static int vidioc_g_fbuf(struct file *fi +@@ -853,8 +851,7 @@ static int vidioc_g_fbuf(struct file *fi */ struct bm2835_mmal_dev *dev = video_drvdata(file); struct vchiq_mmal_port *preview_port = @@ -43,7 +43,7 @@ Signed-off-by: Dave Stevenson a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_GLOBAL_ALPHA; -@@ -1033,8 +1030,7 @@ static int mmal_setup_components(struct +@@ -1046,8 +1043,7 @@ static int mmal_setup_components(struct dev->capture.camera_port, NULL); dev->capture.camera_port = NULL; ret = vchiq_mmal_component_disable(dev->instance, @@ -53,7 +53,7 @@ Signed-off-by: Dave Stevenson if (ret) v4l2_err(&dev->v4l2_dev, "Failed to disable encode component %d\n", -@@ -1049,26 +1045,22 @@ static int mmal_setup_components(struct +@@ -1062,26 +1058,22 @@ static int mmal_setup_components(struct if (f->fmt.pix.width <= max_video_width && f->fmt.pix.height <= max_video_height) camera_port = port = @@ -84,7 +84,7 @@ Signed-off-by: Dave Stevenson break; default: break; -@@ -1110,8 +1102,7 @@ static int mmal_setup_components(struct +@@ -1123,8 +1115,7 @@ static int mmal_setup_components(struct if (!ret && camera_port == @@ -94,7 +94,7 @@ Signed-off-by: Dave Stevenson bool overlay_enabled = !!dev->component[COMP_PREVIEW]->enabled; struct vchiq_mmal_port *preview_port = -@@ -1248,9 +1239,8 @@ static int mmal_setup_components(struct +@@ -1261,9 +1252,8 @@ static int mmal_setup_components(struct port->current_buffer.size); port->current_buffer.size = (f->fmt.pix.sizeimage < @@ -106,7 +106,7 @@ Signed-off-by: Dave Stevenson } v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -@@ -1709,8 +1699,7 @@ static int mmal_init(struct bm2835_mmal_ +@@ -1722,8 +1712,7 @@ static int mmal_init(struct bm2835_mmal_ /* get the video encoder component ready */ ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode", @@ -116,7 +116,7 @@ Signed-off-by: Dave Stevenson if (ret < 0) goto unreg_image_encoder; -@@ -1833,12 +1822,10 @@ static void bcm2835_cleanup_instance(str +@@ -1846,12 +1835,10 @@ static void bcm2835_cleanup_instance(str dev->component[COMP_CAMERA]); vchiq_mmal_component_finalise(dev->instance, diff --git a/target/linux/brcm2708/patches-4.19/950-0248-staging-bcm2835-camera-Fix-brace-style-issues.patch b/target/linux/brcm2708/patches-4.19/950-0248-staging-bcm2835-camera-Fix-brace-style-issues.patch index 4b0a499063..748e2a6a67 100644 --- a/target/linux/brcm2708/patches-4.19/950-0248-staging-bcm2835-camera-Fix-brace-style-issues.patch +++ b/target/linux/brcm2708/patches-4.19/950-0248-staging-bcm2835-camera-Fix-brace-style-issues.patch @@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -@@ -566,10 +566,11 @@ static int start_streaming(struct vb2_qu +@@ -569,10 +569,11 @@ static int start_streaming(struct vb2_qu /* Flag to indicate just to rely on kernel timestamps */ dev->capture.vc_start_timestamp = -1; @@ -42,7 +42,7 @@ Signed-off-by: Dave Stevenson static int ctrl_set_flicker_avoidance(struct bm2835_mmal_dev *dev, --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -@@ -1262,9 +1262,10 @@ static int port_parameter_get(struct vch +@@ -1268,9 +1268,10 @@ static int port_parameter_get(struct vch memcpy(value, &rmsg->u.port_parameter_get_reply.value, *value_size); *value_size = rmsg->u.port_parameter_get_reply.size; diff --git a/target/linux/brcm2708/patches-4.19/950-0250-staging-bcm2835-camera-Fix-logical-continuation-spli.patch b/target/linux/brcm2708/patches-4.19/950-0250-staging-bcm2835-camera-Fix-logical-continuation-spli.patch index a04ebef3b8..6d4526d1bb 100644 --- a/target/linux/brcm2708/patches-4.19/950-0250-staging-bcm2835-camera-Fix-logical-continuation-spli.patch +++ b/target/linux/brcm2708/patches-4.19/950-0250-staging-bcm2835-camera-Fix-logical-continuation-spli.patch @@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -@@ -542,8 +542,8 @@ static int start_streaming(struct vb2_qu +@@ -545,8 +545,8 @@ static int start_streaming(struct vb2_qu msleep(300); /* enable the connection from camera to encoder (if applicable) */ @@ -25,7 +25,7 @@ Signed-off-by: Dave Stevenson ret = vchiq_mmal_port_enable(dev->instance, dev->capture.camera_port, NULL); if (ret) { -@@ -1043,8 +1043,8 @@ static int mmal_setup_components(struct +@@ -1056,8 +1056,8 @@ static int mmal_setup_components(struct switch (mfmt->mmal_component) { case COMP_CAMERA: /* Make a further decision on port based on resolution */ @@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson camera_port = port = &dev->component[COMP_CAMERA]->output[CAM_PORT_VIDEO]; else -@@ -1101,8 +1101,8 @@ static int mmal_setup_components(struct +@@ -1114,8 +1114,8 @@ static int mmal_setup_components(struct ret = vchiq_mmal_port_set_format(dev->instance, camera_port); diff --git a/target/linux/brcm2708/patches-4.19/950-0251-staging-bcm2835-camera-Fix-open-parenthesis-alignmen.patch b/target/linux/brcm2708/patches-4.19/950-0251-staging-bcm2835-camera-Fix-open-parenthesis-alignmen.patch index 965261fd0b..1331849457 100644 --- a/target/linux/brcm2708/patches-4.19/950-0251-staging-bcm2835-camera-Fix-open-parenthesis-alignmen.patch +++ b/target/linux/brcm2708/patches-4.19/950-0251-staging-bcm2835-camera-Fix-open-parenthesis-alignmen.patch @@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -@@ -412,8 +412,7 @@ static void buffer_cb(struct vchiq_mmal_ +@@ -415,8 +415,7 @@ static void buffer_cb(struct vchiq_mmal_ buf->vb.flags |= V4L2_BUF_FLAG_KEYFRAME; v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, @@ -27,7 +27,7 @@ Signed-off-by: Dave Stevenson vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE); if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS && -@@ -581,8 +580,8 @@ static int start_streaming(struct vb2_qu +@@ -584,8 +583,8 @@ static int start_streaming(struct vb2_qu vchiq_mmal_port_enable(dev->instance, dev->capture.port, buffer_cb); if (ret) { v4l2_err(&dev->v4l2_dev, @@ -38,7 +38,7 @@ Signed-off-by: Dave Stevenson vchiq_mmal_port_disable(dev->instance, dev->capture.camera_port); -@@ -978,8 +977,7 @@ static int vidioc_try_fmt_vid_cap(struct +@@ -991,8 +990,7 @@ static int vidioc_try_fmt_vid_cap(struct f->fmt.pix.bytesperline = (f->fmt.pix.bytesperline + align_mask) & ~align_mask; v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, @@ -48,7 +48,7 @@ Signed-off-by: Dave Stevenson f->fmt.pix.bytesperline, align_mask); } -@@ -1325,7 +1323,7 @@ static int vidioc_s_fmt_vid_cap(struct f +@@ -1338,7 +1336,7 @@ static int vidioc_s_fmt_vid_cap(struct f } static int vidioc_enum_framesizes(struct file *file, void *fh, @@ -104,7 +104,7 @@ Signed-off-by: Dave Stevenson case MMAL_CONTROL_TYPE_CLUSTER: --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -@@ -645,7 +645,7 @@ static int send_synchronous_mmal_msg(str +@@ -651,7 +651,7 @@ static int send_synchronous_mmal_msg(str if (payload_len > (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))) { pr_err("payload length %d exceeds max:%d\n", payload_len, @@ -115,7 +115,7 @@ Signed-off-by: Dave Stevenson } --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h -@@ -128,7 +128,7 @@ int vchiq_mmal_port_enable( +@@ -131,7 +131,7 @@ int vchiq_mmal_port_enable( * disable a port will dequeue any pending buffers */ int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, @@ -124,7 +124,7 @@ Signed-off-by: Dave Stevenson int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, struct vchiq_mmal_port *port, -@@ -146,8 +146,8 @@ int vchiq_mmal_port_set_format(struct vc +@@ -149,8 +149,8 @@ int vchiq_mmal_port_set_format(struct vc struct vchiq_mmal_port *port); int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, diff --git a/target/linux/brcm2708/patches-4.19/950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch b/target/linux/brcm2708/patches-4.19/950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch deleted file mode 100644 index b5fbceba24..0000000000 --- a/target/linux/brcm2708/patches-4.19/950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 754a5ed1aa42ce9d5be5f84a5a0888f850b15e00 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Thu, 28 Jun 2018 15:57:25 +0100 -Subject: [PATCH 252/703] staging: bcm2835_camera: Ensure all buffers are - returned on disable - -With the recent change to match MMAL and V4L2 buffers there -is a need to wait for all MMAL buffers to be returned during -stop_streaming. - -Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping" -Signed-off-by: Dave Stevenson ---- - .../bcm2835-camera/bcm2835-camera.c | 22 ++++++++++++++----- - .../vc04_services/bcm2835-camera/mmal-vchiq.c | 4 ++++ - .../vc04_services/bcm2835-camera/mmal-vchiq.h | 3 +++ - 3 files changed, 23 insertions(+), 6 deletions(-) - ---- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -@@ -607,6 +607,7 @@ static void stop_streaming(struct vb2_qu - int ret; - unsigned long timeout; - struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ struct vchiq_mmal_port *port = dev->capture.port; - - v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", - __func__, dev); -@@ -630,12 +631,6 @@ static void stop_streaming(struct vb2_qu - &dev->capture.frame_count, - sizeof(dev->capture.frame_count)); - -- /* wait for last frame to complete */ -- timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ); -- if (timeout == 0) -- v4l2_err(&dev->v4l2_dev, -- "timed out waiting for frame completion\n"); -- - v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, - "disabling connection\n"); - -@@ -650,6 +645,21 @@ static void stop_streaming(struct vb2_qu - ret); - } - -+ /* wait for all buffers to be returned */ -+ while (atomic_read(&port->buffers_with_vpu)) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: Waiting for buffers to be returned - %d outstanding\n", -+ __func__, atomic_read(&port->buffers_with_vpu)); -+ timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt, -+ HZ); -+ if (timeout == 0) { -+ v4l2_err(&dev->v4l2_dev, "%s: Timeout waiting for buffers to be returned - %d outstanding\n", -+ __func__, -+ atomic_read(&port->buffers_with_vpu)); -+ break; -+ } -+ } -+ - if (disable_camera(dev) < 0) - v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n"); - } ---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -@@ -246,6 +246,8 @@ static void buffer_work_cb(struct work_s - struct mmal_msg_context *msg_context = - container_of(work, struct mmal_msg_context, u.bulk.work); - -+ atomic_dec(&msg_context->u.bulk.port->buffers_with_vpu); -+ - msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance, - msg_context->u.bulk.port, - msg_context->u.bulk.status, -@@ -389,6 +391,8 @@ buffer_from_host(struct vchiq_mmal_insta - INIT_WORK(&msg_context->u.bulk.buffer_to_host_work, - buffer_to_host_work_cb); - -+ atomic_inc(&port->buffers_with_vpu); -+ - /* prep the buffer from host message */ - memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */ - ---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h -+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h -@@ -72,6 +72,9 @@ struct vchiq_mmal_port { - struct list_head buffers; - /* lock to serialise adding and removing buffers from list */ - spinlock_t slock; -+ -+ /* Count of buffers the VPU has yet to return */ -+ atomic_t buffers_with_vpu; - /* callback on buffer completion */ - vchiq_mmal_buffer_cb buffer_cb; - /* callback context */ diff --git a/target/linux/brcm2708/patches-4.19/950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch b/target/linux/brcm2708/patches-4.19/950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch deleted file mode 100644 index f916ae1830..0000000000 --- a/target/linux/brcm2708/patches-4.19/950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 98457a5263c83026cf1d451d44d8b028b8423b87 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Wed, 4 Jul 2018 17:01:15 +0100 -Subject: [PATCH 253/703] staging: bcm2835-camera: Remove check of the number - of buffers supplied - -Before 9384167 there was a need to ensure that there were sufficient -buffers supplied from the user to cover those being sent to the VPU -(always 1). -With 9384167 the buffers are linked 1:1 between MMAL and V4L2, -therefore there is no need for that check, and indeed it is wrong -as there is no need to submit all the buffers before starting streaming. - -Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping" - -Signed-off-by: Dave Stevenson ---- - .../staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 10 ---------- - 1 file changed, 10 deletions(-) - ---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -@@ -1338,16 +1338,6 @@ static int port_enable(struct vchiq_mmal - if (port->enabled) - return 0; - -- /* ensure there are enough buffers queued to cover the buffer headers */ -- if (port->buffer_cb) { -- hdr_count = 0; -- list_for_each(buf_head, &port->buffers) { -- hdr_count++; -- } -- if (hdr_count < port->current_buffer.num) -- return -ENOSPC; -- } -- - ret = port_action_port(instance, port, - MMAL_MSG_PORT_ACTION_TYPE_ENABLE); - if (ret) diff --git a/target/linux/brcm2708/patches-4.19/950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch b/target/linux/brcm2708/patches-4.19/950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch deleted file mode 100644 index 81153c9ff9..0000000000 --- a/target/linux/brcm2708/patches-4.19/950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 1da35962d95cdb8648cb85c4b6f3d3367be88601 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Thu, 5 Jul 2018 16:17:03 +0100 -Subject: [PATCH 254/703] staging: bcm2835-camera: Handle empty EOS buffers - whilst streaming - -The change to mapping V4L2 to MMAL buffers 1:1 didn't handle -the condition we get with raw pixel buffers (eg YUV and RGB) -direct from the camera's stills port. That sends the pixel buffer -and then an empty buffer with the EOS flag set. The EOS buffer -wasn't handled and returned an error up the stack. - -Handle the condition correctly by returning it to the component -if streaming, or returning with an error if stopping streaming. - -Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping" - -Signed-off-by: Dave Stevenson ---- - .../bcm2835-camera/bcm2835-camera.c | 21 +++++++++++-------- - .../vc04_services/bcm2835-camera/mmal-vchiq.c | 5 +++-- - 2 files changed, 15 insertions(+), 11 deletions(-) - ---- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c -@@ -339,16 +339,13 @@ static void buffer_cb(struct vchiq_mmal_ - - if (length == 0) { - /* stream ended */ -- if (buf) { -- /* this should only ever happen if the port is -- * disabled and there are buffers still queued -+ if (dev->capture.frame_count) { -+ /* empty buffer whilst capturing - expected to be an -+ * EOS, so grab another frame - */ -- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); -- pr_debug("Empty buffer"); -- } else if (dev->capture.frame_count) { -- /* grab another frame */ - if (is_capturing(dev)) { -- pr_debug("Grab another frame"); -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Grab another frame"); - vchiq_mmal_port_parameter_set( - instance, - dev->capture.camera_port, -@@ -356,8 +353,14 @@ static void buffer_cb(struct vchiq_mmal_ - &dev->capture.frame_count, - sizeof(dev->capture.frame_count)); - } -+ if (vchiq_mmal_submit_buffer(instance, port, buf)) -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Failed to return EOS buffer"); - } else { -- /* signal frame completion */ -+ /* stopping streaming. -+ * return buffer, and signal frame completion -+ */ -+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); - complete(&dev->capture.frame_cmplt); - } - return; ---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -@@ -332,8 +332,6 @@ static int bulk_receive(struct vchiq_mma - - /* store length */ - msg_context->u.bulk.buffer_used = rd_len; -- msg_context->u.bulk.mmal_flags = -- msg->u.buffer_from_host.buffer_header.flags; - msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts; - msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts; - -@@ -461,6 +459,9 @@ static void buffer_to_host_cb(struct vch - return; - } - -+ msg_context->u.bulk.mmal_flags = -+ msg->u.buffer_from_host.buffer_header.flags; -+ - if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) { - /* message reception had an error */ - pr_warn("error %d in reply\n", msg->h.status); diff --git a/target/linux/brcm2708/patches-4.19/950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch b/target/linux/brcm2708/patches-4.19/950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch index 5ba783d112..13ee7ba190 100644 --- a/target/linux/brcm2708/patches-4.19/950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch +++ b/target/linux/brcm2708/patches-4.19/950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch @@ -109,1910 +109,9 @@ Signed-off-by: Dave Stevenson +ccflags-y += \ + -Idrivers/staging/vc04_services \ + -D__VCCOREVER__=0x04000000 ---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c -+++ /dev/null -@@ -1,1898 +0,0 @@ --// SPDX-License-Identifier: GPL-2.0 --/* -- * Broadcom BM2835 V4L2 driver -- * -- * Copyright © 2013 Raspberry Pi (Trading) Ltd. -- * -- * Authors: Vincent Sanders @ Collabora -- * Dave Stevenson @ Broadcom -- * (now dave.stevenson@raspberrypi.org) -- * Simon Mellor @ Broadcom -- * Luke Diamand @ Broadcom -- * -- * V4L2 driver MMAL vchiq interface code -- */ -- --#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -- --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --#include "mmal-common.h" --#include "mmal-vchiq.h" --#include "mmal-msg.h" -- --#define USE_VCHIQ_ARM --#include "interface/vchi/vchi.h" -- --/* maximum number of components supported */ --#define VCHIQ_MMAL_MAX_COMPONENTS 4 -- --/*#define FULL_MSG_DUMP 1*/ -- --#ifdef DEBUG --static const char *const msg_type_names[] = { -- "UNKNOWN", -- "QUIT", -- "SERVICE_CLOSED", -- "GET_VERSION", -- "COMPONENT_CREATE", -- "COMPONENT_DESTROY", -- "COMPONENT_ENABLE", -- "COMPONENT_DISABLE", -- "PORT_INFO_GET", -- "PORT_INFO_SET", -- "PORT_ACTION", -- "BUFFER_FROM_HOST", -- "BUFFER_TO_HOST", -- "GET_STATS", -- "PORT_PARAMETER_SET", -- "PORT_PARAMETER_GET", -- "EVENT_TO_HOST", -- "GET_CORE_STATS_FOR_PORT", -- "OPAQUE_ALLOCATOR", -- "CONSUME_MEM", -- "LMK", -- "OPAQUE_ALLOCATOR_DESC", -- "DRM_GET_LHS32", -- "DRM_GET_TIME", -- "BUFFER_FROM_HOST_ZEROLEN", -- "PORT_FLUSH", -- "HOST_LOG", --}; --#endif -- --static const char *const port_action_type_names[] = { -- "UNKNOWN", -- "ENABLE", -- "DISABLE", -- "FLUSH", -- "CONNECT", -- "DISCONNECT", -- "SET_REQUIREMENTS", --}; -- --#if defined(DEBUG) --#if defined(FULL_MSG_DUMP) --#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) \ -- do { \ -- pr_debug(TITLE" type:%s(%d) length:%d\n", \ -- msg_type_names[(MSG)->h.type], \ -- (MSG)->h.type, (MSG_LEN)); \ -- print_hex_dump(KERN_DEBUG, "<h.type], \ -- (MSG)->h.type, (MSG_LEN)); \ -- } --#endif --#else --#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) --#endif -- --struct vchiq_mmal_instance; -- --/* normal message context */ --struct mmal_msg_context { -- struct vchiq_mmal_instance *instance; -- -- /* Index in the context_map idr so that we can find the -- * mmal_msg_context again when servicing the VCHI reply. -- */ -- int handle; -- -- union { -- struct { -- /* work struct for buffer_cb callback */ -- struct work_struct work; -- /* work struct for deferred callback */ -- struct work_struct buffer_to_host_work; -- /* mmal instance */ -- struct vchiq_mmal_instance *instance; -- /* mmal port */ -- struct vchiq_mmal_port *port; -- /* actual buffer used to store bulk reply */ -- struct mmal_buffer *buffer; -- /* amount of buffer used */ -- unsigned long buffer_used; -- /* MMAL buffer flags */ -- u32 mmal_flags; -- /* Presentation and Decode timestamps */ -- s64 pts; -- s64 dts; -- -- int status; /* context status */ -- -- } bulk; /* bulk data */ -- -- struct { -- /* message handle to release */ -- VCHI_HELD_MSG_T msg_handle; -- /* pointer to received message */ -- struct mmal_msg *msg; -- /* received message length */ -- u32 msg_len; -- /* completion upon reply */ -- struct completion cmplt; -- } sync; /* synchronous response */ -- } u; -- --}; -- --struct vchiq_mmal_instance { -- VCHI_SERVICE_HANDLE_T handle; -- -- /* ensure serialised access to service */ -- struct mutex vchiq_mutex; -- -- /* vmalloc page to receive scratch bulk xfers into */ -- void *bulk_scratch; -- -- struct idr context_map; -- spinlock_t context_map_lock; -- -- /* component to use next */ -- int component_idx; -- struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; -- -- /* ordered workqueue to process all bulk operations */ -- struct workqueue_struct *bulk_wq; --}; -- --static struct mmal_msg_context * --get_msg_context(struct vchiq_mmal_instance *instance) --{ -- struct mmal_msg_context *msg_context; -- int handle; -- -- /* todo: should this be allocated from a pool to avoid kzalloc */ -- msg_context = kzalloc(sizeof(*msg_context), GFP_KERNEL); -- -- if (!msg_context) -- return ERR_PTR(-ENOMEM); -- -- /* Create an ID that will be passed along with our message so -- * that when we service the VCHI reply, we can look up what -- * message is being replied to. -- */ -- spin_lock(&instance->context_map_lock); -- handle = idr_alloc(&instance->context_map, msg_context, -- 0, 0, GFP_KERNEL); -- spin_unlock(&instance->context_map_lock); -- -- if (handle < 0) { -- kfree(msg_context); -- return ERR_PTR(handle); -- } -- -- msg_context->instance = instance; -- msg_context->handle = handle; -- -- return msg_context; --} -- --static struct mmal_msg_context * --lookup_msg_context(struct vchiq_mmal_instance *instance, int handle) --{ -- return idr_find(&instance->context_map, handle); --} -- --static void --release_msg_context(struct mmal_msg_context *msg_context) --{ -- struct vchiq_mmal_instance *instance = msg_context->instance; -- -- spin_lock(&instance->context_map_lock); -- idr_remove(&instance->context_map, msg_context->handle); -- spin_unlock(&instance->context_map_lock); -- kfree(msg_context); --} -- --/* deals with receipt of event to host message */ --static void event_to_host_cb(struct vchiq_mmal_instance *instance, -- struct mmal_msg *msg, u32 msg_len) --{ -- pr_debug("unhandled event\n"); -- pr_debug("component:%u port type:%d num:%d cmd:0x%x length:%d\n", -- msg->u.event_to_host.client_component, -- msg->u.event_to_host.port_type, -- msg->u.event_to_host.port_num, -- msg->u.event_to_host.cmd, msg->u.event_to_host.length); --} -- --/* workqueue scheduled callback -- * -- * we do this because it is important we do not call any other vchiq -- * sync calls from witin the message delivery thread -- */ --static void buffer_work_cb(struct work_struct *work) --{ -- struct mmal_msg_context *msg_context = -- container_of(work, struct mmal_msg_context, u.bulk.work); -- -- atomic_dec(&msg_context->u.bulk.port->buffers_with_vpu); -- -- msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance, -- msg_context->u.bulk.port, -- msg_context->u.bulk.status, -- msg_context->u.bulk.buffer, -- msg_context->u.bulk.buffer_used, -- msg_context->u.bulk.mmal_flags, -- msg_context->u.bulk.dts, -- msg_context->u.bulk.pts); --} -- --/* workqueue scheduled callback to handle receiving buffers -- * -- * VCHI will allow up to 4 bulk receives to be scheduled before blocking. -- * If we block in the service_callback context then we can't process the -- * VCHI_CALLBACK_BULK_RECEIVED message that would otherwise allow the blocked -- * vchi_bulk_queue_receive() call to complete. -- */ --static void buffer_to_host_work_cb(struct work_struct *work) --{ -- struct mmal_msg_context *msg_context = -- container_of(work, struct mmal_msg_context, -- u.bulk.buffer_to_host_work); -- struct vchiq_mmal_instance *instance = msg_context->instance; -- unsigned long len = msg_context->u.bulk.buffer_used; -- int ret; -- -- if (!len) -- /* Dummy receive to ensure the buffers remain in order */ -- len = 8; -- /* queue the bulk submission */ -- vchi_service_use(instance->handle); -- ret = vchi_bulk_queue_receive(instance->handle, -- msg_context->u.bulk.buffer->buffer, -- /* Actual receive needs to be a multiple -- * of 4 bytes -- */ -- (len + 3) & ~3, -- VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | -- VCHI_FLAGS_BLOCK_UNTIL_QUEUED, -- msg_context); -- -- vchi_service_release(instance->handle); -- -- if (ret != 0) -- pr_err("%s: ctx: %p, vchi_bulk_queue_receive failed %d\n", -- __func__, msg_context, ret); --} -- --/* enqueue a bulk receive for a given message context */ --static int bulk_receive(struct vchiq_mmal_instance *instance, -- struct mmal_msg *msg, -- struct mmal_msg_context *msg_context) --{ -- unsigned long rd_len; -- -- rd_len = msg->u.buffer_from_host.buffer_header.length; -- -- if (!msg_context->u.bulk.buffer) { -- pr_err("bulk.buffer not configured - error in buffer_from_host\n"); -- -- /* todo: this is a serious error, we should never have -- * committed a buffer_to_host operation to the mmal -- * port without the buffer to back it up (underflow -- * handling) and there is no obvious way to deal with -- * this - how is the mmal servie going to react when -- * we fail to do the xfer and reschedule a buffer when -- * it arrives? perhaps a starved flag to indicate a -- * waiting bulk receive? -- */ -- -- return -EINVAL; -- } -- -- /* ensure we do not overrun the available buffer */ -- if (rd_len > msg_context->u.bulk.buffer->buffer_size) { -- rd_len = msg_context->u.bulk.buffer->buffer_size; -- pr_warn("short read as not enough receive buffer space\n"); -- /* todo: is this the correct response, what happens to -- * the rest of the message data? -- */ -- } -- -- /* store length */ -- msg_context->u.bulk.buffer_used = rd_len; -- msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts; -- msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts; -- -- queue_work(msg_context->instance->bulk_wq, -- &msg_context->u.bulk.buffer_to_host_work); -- -- return 0; --} -- --/* data in message, memcpy from packet into output buffer */ --static int inline_receive(struct vchiq_mmal_instance *instance, -- struct mmal_msg *msg, -- struct mmal_msg_context *msg_context) --{ -- memcpy(msg_context->u.bulk.buffer->buffer, -- msg->u.buffer_from_host.short_data, -- msg->u.buffer_from_host.payload_in_message); -- -- msg_context->u.bulk.buffer_used = -- msg->u.buffer_from_host.payload_in_message; -- -- return 0; --} -- --/* queue the buffer availability with MMAL_MSG_TYPE_BUFFER_FROM_HOST */ --static int --buffer_from_host(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port, struct mmal_buffer *buf) --{ -- struct mmal_msg_context *msg_context; -- struct mmal_msg m; -- int ret; -- -- if (!port->enabled) -- return -EINVAL; -- -- pr_debug("instance:%p buffer:%p\n", instance->handle, buf); -- -- /* get context */ -- if (!buf->msg_context) { -- pr_err("%s: msg_context not allocated, buf %p\n", __func__, -- buf); -- return -EINVAL; -- } -- msg_context = buf->msg_context; -- -- /* store bulk message context for when data arrives */ -- msg_context->u.bulk.instance = instance; -- msg_context->u.bulk.port = port; -- msg_context->u.bulk.buffer = buf; -- msg_context->u.bulk.buffer_used = 0; -- -- /* initialise work structure ready to schedule callback */ -- INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb); -- INIT_WORK(&msg_context->u.bulk.buffer_to_host_work, -- buffer_to_host_work_cb); -- -- atomic_inc(&port->buffers_with_vpu); -- -- /* prep the buffer from host message */ -- memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */ -- -- m.h.type = MMAL_MSG_TYPE_BUFFER_FROM_HOST; -- m.h.magic = MMAL_MAGIC; -- m.h.context = msg_context->handle; -- m.h.status = 0; -- -- /* drvbuf is our private data passed back */ -- m.u.buffer_from_host.drvbuf.magic = MMAL_MAGIC; -- m.u.buffer_from_host.drvbuf.component_handle = port->component->handle; -- m.u.buffer_from_host.drvbuf.port_handle = port->handle; -- m.u.buffer_from_host.drvbuf.client_context = msg_context->handle; -- -- /* buffer header */ -- m.u.buffer_from_host.buffer_header.cmd = 0; -- m.u.buffer_from_host.buffer_header.data = -- (u32)(unsigned long)buf->buffer; -- m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size; -- m.u.buffer_from_host.buffer_header.length = 0; /* nothing used yet */ -- m.u.buffer_from_host.buffer_header.offset = 0; /* no offset */ -- m.u.buffer_from_host.buffer_header.flags = 0; /* no flags */ -- m.u.buffer_from_host.buffer_header.pts = MMAL_TIME_UNKNOWN; -- m.u.buffer_from_host.buffer_header.dts = MMAL_TIME_UNKNOWN; -- -- /* clear buffer type sepecific data */ -- memset(&m.u.buffer_from_host.buffer_header_type_specific, 0, -- sizeof(m.u.buffer_from_host.buffer_header_type_specific)); -- -- /* no payload in message */ -- m.u.buffer_from_host.payload_in_message = 0; -- -- vchi_service_use(instance->handle); -- -- ret = vchi_queue_kernel_message(instance->handle, -- &m, -- sizeof(struct mmal_msg_header) + -- sizeof(m.u.buffer_from_host)); -- -- vchi_service_release(instance->handle); -- -- return ret; --} -- --/* deals with receipt of buffer to host message */ --static void buffer_to_host_cb(struct vchiq_mmal_instance *instance, -- struct mmal_msg *msg, u32 msg_len) --{ -- struct mmal_msg_context *msg_context; -- u32 handle; -- -- pr_debug("%s: instance:%p msg:%p msg_len:%d\n", -- __func__, instance, msg, msg_len); -- -- if (msg->u.buffer_from_host.drvbuf.magic == MMAL_MAGIC) { -- handle = msg->u.buffer_from_host.drvbuf.client_context; -- msg_context = lookup_msg_context(instance, handle); -- -- if (!msg_context) { -- pr_err("drvbuf.client_context(%u) is invalid\n", -- handle); -- return; -- } -- } else { -- pr_err("MMAL_MSG_TYPE_BUFFER_TO_HOST with bad magic\n"); -- return; -- } -- -- msg_context->u.bulk.mmal_flags = -- msg->u.buffer_from_host.buffer_header.flags; -- -- if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) { -- /* message reception had an error */ -- pr_warn("error %d in reply\n", msg->h.status); -- -- msg_context->u.bulk.status = msg->h.status; -- -- } else if (msg->u.buffer_from_host.buffer_header.length == 0) { -- /* empty buffer */ -- if (msg->u.buffer_from_host.buffer_header.flags & -- MMAL_BUFFER_HEADER_FLAG_EOS) { -- msg_context->u.bulk.status = -- bulk_receive(instance, msg, msg_context); -- if (msg_context->u.bulk.status == 0) -- return; /* successful bulk submission, bulk -- * completion will trigger callback -- */ -- } else { -- /* do callback with empty buffer - not EOS though */ -- msg_context->u.bulk.status = 0; -- msg_context->u.bulk.buffer_used = 0; -- } -- } else if (msg->u.buffer_from_host.payload_in_message == 0) { -- /* data is not in message, queue a bulk receive */ -- msg_context->u.bulk.status = -- bulk_receive(instance, msg, msg_context); -- if (msg_context->u.bulk.status == 0) -- return; /* successful bulk submission, bulk -- * completion will trigger callback -- */ -- -- /* failed to submit buffer, this will end badly */ -- pr_err("error %d on bulk submission\n", -- msg_context->u.bulk.status); -- -- } else if (msg->u.buffer_from_host.payload_in_message <= -- MMAL_VC_SHORT_DATA) { -- /* data payload within message */ -- msg_context->u.bulk.status = inline_receive(instance, msg, -- msg_context); -- } else { -- pr_err("message with invalid short payload\n"); -- -- /* signal error */ -- msg_context->u.bulk.status = -EINVAL; -- msg_context->u.bulk.buffer_used = -- msg->u.buffer_from_host.payload_in_message; -- } -- -- /* schedule the port callback */ -- schedule_work(&msg_context->u.bulk.work); --} -- --static void bulk_receive_cb(struct vchiq_mmal_instance *instance, -- struct mmal_msg_context *msg_context) --{ -- msg_context->u.bulk.status = 0; -- -- /* schedule the port callback */ -- schedule_work(&msg_context->u.bulk.work); --} -- --static void bulk_abort_cb(struct vchiq_mmal_instance *instance, -- struct mmal_msg_context *msg_context) --{ -- pr_err("%s: bulk ABORTED msg_context:%p\n", __func__, msg_context); -- -- msg_context->u.bulk.status = -EINTR; -- -- schedule_work(&msg_context->u.bulk.work); --} -- --/* incoming event service callback */ --static void service_callback(void *param, -- const VCHI_CALLBACK_REASON_T reason, -- void *bulk_ctx) --{ -- struct vchiq_mmal_instance *instance = param; -- int status; -- u32 msg_len; -- struct mmal_msg *msg; -- VCHI_HELD_MSG_T msg_handle; -- struct mmal_msg_context *msg_context; -- -- if (!instance) { -- pr_err("Message callback passed NULL instance\n"); -- return; -- } -- -- switch (reason) { -- case VCHI_CALLBACK_MSG_AVAILABLE: -- status = vchi_msg_hold(instance->handle, (void **)&msg, -- &msg_len, VCHI_FLAGS_NONE, &msg_handle); -- if (status) { -- pr_err("Unable to dequeue a message (%d)\n", status); -- break; -- } -- -- DBG_DUMP_MSG(msg, msg_len, "<<< reply message"); -- -- /* handling is different for buffer messages */ -- switch (msg->h.type) { -- case MMAL_MSG_TYPE_BUFFER_FROM_HOST: -- vchi_held_msg_release(&msg_handle); -- break; -- -- case MMAL_MSG_TYPE_EVENT_TO_HOST: -- event_to_host_cb(instance, msg, msg_len); -- vchi_held_msg_release(&msg_handle); -- -- break; -- -- case MMAL_MSG_TYPE_BUFFER_TO_HOST: -- buffer_to_host_cb(instance, msg, msg_len); -- vchi_held_msg_release(&msg_handle); -- break; -- -- default: -- /* messages dependent on header context to complete */ -- if (!msg->h.context) { -- pr_err("received message context was null!\n"); -- vchi_held_msg_release(&msg_handle); -- break; -- } -- -- msg_context = lookup_msg_context(instance, -- msg->h.context); -- if (!msg_context) { -- pr_err("received invalid message context %u!\n", -- msg->h.context); -- vchi_held_msg_release(&msg_handle); -- break; -- } -- -- /* fill in context values */ -- msg_context->u.sync.msg_handle = msg_handle; -- msg_context->u.sync.msg = msg; -- msg_context->u.sync.msg_len = msg_len; -- -- /* todo: should this check (completion_done() -- * == 1) for no one waiting? or do we need a -- * flag to tell us the completion has been -- * interrupted so we can free the message and -- * its context. This probably also solves the -- * message arriving after interruption todo -- * below -- */ -- -- /* complete message so caller knows it happened */ -- complete(&msg_context->u.sync.cmplt); -- break; -- } -- -- break; -- -- case VCHI_CALLBACK_BULK_RECEIVED: -- bulk_receive_cb(instance, bulk_ctx); -- break; -- -- case VCHI_CALLBACK_BULK_RECEIVE_ABORTED: -- bulk_abort_cb(instance, bulk_ctx); -- break; -- -- case VCHI_CALLBACK_SERVICE_CLOSED: -- /* TODO: consider if this requires action if received when -- * driver is not explicitly closing the service -- */ -- break; -- -- default: -- pr_err("Received unhandled message reason %d\n", reason); -- break; -- } --} -- --static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, -- struct mmal_msg *msg, -- unsigned int payload_len, -- struct mmal_msg **msg_out, -- VCHI_HELD_MSG_T *msg_handle_out) --{ -- struct mmal_msg_context *msg_context; -- int ret; -- unsigned long timeout; -- -- /* payload size must not cause message to exceed max size */ -- if (payload_len > -- (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))) { -- pr_err("payload length %d exceeds max:%d\n", payload_len, -- (int)(MMAL_MSG_MAX_SIZE - -- sizeof(struct mmal_msg_header))); -- return -EINVAL; -- } -- -- msg_context = get_msg_context(instance); -- if (IS_ERR(msg_context)) -- return PTR_ERR(msg_context); -- -- init_completion(&msg_context->u.sync.cmplt); -- -- msg->h.magic = MMAL_MAGIC; -- msg->h.context = msg_context->handle; -- msg->h.status = 0; -- -- DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), -- ">>> sync message"); -- -- vchi_service_use(instance->handle); -- -- ret = vchi_queue_kernel_message(instance->handle, -- msg, -- sizeof(struct mmal_msg_header) + -- payload_len); -- -- vchi_service_release(instance->handle); -- -- if (ret) { -- pr_err("error %d queuing message\n", ret); -- release_msg_context(msg_context); -- return ret; -- } -- -- timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt, -- 3 * HZ); -- if (timeout == 0) { -- pr_err("timed out waiting for sync completion\n"); -- ret = -ETIME; -- /* todo: what happens if the message arrives after aborting */ -- release_msg_context(msg_context); -- return ret; -- } -- -- *msg_out = msg_context->u.sync.msg; -- *msg_handle_out = msg_context->u.sync.msg_handle; -- release_msg_context(msg_context); -- -- return 0; --} -- --static void dump_port_info(struct vchiq_mmal_port *port) --{ -- pr_debug("port handle:0x%x enabled:%d\n", port->handle, port->enabled); -- -- pr_debug("buffer minimum num:%d size:%d align:%d\n", -- port->minimum_buffer.num, -- port->minimum_buffer.size, port->minimum_buffer.alignment); -- -- pr_debug("buffer recommended num:%d size:%d align:%d\n", -- port->recommended_buffer.num, -- port->recommended_buffer.size, -- port->recommended_buffer.alignment); -- -- pr_debug("buffer current values num:%d size:%d align:%d\n", -- port->current_buffer.num, -- port->current_buffer.size, port->current_buffer.alignment); -- -- pr_debug("elementary stream: type:%d encoding:0x%x variant:0x%x\n", -- port->format.type, -- port->format.encoding, port->format.encoding_variant); -- -- pr_debug(" bitrate:%d flags:0x%x\n", -- port->format.bitrate, port->format.flags); -- -- if (port->format.type == MMAL_ES_TYPE_VIDEO) { -- pr_debug -- ("es video format: width:%d height:%d colourspace:0x%x\n", -- port->es.video.width, port->es.video.height, -- port->es.video.color_space); -- -- pr_debug(" : crop xywh %d,%d,%d,%d\n", -- port->es.video.crop.x, -- port->es.video.crop.y, -- port->es.video.crop.width, port->es.video.crop.height); -- pr_debug(" : framerate %d/%d aspect %d/%d\n", -- port->es.video.frame_rate.num, -- port->es.video.frame_rate.den, -- port->es.video.par.num, port->es.video.par.den); -- } --} -- --static void port_to_mmal_msg(struct vchiq_mmal_port *port, struct mmal_port *p) --{ -- /* todo do readonly fields need setting at all? */ -- p->type = port->type; -- p->index = port->index; -- p->index_all = 0; -- p->is_enabled = port->enabled; -- p->buffer_num_min = port->minimum_buffer.num; -- p->buffer_size_min = port->minimum_buffer.size; -- p->buffer_alignment_min = port->minimum_buffer.alignment; -- p->buffer_num_recommended = port->recommended_buffer.num; -- p->buffer_size_recommended = port->recommended_buffer.size; -- -- /* only three writable fields in a port */ -- p->buffer_num = port->current_buffer.num; -- p->buffer_size = port->current_buffer.size; -- p->userdata = (u32)(unsigned long)port; --} -- --static int port_info_set(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- pr_debug("setting port info port %p\n", port); -- if (!port) -- return -1; -- dump_port_info(port); -- -- m.h.type = MMAL_MSG_TYPE_PORT_INFO_SET; -- -- m.u.port_info_set.component_handle = port->component->handle; -- m.u.port_info_set.port_type = port->type; -- m.u.port_info_set.port_index = port->index; -- -- port_to_mmal_msg(port, &m.u.port_info_set.port); -- -- /* elementary stream format setup */ -- m.u.port_info_set.format.type = port->format.type; -- m.u.port_info_set.format.encoding = port->format.encoding; -- m.u.port_info_set.format.encoding_variant = -- port->format.encoding_variant; -- m.u.port_info_set.format.bitrate = port->format.bitrate; -- m.u.port_info_set.format.flags = port->format.flags; -- -- memcpy(&m.u.port_info_set.es, &port->es, -- sizeof(union mmal_es_specific_format)); -- -- m.u.port_info_set.format.extradata_size = port->format.extradata_size; -- memcpy(&m.u.port_info_set.extradata, port->format.extradata, -- port->format.extradata_size); -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(m.u.port_info_set), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_SET) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- /* return operation status */ -- ret = -rmsg->u.port_info_get_reply.status; -- -- pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret, -- port->component->handle, port->handle); -- --release_msg: -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --/* use port info get message to retrieve port information */ --static int port_info_get(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- /* port info time */ -- m.h.type = MMAL_MSG_TYPE_PORT_INFO_GET; -- m.u.port_info_get.component_handle = port->component->handle; -- m.u.port_info_get.port_type = port->type; -- m.u.port_info_get.index = port->index; -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(m.u.port_info_get), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_GET) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- /* return operation status */ -- ret = -rmsg->u.port_info_get_reply.status; -- if (ret != MMAL_MSG_STATUS_SUCCESS) -- goto release_msg; -- -- if (rmsg->u.port_info_get_reply.port.is_enabled == 0) -- port->enabled = false; -- else -- port->enabled = true; -- -- /* copy the values out of the message */ -- port->handle = rmsg->u.port_info_get_reply.port_handle; -- -- /* port type and index cached to use on port info set because -- * it does not use a port handle -- */ -- port->type = rmsg->u.port_info_get_reply.port_type; -- port->index = rmsg->u.port_info_get_reply.port_index; -- -- port->minimum_buffer.num = -- rmsg->u.port_info_get_reply.port.buffer_num_min; -- port->minimum_buffer.size = -- rmsg->u.port_info_get_reply.port.buffer_size_min; -- port->minimum_buffer.alignment = -- rmsg->u.port_info_get_reply.port.buffer_alignment_min; -- -- port->recommended_buffer.alignment = -- rmsg->u.port_info_get_reply.port.buffer_alignment_min; -- port->recommended_buffer.num = -- rmsg->u.port_info_get_reply.port.buffer_num_recommended; -- -- port->current_buffer.num = rmsg->u.port_info_get_reply.port.buffer_num; -- port->current_buffer.size = -- rmsg->u.port_info_get_reply.port.buffer_size; -- -- /* stream format */ -- port->format.type = rmsg->u.port_info_get_reply.format.type; -- port->format.encoding = rmsg->u.port_info_get_reply.format.encoding; -- port->format.encoding_variant = -- rmsg->u.port_info_get_reply.format.encoding_variant; -- port->format.bitrate = rmsg->u.port_info_get_reply.format.bitrate; -- port->format.flags = rmsg->u.port_info_get_reply.format.flags; -- -- /* elementary stream format */ -- memcpy(&port->es, -- &rmsg->u.port_info_get_reply.es, -- sizeof(union mmal_es_specific_format)); -- port->format.es = &port->es; -- -- port->format.extradata_size = -- rmsg->u.port_info_get_reply.format.extradata_size; -- memcpy(port->format.extradata, -- rmsg->u.port_info_get_reply.extradata, -- port->format.extradata_size); -- -- pr_debug("received port info\n"); -- dump_port_info(port); -- --release_msg: -- -- pr_debug("%s:result:%d component:0x%x port:%d\n", -- __func__, ret, port->component->handle, port->handle); -- -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --/* create comonent on vc */ --static int create_component(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_component *component, -- const char *name) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- /* build component create message */ -- m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; -- m.u.component_create.client_component = (u32)(unsigned long)component; -- strncpy(m.u.component_create.name, name, -- sizeof(m.u.component_create.name)); -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(m.u.component_create), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != m.h.type) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- ret = -rmsg->u.component_create_reply.status; -- if (ret != MMAL_MSG_STATUS_SUCCESS) -- goto release_msg; -- -- /* a valid component response received */ -- component->handle = rmsg->u.component_create_reply.component_handle; -- component->inputs = rmsg->u.component_create_reply.input_num; -- component->outputs = rmsg->u.component_create_reply.output_num; -- component->clocks = rmsg->u.component_create_reply.clock_num; -- -- pr_debug("Component handle:0x%x in:%d out:%d clock:%d\n", -- component->handle, -- component->inputs, component->outputs, component->clocks); -- --release_msg: -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --/* destroys a component on vc */ --static int destroy_component(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_component *component) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- m.h.type = MMAL_MSG_TYPE_COMPONENT_DESTROY; -- m.u.component_destroy.component_handle = component->handle; -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(m.u.component_destroy), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != m.h.type) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- ret = -rmsg->u.component_destroy_reply.status; -- --release_msg: -- -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --/* enable a component on vc */ --static int enable_component(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_component *component) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- m.h.type = MMAL_MSG_TYPE_COMPONENT_ENABLE; -- m.u.component_enable.component_handle = component->handle; -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(m.u.component_enable), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != m.h.type) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- ret = -rmsg->u.component_enable_reply.status; -- --release_msg: -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --/* disable a component on vc */ --static int disable_component(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_component *component) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- m.h.type = MMAL_MSG_TYPE_COMPONENT_DISABLE; -- m.u.component_disable.component_handle = component->handle; -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(m.u.component_disable), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != m.h.type) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- ret = -rmsg->u.component_disable_reply.status; -- --release_msg: -- -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --/* get version of mmal implementation */ --static int get_version(struct vchiq_mmal_instance *instance, -- u32 *major_out, u32 *minor_out) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- m.h.type = MMAL_MSG_TYPE_GET_VERSION; -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(m.u.version), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != m.h.type) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- *major_out = rmsg->u.version.major; -- *minor_out = rmsg->u.version.minor; -- --release_msg: -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --/* do a port action with a port as a parameter */ --static int port_action_port(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port, -- enum mmal_msg_port_action_type action_type) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- m.h.type = MMAL_MSG_TYPE_PORT_ACTION; -- m.u.port_action_port.component_handle = port->component->handle; -- m.u.port_action_port.port_handle = port->handle; -- m.u.port_action_port.action = action_type; -- -- port_to_mmal_msg(port, &m.u.port_action_port.port); -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(m.u.port_action_port), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- ret = -rmsg->u.port_action_reply.status; -- -- pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)\n", -- __func__, -- ret, port->component->handle, port->handle, -- port_action_type_names[action_type], action_type); -- --release_msg: -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --/* do a port action with handles as parameters */ --static int port_action_handle(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port, -- enum mmal_msg_port_action_type action_type, -- u32 connect_component_handle, -- u32 connect_port_handle) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- m.h.type = MMAL_MSG_TYPE_PORT_ACTION; -- -- m.u.port_action_handle.component_handle = port->component->handle; -- m.u.port_action_handle.port_handle = port->handle; -- m.u.port_action_handle.action = action_type; -- -- m.u.port_action_handle.connect_component_handle = -- connect_component_handle; -- m.u.port_action_handle.connect_port_handle = connect_port_handle; -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(m.u.port_action_handle), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- ret = -rmsg->u.port_action_reply.status; -- -- pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d) connect component:0x%x connect port:%d\n", -- __func__, -- ret, port->component->handle, port->handle, -- port_action_type_names[action_type], -- action_type, connect_component_handle, connect_port_handle); -- --release_msg: -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --static int port_parameter_set(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port, -- u32 parameter_id, void *value, u32 value_size) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_SET; -- -- m.u.port_parameter_set.component_handle = port->component->handle; -- m.u.port_parameter_set.port_handle = port->handle; -- m.u.port_parameter_set.id = parameter_id; -- m.u.port_parameter_set.size = (2 * sizeof(u32)) + value_size; -- memcpy(&m.u.port_parameter_set.value, value, value_size); -- -- ret = send_synchronous_mmal_msg(instance, &m, -- (4 * sizeof(u32)) + value_size, -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_SET) { -- /* got an unexpected message type in reply */ -- ret = -EINVAL; -- goto release_msg; -- } -- -- ret = -rmsg->u.port_parameter_set_reply.status; -- -- pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", -- __func__, -- ret, port->component->handle, port->handle, parameter_id); -- --release_msg: -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --static int port_parameter_get(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port, -- u32 parameter_id, void *value, u32 *value_size) --{ -- int ret; -- struct mmal_msg m; -- struct mmal_msg *rmsg; -- VCHI_HELD_MSG_T rmsg_handle; -- -- m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_GET; -- -- m.u.port_parameter_get.component_handle = port->component->handle; -- m.u.port_parameter_get.port_handle = port->handle; -- m.u.port_parameter_get.id = parameter_id; -- m.u.port_parameter_get.size = (2 * sizeof(u32)) + *value_size; -- -- ret = send_synchronous_mmal_msg(instance, &m, -- sizeof(struct -- mmal_msg_port_parameter_get), -- &rmsg, &rmsg_handle); -- if (ret) -- return ret; -- -- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_GET) { -- /* got an unexpected message type in reply */ -- pr_err("Incorrect reply type %d\n", rmsg->h.type); -- ret = -EINVAL; -- goto release_msg; -- } -- -- ret = -rmsg->u.port_parameter_get_reply.status; -- /* port_parameter_get_reply.size includes the header, -- * whilst *value_size doesn't. -- */ -- rmsg->u.port_parameter_get_reply.size -= (2 * sizeof(u32)); -- -- if (ret || rmsg->u.port_parameter_get_reply.size > *value_size) { -- /* Copy only as much as we have space for -- * but report true size of parameter -- */ -- memcpy(value, &rmsg->u.port_parameter_get_reply.value, -- *value_size); -- *value_size = rmsg->u.port_parameter_get_reply.size; -- } else { -- memcpy(value, &rmsg->u.port_parameter_get_reply.value, -- rmsg->u.port_parameter_get_reply.size); -- } -- -- pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__, -- ret, port->component->handle, port->handle, parameter_id); -- --release_msg: -- vchi_held_msg_release(&rmsg_handle); -- -- return ret; --} -- --/* disables a port and drains buffers from it */ --static int port_disable(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port) --{ -- int ret; -- struct list_head *q, *buf_head; -- unsigned long flags = 0; -- -- if (!port->enabled) -- return 0; -- -- port->enabled = false; -- -- ret = port_action_port(instance, port, -- MMAL_MSG_PORT_ACTION_TYPE_DISABLE); -- if (ret == 0) { -- /* -- * Drain all queued buffers on port. This should only -- * apply to buffers that have been queued before the port -- * has been enabled. If the port has been enabled and buffers -- * passed, then the buffers should have been removed from this -- * list, and we should get the relevant callbacks via VCHIQ -- * to release the buffers. -- */ -- spin_lock_irqsave(&port->slock, flags); -- -- list_for_each_safe(buf_head, q, &port->buffers) { -- struct mmal_buffer *mmalbuf; -- -- mmalbuf = list_entry(buf_head, struct mmal_buffer, -- list); -- list_del(buf_head); -- if (port->buffer_cb) -- port->buffer_cb(instance, -- port, 0, mmalbuf, 0, 0, -- MMAL_TIME_UNKNOWN, -- MMAL_TIME_UNKNOWN); -- } -- -- spin_unlock_irqrestore(&port->slock, flags); -- -- ret = port_info_get(instance, port); -- } -- -- return ret; --} -- --/* enable a port */ --static int port_enable(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port) --{ -- unsigned int hdr_count; -- struct list_head *q, *buf_head; -- int ret; -- -- if (port->enabled) -- return 0; -- -- ret = port_action_port(instance, port, -- MMAL_MSG_PORT_ACTION_TYPE_ENABLE); -- if (ret) -- goto done; -- -- port->enabled = true; -- -- if (port->buffer_cb) { -- /* send buffer headers to videocore */ -- hdr_count = 1; -- list_for_each_safe(buf_head, q, &port->buffers) { -- struct mmal_buffer *mmalbuf; -- -- mmalbuf = list_entry(buf_head, struct mmal_buffer, -- list); -- ret = buffer_from_host(instance, port, mmalbuf); -- if (ret) -- goto done; -- -- list_del(buf_head); -- hdr_count++; -- if (hdr_count > port->current_buffer.num) -- break; -- } -- } -- -- ret = port_info_get(instance, port); -- --done: -- return ret; --} -- --/* ------------------------------------------------------------------ -- * Exported API -- *------------------------------------------------------------------ -- */ -- --int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- ret = port_info_set(instance, port); -- if (ret) -- goto release_unlock; -- -- /* read what has actually been set */ -- ret = port_info_get(instance, port); -- --release_unlock: -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port, -- u32 parameter, void *value, u32 value_size) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- ret = port_parameter_set(instance, port, parameter, value, value_size); -- -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port, -- u32 parameter, void *value, u32 *value_size) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- ret = port_parameter_get(instance, port, parameter, value, value_size); -- -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --/* enable a port -- * -- * enables a port and queues buffers for satisfying callbacks if we -- * provide a callback handler -- */ --int vchiq_mmal_port_enable(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port, -- vchiq_mmal_buffer_cb buffer_cb) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- /* already enabled - noop */ -- if (port->enabled) { -- ret = 0; -- goto unlock; -- } -- -- port->buffer_cb = buffer_cb; -- -- ret = port_enable(instance, port); -- --unlock: -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- if (!port->enabled) { -- mutex_unlock(&instance->vchiq_mutex); -- return 0; -- } -- -- ret = port_disable(instance, port); -- -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --/* ports will be connected in a tunneled manner so data buffers -- * are not handled by client. -- */ --int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *src, -- struct vchiq_mmal_port *dst) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- /* disconnect ports if connected */ -- if (src->connected) { -- ret = port_disable(instance, src); -- if (ret) { -- pr_err("failed disabling src port(%d)\n", ret); -- goto release_unlock; -- } -- -- /* do not need to disable the destination port as they -- * are connected and it is done automatically -- */ -- -- ret = port_action_handle(instance, src, -- MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT, -- src->connected->component->handle, -- src->connected->handle); -- if (ret < 0) { -- pr_err("failed disconnecting src port\n"); -- goto release_unlock; -- } -- src->connected->enabled = false; -- src->connected = NULL; -- } -- -- if (!dst) { -- /* do not make new connection */ -- ret = 0; -- pr_debug("not making new connection\n"); -- goto release_unlock; -- } -- -- /* copy src port format to dst */ -- dst->format.encoding = src->format.encoding; -- dst->es.video.width = src->es.video.width; -- dst->es.video.height = src->es.video.height; -- dst->es.video.crop.x = src->es.video.crop.x; -- dst->es.video.crop.y = src->es.video.crop.y; -- dst->es.video.crop.width = src->es.video.crop.width; -- dst->es.video.crop.height = src->es.video.crop.height; -- dst->es.video.frame_rate.num = src->es.video.frame_rate.num; -- dst->es.video.frame_rate.den = src->es.video.frame_rate.den; -- -- /* set new format */ -- ret = port_info_set(instance, dst); -- if (ret) { -- pr_debug("setting port info failed\n"); -- goto release_unlock; -- } -- -- /* read what has actually been set */ -- ret = port_info_get(instance, dst); -- if (ret) { -- pr_debug("read back port info failed\n"); -- goto release_unlock; -- } -- -- /* connect two ports together */ -- ret = port_action_handle(instance, src, -- MMAL_MSG_PORT_ACTION_TYPE_CONNECT, -- dst->component->handle, dst->handle); -- if (ret < 0) { -- pr_debug("connecting port %d:%d to %d:%d failed\n", -- src->component->handle, src->handle, -- dst->component->handle, dst->handle); -- goto release_unlock; -- } -- src->connected = dst; -- --release_unlock: -- -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_port *port, -- struct mmal_buffer *buffer) --{ -- unsigned long flags = 0; -- int ret; -- -- ret = buffer_from_host(instance, port, buffer); -- if (ret == -EINVAL) { -- /* Port is disabled. Queue for when it is enabled. */ -- spin_lock_irqsave(&port->slock, flags); -- list_add_tail(&buffer->list, &port->buffers); -- spin_unlock_irqrestore(&port->slock, flags); -- } -- -- 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 -- * -- */ --int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, -- const char *name, -- struct vchiq_mmal_component **component_out) --{ -- int ret; -- int idx; /* port index */ -- struct vchiq_mmal_component *component; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- if (instance->component_idx == VCHIQ_MMAL_MAX_COMPONENTS) { -- ret = -EINVAL; /* todo is this correct error? */ -- goto unlock; -- } -- -- component = &instance->component[instance->component_idx]; -- -- ret = create_component(instance, component, name); -- if (ret < 0) { -- pr_err("%s: failed to create component %d (Not enough GPU mem?)\n", -- __func__, ret); -- goto unlock; -- } -- -- /* ports info needs gathering */ -- component->control.type = MMAL_PORT_TYPE_CONTROL; -- component->control.index = 0; -- component->control.component = component; -- spin_lock_init(&component->control.slock); -- INIT_LIST_HEAD(&component->control.buffers); -- ret = port_info_get(instance, &component->control); -- if (ret < 0) -- goto release_component; -- -- for (idx = 0; idx < component->inputs; idx++) { -- component->input[idx].type = MMAL_PORT_TYPE_INPUT; -- component->input[idx].index = idx; -- component->input[idx].component = component; -- spin_lock_init(&component->input[idx].slock); -- INIT_LIST_HEAD(&component->input[idx].buffers); -- ret = port_info_get(instance, &component->input[idx]); -- if (ret < 0) -- goto release_component; -- } -- -- for (idx = 0; idx < component->outputs; idx++) { -- component->output[idx].type = MMAL_PORT_TYPE_OUTPUT; -- component->output[idx].index = idx; -- component->output[idx].component = component; -- spin_lock_init(&component->output[idx].slock); -- INIT_LIST_HEAD(&component->output[idx].buffers); -- ret = port_info_get(instance, &component->output[idx]); -- if (ret < 0) -- goto release_component; -- } -- -- for (idx = 0; idx < component->clocks; idx++) { -- component->clock[idx].type = MMAL_PORT_TYPE_CLOCK; -- component->clock[idx].index = idx; -- component->clock[idx].component = component; -- spin_lock_init(&component->clock[idx].slock); -- INIT_LIST_HEAD(&component->clock[idx].buffers); -- ret = port_info_get(instance, &component->clock[idx]); -- if (ret < 0) -- goto release_component; -- } -- -- instance->component_idx++; -- -- *component_out = component; -- -- mutex_unlock(&instance->vchiq_mutex); -- -- return 0; -- --release_component: -- destroy_component(instance, component); --unlock: -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --/* -- * cause a mmal component to be destroyed -- */ --int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_component *component) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- if (component->enabled) -- ret = disable_component(instance, component); -- -- ret = destroy_component(instance, component); -- -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --/* -- * cause a mmal component to be enabled -- */ --int vchiq_mmal_component_enable(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_component *component) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- if (component->enabled) { -- mutex_unlock(&instance->vchiq_mutex); -- return 0; -- } -- -- ret = enable_component(instance, component); -- if (ret == 0) -- component->enabled = true; -- -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --/* -- * cause a mmal component to be enabled -- */ --int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance, -- struct vchiq_mmal_component *component) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- if (!component->enabled) { -- mutex_unlock(&instance->vchiq_mutex); -- return 0; -- } -- -- ret = disable_component(instance, component); -- if (ret == 0) -- component->enabled = false; -- -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --int vchiq_mmal_version(struct vchiq_mmal_instance *instance, -- u32 *major_out, u32 *minor_out) --{ -- int ret; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- ret = get_version(instance, major_out, minor_out); -- -- mutex_unlock(&instance->vchiq_mutex); -- -- return ret; --} -- --int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) --{ -- int status = 0; -- -- if (!instance) -- return -EINVAL; -- -- if (mutex_lock_interruptible(&instance->vchiq_mutex)) -- return -EINTR; -- -- vchi_service_use(instance->handle); -- -- status = vchi_service_close(instance->handle); -- if (status != 0) -- pr_err("mmal-vchiq: VCHIQ close failed\n"); -- -- mutex_unlock(&instance->vchiq_mutex); -- -- flush_workqueue(instance->bulk_wq); -- destroy_workqueue(instance->bulk_wq); -- -- vfree(instance->bulk_scratch); -- -- idr_destroy(&instance->context_map); -- -- kfree(instance); -- -- return status; --} -- --int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) --{ -- int status; -- struct vchiq_mmal_instance *instance; -- static VCHI_CONNECTION_T *vchi_connection; -- static VCHI_INSTANCE_T vchi_instance; -- SERVICE_CREATION_T params = { -- .version = VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER), -- .service_id = VC_MMAL_SERVER_NAME, -- .connection = vchi_connection, -- .rx_fifo_size = 0, -- .tx_fifo_size = 0, -- .callback = service_callback, -- .callback_param = NULL, -- .want_unaligned_bulk_rx = 1, -- .want_unaligned_bulk_tx = 1, -- .want_crc = 0 -- }; -- -- /* compile time checks to ensure structure size as they are -- * directly (de)serialised from memory. -- */ -- -- /* ensure the header structure has packed to the correct size */ -- BUILD_BUG_ON(sizeof(struct mmal_msg_header) != 24); -- -- /* ensure message structure does not exceed maximum length */ -- BUILD_BUG_ON(sizeof(struct mmal_msg) > MMAL_MSG_MAX_SIZE); -- -- /* mmal port struct is correct size */ -- BUILD_BUG_ON(sizeof(struct mmal_port) != 64); -- -- /* create a vchi instance */ -- status = vchi_initialise(&vchi_instance); -- if (status) { -- pr_err("Failed to initialise VCHI instance (status=%d)\n", -- status); -- return -EIO; -- } -- -- status = vchi_connect(NULL, 0, vchi_instance); -- if (status) { -- pr_err("Failed to connect VCHI instance (status=%d)\n", status); -- return -EIO; -- } -- -- instance = kzalloc(sizeof(*instance), GFP_KERNEL); -- -- if (!instance) -- return -ENOMEM; -- -- mutex_init(&instance->vchiq_mutex); -- -- instance->bulk_scratch = vmalloc(PAGE_SIZE); -- -- spin_lock_init(&instance->context_map_lock); -- idr_init_base(&instance->context_map, 1); -- -- params.callback_param = instance; -- -- instance->bulk_wq = alloc_ordered_workqueue("mmal-vchiq", -- WQ_MEM_RECLAIM); -- if (!instance->bulk_wq) -- goto err_free; -- -- status = vchi_service_open(vchi_instance, ¶ms, &instance->handle); -- if (status) { -- pr_err("Failed to open VCHI service connection (status=%d)\n", -- status); -- goto err_close_services; -- } -- -- vchi_service_release(instance->handle); -- -- *out_instance = instance; -- -- return 0; -- --err_close_services: -- vchi_service_close(instance->handle); -- destroy_workqueue(instance->bulk_wq); --err_free: -- vfree(instance->bulk_scratch); -- kfree(instance); -- return -ENODEV; --} --- /dev/null +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -0,0 +1,1920 @@ +@@ -0,0 +1,1921 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Broadcom BM2835 V4L2 driver @@ -2186,7 +285,8 @@ Signed-off-by: Dave Stevenson + void *bulk_scratch; + + struct idr context_map; -+ spinlock_t context_map_lock; ++ /* protect accesses to context_map */ ++ struct mutex context_map_lock; + + /* component to use next */ + int component_idx; @@ -2212,10 +312,10 @@ Signed-off-by: Dave Stevenson + * that when we service the VCHI reply, we can look up what + * message is being replied to. + */ -+ spin_lock(&instance->context_map_lock); ++ mutex_lock(&instance->context_map_lock); + handle = idr_alloc(&instance->context_map, msg_context, + 0, 0, GFP_KERNEL); -+ spin_unlock(&instance->context_map_lock); ++ mutex_unlock(&instance->context_map_lock); + + if (handle < 0) { + kfree(msg_context); @@ -2239,9 +339,9 @@ Signed-off-by: Dave Stevenson +{ + struct vchiq_mmal_instance *instance = msg_context->instance; + -+ spin_lock(&instance->context_map_lock); ++ mutex_lock(&instance->context_map_lock); + idr_remove(&instance->context_map, msg_context->handle); -+ spin_unlock(&instance->context_map_lock); ++ mutex_unlock(&instance->context_map_lock); + kfree(msg_context); +} + @@ -3901,7 +2001,7 @@ Signed-off-by: Dave Stevenson + + instance->bulk_scratch = vmalloc(PAGE_SIZE); + -+ spin_lock_init(&instance->context_map_lock); ++ mutex_init(&instance->context_map_lock); + idr_init_base(&instance->context_map, 1); + + params.callback_param = instance; diff --git a/target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch b/target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch index fefea5d9bb..4764ae297e 100644 --- a/target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch +++ b/target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch @@ -30,16 +30,16 @@ Signed-off-by: Dave Stevenson /*#define FULL_MSG_DUMP 1*/ -@@ -173,8 +176,6 @@ struct vchiq_mmal_instance { - struct idr context_map; - spinlock_t context_map_lock; +@@ -174,8 +177,6 @@ struct vchiq_mmal_instance { + /* protect accesses to context_map */ + struct mutex context_map_lock; - /* component to use next */ - int component_idx; struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; /* ordered workqueue to process all bulk operations */ -@@ -1631,18 +1632,24 @@ int vchiq_mmal_component_init(struct vch +@@ -1632,18 +1633,24 @@ int vchiq_mmal_component_init(struct vch { int ret; int idx; /* port index */ @@ -68,7 +68,7 @@ Signed-off-by: Dave Stevenson ret = create_component(instance, component, name); if (ret < 0) { pr_err("%s: failed to create component %d (Not enough GPU mem?)\n", -@@ -1693,8 +1700,6 @@ int vchiq_mmal_component_init(struct vch +@@ -1694,8 +1701,6 @@ int vchiq_mmal_component_init(struct vch goto release_component; } @@ -77,7 +77,7 @@ Signed-off-by: Dave Stevenson *component_out = component; mutex_unlock(&instance->vchiq_mutex); -@@ -1704,6 +1709,8 @@ int vchiq_mmal_component_init(struct vch +@@ -1705,6 +1710,8 @@ int vchiq_mmal_component_init(struct vch release_component: destroy_component(instance, component); unlock: @@ -86,7 +86,7 @@ Signed-off-by: Dave Stevenson mutex_unlock(&instance->vchiq_mutex); return ret; -@@ -1726,6 +1733,8 @@ int vchiq_mmal_component_finalise(struct +@@ -1727,6 +1734,8 @@ int vchiq_mmal_component_finalise(struct ret = destroy_component(instance, component); diff --git a/target/linux/brcm2708/patches-4.19/950-0269-staging-mmal-vchiq-Avoid-use-of-bool-in-structures.patch b/target/linux/brcm2708/patches-4.19/950-0269-staging-mmal-vchiq-Avoid-use-of-bool-in-structures.patch index 9a2d443125..48cc89eec9 100644 --- a/target/linux/brcm2708/patches-4.19/950-0269-staging-mmal-vchiq-Avoid-use-of-bool-in-structures.patch +++ b/target/linux/brcm2708/patches-4.19/950-0269-staging-mmal-vchiq-Avoid-use-of-bool-in-structures.patch @@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -860,9 +860,9 @@ static int port_info_get(struct vchiq_mm +@@ -861,9 +861,9 @@ static int port_info_get(struct vchiq_mm goto release_msg; if (rmsg->u.port_info_get_reply.port.is_enabled == 0) @@ -26,7 +26,7 @@ Signed-off-by: Dave Stevenson /* copy the values out of the message */ port->handle = rmsg->u.port_info_get_reply.port_handle; -@@ -1299,7 +1299,7 @@ static int port_disable(struct vchiq_mma +@@ -1300,7 +1300,7 @@ static int port_disable(struct vchiq_mma if (!port->enabled) return 0; @@ -35,7 +35,7 @@ Signed-off-by: Dave Stevenson ret = port_action_port(instance, port, MMAL_MSG_PORT_ACTION_TYPE_DISABLE); -@@ -1351,7 +1351,7 @@ static int port_enable(struct vchiq_mmal +@@ -1352,7 +1352,7 @@ static int port_enable(struct vchiq_mmal if (ret) goto done; @@ -44,7 +44,7 @@ Signed-off-by: Dave Stevenson if (port->buffer_cb) { /* send buffer headers to videocore */ -@@ -1523,7 +1523,7 @@ int vchiq_mmal_port_connect_tunnel(struc +@@ -1524,7 +1524,7 @@ int vchiq_mmal_port_connect_tunnel(struc pr_err("failed disconnecting src port\n"); goto release_unlock; } @@ -53,7 +53,7 @@ Signed-off-by: Dave Stevenson src->connected = NULL; } -@@ -1759,7 +1759,7 @@ int vchiq_mmal_component_enable(struct v +@@ -1760,7 +1760,7 @@ int vchiq_mmal_component_enable(struct v ret = enable_component(instance, component); if (ret == 0) @@ -62,7 +62,7 @@ Signed-off-by: Dave Stevenson mutex_unlock(&instance->vchiq_mutex); -@@ -1785,7 +1785,7 @@ int vchiq_mmal_component_disable(struct +@@ -1786,7 +1786,7 @@ int vchiq_mmal_component_disable(struct ret = disable_component(instance, component); if (ret == 0) diff --git a/target/linux/brcm2708/patches-4.19/950-0270-staging-mmal-vchiq-Make-timeout-a-defined-parameter.patch b/target/linux/brcm2708/patches-4.19/950-0270-staging-mmal-vchiq-Make-timeout-a-defined-parameter.patch index 6168d078f8..bcccde74de 100644 --- a/target/linux/brcm2708/patches-4.19/950-0270-staging-mmal-vchiq-Make-timeout-a-defined-parameter.patch +++ b/target/linux/brcm2708/patches-4.19/950-0270-staging-mmal-vchiq-Make-timeout-a-defined-parameter.patch @@ -27,7 +27,7 @@ Signed-off-by: Dave Stevenson /*#define FULL_MSG_DUMP 1*/ #ifdef DEBUG -@@ -691,7 +697,7 @@ static int send_synchronous_mmal_msg(str +@@ -692,7 +698,7 @@ static int send_synchronous_mmal_msg(str } timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt, diff --git a/target/linux/brcm2708/patches-4.19/950-0271-staging-mmal-vchiq-Make-a-mmal_buf-struct-for-passin.patch b/target/linux/brcm2708/patches-4.19/950-0271-staging-mmal-vchiq-Make-a-mmal_buf-struct-for-passin.patch index daf73061f0..d32aa85445 100644 --- a/target/linux/brcm2708/patches-4.19/950-0271-staging-mmal-vchiq-Make-a-mmal_buf-struct-for-passin.patch +++ b/target/linux/brcm2708/patches-4.19/950-0271-staging-mmal-vchiq-Make-a-mmal_buf-struct-for-passin.patch @@ -216,7 +216,7 @@ Signed-off-by: Dave Stevenson /* */ --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -258,17 +258,25 @@ static void buffer_work_cb(struct work_s +@@ -259,17 +259,25 @@ static void buffer_work_cb(struct work_s { struct mmal_msg_context *msg_context = container_of(work, struct mmal_msg_context, u.bulk.work); @@ -247,7 +247,7 @@ Signed-off-by: Dave Stevenson } /* workqueue scheduled callback to handle receiving buffers -@@ -1326,11 +1334,14 @@ static int port_disable(struct vchiq_mma +@@ -1327,11 +1335,14 @@ static int port_disable(struct vchiq_mma mmalbuf = list_entry(buf_head, struct mmal_buffer, list); list_del(buf_head); diff --git a/target/linux/brcm2708/patches-4.19/950-0272-staging-mmal-vchiq-Add-support-for-event-callbacks.patch b/target/linux/brcm2708/patches-4.19/950-0272-staging-mmal-vchiq-Add-support-for-event-callbacks.patch index 4744405a45..34006c5377 100644 --- a/target/linux/brcm2708/patches-4.19/950-0272-staging-mmal-vchiq-Add-support-for-event-callbacks.patch +++ b/target/linux/brcm2708/patches-4.19/950-0272-staging-mmal-vchiq-Add-support-for-event-callbacks.patch @@ -83,7 +83,7 @@ Signed-off-by: Dave Stevenson int status; /* context status */ -@@ -237,18 +239,6 @@ release_msg_context(struct mmal_msg_cont +@@ -238,18 +240,6 @@ release_msg_context(struct mmal_msg_cont kfree(msg_context); } @@ -102,7 +102,7 @@ Signed-off-by: Dave Stevenson /* workqueue scheduled callback * * we do this because it is important we do not call any other vchiq -@@ -270,13 +260,18 @@ static void buffer_work_cb(struct work_s +@@ -271,13 +261,18 @@ static void buffer_work_cb(struct work_s buffer->mmal_flags = msg_context->u.bulk.mmal_flags; buffer->dts = msg_context->u.bulk.dts; buffer->pts = msg_context->u.bulk.pts; @@ -122,7 +122,7 @@ Signed-off-by: Dave Stevenson } /* workqueue scheduled callback to handle receiving buffers -@@ -355,6 +350,7 @@ static int bulk_receive(struct vchiq_mma +@@ -356,6 +351,7 @@ static int bulk_receive(struct vchiq_mma msg_context->u.bulk.buffer_used = rd_len; msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts; msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts; @@ -130,7 +130,7 @@ Signed-off-by: Dave Stevenson queue_work(msg_context->instance->bulk_wq, &msg_context->u.bulk.buffer_to_host_work); -@@ -456,6 +452,103 @@ buffer_from_host(struct vchiq_mmal_insta +@@ -457,6 +453,103 @@ buffer_from_host(struct vchiq_mmal_insta return ret; } @@ -234,7 +234,7 @@ Signed-off-by: Dave Stevenson /* deals with receipt of buffer to host message */ static void buffer_to_host_cb(struct vchiq_mmal_instance *instance, struct mmal_msg *msg, u32 msg_len) -@@ -1339,6 +1432,7 @@ static int port_disable(struct vchiq_mma +@@ -1340,6 +1433,7 @@ static int port_disable(struct vchiq_mma mmalbuf->mmal_flags = 0; mmalbuf->dts = MMAL_TIME_UNKNOWN; mmalbuf->pts = MMAL_TIME_UNKNOWN; @@ -242,7 +242,7 @@ Signed-off-by: Dave Stevenson port->buffer_cb(instance, port, 0, mmalbuf); } -@@ -1640,6 +1734,43 @@ int mmal_vchi_buffer_cleanup(struct mmal +@@ -1641,6 +1735,43 @@ int mmal_vchi_buffer_cleanup(struct mmal } EXPORT_SYMBOL_GPL(mmal_vchi_buffer_cleanup); @@ -286,7 +286,7 @@ Signed-off-by: Dave Stevenson /* Initialise a mmal component and its ports * */ -@@ -1683,6 +1814,7 @@ int vchiq_mmal_component_init(struct vch +@@ -1684,6 +1815,7 @@ int vchiq_mmal_component_init(struct vch ret = port_info_get(instance, &component->control); if (ret < 0) goto release_component; @@ -294,7 +294,7 @@ Signed-off-by: Dave Stevenson for (idx = 0; idx < component->inputs; idx++) { component->input[idx].type = MMAL_PORT_TYPE_INPUT; -@@ -1693,6 +1825,7 @@ int vchiq_mmal_component_init(struct vch +@@ -1694,6 +1826,7 @@ int vchiq_mmal_component_init(struct vch ret = port_info_get(instance, &component->input[idx]); if (ret < 0) goto release_component; @@ -302,7 +302,7 @@ Signed-off-by: Dave Stevenson } for (idx = 0; idx < component->outputs; idx++) { -@@ -1704,6 +1837,7 @@ int vchiq_mmal_component_init(struct vch +@@ -1705,6 +1838,7 @@ int vchiq_mmal_component_init(struct vch ret = port_info_get(instance, &component->output[idx]); if (ret < 0) goto release_component; @@ -310,7 +310,7 @@ Signed-off-by: Dave Stevenson } for (idx = 0; idx < component->clocks; idx++) { -@@ -1715,6 +1849,7 @@ int vchiq_mmal_component_init(struct vch +@@ -1716,6 +1850,7 @@ int vchiq_mmal_component_init(struct vch ret = port_info_get(instance, &component->clock[idx]); if (ret < 0) goto release_component; @@ -318,7 +318,7 @@ Signed-off-by: Dave Stevenson } *component_out = component; -@@ -1740,7 +1875,7 @@ EXPORT_SYMBOL_GPL(vchiq_mmal_component_i +@@ -1741,7 +1876,7 @@ EXPORT_SYMBOL_GPL(vchiq_mmal_component_i int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, struct vchiq_mmal_component *component) { @@ -327,7 +327,7 @@ Signed-off-by: Dave Stevenson if (mutex_lock_interruptible(&instance->vchiq_mutex)) return -EINTR; -@@ -1752,6 +1887,13 @@ int vchiq_mmal_component_finalise(struct +@@ -1753,6 +1888,13 @@ int vchiq_mmal_component_finalise(struct component->in_use = 0; diff --git a/target/linux/brcm2708/patches-4.19/950-0273-staging-vc04_services-Support-sending-data-to-MMAL-p.patch b/target/linux/brcm2708/patches-4.19/950-0273-staging-vc04_services-Support-sending-data-to-MMAL-p.patch index 735ef4a4f3..4d2a20fa5f 100644 --- a/target/linux/brcm2708/patches-4.19/950-0273-staging-vc04_services-Support-sending-data-to-MMAL-p.patch +++ b/target/linux/brcm2708/patches-4.19/950-0273-staging-vc04_services-Support-sending-data-to-MMAL-p.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -427,11 +427,19 @@ buffer_from_host(struct vchiq_mmal_insta +@@ -428,11 +428,19 @@ buffer_from_host(struct vchiq_mmal_insta m.u.buffer_from_host.buffer_header.data = (u32)(unsigned long)buf->buffer; m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size; diff --git a/target/linux/brcm2708/patches-4.19/950-0277-staging-vc04_services-Use-vc-sm-cma-to-support-zero-.patch b/target/linux/brcm2708/patches-4.19/950-0277-staging-vc04_services-Use-vc-sm-cma-to-support-zero-.patch index 93dbba1cc0..5d4c7a53c3 100644 --- a/target/linux/brcm2708/patches-4.19/950-0277-staging-vc04_services-Use-vc-sm-cma-to-support-zero-.patch +++ b/target/linux/brcm2708/patches-4.19/950-0277-staging-vc04_services-Use-vc-sm-cma-to-support-zero-.patch @@ -53,7 +53,7 @@ Signed-off-by: Dave Stevenson #define USE_VCHIQ_ARM #include "interface/vchi/vchi.h" -@@ -424,8 +427,13 @@ buffer_from_host(struct vchiq_mmal_insta +@@ -425,8 +428,13 @@ buffer_from_host(struct vchiq_mmal_insta /* buffer header */ m.u.buffer_from_host.buffer_header.cmd = 0; @@ -69,7 +69,7 @@ Signed-off-by: Dave Stevenson m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size; if (port->type == MMAL_PORT_TYPE_OUTPUT) { m.u.buffer_from_host.buffer_header.length = 0; -@@ -590,6 +598,22 @@ static void buffer_to_host_cb(struct vch +@@ -591,6 +599,22 @@ static void buffer_to_host_cb(struct vch msg_context->u.bulk.status = msg->h.status; @@ -92,7 +92,7 @@ Signed-off-by: Dave Stevenson } else if (msg->u.buffer_from_host.buffer_header.length == 0) { /* empty buffer */ if (msg->u.buffer_from_host.buffer_header.flags & -@@ -1537,6 +1561,9 @@ int vchiq_mmal_port_parameter_set(struct +@@ -1538,6 +1562,9 @@ int vchiq_mmal_port_parameter_set(struct mutex_unlock(&instance->vchiq_mutex); @@ -102,7 +102,7 @@ Signed-off-by: Dave Stevenson return ret; } EXPORT_SYMBOL_GPL(vchiq_mmal_port_parameter_set); -@@ -1705,6 +1732,31 @@ int vchiq_mmal_submit_buffer(struct vchi +@@ -1706,6 +1733,31 @@ int vchiq_mmal_submit_buffer(struct vchi unsigned long flags = 0; int ret; @@ -134,7 +134,7 @@ Signed-off-by: Dave Stevenson ret = buffer_from_host(instance, port, buffer); if (ret == -EINVAL) { /* Port is disabled. Queue for when it is enabled. */ -@@ -1738,6 +1790,16 @@ int mmal_vchi_buffer_cleanup(struct mmal +@@ -1739,6 +1791,16 @@ int mmal_vchi_buffer_cleanup(struct mmal release_msg_context(msg_context); buf->msg_context = NULL; diff --git a/target/linux/brcm2708/patches-4.19/950-0278-media-videobuf2-Allow-exporting-of-a-struct-dmabuf.patch b/target/linux/brcm2708/patches-4.19/950-0278-media-videobuf2-Allow-exporting-of-a-struct-dmabuf.patch index 3972c0b6ad..743faa2c3f 100644 --- a/target/linux/brcm2708/patches-4.19/950-0278-media-videobuf2-Allow-exporting-of-a-struct-dmabuf.patch +++ b/target/linux/brcm2708/patches-4.19/950-0278-media-videobuf2-Allow-exporting-of-a-struct-dmabuf.patch @@ -19,7 +19,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c -@@ -1847,12 +1847,12 @@ static int __find_plane_by_offset(struct +@@ -1851,12 +1851,12 @@ static int __find_plane_by_offset(struct return -EINVAL; } @@ -35,7 +35,7 @@ Signed-off-by: Dave Stevenson struct dma_buf *dbuf; if (q->memory != VB2_MEMORY_MMAP) { -@@ -1902,6 +1902,21 @@ int vb2_core_expbuf(struct vb2_queue *q, +@@ -1906,6 +1906,21 @@ int vb2_core_expbuf(struct vb2_queue *q, return -EINVAL; } diff --git a/target/linux/brcm2708/patches-4.19/950-0285-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch b/target/linux/brcm2708/patches-4.19/950-0285-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch index df13c3b87c..33c3242c92 100644 --- a/target/linux/brcm2708/patches-4.19/950-0285-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch +++ b/target/linux/brcm2708/patches-4.19/950-0285-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch @@ -36,7 +36,7 @@ Signed-off-by: Tomasz Figa --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c -@@ -550,20 +550,6 @@ bool vb2_buffer_in_use(struct vb2_queue +@@ -554,20 +554,6 @@ bool vb2_buffer_in_use(struct vb2_queue } EXPORT_SYMBOL(vb2_buffer_in_use); @@ -57,7 +57,7 @@ Signed-off-by: Tomasz Figa void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb) { call_void_bufop(q, fill_user_buffer, q->bufs[index], pb); -@@ -675,16 +661,7 @@ int vb2_core_reqbufs(struct vb2_queue *q +@@ -679,16 +665,7 @@ int vb2_core_reqbufs(struct vb2_queue *q if (*count == 0 || q->num_buffers != 0 || (q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) { diff --git a/target/linux/brcm2708/patches-4.19/950-0319-staging-mmal-vchiq-Fix-client_component-for-64-bit-k.patch b/target/linux/brcm2708/patches-4.19/950-0319-staging-mmal-vchiq-Fix-client_component-for-64-bit-k.patch index 098362baf6..f06f3034e1 100644 --- a/target/linux/brcm2708/patches-4.19/950-0319-staging-mmal-vchiq-Fix-client_component-for-64-bit-k.patch +++ b/target/linux/brcm2708/patches-4.19/950-0319-staging-mmal-vchiq-Fix-client_component-for-64-bit-k.patch @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -472,9 +472,9 @@ buffer_from_host(struct vchiq_mmal_insta +@@ -473,9 +473,9 @@ buffer_from_host(struct vchiq_mmal_insta static void event_to_host_cb(struct vchiq_mmal_instance *instance, struct mmal_msg *msg, u32 msg_len) { @@ -34,7 +34,7 @@ Signed-off-by: Dave Stevenson struct vchiq_mmal_port *port = NULL; struct mmal_msg_context *msg_context; u32 port_num = msg->u.event_to_host.port_num; -@@ -1073,7 +1073,7 @@ static int create_component(struct vchiq +@@ -1074,7 +1074,7 @@ static int create_component(struct vchiq /* build component create message */ m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; @@ -43,7 +43,7 @@ Signed-off-by: Dave Stevenson strncpy(m.u.component_create.name, name, sizeof(m.u.component_create.name)); -@@ -1868,6 +1868,12 @@ int vchiq_mmal_component_init(struct vch +@@ -1869,6 +1869,12 @@ int vchiq_mmal_component_init(struct vch goto unlock; } diff --git a/target/linux/brcm2708/patches-4.19/950-0346-staging-vc-sm-cma-Use-a-void-pointer-as-the-handle-w.patch b/target/linux/brcm2708/patches-4.19/950-0346-staging-vc-sm-cma-Use-a-void-pointer-as-the-handle-w.patch index a9205fbff2..c263663533 100644 --- a/target/linux/brcm2708/patches-4.19/950-0346-staging-vc-sm-cma-Use-a-void-pointer-as-the-handle-w.patch +++ b/target/linux/brcm2708/patches-4.19/950-0346-staging-vc-sm-cma-Use-a-void-pointer-as-the-handle-w.patch @@ -100,7 +100,7 @@ Signed-off-by: Dave Stevenson u32 cmd; /* MMAL command. 0=data. */ --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -1793,7 +1793,7 @@ int mmal_vchi_buffer_cleanup(struct mmal +@@ -1794,7 +1794,7 @@ int mmal_vchi_buffer_cleanup(struct mmal if (buf->vcsm_handle) { int ret; diff --git a/target/linux/brcm2708/patches-4.19/950-0359-staging-mmal-vchiq-Always-return-the-param-size-from.patch b/target/linux/brcm2708/patches-4.19/950-0359-staging-mmal-vchiq-Always-return-the-param-size-from.patch index 5e8b8e9b55..f43d5c4412 100644 --- a/target/linux/brcm2708/patches-4.19/950-0359-staging-mmal-vchiq-Always-return-the-param-size-from.patch +++ b/target/linux/brcm2708/patches-4.19/950-0359-staging-mmal-vchiq-Always-return-the-param-size-from.patch @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -1412,11 +1412,12 @@ static int port_parameter_get(struct vch +@@ -1413,11 +1413,12 @@ static int port_parameter_get(struct vch */ memcpy(value, &rmsg->u.port_parameter_get_reply.value, *value_size); diff --git a/target/linux/brcm2708/patches-4.19/950-0360-staging-mmal-vchiq-If-the-VPU-returns-an-error-don-t.patch b/target/linux/brcm2708/patches-4.19/950-0360-staging-mmal-vchiq-If-the-VPU-returns-an-error-don-t.patch index f79e499930..d9b3d7e77f 100644 --- a/target/linux/brcm2708/patches-4.19/950-0360-staging-mmal-vchiq-If-the-VPU-returns-an-error-don-t.patch +++ b/target/linux/brcm2708/patches-4.19/950-0360-staging-mmal-vchiq-If-the-VPU-returns-an-error-don-t.patch @@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -1400,7 +1400,8 @@ static int port_parameter_get(struct vch +@@ -1401,7 +1401,8 @@ static int port_parameter_get(struct vch goto release_msg; } diff --git a/target/linux/brcm2708/patches-4.19/950-0364-staging-bcm2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch b/target/linux/brcm2708/patches-4.19/950-0364-staging-bcm2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch index 8e6e693563..5bd32d1184 100644 --- a/target/linux/brcm2708/patches-4.19/950-0364-staging-bcm2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch +++ b/target/linux/brcm2708/patches-4.19/950-0364-staging-bcm2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch @@ -137,7 +137,7 @@ Signed-off-by: Dave Stevenson /* If both ports disabled, then disable the component */ --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -1784,13 +1784,9 @@ int mmal_vchi_buffer_init(struct vchiq_m +@@ -1785,13 +1785,9 @@ int mmal_vchi_buffer_init(struct vchiq_m } EXPORT_SYMBOL_GPL(mmal_vchi_buffer_init); @@ -153,7 +153,7 @@ Signed-off-by: Dave Stevenson if (buf->vcsm_handle) { int ret; -@@ -1802,6 +1798,19 @@ int mmal_vchi_buffer_cleanup(struct mmal +@@ -1803,6 +1799,19 @@ int mmal_vchi_buffer_cleanup(struct mmal pr_err("%s: vcsm_free failed, ret %d\n", __func__, ret); buf->vcsm_handle = 0; } diff --git a/target/linux/brcm2708/patches-4.19/950-0488-staging-mmal-vchiq-Free-the-event-context-for-contro.patch b/target/linux/brcm2708/patches-4.19/950-0488-staging-mmal-vchiq-Free-the-event-context-for-contro.patch index 046ea7a1dc..e5489018ab 100644 --- a/target/linux/brcm2708/patches-4.19/950-0488-staging-mmal-vchiq-Free-the-event-context-for-contro.patch +++ b/target/linux/brcm2708/patches-4.19/950-0488-staging-mmal-vchiq-Free-the-event-context-for-contro.patch @@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -1981,6 +1981,8 @@ int vchiq_mmal_component_finalise(struct +@@ -1982,6 +1982,8 @@ int vchiq_mmal_component_finalise(struct for (idx = 0; idx < component->clocks; idx++) free_event_context(&component->clock[idx]); diff --git a/target/linux/brcm2708/patches-4.19/950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch b/target/linux/brcm2708/patches-4.19/950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch deleted file mode 100644 index 7b2744d743..0000000000 --- a/target/linux/brcm2708/patches-4.19/950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 39464cbb618af3ddf6427d77b0c0be0042bcaaf9 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Wed, 1 May 2019 15:17:00 +0100 -Subject: [PATCH 489/703] staging: mmal-vchiq: Replace spinlock protecting - context_map with mutex - -950fd86 staging: bcm2835-camera: Replace open-coded idr with a struct idr. -replaced an internal implementation of an idr with the standard functions -and a spinlock. -idr_alloc(GFP_KERNEL) can sleep whilst calling kmem_cache_alloc to allocate -the new node, but this is not valid whilst in an atomic context due to the -spinlock. - -There is no need for this to be a spinlock as a standard mutex is -sufficient. - -Signed-off-by: Dave Stevenson ---- - .../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 13 +++++++------ - 1 file changed, 7 insertions(+), 6 deletions(-) - ---- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c -@@ -185,7 +185,8 @@ struct vchiq_mmal_instance { - void *bulk_scratch; - - struct idr context_map; -- spinlock_t context_map_lock; -+ /* protect accesses to context_map */ -+ struct mutex context_map_lock; - - struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; - -@@ -209,10 +210,10 @@ get_msg_context(struct vchiq_mmal_instan - * that when we service the VCHI reply, we can look up what - * message is being replied to. - */ -- spin_lock(&instance->context_map_lock); -+ mutex_lock(&instance->context_map_lock); - handle = idr_alloc(&instance->context_map, msg_context, - 0, 0, GFP_KERNEL); -- spin_unlock(&instance->context_map_lock); -+ mutex_unlock(&instance->context_map_lock); - - if (handle < 0) { - kfree(msg_context); -@@ -236,9 +237,9 @@ release_msg_context(struct mmal_msg_cont - { - struct vchiq_mmal_instance *instance = msg_context->instance; - -- spin_lock(&instance->context_map_lock); -+ mutex_lock(&instance->context_map_lock); - idr_remove(&instance->context_map, msg_context->handle); -- spin_unlock(&instance->context_map_lock); -+ mutex_unlock(&instance->context_map_lock); - kfree(msg_context); - } - -@@ -2143,7 +2144,7 @@ int vchiq_mmal_init(struct vchiq_mmal_in - - instance->bulk_scratch = vmalloc(PAGE_SIZE); - -- spin_lock_init(&instance->context_map_lock); -+ mutex_init(&instance->context_map_lock); - idr_init_base(&instance->context_map, 1); - - params.callback_param = instance; diff --git a/target/linux/brcm2708/patches-4.19/950-0548-bcmgenet-Better-coalescing-parameter-defaults.patch b/target/linux/brcm2708/patches-4.19/950-0548-bcmgenet-Better-coalescing-parameter-defaults.patch index 939c8cde0f..3577fcdb5b 100644 --- a/target/linux/brcm2708/patches-4.19/950-0548-bcmgenet-Better-coalescing-parameter-defaults.patch +++ b/target/linux/brcm2708/patches-4.19/950-0548-bcmgenet-Better-coalescing-parameter-defaults.patch @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /* Disable rate control for now */ bcmgenet_tdma_ring_writel(priv, index, flow_period_val, TDMA_FLOW_PERIOD); -@@ -3576,9 +3576,12 @@ static int bcmgenet_probe(struct platfor +@@ -3571,9 +3571,12 @@ static int bcmgenet_probe(struct platfor netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); /* Set default coalescing parameters */ diff --git a/target/linux/brcm2708/patches-4.19/950-0696-Revert-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch b/target/linux/brcm2708/patches-4.19/950-0696-Revert-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch index 5bc0e98c84..2731d46136 100644 --- a/target/linux/brcm2708/patches-4.19/950-0696-Revert-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch +++ b/target/linux/brcm2708/patches-4.19/950-0696-Revert-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c -@@ -550,6 +550,20 @@ bool vb2_buffer_in_use(struct vb2_queue +@@ -554,6 +554,20 @@ bool vb2_buffer_in_use(struct vb2_queue } EXPORT_SYMBOL(vb2_buffer_in_use); @@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb) { call_void_bufop(q, fill_user_buffer, q->bufs[index], pb); -@@ -661,7 +675,16 @@ int vb2_core_reqbufs(struct vb2_queue *q +@@ -665,7 +679,16 @@ int vb2_core_reqbufs(struct vb2_queue *q if (*count == 0 || q->num_buffers != 0 || (q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) { diff --git a/target/linux/brcm2708/patches-4.19/950-0699-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch b/target/linux/brcm2708/patches-4.19/950-0699-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch index 0ee04e6c29..145fd71a09 100644 --- a/target/linux/brcm2708/patches-4.19/950-0699-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch +++ b/target/linux/brcm2708/patches-4.19/950-0699-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch @@ -92,7 +92,7 @@ Signed-off-by: Mauro Carvalho Chehab ============ --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c -@@ -680,11 +680,9 @@ int vb2_core_reqbufs(struct vb2_queue *q +@@ -684,11 +684,9 @@ int vb2_core_reqbufs(struct vb2_queue *q * are not in use and can be freed. */ mutex_lock(&q->mmap_lock); -- cgit v1.2.3