forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/media/platform/omap/omap_vout_vrfb.c
....@@ -14,7 +14,6 @@
1414 #include <linux/videodev2.h>
1515 #include <linux/slab.h>
1616
17
-#include <media/videobuf-dma-contig.h>
1817 #include <media/v4l2-device.h>
1918
2019 #include <video/omapvrfb.h>
....@@ -40,7 +39,7 @@
4039 &vout->smsshado_phy_addr[i]);
4140 }
4241 if (!vout->smsshado_virt_addr[i] && startindex != -1) {
43
- if (V4L2_MEMORY_MMAP == vout->memory && i >= startindex)
42
+ if (vout->vq.memory == V4L2_MEMORY_MMAP && i >= startindex)
4443 break;
4544 }
4645 if (!vout->smsshado_virt_addr[i]) {
....@@ -109,8 +108,7 @@
109108 dev_info(&pdev->dev, ": VRFB allocation failed\n");
110109 for (j = 0; j < i; j++)
111110 omap_vrfb_release_ctx(&vout->vrfb_context[j]);
112
- ret = -ENOMEM;
113
- goto free_buffers;
111
+ return -ENOMEM;
114112 }
115113 }
116114
....@@ -155,8 +153,10 @@
155153
156154 init_waitqueue_head(&vout->vrfb_dma_tx.wait);
157155
158
- /* statically allocated the VRFB buffer is done through
159
- commands line aruments */
156
+ /*
157
+ * statically allocated the VRFB buffer is done through
158
+ * command line arguments
159
+ */
160160 if (static_vrfb_allocation) {
161161 if (omap_vout_allocate_vrfb_buffers(vout, &vrfb_num_bufs, -1)) {
162162 ret = -ENOMEM;
....@@ -169,9 +169,6 @@
169169 release_vrfb_ctx:
170170 for (j = 0; j < VRFB_NUM_BUFS; j++)
171171 omap_vrfb_release_ctx(&vout->vrfb_context[j]);
172
-free_buffers:
173
- omap_vout_free_buffers(vout);
174
-
175172 return ret;
176173 }
177174
....@@ -231,13 +228,14 @@
231228 }
232229
233230 int omap_vout_prepare_vrfb(struct omap_vout_device *vout,
234
- struct videobuf_buffer *vb)
231
+ struct vb2_buffer *vb)
235232 {
236233 struct dma_async_tx_descriptor *tx;
237234 enum dma_ctrl_flags flags = DMA_PREP_INTERRUPT | DMA_CTRL_ACK;
238235 struct dma_chan *chan = vout->vrfb_dma_tx.chan;
239236 struct dma_interleaved_template *xt = vout->vrfb_dma_tx.xt;
240237 dma_cookie_t cookie;
238
+ dma_addr_t buf_phy_addr = vb2_dma_contig_plane_dma_addr(vb, 0);
241239 enum dma_status status;
242240 enum dss_rotation rotation;
243241 size_t dst_icg;
....@@ -255,8 +253,8 @@
255253 pixsize = vout->bpp * vout->vrfb_bpp;
256254 dst_icg = MAX_PIXELS_PER_LINE * pixsize - vout->pix.width * vout->bpp;
257255
258
- xt->src_start = vout->buf_phy_addr[vb->i];
259
- xt->dst_start = vout->vrfb_context[vb->i].paddr[0];
256
+ xt->src_start = buf_phy_addr;
257
+ xt->dst_start = vout->vrfb_context[vb->index].paddr[0];
260258
261259 xt->numf = vout->pix.height;
262260 xt->frame_size = 1;
....@@ -307,8 +305,8 @@
307305 /* Store buffers physical address into an array. Addresses
308306 * from this array will be used to configure DSS */
309307 rotation = calc_rotation(vout);
310
- vout->queued_buf_addr[vb->i] = (u8 *)
311
- vout->vrfb_context[vb->i].paddr[rotation];
308
+ vout->queued_buf_addr[vb->index] = (u8 *)
309
+ vout->vrfb_context[vb->index].paddr[rotation];
312310 return 0;
313311 }
314312