summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2019-02-20 20:46:42 -0500
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2019-03-18 11:24:14 -0400
commita63722aeb76c65f39c98c66a1e730a2f3da123ab (patch)
treef1643681ec6f2ec2d8cb77abf19d855e858cd79e
parent09e513e390eab1f2db4d4242ef209cbe0c39c444 (diff)
media: vsp1: drm: Implement writeback support
Extend the vsp1_du_atomic_flush() API with writeback support by adding format, pitch and memory addresses of the writeback framebuffer. Writeback completion is reported through the existing frame completion callback with a new VSP1_DU_STATUS_WRITEBACK status flag. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--drivers/media/platform/vsp1/vsp1_dl.c14
-rw-r--r--drivers/media/platform/vsp1/vsp1_dl.h3
-rw-r--r--drivers/media/platform/vsp1/vsp1_drm.c25
-rw-r--r--include/media/vsp1.h15
4 files changed, 55 insertions, 2 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c
index ed7cda4130f2..104b6f514536 100644
--- a/drivers/media/platform/vsp1/vsp1_dl.c
+++ b/drivers/media/platform/vsp1/vsp1_dl.c
@@ -958,6 +958,9 @@ void vsp1_dl_list_commit(struct vsp1_dl_list *dl, unsigned int dl_flags)
958 * 958 *
959 * The VSP1_DL_FRAME_END_INTERNAL flag indicates that the display list that just 959 * The VSP1_DL_FRAME_END_INTERNAL flag indicates that the display list that just
960 * became active had been queued with the internal notification flag. 960 * became active had been queued with the internal notification flag.
961 *
962 * The VSP1_DL_FRAME_END_WRITEBACK flag indicates that the previously active
963 * display list had been queued with the writeback flag.
961 */ 964 */
962unsigned int vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm) 965unsigned int vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm)
963{ 966{
@@ -996,6 +999,17 @@ unsigned int vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm)
996 goto done; 999 goto done;
997 1000
998 /* 1001 /*
1002 * If the active display list has the writeback flag set, the frame
1003 * completion marks the end of the writeback capture. Return the
1004 * VSP1_DL_FRAME_END_WRITEBACK flag and reset the display list's
1005 * writeback flag.
1006 */
1007 if (dlm->active && (dlm->active->flags & VSP1_DL_FRAME_END_WRITEBACK)) {
1008 flags |= VSP1_DL_FRAME_END_WRITEBACK;
1009 dlm->active->flags &= ~VSP1_DL_FRAME_END_WRITEBACK;
1010 }
1011
1012 /*
999 * The device starts processing the queued display list right after the 1013 * The device starts processing the queued display list right after the
1000 * frame end interrupt. The display list thus becomes active. 1014 * frame end interrupt. The display list thus becomes active.
1001 */ 1015 */
diff --git a/drivers/media/platform/vsp1/vsp1_dl.h b/drivers/media/platform/vsp1/vsp1_dl.h
index 079ba5af0315..bebe16483ca5 100644
--- a/drivers/media/platform/vsp1/vsp1_dl.h
+++ b/drivers/media/platform/vsp1/vsp1_dl.h
@@ -19,7 +19,8 @@ struct vsp1_dl_manager;
19 19
20/* Keep these flags in sync with VSP1_DU_STATUS_* in include/media/vsp1.h. */ 20/* Keep these flags in sync with VSP1_DU_STATUS_* in include/media/vsp1.h. */
21#define VSP1_DL_FRAME_END_COMPLETED BIT(0) 21#define VSP1_DL_FRAME_END_COMPLETED BIT(0)
22#define VSP1_DL_FRAME_END_INTERNAL BIT(1) 22#define VSP1_DL_FRAME_END_WRITEBACK BIT(1)
23#define VSP1_DL_FRAME_END_INTERNAL BIT(2)
23 24
24/** 25/**
25 * struct vsp1_dl_ext_cmd - Extended Display command 26 * struct vsp1_dl_ext_cmd - Extended Display command
diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c
index bd95683c1cd9..a4a45d68a6ef 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -37,7 +37,9 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe,
37 37
38 if (drm_pipe->du_complete) { 38 if (drm_pipe->du_complete) {
39 struct vsp1_entity *uif = drm_pipe->uif; 39 struct vsp1_entity *uif = drm_pipe->uif;
40 unsigned int status = completion & VSP1_DU_STATUS_COMPLETE; 40 unsigned int status = completion
41 & (VSP1_DU_STATUS_COMPLETE |
42 VSP1_DU_STATUS_WRITEBACK);
41 u32 crc; 43 u32 crc;
42 44
43 crc = uif ? vsp1_uif_get_crc(to_uif(&uif->subdev)) : 0; 45 crc = uif ? vsp1_uif_get_crc(to_uif(&uif->subdev)) : 0;
@@ -541,6 +543,8 @@ static void vsp1_du_pipeline_configure(struct vsp1_pipeline *pipe)
541 543
542 if (drm_pipe->force_brx_release) 544 if (drm_pipe->force_brx_release)
543 dl_flags |= VSP1_DL_FRAME_END_INTERNAL; 545 dl_flags |= VSP1_DL_FRAME_END_INTERNAL;
546 if (pipe->output->writeback)
547 dl_flags |= VSP1_DL_FRAME_END_WRITEBACK;
544 548
545 dl = vsp1_dl_list_get(pipe->output->dlm); 549 dl = vsp1_dl_list_get(pipe->output->dlm);
546 dlb = vsp1_dl_list_get_body0(dl); 550 dlb = vsp1_dl_list_get_body0(dl);
@@ -870,12 +874,31 @@ void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
870 struct vsp1_device *vsp1 = dev_get_drvdata(dev); 874 struct vsp1_device *vsp1 = dev_get_drvdata(dev);
871 struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index]; 875 struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index];
872 struct vsp1_pipeline *pipe = &drm_pipe->pipe; 876 struct vsp1_pipeline *pipe = &drm_pipe->pipe;
877 int ret;
873 878
874 drm_pipe->crc = cfg->crc; 879 drm_pipe->crc = cfg->crc;
875 880
876 mutex_lock(&vsp1->drm->lock); 881 mutex_lock(&vsp1->drm->lock);
882
883 if (cfg->writeback.pixelformat) {
884 const struct vsp1_du_writeback_config *wb_cfg = &cfg->writeback;
885
886 ret = vsp1_du_pipeline_set_rwpf_format(vsp1, pipe->output,
887 wb_cfg->pixelformat,
888 wb_cfg->pitch);
889 if (WARN_ON(ret < 0))
890 goto done;
891
892 pipe->output->mem.addr[0] = wb_cfg->mem[0];
893 pipe->output->mem.addr[1] = wb_cfg->mem[1];
894 pipe->output->mem.addr[2] = wb_cfg->mem[2];
895 pipe->output->writeback = true;
896 }
897
877 vsp1_du_pipeline_setup_inputs(vsp1, pipe); 898 vsp1_du_pipeline_setup_inputs(vsp1, pipe);
878 vsp1_du_pipeline_configure(pipe); 899 vsp1_du_pipeline_configure(pipe);
900
901done:
879 mutex_unlock(&vsp1->drm->lock); 902 mutex_unlock(&vsp1->drm->lock);
880} 903}
881EXPORT_SYMBOL_GPL(vsp1_du_atomic_flush); 904EXPORT_SYMBOL_GPL(vsp1_du_atomic_flush);
diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index 877496936487..cc1b0d42ce95 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -18,6 +18,7 @@ struct device;
18int vsp1_du_init(struct device *dev); 18int vsp1_du_init(struct device *dev);
19 19
20#define VSP1_DU_STATUS_COMPLETE BIT(0) 20#define VSP1_DU_STATUS_COMPLETE BIT(0)
21#define VSP1_DU_STATUS_WRITEBACK BIT(1)
21 22
22/** 23/**
23 * struct vsp1_du_lif_config - VSP LIF configuration 24 * struct vsp1_du_lif_config - VSP LIF configuration
@@ -84,11 +85,25 @@ struct vsp1_du_crc_config {
84}; 85};
85 86
86/** 87/**
88 * struct vsp1_du_writeback_config - VSP writeback configuration parameters
89 * @pixelformat: plane pixel format (V4L2 4CC)
90 * @pitch: line pitch in bytes for the first plane
91 * @mem: DMA memory address for each plane of the frame buffer
92 */
93struct vsp1_du_writeback_config {
94 u32 pixelformat;
95 unsigned int pitch;
96 dma_addr_t mem[3];
97};
98
99/**
87 * struct vsp1_du_atomic_pipe_config - VSP atomic pipe configuration parameters 100 * struct vsp1_du_atomic_pipe_config - VSP atomic pipe configuration parameters
88 * @crc: CRC computation configuration 101 * @crc: CRC computation configuration
102 * @writeback: writeback configuration
89 */ 103 */
90struct vsp1_du_atomic_pipe_config { 104struct vsp1_du_atomic_pipe_config {
91 struct vsp1_du_crc_config crc; 105 struct vsp1_du_crc_config crc;
106 struct vsp1_du_writeback_config writeback;
92}; 107};
93 108
94void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index); 109void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index);