Merge keystone/android12-5.10-keystone-qcom-release.81+ (f7e39d7) into msm-5.10

* refs/heads/tmp-f7e39d7:
  BACKPORT: media: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls
  FROMLIST: remoteproc: Use unbounded workqueue for recovery work

Change-Id: Id2b10b7253fd847599ec8d73ebb04e7d2c598536
Signed-off-by: Sivasri Kumar, Vanka <quic_svanka@quicinc.com>
This commit is contained in:
Sivasri Kumar, Vanka 2022-04-29 12:50:23 +05:30
commit 91cd433051
3 changed files with 54 additions and 14 deletions

View File

@ -1 +1 @@
64099431c232d4a95f621411747a3972cc1c8061
ce5963469cb42a79c04d0c62286d6d0377c84988

View File

@ -585,19 +585,14 @@ int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
}
EXPORT_SYMBOL_GPL(v4l2_m2m_reqbufs);
int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
struct v4l2_buffer *buf)
static void v4l2_m2m_adjust_mem_offset(struct vb2_queue *vq,
struct v4l2_buffer *buf)
{
struct vb2_queue *vq;
int ret = 0;
unsigned int i;
vq = v4l2_m2m_get_vq(m2m_ctx, buf->type);
ret = vb2_querybuf(vq, buf);
/* Adjust MMAP memory offsets for the CAPTURE queue */
if (buf->memory == V4L2_MEMORY_MMAP && V4L2_TYPE_IS_CAPTURE(vq->type)) {
if (V4L2_TYPE_IS_MULTIPLANAR(vq->type)) {
unsigned int i;
for (i = 0; i < buf->length; ++i)
buf->m.planes[i].m.mem_offset
+= DST_QUEUE_OFF_BASE;
@ -605,8 +600,23 @@ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
buf->m.offset += DST_QUEUE_OFF_BASE;
}
}
}
return ret;
int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
struct v4l2_buffer *buf)
{
struct vb2_queue *vq;
int ret;
vq = v4l2_m2m_get_vq(m2m_ctx, buf->type);
ret = vb2_querybuf(vq, buf);
if (ret)
return ret;
/* Adjust MMAP memory offsets for the CAPTURE queue */
v4l2_m2m_adjust_mem_offset(vq, buf);
return 0;
}
EXPORT_SYMBOL_GPL(v4l2_m2m_querybuf);
@ -763,6 +773,9 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
if (ret)
return ret;
/* Adjust MMAP memory offsets for the CAPTURE queue */
v4l2_m2m_adjust_mem_offset(vq, buf);
/*
* If the capture queue is streaming, but streaming hasn't started
* on the device, but was asked to stop, mark the previously queued
@ -784,9 +797,17 @@ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
struct v4l2_buffer *buf)
{
struct vb2_queue *vq;
int ret;
vq = v4l2_m2m_get_vq(m2m_ctx, buf->type);
return vb2_dqbuf(vq, buf, file->f_flags & O_NONBLOCK);
ret = vb2_dqbuf(vq, buf, file->f_flags & O_NONBLOCK);
if (ret)
return ret;
/* Adjust MMAP memory offsets for the CAPTURE queue */
v4l2_m2m_adjust_mem_offset(vq, buf);
return 0;
}
EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf);
@ -795,9 +816,17 @@ int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
{
struct video_device *vdev = video_devdata(file);
struct vb2_queue *vq;
int ret;
vq = v4l2_m2m_get_vq(m2m_ctx, buf->type);
return vb2_prepare_buf(vq, vdev->v4l2_dev->mdev, buf);
ret = vb2_prepare_buf(vq, vdev->v4l2_dev->mdev, buf);
if (ret)
return ret;
/* Adjust MMAP memory offsets for the CAPTURE queue */
v4l2_m2m_adjust_mem_offset(vq, buf);
return 0;
}
EXPORT_SYMBOL_GPL(v4l2_m2m_prepare_buf);

View File

@ -59,6 +59,7 @@ static int rproc_release_carveout(struct rproc *rproc,
/* Unique indices for remoteproc devices */
static DEFINE_IDA(rproc_dev_index);
static struct workqueue_struct *rproc_recovery_wq;
static const char * const rproc_crash_names[] = {
[RPROC_MMUFAULT] = "mmufault",
@ -2488,8 +2489,11 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type)
dev_err(&rproc->dev, "crash detected in %s: type %s\n",
rproc->name, rproc_crash_to_string(type));
if (rproc_recovery_wq)
queue_work(rproc_recovery_wq, &rproc->crash_handler);
else
/* Have a worker handle the error; ensure system is not suspended */
queue_work(system_freezable_wq, &rproc->crash_handler);
queue_work(system_freezable_wq, &rproc->crash_handler);
}
EXPORT_SYMBOL(rproc_report_crash);
@ -2534,6 +2538,11 @@ static void __exit rproc_exit_panic(void)
static int __init remoteproc_init(void)
{
rproc_recovery_wq = alloc_workqueue("rproc_recovery_wq",
WQ_UNBOUND | WQ_FREEZABLE, 0);
if (!rproc_recovery_wq)
pr_err("remoteproc: creation of rproc_recovery_wq failed\n");
rproc_init_sysfs();
rproc_init_debugfs();
rproc_init_cdev();
@ -2550,6 +2559,8 @@ static void __exit remoteproc_exit(void)
rproc_exit_panic();
rproc_exit_debugfs();
rproc_exit_sysfs();
if (rproc_recovery_wq)
destroy_workqueue(rproc_recovery_wq);
}
module_exit(remoteproc_exit);