aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel@collabora.com>2019-04-25 03:12:25 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-05-28 12:11:08 -0400
commit9d4e1f745d5888b386a807792a3814e8f23eacdc (patch)
treebca4bad44975880c911bde3dd6918ca9b27deb83 /drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h
parentmedia: rockchip/vpu: Cleanup macroblock alignment (diff)
downloadlinux-dev-9d4e1f745d5888b386a807792a3814e8f23eacdc.tar.xz
linux-dev-9d4e1f745d5888b386a807792a3814e8f23eacdc.zip
media: rockchip/vpu: Cleanup JPEG bounce buffer management
In order to make the code more generic, introduce a pair of start/stop codec operations, and use them to allocate and release the JPEG bounce buffer. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h')
-rw-r--r--drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h b/drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h
index 2b955da1be1a..46716d121538 100644
--- a/drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h
+++ b/drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h
@@ -19,8 +19,32 @@ struct rockchip_vpu_buf;
struct rockchip_vpu_variant;
/**
+ * struct rockchip_vpu_aux_buf - auxiliary DMA buffer for hardware data
+ * @cpu: CPU pointer to the buffer.
+ * @dma: DMA address of the buffer.
+ * @size: Size of the buffer.
+ */
+struct rockchip_vpu_aux_buf {
+ void *cpu;
+ dma_addr_t dma;
+ size_t size;
+};
+
+/**
+ * struct rockchip_vpu_jpeg_enc_hw_ctx
+ * @bounce_buffer: Bounce buffer
+ */
+struct rockchip_vpu_jpeg_enc_hw_ctx {
+ struct rockchip_vpu_aux_buf bounce_buffer;
+};
+
+/**
* struct rockchip_vpu_codec_ops - codec mode specific operations
*
+ * @init: If needed, can be used for initialization.
+ * Optional and called from process context.
+ * @exit: If needed, can be used to undo the .init phase.
+ * Optional and called from process context.
* @run: Start single {en,de)coding job. Called from atomic context
* to indicate that a pair of buffers is ready and the hardware
* should be programmed and started.
@@ -28,6 +52,8 @@ struct rockchip_vpu_variant;
* @reset: Reset the hardware in case of a timeout.
*/
struct rockchip_vpu_codec_ops {
+ int (*init)(struct rockchip_vpu_ctx *ctx);
+ void (*exit)(struct rockchip_vpu_ctx *ctx);
void (*run)(struct rockchip_vpu_ctx *ctx);
void (*done)(struct rockchip_vpu_ctx *ctx, enum vb2_buffer_state);
void (*reset)(struct rockchip_vpu_ctx *ctx);
@@ -54,5 +80,7 @@ void rockchip_vpu_irq_done(struct rockchip_vpu_dev *vpu,
void rk3288_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx);
void rk3399_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx);
+int rockchip_vpu_jpeg_enc_init(struct rockchip_vpu_ctx *ctx);
+void rockchip_vpu_jpeg_enc_exit(struct rockchip_vpu_ctx *ctx);
#endif /* ROCKCHIP_VPU_HW_H_ */