• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef CAMERA_BUFFER_MANAGER_SG_DMA_H
10 #define CAMERA_BUFFER_MANAGER_SG_DMA_H
11 
12 #include <linux/scatterlist.h>
13 #include <linux/slab.h>
14 #include "camera_buffer_manager_adapter.h"
15 #include "camera_buffer.h"
16 
17 struct MemOps *GetSgDmaOps(void);
18 
DmaSgPlaneDesc(struct CameraBuffer * buffer,uint32_t planeId)19 static inline struct sg_table *DmaSgPlaneDesc(struct CameraBuffer *buffer, uint32_t planeId)
20 {
21     struct BufferQueue *queue = buffer->bufferQueue;
22 
23     if (planeId >= buffer->numPlanes || buffer->planes[planeId].memPriv == NULL) {
24         return NULL;
25     }
26 
27     if (queue->memOps->getCookie != NULL) {
28         return (struct sg_table *)queue->memOps->getCookie(buffer->planes[planeId].memPriv);
29     }
30 
31     return NULL;
32 }
33 
34 #endif /* CAMERA_BUFFER_MANAGER_SG_DMA_H */