diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-07-09 20:32:28 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-07-14 12:44:14 +0200 |
commit | 42954857190b9df16d9d873ecc7f6cc38e013e44 (patch) | |
tree | 98c588f629ff534d458eb0884782ea99672d7634 /target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch | |
parent | f1875e902d0afb7d9b9e5285b4fd8da7f6c5e30a (diff) | |
download | upstream-42954857190b9df16d9d873ecc7f6cc38e013e44.tar.gz upstream-42954857190b9df16d9d873ecc7f6cc38e013e44.tar.bz2 upstream-42954857190b9df16d9d873ecc7f6cc38e013e44.zip |
brcm2708: add linux 4.19 support
Boot tested on Raspberry Pi B+ (BCM2708) and Raspberry Pi 2 (BCM2709)
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch')
-rw-r--r-- | target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch | 107 |
1 files changed, 107 insertions, 0 deletions
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 new file mode 100644 index 0000000000..fefea5d9bb --- /dev/null +++ b/target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch @@ -0,0 +1,107 @@ +From 9daa20076f689c9d3f32446b5a73a0f0e20651ca Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <dave.stevenson@raspberrypi.org> +Date: Mon, 24 Sep 2018 16:51:13 +0100 +Subject: [PATCH 268/703] staging: mmal-vchiq: Allocate and free components as + required + +The existing code assumed that there would only ever be 4 components, +and never freed the entries once used. +Allow arbitrary creation and destruction of components. + +Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> +--- + .../vc04_services/vchiq-mmal/mmal-vchiq.c | 29 ++++++++++++------- + .../vc04_services/vchiq-mmal/mmal-vchiq.h | 1 + + 2 files changed, 20 insertions(+), 10 deletions(-) + +--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c ++++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +@@ -38,8 +38,11 @@ MODULE_AUTHOR("Dave Stevenson, <dave.ste + MODULE_LICENSE("GPL"); + MODULE_VERSION("0.0.1"); + +-/* maximum number of components supported */ +-#define VCHIQ_MMAL_MAX_COMPONENTS 4 ++/* ++ * maximum number of components supported. ++ * This matches the maximum permitted by default on the VPU ++ */ ++#define VCHIQ_MMAL_MAX_COMPONENTS 64 + + /*#define FULL_MSG_DUMP 1*/ + +@@ -173,8 +176,6 @@ struct vchiq_mmal_instance { + 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 */ +@@ -1631,18 +1632,24 @@ int vchiq_mmal_component_init(struct vch + { + int ret; + int idx; /* port index */ +- struct vchiq_mmal_component *component; ++ struct vchiq_mmal_component *component = NULL; + + if (mutex_lock_interruptible(&instance->vchiq_mutex)) + return -EINTR; + +- if (instance->component_idx == VCHIQ_MMAL_MAX_COMPONENTS) { ++ for (idx = 0; idx < VCHIQ_MMAL_MAX_COMPONENTS; idx++) { ++ if (!instance->component[idx].in_use) { ++ component = &instance->component[idx]; ++ component->in_use = 1; ++ break; ++ } ++ } ++ ++ if (!component) { + 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", +@@ -1693,8 +1700,6 @@ int vchiq_mmal_component_init(struct vch + goto release_component; + } + +- instance->component_idx++; +- + *component_out = component; + + mutex_unlock(&instance->vchiq_mutex); +@@ -1704,6 +1709,8 @@ int vchiq_mmal_component_init(struct vch + release_component: + destroy_component(instance, component); + unlock: ++ if (component) ++ component->in_use = 0; + mutex_unlock(&instance->vchiq_mutex); + + return ret; +@@ -1726,6 +1733,8 @@ int vchiq_mmal_component_finalise(struct + + ret = destroy_component(instance, component); + ++ component->in_use = 0; ++ + mutex_unlock(&instance->vchiq_mutex); + + return ret; +--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h ++++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h +@@ -82,6 +82,7 @@ struct vchiq_mmal_port { + }; + + struct vchiq_mmal_component { ++ u32 in_use:1; + bool enabled; + u32 handle; /* VideoCore handle for component */ + u32 inputs; /* Number of input ports */ |