summaryrefslogtreecommitdiff
path: root/drivers/media/platform/amphion
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-11 12:20:25 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-11 12:20:25 -0800
commitb7ef56a07672e0d7ebe71c9d9b45f959f0c2f8e8 (patch)
tree47c65da1d9c6514bc74df8b86c29fb87313ca3fe /drivers/media/platform/amphion
parentd061251387903e8502843ac983553f0b2e098ef8 (diff)
parentc824345288d11e269ce41b36c105715bc2286050 (diff)
downloadlinux-next-b7ef56a07672e0d7ebe71c9d9b45f959f0c2f8e8.tar.gz
linux-next-b7ef56a07672e0d7ebe71c9d9b45f959f0c2f8e8.zip
Merge tag 'media/v7.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - Add support for GMSL1 and GMSL‑coax modules (PCI mgb4) - Add driver for TI VIP - AV1 – first kernel support (pixel‑format, decoder, transcoder) - Three new camera‑sensor drivers (os05b10, s5k3m5, s5kjn1) - Synopsys CSI‑2 receiver driver - Verisilicon & rkvdec – major fixes and enhancements - IPU6 (and 7) fixes and preparation for metadata - omap3isp: v4l2-compliance updates - Fix DVB streaming, drop wait_prepare/finish (dvb/vb2) * tag 'media/v7.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (307 commits) media: uvcvideo: Pass allocation size directly to uvc_alloc_urb_buffer media: uvcvideo: Fix allocation for small frame sizes media: uvcvideo: Return queued buffers on start_streaming() failure media: uvcvideo: Create an ID namespace for streaming output terminals media: rkvdec: Add HEVC support for the VDPU383 variant media: rkvdec: Add HEVC support for the VDPU381 variant media: rkvdec: Add H264 support for the VDPU383 variant media: rkvdec: Add H264 support for the VDPU381 variant media: rkvdec: Disable multicore support media: rkvdec: Enable all clocks without naming them media: rkvdec: Support per-variant interrupt handler media: rkvdec: Add RCB and SRAM support media: rkvdec: Add variant specific coded formats list media: rkvdec: Move hevc functions to common file media: rkvdec: Move h264 functions to common file media: rkvdec: Use structs to represent the HW RPS media: rkvdec: Move cabac tables to their own source file media: rkvdec: Switch to using structs instead of writel media: visl: Add HEVC short and long term RPS sets media: v4l2-ctrls: Add hevc_ext_sps_[ls]t_rps controls ...
Diffstat (limited to 'drivers/media/platform/amphion')
-rw-r--r--drivers/media/platform/amphion/vdec.c78
-rw-r--r--drivers/media/platform/amphion/venc.c20
-rw-r--r--drivers/media/platform/amphion/vpu_cmds.c15
-rw-r--r--drivers/media/platform/amphion/vpu_core.c11
-rw-r--r--drivers/media/platform/amphion/vpu_v4l2.c3
5 files changed, 68 insertions, 59 deletions
diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c
index c0d2aabb9e0e..adf53b49020e 100644
--- a/drivers/media/platform/amphion/vdec.c
+++ b/drivers/media/platform/amphion/vdec.c
@@ -9,7 +9,6 @@
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/vmalloc.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
@@ -17,7 +16,6 @@
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-dma-contig.h>
-#include <media/videobuf2-vmalloc.h>
#include "vpu.h"
#include "vpu_defs.h"
#include "vpu_core.h"
@@ -724,6 +722,7 @@ static int vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd
switch (cmd->cmd) {
case V4L2_DEC_CMD_START:
vdec_cmd_start(inst);
+ vb2_clear_last_buffer_dequeued(v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx));
break;
case V4L2_DEC_CMD_STOP:
vdec_cmd_stop(inst);
@@ -949,7 +948,7 @@ static void vdec_stop_done(struct vpu_inst *inst)
vpu_inst_unlock(inst);
}
-static bool vdec_check_source_change(struct vpu_inst *inst)
+static bool vdec_check_source_change(struct vpu_inst *inst, struct vpu_dec_codec_info *hdr)
{
struct vdec_t *vdec = inst->priv;
const struct vpu_format *sibling;
@@ -961,26 +960,35 @@ static bool vdec_check_source_change(struct vpu_inst *inst)
return false;
sibling = vpu_helper_find_sibling(inst, inst->cap_format.type, inst->cap_format.pixfmt);
- if (sibling && vdec->codec_info.pixfmt == sibling->pixfmt)
- vdec->codec_info.pixfmt = inst->cap_format.pixfmt;
+ if (sibling && hdr->pixfmt == sibling->pixfmt)
+ hdr->pixfmt = inst->cap_format.pixfmt;
if (!vb2_is_streaming(v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx)))
return true;
- if (inst->cap_format.pixfmt != vdec->codec_info.pixfmt)
+ if (inst->cap_format.pixfmt != hdr->pixfmt)
return true;
- if (inst->cap_format.width != vdec->codec_info.decoded_width)
+ if (inst->cap_format.width != hdr->decoded_width)
return true;
- if (inst->cap_format.height != vdec->codec_info.decoded_height)
+ if (inst->cap_format.height != hdr->decoded_height)
return true;
if (vpu_get_num_buffers(inst, inst->cap_format.type) < inst->min_buffer_cap)
return true;
- if (inst->crop.left != vdec->codec_info.offset_x)
+ if (inst->crop.left != hdr->offset_x)
return true;
- if (inst->crop.top != vdec->codec_info.offset_y)
+ if (inst->crop.top != hdr->offset_y)
return true;
- if (inst->crop.width != vdec->codec_info.width)
+ if (inst->crop.width != hdr->width)
return true;
- if (inst->crop.height != vdec->codec_info.height)
+ if (inst->crop.height != hdr->height)
+ return true;
+ if (!hdr->progressive)
+ return true;
+
+ if (vdec->seq_hdr_found &&
+ (hdr->color_primaries != vdec->codec_info.color_primaries ||
+ hdr->transfer_chars != vdec->codec_info.transfer_chars ||
+ hdr->matrix_coeffs != vdec->codec_info.matrix_coeffs ||
+ hdr->full_range != vdec->codec_info.full_range))
return true;
return false;
@@ -1332,20 +1340,25 @@ static void vdec_event_seq_hdr(struct vpu_inst *inst, struct vpu_dec_codec_info
struct vdec_t *vdec = inst->priv;
vpu_inst_lock(inst);
- memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info));
- vpu_trace(inst->dev, "[%d] %d x %d, crop : (%d, %d) %d x %d, %d, %d\n",
+ vpu_trace(inst->dev,
+ "[%d] %d x %d, crop : (%d, %d) %d x %d, %d, %d, colorspace: %d, %d, %d, %d\n",
inst->id,
- vdec->codec_info.decoded_width,
- vdec->codec_info.decoded_height,
- vdec->codec_info.offset_x,
- vdec->codec_info.offset_y,
- vdec->codec_info.width,
- vdec->codec_info.height,
+ hdr->decoded_width,
+ hdr->decoded_height,
+ hdr->offset_x,
+ hdr->offset_y,
+ hdr->width,
+ hdr->height,
hdr->num_ref_frms,
- hdr->num_dpb_frms);
+ hdr->num_dpb_frms,
+ hdr->color_primaries,
+ hdr->transfer_chars,
+ hdr->matrix_coeffs,
+ hdr->full_range);
inst->min_buffer_cap = hdr->num_ref_frms + hdr->num_dpb_frms;
- vdec->is_source_changed = vdec_check_source_change(inst);
+ vdec->is_source_changed = vdec_check_source_change(inst, hdr);
+ memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info));
vdec_init_fmt(inst);
vdec_init_crop(inst);
vdec_init_mbi(inst);
@@ -1374,7 +1387,12 @@ static void vdec_event_resolution_change(struct vpu_inst *inst)
{
struct vdec_t *vdec = inst->priv;
- vpu_trace(inst->dev, "[%d]\n", inst->id);
+ vpu_trace(inst->dev, "[%d] input : %d, decoded : %d, display : %d, sequence : %d\n",
+ inst->id,
+ vdec->params.frame_count,
+ vdec->decoded_frame_count,
+ vdec->display_frame_count,
+ vdec->sequence);
vpu_inst_lock(inst);
vdec->seq_tag = vdec->codec_info.tag;
vdec_clear_fs(&vdec->mbi);
@@ -1642,9 +1660,9 @@ static void vdec_cleanup(struct vpu_inst *inst)
vdec->slots = NULL;
vdec->slot_count = 0;
}
- vfree(vdec);
+ kfree(vdec);
inst->priv = NULL;
- vfree(inst);
+ kfree(inst);
}
static void vdec_init_params(struct vdec_t *vdec)
@@ -1909,13 +1927,13 @@ static int vdec_open(struct file *file)
struct vdec_t *vdec;
int ret;
- inst = vzalloc(sizeof(*inst));
+ inst = kzalloc(sizeof(*inst), GFP_KERNEL);
if (!inst)
return -ENOMEM;
- vdec = vzalloc(sizeof(*vdec));
+ vdec = kzalloc(sizeof(*vdec), GFP_KERNEL);
if (!vdec) {
- vfree(inst);
+ kfree(inst);
return -ENOMEM;
}
@@ -1923,8 +1941,8 @@ static int vdec_open(struct file *file)
sizeof(*vdec->slots),
GFP_KERNEL | __GFP_ZERO);
if (!vdec->slots) {
- vfree(vdec);
- vfree(inst);
+ kfree(vdec);
+ kfree(inst);
return -ENOMEM;
}
vdec->slot_count = VDEC_SLOT_CNT_DFT;
diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c
index aced76401b69..9e5cbc2b0d3f 100644
--- a/drivers/media/platform/amphion/venc.c
+++ b/drivers/media/platform/amphion/venc.c
@@ -13,14 +13,12 @@
#include <linux/videodev2.h>
#include <linux/ktime.h>
#include <linux/rational.h>
-#include <linux/vmalloc.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-mem2mem.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-dma-contig.h>
-#include <media/videobuf2-vmalloc.h>
#include "vpu.h"
#include "vpu_defs.h"
#include "vpu_core.h"
@@ -844,7 +842,7 @@ static int venc_get_encoded_frames(struct vpu_inst *inst)
v4l2_m2m_dst_buf_remove(inst->fh.m2m_ctx)))
break;
list_del_init(&frame->list);
- vfree(frame);
+ kfree(frame);
}
return 0;
@@ -860,7 +858,7 @@ static int venc_frame_encoded(struct vpu_inst *inst, void *arg)
if (!info)
return -EINVAL;
venc = inst->priv;
- frame = vzalloc(sizeof(*frame));
+ frame = kzalloc(sizeof(*frame), GFP_KERNEL);
if (!frame)
return -ENOMEM;
@@ -912,9 +910,9 @@ static void venc_cleanup(struct vpu_inst *inst)
return;
venc = inst->priv;
- vfree(venc);
+ kfree(venc);
inst->priv = NULL;
- vfree(inst);
+ kfree(inst);
}
static int venc_start_session(struct vpu_inst *inst, u32 type)
@@ -1067,7 +1065,7 @@ static void venc_cleanup_frames(struct venc_t *venc)
list_for_each_entry_safe(frame, tmp, &venc->frames, list) {
list_del_init(&frame->list);
- vfree(frame);
+ kfree(frame);
}
}
@@ -1151,7 +1149,7 @@ static int venc_process_capture(struct vpu_inst *inst, struct vb2_buffer *vb)
return ret;
list_del_init(&frame->list);
- vfree(frame);
+ kfree(frame);
return 0;
}
@@ -1309,13 +1307,13 @@ static int venc_open(struct file *file)
struct venc_t *venc;
int ret;
- inst = vzalloc(sizeof(*inst));
+ inst = kzalloc(sizeof(*inst), GFP_KERNEL);
if (!inst)
return -ENOMEM;
- venc = vzalloc(sizeof(*venc));
+ venc = kzalloc(sizeof(*venc), GFP_KERNEL);
if (!venc) {
- vfree(inst);
+ kfree(inst);
return -ENOMEM;
}
diff --git a/drivers/media/platform/amphion/vpu_cmds.c b/drivers/media/platform/amphion/vpu_cmds.c
index 5695f5c1cb3e..ab69412e0aa7 100644
--- a/drivers/media/platform/amphion/vpu_cmds.c
+++ b/drivers/media/platform/amphion/vpu_cmds.c
@@ -13,7 +13,6 @@
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/delay.h>
-#include <linux/vmalloc.h>
#include "vpu.h"
#include "vpu_defs.h"
#include "vpu_cmds.h"
@@ -84,13 +83,13 @@ static struct vpu_cmd_t *vpu_alloc_cmd(struct vpu_inst *inst, u32 id, void *data
int i;
int ret;
- cmd = vzalloc(sizeof(*cmd));
+ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd)
return NULL;
- cmd->pkt = vzalloc(sizeof(*cmd->pkt));
+ cmd->pkt = kzalloc(sizeof(*cmd->pkt), GFP_KERNEL);
if (!cmd->pkt) {
- vfree(cmd);
+ kfree(cmd);
return NULL;
}
@@ -98,8 +97,8 @@ static struct vpu_cmd_t *vpu_alloc_cmd(struct vpu_inst *inst, u32 id, void *data
ret = vpu_iface_pack_cmd(inst->core, cmd->pkt, inst->id, id, data);
if (ret) {
dev_err(inst->dev, "iface pack cmd %s fail\n", vpu_id_name(id));
- vfree(cmd->pkt);
- vfree(cmd);
+ kfree(cmd->pkt);
+ kfree(cmd);
return NULL;
}
for (i = 0; i < ARRAY_SIZE(vpu_cmd_requests); i++) {
@@ -118,8 +117,8 @@ static void vpu_free_cmd(struct vpu_cmd_t *cmd)
return;
if (cmd->last_response_cmd)
atomic_long_set(cmd->last_response_cmd, cmd->key);
- vfree(cmd->pkt);
- vfree(cmd);
+ kfree(cmd->pkt);
+ kfree(cmd);
}
static int vpu_session_process_cmd(struct vpu_inst *inst, struct vpu_cmd_t *cmd)
diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c
index 168f0514851e..85cc4a14f8ed 100644
--- a/drivers/media/platform/amphion/vpu_core.c
+++ b/drivers/media/platform/amphion/vpu_core.c
@@ -17,7 +17,6 @@
#include <linux/pm_runtime.h>
#include <linux/pm_domain.h>
#include <linux/firmware.h>
-#include <linux/vmalloc.h>
#include "vpu.h"
#include "vpu_defs.h"
#include "vpu_core.h"
@@ -265,7 +264,7 @@ static int vpu_core_register(struct device *dev, struct vpu_core *core)
INIT_WORK(&core->msg_work, vpu_msg_run_work);
INIT_DELAYED_WORK(&core->msg_delayed_work, vpu_msg_delayed_work);
buffer_size = roundup_pow_of_two(VPU_MSG_BUFFER_SIZE);
- core->msg_buffer = vzalloc(buffer_size);
+ core->msg_buffer = kzalloc(buffer_size, GFP_KERNEL);
if (!core->msg_buffer) {
dev_err(core->dev, "failed allocate buffer for fifo\n");
ret = -ENOMEM;
@@ -282,10 +281,8 @@ static int vpu_core_register(struct device *dev, struct vpu_core *core)
return 0;
error:
- if (core->msg_buffer) {
- vfree(core->msg_buffer);
- core->msg_buffer = NULL;
- }
+ kfree(core->msg_buffer);
+ core->msg_buffer = NULL;
if (core->workqueue) {
destroy_workqueue(core->workqueue);
core->workqueue = NULL;
@@ -308,7 +305,7 @@ static int vpu_core_unregister(struct device *dev, struct vpu_core *core)
vpu_core_put_vpu(core);
core->vpu = NULL;
- vfree(core->msg_buffer);
+ kfree(core->msg_buffer);
core->msg_buffer = NULL;
if (core->workqueue) {
diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c
index 47dff9a35bb4..64fc88d89ccc 100644
--- a/drivers/media/platform/amphion/vpu_v4l2.c
+++ b/drivers/media/platform/amphion/vpu_v4l2.c
@@ -102,7 +102,6 @@ static int vpu_notify_eos(struct vpu_inst *inst)
int vpu_notify_source_change(struct vpu_inst *inst)
{
static const struct v4l2_event ev = {
- .id = 0,
.type = V4L2_EVENT_SOURCE_CHANGE,
.u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION
};
@@ -670,7 +669,6 @@ static int vpu_m2m_queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_q
src_vq->mem_ops = &vb2_vmalloc_memops;
src_vq->drv_priv = inst;
src_vq->buf_struct_size = sizeof(struct vpu_vb2_buffer);
- src_vq->min_queued_buffers = 1;
src_vq->dev = inst->vpu->dev;
src_vq->lock = &inst->lock;
ret = vb2_queue_init(src_vq);
@@ -687,7 +685,6 @@ static int vpu_m2m_queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_q
dst_vq->mem_ops = &vb2_vmalloc_memops;
dst_vq->drv_priv = inst;
dst_vq->buf_struct_size = sizeof(struct vpu_vb2_buffer);
- dst_vq->min_queued_buffers = 1;
dst_vq->dev = inst->vpu->dev;
dst_vq->lock = &inst->lock;
ret = vb2_queue_init(dst_vq);