mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-11 18:06:40 +07:00
media fixes for v4.5-rc3
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWtPxGAAoJEAhfPr2O5OEVnG4P/1PeHTPHbKJXl5m8QaefVhMj OLCdDddSs5LOPI0xCqZ+vZfiEI21Dy56NBfYmTAz/1aLafy3eDnqKE1NKAjPxBIL //3Isq8BBmJfRxie9juZpqZPi0RNZB9bl1EAcPKPA3jBpxxp2jCttlUI8rUiOPuL z/f+cZ2se2u7Fgg7vFzK3JOnWdQHTfuZOkcOse6BtkpkLDnCDKqv3fN44puVQRSB JOPXbdHn2YuWtMLshjvN61UQukMGH3yia/mQvMdGb6zP+v16NUBJBfhTVVDhLAlD xPdnygM3HuZI+hXJ4CIJzzb/CUEqh5uJlrCQUw1cDoeXKAhw8+RtHKFN+INW8B5O 2eWAcMMDuF4+ULcO/uNo66RG/VYbDOFZ/IMfsFeP80sdpctq8FwinH1yMaFTY5Oe KS3NW9i75HFZMZwG+mzHWX16q+dcZx+3qemlGZ30pgHnkMdMUmfW5mX92wZ1GhQx bE6dVbDOHldpzP1krGxFGeVKFlbufg+Zjjee1V85kX+X9Rn/ywzpl7jc6huOQUza RrOIUk/s/wlg2dFobl0xumLxKhFPOssI9+JSG1kctrGpwD/oJDY5DNx0g+RUz/OW Q5K37N6Givyta2Ho7CVWMlMNZBI2d/WhX+6xBVdrSwvANKlXfcNcLWPjT9wW+Us6 8utLwl8q4PZUxf+nbxpk =OuDf -----END PGP SIGNATURE----- Merge tag 'media/v4.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media fixes from Mauro Carvalho Chehab: - vb2: fix a vb2_thread regression and DVB read() breakages - vsp1: fix compilation and links creation - s5k6a3: Fix VIDIOC_SUBDEV_G_FMT ioctl for TRY format - exynos4-is: fix a build issue, format negotiation and sensor detection - Fix a regression with pvrusb2 and ir-kbd-i2c - atmel-isi: fix debug message which only show the first format - tda1004x: fix a tuning bug if G_PROPERTY is called too early - saa7134-alsa: fix a bug at device unbinding/driver removal - Fix build of one driver if !HAS_DMA - soc_camera: cleanup control device on async_unbind * tag 'media/v4.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: [media] saa7134-alsa: Only frees registered sound cards [media] vb2-core: call threadio->fnc() if !VB2_BUF_STATE_ERROR [media] vb2: fix nasty vb2_thread regression [media] tda1004x: only update the frontend properties if locked [media] media: i2c: Don't export ir-kbd-i2c module alias [media] exynos4-is: make VIDEO_SAMSUNG_EXYNOS4_IS tristate [media] media: Kconfig: add dependency of HAS_DMA [media] exynos4-is: Wait for 100us before opening sensor [media] exynos4-is: Open shouldn't fail when sensor entity is not linked [media] s5k6a3: Fix VIDIOC_SUBDEV_G_FMT ioctl for TRY format [media] exynos4-is: fix a format string bug [media] drivers/media: vsp1_video: fix compile error [media] atmel-isi: fix debug message which only show the first format [media] soc_camera: cleanup control device on async_unbind [media] v4l: vsp1: Fix wrong entities links creation
This commit is contained in:
commit
dd6f86af39
@ -903,9 +903,18 @@ static int tda1004x_get_fe(struct dvb_frontend *fe)
|
||||
{
|
||||
struct dtv_frontend_properties *fe_params = &fe->dtv_property_cache;
|
||||
struct tda1004x_state* state = fe->demodulator_priv;
|
||||
int status;
|
||||
|
||||
dprintk("%s\n", __func__);
|
||||
|
||||
status = tda1004x_read_byte(state, TDA1004X_STATUS_CD);
|
||||
if (status == -1)
|
||||
return -EIO;
|
||||
|
||||
/* Only update the properties cache if device is locked */
|
||||
if (!(status & 8))
|
||||
return 0;
|
||||
|
||||
// inversion status
|
||||
fe_params->inversion = INVERSION_OFF;
|
||||
if (tda1004x_read_byte(state, TDA1004X_CONFC1) & 0x20)
|
||||
|
@ -478,7 +478,6 @@ static const struct i2c_device_id ir_kbd_id[] = {
|
||||
{ "ir_rx_z8f0811_hdpvr", 0 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ir_kbd_id);
|
||||
|
||||
static struct i2c_driver ir_kbd_driver = {
|
||||
.driver = {
|
||||
|
@ -144,8 +144,7 @@ static int s5k6a3_set_fmt(struct v4l2_subdev *sd,
|
||||
mf = __s5k6a3_get_format(sensor, cfg, fmt->pad, fmt->which);
|
||||
if (mf) {
|
||||
mutex_lock(&sensor->lock);
|
||||
if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE)
|
||||
*mf = fmt->format;
|
||||
*mf = fmt->format;
|
||||
mutex_unlock(&sensor->lock);
|
||||
}
|
||||
return 0;
|
||||
|
@ -1211,6 +1211,8 @@ static int alsa_device_init(struct saa7134_dev *dev)
|
||||
|
||||
static int alsa_device_exit(struct saa7134_dev *dev)
|
||||
{
|
||||
if (!snd_saa7134_cards[dev->nr])
|
||||
return 1;
|
||||
|
||||
snd_card_free(snd_saa7134_cards[dev->nr]);
|
||||
snd_saa7134_cards[dev->nr] = NULL;
|
||||
@ -1260,7 +1262,8 @@ static void saa7134_alsa_exit(void)
|
||||
int idx;
|
||||
|
||||
for (idx = 0; idx < SNDRV_CARDS; idx++) {
|
||||
snd_card_free(snd_saa7134_cards[idx]);
|
||||
if (snd_saa7134_cards[idx])
|
||||
snd_card_free(snd_saa7134_cards[idx]);
|
||||
}
|
||||
|
||||
saa7134_dmasound_init = NULL;
|
||||
|
@ -215,6 +215,7 @@ config VIDEO_SAMSUNG_EXYNOS_GSC
|
||||
config VIDEO_STI_BDISP
|
||||
tristate "STMicroelectronics BDISP 2D blitter driver"
|
||||
depends on VIDEO_DEV && VIDEO_V4L2
|
||||
depends on HAS_DMA
|
||||
depends on ARCH_STI || COMPILE_TEST
|
||||
select VIDEOBUF2_DMA_CONTIG
|
||||
select V4L2_MEM2MEM_DEV
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
config VIDEO_SAMSUNG_EXYNOS4_IS
|
||||
bool "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver"
|
||||
tristate "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver"
|
||||
depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
|
||||
depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
|
||||
depends on OF && COMMON_CLK
|
||||
|
@ -631,6 +631,12 @@ static int fimc_is_hw_open_sensor(struct fimc_is *is,
|
||||
|
||||
fimc_is_mem_barrier();
|
||||
|
||||
/*
|
||||
* Some user space use cases hang up here without this
|
||||
* empirically chosen delay.
|
||||
*/
|
||||
udelay(100);
|
||||
|
||||
mcuctl_write(HIC_OPEN_SENSOR, is, MCUCTL_REG_ISSR(0));
|
||||
mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1));
|
||||
mcuctl_write(sensor->drvdata->id, is, MCUCTL_REG_ISSR(2));
|
||||
|
@ -218,8 +218,8 @@ static void isp_video_capture_buffer_queue(struct vb2_buffer *vb)
|
||||
ivb->dma_addr[i];
|
||||
|
||||
isp_dbg(2, &video->ve.vdev,
|
||||
"dma_buf %pad (%d/%d/%d) addr: %pad\n",
|
||||
&buf_index, ivb->index, i, vb->index,
|
||||
"dma_buf %d (%d/%d/%d) addr: %pad\n",
|
||||
buf_index, ivb->index, i, vb->index,
|
||||
&ivb->dma_addr[i]);
|
||||
}
|
||||
|
||||
|
@ -186,32 +186,20 @@ static int fimc_pipeline_s_power(struct fimc_pipeline *p, bool on)
|
||||
}
|
||||
|
||||
/**
|
||||
* __fimc_pipeline_open - update the pipeline information, enable power
|
||||
* of all pipeline subdevs and the sensor clock
|
||||
* @me: media entity to start graph walk with
|
||||
* @prepare: true to walk the current pipeline and acquire all subdevs
|
||||
* __fimc_pipeline_enable - enable power of all pipeline subdevs
|
||||
* and the sensor clock
|
||||
* @ep: video pipeline structure
|
||||
* @fmd: fimc media device
|
||||
*
|
||||
* Called with the graph mutex held.
|
||||
*/
|
||||
static int __fimc_pipeline_open(struct exynos_media_pipeline *ep,
|
||||
struct media_entity *me, bool prepare)
|
||||
static int __fimc_pipeline_enable(struct exynos_media_pipeline *ep,
|
||||
struct fimc_md *fmd)
|
||||
{
|
||||
struct fimc_md *fmd = entity_to_fimc_mdev(me);
|
||||
struct fimc_pipeline *p = to_fimc_pipeline(ep);
|
||||
struct v4l2_subdev *sd;
|
||||
int ret;
|
||||
|
||||
if (WARN_ON(p == NULL || me == NULL))
|
||||
return -EINVAL;
|
||||
|
||||
if (prepare)
|
||||
fimc_pipeline_prepare(p, me);
|
||||
|
||||
sd = p->subdevs[IDX_SENSOR];
|
||||
if (sd == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
/* Disable PXLASYNC clock if this pipeline includes FIMC-IS */
|
||||
/* Enable PXLASYNC clock if this pipeline includes FIMC-IS */
|
||||
if (!IS_ERR(fmd->wbclk[CLK_IDX_WB_B]) && p->subdevs[IDX_IS_ISP]) {
|
||||
ret = clk_prepare_enable(fmd->wbclk[CLK_IDX_WB_B]);
|
||||
if (ret < 0)
|
||||
@ -228,6 +216,40 @@ static int __fimc_pipeline_open(struct exynos_media_pipeline *ep,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* __fimc_pipeline_open - update the pipeline information, enable power
|
||||
* of all pipeline subdevs and the sensor clock
|
||||
* @me: media entity to start graph walk with
|
||||
* @prepare: true to walk the current pipeline and acquire all subdevs
|
||||
*
|
||||
* Called with the graph mutex held.
|
||||
*/
|
||||
static int __fimc_pipeline_open(struct exynos_media_pipeline *ep,
|
||||
struct media_entity *me, bool prepare)
|
||||
{
|
||||
struct fimc_md *fmd = entity_to_fimc_mdev(me);
|
||||
struct fimc_pipeline *p = to_fimc_pipeline(ep);
|
||||
struct v4l2_subdev *sd;
|
||||
|
||||
if (WARN_ON(p == NULL || me == NULL))
|
||||
return -EINVAL;
|
||||
|
||||
if (prepare)
|
||||
fimc_pipeline_prepare(p, me);
|
||||
|
||||
sd = p->subdevs[IDX_SENSOR];
|
||||
if (sd == NULL) {
|
||||
pr_warn("%s(): No sensor subdev\n", __func__);
|
||||
/*
|
||||
* Pipeline open cannot fail so as to make it possible
|
||||
* for the user space to configure the pipeline.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
return __fimc_pipeline_enable(ep, fmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* __fimc_pipeline_close - disable the sensor clock and pipeline power
|
||||
* @fimc: fimc device terminating the pipeline
|
||||
@ -269,10 +291,43 @@ static int __fimc_pipeline_s_stream(struct exynos_media_pipeline *ep, bool on)
|
||||
{ IDX_CSIS, IDX_FLITE, IDX_FIMC, IDX_SENSOR, IDX_IS_ISP },
|
||||
};
|
||||
struct fimc_pipeline *p = to_fimc_pipeline(ep);
|
||||
struct fimc_md *fmd = entity_to_fimc_mdev(&p->subdevs[IDX_CSIS]->entity);
|
||||
enum fimc_subdev_index sd_id;
|
||||
int i, ret = 0;
|
||||
|
||||
if (p->subdevs[IDX_SENSOR] == NULL)
|
||||
return -ENODEV;
|
||||
if (p->subdevs[IDX_SENSOR] == NULL) {
|
||||
if (!fmd->user_subdev_api) {
|
||||
/*
|
||||
* Sensor must be already discovered if we
|
||||
* aren't in the user_subdev_api mode
|
||||
*/
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Get pipeline sink entity */
|
||||
if (p->subdevs[IDX_FIMC])
|
||||
sd_id = IDX_FIMC;
|
||||
else if (p->subdevs[IDX_IS_ISP])
|
||||
sd_id = IDX_IS_ISP;
|
||||
else if (p->subdevs[IDX_FLITE])
|
||||
sd_id = IDX_FLITE;
|
||||
else
|
||||
return -ENODEV;
|
||||
|
||||
/*
|
||||
* Sensor could have been linked between open and STREAMON -
|
||||
* check if this is the case.
|
||||
*/
|
||||
fimc_pipeline_prepare(p, &p->subdevs[sd_id]->entity);
|
||||
|
||||
if (p->subdevs[IDX_SENSOR] == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
ret = __fimc_pipeline_enable(ep, fmd);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
for (i = 0; i < IDX_MAX; i++) {
|
||||
unsigned int idx = seq[on][i];
|
||||
@ -282,8 +337,10 @@ static int __fimc_pipeline_s_stream(struct exynos_media_pipeline *ep, bool on)
|
||||
if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV)
|
||||
goto error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
error:
|
||||
fimc_pipeline_s_power(p, !on);
|
||||
for (; i >= 0; i--) {
|
||||
unsigned int idx = seq[on][i];
|
||||
v4l2_subdev_call(p->subdevs[idx], video, s_stream, !on);
|
||||
|
@ -795,7 +795,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
|
||||
xlate->host_fmt = &isi_camera_formats[i];
|
||||
xlate->code = code.code;
|
||||
dev_dbg(icd->parent, "Providing format %s using code %d\n",
|
||||
isi_camera_formats[0].name, code.code);
|
||||
xlate->host_fmt->name, xlate->code);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1493,6 +1493,8 @@ static void soc_camera_async_unbind(struct v4l2_async_notifier *notifier,
|
||||
struct soc_camera_async_client, notifier);
|
||||
struct soc_camera_device *icd = platform_get_drvdata(sasc->pdev);
|
||||
|
||||
icd->control = NULL;
|
||||
|
||||
if (icd->clk) {
|
||||
v4l2_clk_unregister(icd->clk);
|
||||
icd->clk = NULL;
|
||||
|
@ -256,7 +256,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
|
||||
|
||||
/* Create links. */
|
||||
list_for_each_entry(entity, &vsp1->entities, list_dev) {
|
||||
if (entity->type == VSP1_ENTITY_LIF) {
|
||||
if (entity->type == VSP1_ENTITY_WPF) {
|
||||
ret = vsp1_wpf_create_links(vsp1, entity);
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
@ -264,7 +264,10 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
|
||||
ret = vsp1_rpf_create_links(vsp1, entity);
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (entity->type != VSP1_ENTITY_LIF &&
|
||||
entity->type != VSP1_ENTITY_RPF) {
|
||||
ret = vsp1_create_links(vsp1, entity);
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
|
@ -515,7 +515,7 @@ static bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe)
|
||||
bool stopped;
|
||||
|
||||
spin_lock_irqsave(&pipe->irqlock, flags);
|
||||
stopped = pipe->state == VSP1_PIPELINE_STOPPED,
|
||||
stopped = pipe->state == VSP1_PIPELINE_STOPPED;
|
||||
spin_unlock_irqrestore(&pipe->irqlock, flags);
|
||||
|
||||
return stopped;
|
||||
|
@ -1063,8 +1063,11 @@ EXPORT_SYMBOL_GPL(vb2_discard_done);
|
||||
*/
|
||||
static int __qbuf_mmap(struct vb2_buffer *vb, const void *pb)
|
||||
{
|
||||
int ret = call_bufop(vb->vb2_queue, fill_vb2_buffer,
|
||||
vb, pb, vb->planes);
|
||||
int ret = 0;
|
||||
|
||||
if (pb)
|
||||
ret = call_bufop(vb->vb2_queue, fill_vb2_buffer,
|
||||
vb, pb, vb->planes);
|
||||
return ret ? ret : call_vb_qop(vb, buf_prepare, vb);
|
||||
}
|
||||
|
||||
@ -1077,14 +1080,16 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const void *pb)
|
||||
struct vb2_queue *q = vb->vb2_queue;
|
||||
void *mem_priv;
|
||||
unsigned int plane;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
enum dma_data_direction dma_dir =
|
||||
q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
|
||||
bool reacquired = vb->planes[0].mem_priv == NULL;
|
||||
|
||||
memset(planes, 0, sizeof(planes[0]) * vb->num_planes);
|
||||
/* Copy relevant information provided by the userspace */
|
||||
ret = call_bufop(vb->vb2_queue, fill_vb2_buffer, vb, pb, planes);
|
||||
if (pb)
|
||||
ret = call_bufop(vb->vb2_queue, fill_vb2_buffer,
|
||||
vb, pb, planes);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -1192,14 +1197,16 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb)
|
||||
struct vb2_queue *q = vb->vb2_queue;
|
||||
void *mem_priv;
|
||||
unsigned int plane;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
enum dma_data_direction dma_dir =
|
||||
q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
|
||||
bool reacquired = vb->planes[0].mem_priv == NULL;
|
||||
|
||||
memset(planes, 0, sizeof(planes[0]) * vb->num_planes);
|
||||
/* Copy relevant information provided by the userspace */
|
||||
ret = call_bufop(vb->vb2_queue, fill_vb2_buffer, vb, pb, planes);
|
||||
if (pb)
|
||||
ret = call_bufop(vb->vb2_queue, fill_vb2_buffer,
|
||||
vb, pb, planes);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -1520,7 +1527,8 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb)
|
||||
q->waiting_for_buffers = false;
|
||||
vb->state = VB2_BUF_STATE_QUEUED;
|
||||
|
||||
call_void_bufop(q, copy_timestamp, vb, pb);
|
||||
if (pb)
|
||||
call_void_bufop(q, copy_timestamp, vb, pb);
|
||||
|
||||
trace_vb2_qbuf(q, vb);
|
||||
|
||||
@ -1532,7 +1540,8 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb)
|
||||
__enqueue_in_driver(vb);
|
||||
|
||||
/* Fill buffer information for the userspace */
|
||||
call_void_bufop(q, fill_user_buffer, vb, pb);
|
||||
if (pb)
|
||||
call_void_bufop(q, fill_user_buffer, vb, pb);
|
||||
|
||||
/*
|
||||
* If streamon has been called, and we haven't yet called
|
||||
@ -1731,7 +1740,8 @@ static void __vb2_dqbuf(struct vb2_buffer *vb)
|
||||
* The return values from this function are intended to be directly returned
|
||||
* from vidioc_dqbuf handler in driver.
|
||||
*/
|
||||
int vb2_core_dqbuf(struct vb2_queue *q, void *pb, bool nonblocking)
|
||||
int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb,
|
||||
bool nonblocking)
|
||||
{
|
||||
struct vb2_buffer *vb = NULL;
|
||||
int ret;
|
||||
@ -1754,8 +1764,12 @@ int vb2_core_dqbuf(struct vb2_queue *q, void *pb, bool nonblocking)
|
||||
|
||||
call_void_vb_qop(vb, buf_finish, vb);
|
||||
|
||||
if (pindex)
|
||||
*pindex = vb->index;
|
||||
|
||||
/* Fill buffer information for the userspace */
|
||||
call_void_bufop(q, fill_user_buffer, vb, pb);
|
||||
if (pb)
|
||||
call_void_bufop(q, fill_user_buffer, vb, pb);
|
||||
|
||||
/* Remove from videobuf queue */
|
||||
list_del(&vb->queued_entry);
|
||||
@ -1828,7 +1842,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
|
||||
* that's done in dqbuf, but that's not going to happen when we
|
||||
* cancel the whole queue. Note: this code belongs here, not in
|
||||
* __vb2_dqbuf() since in vb2_internal_dqbuf() there is a critical
|
||||
* call to __fill_v4l2_buffer() after buf_finish(). That order can't
|
||||
* call to __fill_user_buffer() after buf_finish(). That order can't
|
||||
* be changed, so we can't move the buf_finish() to __vb2_dqbuf().
|
||||
*/
|
||||
for (i = 0; i < q->num_buffers; ++i) {
|
||||
@ -2357,7 +2371,6 @@ struct vb2_fileio_data {
|
||||
unsigned int count;
|
||||
unsigned int type;
|
||||
unsigned int memory;
|
||||
struct vb2_buffer *b;
|
||||
struct vb2_fileio_buf bufs[VB2_MAX_FRAME];
|
||||
unsigned int cur_index;
|
||||
unsigned int initial_index;
|
||||
@ -2410,12 +2423,6 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
|
||||
if (fileio == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
fileio->b = kzalloc(q->buf_struct_size, GFP_KERNEL);
|
||||
if (fileio->b == NULL) {
|
||||
kfree(fileio);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
fileio->read_once = q->fileio_read_once;
|
||||
fileio->write_immediately = q->fileio_write_immediately;
|
||||
|
||||
@ -2460,13 +2467,7 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
|
||||
* Queue all buffers.
|
||||
*/
|
||||
for (i = 0; i < q->num_buffers; i++) {
|
||||
struct vb2_buffer *b = fileio->b;
|
||||
|
||||
memset(b, 0, q->buf_struct_size);
|
||||
b->type = q->type;
|
||||
b->memory = q->memory;
|
||||
b->index = i;
|
||||
ret = vb2_core_qbuf(q, i, b);
|
||||
ret = vb2_core_qbuf(q, i, NULL);
|
||||
if (ret)
|
||||
goto err_reqbufs;
|
||||
fileio->bufs[i].queued = 1;
|
||||
@ -2511,7 +2512,6 @@ static int __vb2_cleanup_fileio(struct vb2_queue *q)
|
||||
q->fileio = NULL;
|
||||
fileio->count = 0;
|
||||
vb2_core_reqbufs(q, fileio->memory, &fileio->count);
|
||||
kfree(fileio->b);
|
||||
kfree(fileio);
|
||||
dprintk(3, "file io emulator closed\n");
|
||||
}
|
||||
@ -2539,7 +2539,8 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
||||
* else is able to provide this information with the write() operation.
|
||||
*/
|
||||
bool copy_timestamp = !read && q->copy_timestamp;
|
||||
int ret, index;
|
||||
unsigned index;
|
||||
int ret;
|
||||
|
||||
dprintk(3, "mode %s, offset %ld, count %zd, %sblocking\n",
|
||||
read ? "read" : "write", (long)*ppos, count,
|
||||
@ -2564,22 +2565,20 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
||||
*/
|
||||
index = fileio->cur_index;
|
||||
if (index >= q->num_buffers) {
|
||||
struct vb2_buffer *b = fileio->b;
|
||||
struct vb2_buffer *b;
|
||||
|
||||
/*
|
||||
* Call vb2_dqbuf to get buffer back.
|
||||
*/
|
||||
memset(b, 0, q->buf_struct_size);
|
||||
b->type = q->type;
|
||||
b->memory = q->memory;
|
||||
ret = vb2_core_dqbuf(q, b, nonblock);
|
||||
ret = vb2_core_dqbuf(q, &index, NULL, nonblock);
|
||||
dprintk(5, "vb2_dqbuf result: %d\n", ret);
|
||||
if (ret)
|
||||
return ret;
|
||||
fileio->dq_count += 1;
|
||||
|
||||
fileio->cur_index = index = b->index;
|
||||
fileio->cur_index = index;
|
||||
buf = &fileio->bufs[index];
|
||||
b = q->bufs[index];
|
||||
|
||||
/*
|
||||
* Get number of bytes filled by the driver
|
||||
@ -2630,7 +2629,7 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
||||
* Queue next buffer if required.
|
||||
*/
|
||||
if (buf->pos == buf->size || (!read && fileio->write_immediately)) {
|
||||
struct vb2_buffer *b = fileio->b;
|
||||
struct vb2_buffer *b = q->bufs[index];
|
||||
|
||||
/*
|
||||
* Check if this is the last buffer to read.
|
||||
@ -2643,15 +2642,11 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
||||
/*
|
||||
* Call vb2_qbuf and give buffer to the driver.
|
||||
*/
|
||||
memset(b, 0, q->buf_struct_size);
|
||||
b->type = q->type;
|
||||
b->memory = q->memory;
|
||||
b->index = index;
|
||||
b->planes[0].bytesused = buf->pos;
|
||||
|
||||
if (copy_timestamp)
|
||||
b->timestamp = ktime_get_ns();
|
||||
ret = vb2_core_qbuf(q, index, b);
|
||||
ret = vb2_core_qbuf(q, index, NULL);
|
||||
dprintk(5, "vb2_dbuf result: %d\n", ret);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -2713,10 +2708,9 @@ static int vb2_thread(void *data)
|
||||
{
|
||||
struct vb2_queue *q = data;
|
||||
struct vb2_threadio_data *threadio = q->threadio;
|
||||
struct vb2_fileio_data *fileio = q->fileio;
|
||||
bool copy_timestamp = false;
|
||||
int prequeue = 0;
|
||||
int index = 0;
|
||||
unsigned prequeue = 0;
|
||||
unsigned index = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (q->is_output) {
|
||||
@ -2728,37 +2722,34 @@ static int vb2_thread(void *data)
|
||||
|
||||
for (;;) {
|
||||
struct vb2_buffer *vb;
|
||||
struct vb2_buffer *b = fileio->b;
|
||||
|
||||
/*
|
||||
* Call vb2_dqbuf to get buffer back.
|
||||
*/
|
||||
memset(b, 0, q->buf_struct_size);
|
||||
b->type = q->type;
|
||||
b->memory = q->memory;
|
||||
if (prequeue) {
|
||||
b->index = index++;
|
||||
vb = q->bufs[index++];
|
||||
prequeue--;
|
||||
} else {
|
||||
call_void_qop(q, wait_finish, q);
|
||||
if (!threadio->stop)
|
||||
ret = vb2_core_dqbuf(q, b, 0);
|
||||
ret = vb2_core_dqbuf(q, &index, NULL, 0);
|
||||
call_void_qop(q, wait_prepare, q);
|
||||
dprintk(5, "file io: vb2_dqbuf result: %d\n", ret);
|
||||
if (!ret)
|
||||
vb = q->bufs[index];
|
||||
}
|
||||
if (ret || threadio->stop)
|
||||
break;
|
||||
try_to_freeze();
|
||||
|
||||
vb = q->bufs[b->index];
|
||||
if (b->state == VB2_BUF_STATE_DONE)
|
||||
if (vb->state != VB2_BUF_STATE_ERROR)
|
||||
if (threadio->fnc(vb, threadio->priv))
|
||||
break;
|
||||
call_void_qop(q, wait_finish, q);
|
||||
if (copy_timestamp)
|
||||
b->timestamp = ktime_get_ns();;
|
||||
vb->timestamp = ktime_get_ns();;
|
||||
if (!threadio->stop)
|
||||
ret = vb2_core_qbuf(q, b->index, b);
|
||||
ret = vb2_core_qbuf(q, vb->index, NULL);
|
||||
call_void_qop(q, wait_prepare, q);
|
||||
if (ret || threadio->stop)
|
||||
break;
|
||||
|
@ -625,7 +625,7 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = vb2_core_dqbuf(q, b, nonblocking);
|
||||
ret = vb2_core_dqbuf(q, NULL, b, nonblocking);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -533,7 +533,8 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
|
||||
const unsigned int requested_sizes[]);
|
||||
int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb);
|
||||
int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb);
|
||||
int vb2_core_dqbuf(struct vb2_queue *q, void *pb, bool nonblocking);
|
||||
int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb,
|
||||
bool nonblocking);
|
||||
|
||||
int vb2_core_streamon(struct vb2_queue *q, unsigned int type);
|
||||
int vb2_core_streamoff(struct vb2_queue *q, unsigned int type);
|
||||
|
Loading…
Reference in New Issue
Block a user