summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2019-09-25 07:45:30 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2020-08-24 14:23:20 +0800
commit0858dfbd38fa0a4b41cd377dbd08e1c9940509e3 (patch)
treed7cf3fd049de05a2c7895df3f802b42e34bb7b25
parent3e38fb203a565ff819baed361619653f5d1aa4a8 (diff)
downloadomap-modules-0858dfbd38fa0a4b41cd377dbd08e1c9940509e3.tar.gz
drivers: gpu: pvr: dma-buf: rename reservation_object to dma_resv
update to fix the compiling problem caused by commits here: dma-buf: rename reservation_object to dma_resv 52791eeec1d9f4a7e7fe08aaba0b1553149d93bc https://android.googlesource.com/kernel/common/+/52791eeec1d9f4a7e7fe08aaba0b1553149d93bc Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org> Change-Id: Id225d1328f6d80cfbc5b6de9fa01a92efe6bf33d
-rw-r--r--pvr/services4/srvkm/env/linux/dmabuf.h19
-rw-r--r--pvr/services4/srvkm/env/linux/pvr_linux_fence.c106
2 files changed, 73 insertions, 52 deletions
diff --git a/pvr/services4/srvkm/env/linux/dmabuf.h b/pvr/services4/srvkm/env/linux/dmabuf.h
index 9a09464..84fa9d5 100644
--- a/pvr/services4/srvkm/env/linux/dmabuf.h
+++ b/pvr/services4/srvkm/env/linux/dmabuf.h
@@ -49,7 +49,24 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "img_types.h"
#include "servicesext.h"
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0))
+#include <linux/dma-resv.h>
+#include "pvr_bridge.h"
+
+struct dmabuf_resvinfo
+{
+ struct dma_resv *resv;
+};
+
+static inline void *DmaBufGetReservationObject(IMG_HANDLE hSync)
+{
+ struct dmabuf_resvinfo *info;
+
+ info = (struct dmabuf_resvinfo *)hSync;
+
+ return info->resv;
+}
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
#include <linux/reservation.h>
#include "pvr_bridge.h"
diff --git a/pvr/services4/srvkm/env/linux/pvr_linux_fence.c b/pvr/services4/srvkm/env/linux/pvr_linux_fence.c
index 4c7ae36..759f6cd 100644
--- a/pvr/services4/srvkm/env/linux/pvr_linux_fence.c
+++ b/pvr/services4/srvkm/env/linux/pvr_linux_fence.c
@@ -56,7 +56,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <linux/atomic.h>
#include <linux/spinlock.h>
#include <linux/dma-fence.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0))
+#include <linux/dma-resv.h>
+#else
#include <linux/reservation.h>
+#endif
#include <linux/list.h>
#include "dmabuf.h"
@@ -312,17 +316,17 @@ static inline int update_reservation_return_value(int ret, bool blocked_on_write
return ret < 0 ? ret : (ret ? 0 : (blocked_on_write ? BLOCKED_ON_WRITE : BLOCKED_ON_READ));
}
-static int update_reservation_object_fences_dst(struct pvr_fence_frame *pvr_fence_frame,
- struct reservation_object *resv)
+static int update_dma_resv_fences_dst(struct pvr_fence_frame *pvr_fence_frame,
+ struct dma_resv *resv)
{
- struct reservation_object_list *flist;
+ struct dma_resv_list *flist;
struct dma_fence *fence_to_signal;
unsigned shared_fence_count;
unsigned blocking_fence_count;
unsigned i;
int ret;
- flist = reservation_object_get_list(resv);
+ flist = dma_resv_get_list(resv);
shared_fence_count = flist ? flist->shared_count : 0;
/*
@@ -336,7 +340,7 @@ static int update_reservation_object_fences_dst(struct pvr_fence_frame *pvr_fenc
{
struct dma_fence *fence;
- fence = reservation_object_get_excl(resv);
+ fence = dma_resv_get_excl(resv);
if (is_unsignalled_blocking_fence(fence))
{
return 0;
@@ -344,7 +348,7 @@ static int update_reservation_object_fences_dst(struct pvr_fence_frame *pvr_fenc
for (i = 0; i < shared_fence_count; i++)
{
- fence = rcu_dereference_protected(flist->shared[i], reservation_object_held(resv));
+ fence = rcu_dereference_protected(flist->shared[i], dma_resv_held(resv));
if (is_unsignalled_blocking_fence(fence))
{
@@ -361,13 +365,13 @@ static int update_reservation_object_fences_dst(struct pvr_fence_frame *pvr_fenc
if (!pvr_fence_frame->have_blocking_fences)
{
- reservation_object_add_excl_fence(resv, fence_to_signal);
+ dma_resv_add_excl_fence(resv, fence_to_signal);
return 0;
}
if (!shared_fence_count)
{
- struct dma_fence *fence = reservation_object_get_excl(resv);
+ struct dma_fence *fence = dma_resv_get_excl(resv);
if (is_blocking_fence(fence))
{
@@ -386,14 +390,14 @@ static int update_reservation_object_fences_dst(struct pvr_fence_frame *pvr_fenc
ret = 1;
}
- reservation_object_add_excl_fence(resv, fence_to_signal);
+ dma_resv_add_excl_fence(resv, fence_to_signal);
return update_reservation_return_value(ret, true);
}
for (i = 0, blocking_fence_count = 0; i < shared_fence_count; i++)
{
- struct dma_fence *fence = rcu_dereference_protected(flist->shared[i], reservation_object_held(resv));
+ struct dma_fence *fence = rcu_dereference_protected(flist->shared[i], dma_resv_held(resv));
if (is_blocking_fence(fence))
{
@@ -410,7 +414,7 @@ static int update_reservation_object_fences_dst(struct pvr_fence_frame *pvr_fenc
for (i = 0; i < shared_fence_count; i++)
{
- struct dma_fence *fence = rcu_dereference_protected(flist->shared[i], reservation_object_held(resv));
+ struct dma_fence *fence = rcu_dereference_protected(flist->shared[i], dma_resv_held(resv));
if (is_blocking_fence(fence))
{
@@ -428,22 +432,22 @@ static int update_reservation_object_fences_dst(struct pvr_fence_frame *pvr_fenc
}
}
- reservation_object_add_excl_fence(resv, fence_to_signal);
+ dma_resv_add_excl_fence(resv, fence_to_signal);
return update_reservation_return_value(ret, false);
}
-static int update_reservation_object_fences_src(struct pvr_fence_frame *pvr_fence_frame,
- struct reservation_object *resv)
+static int update_dma_resv_fences_src(struct pvr_fence_frame *pvr_fence_frame,
+ struct dma_resv *resv)
{
struct dma_fence *fence_to_signal;
struct dma_fence *fence;
int ret;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0))
- ret = reservation_object_reserve_shared(resv, 1);
+ ret = dma_resv_reserve_shared(resv, 1);
#else
- ret = reservation_object_reserve_shared(resv);
+ ret = dma_resv_reserve_shared(resv);
#endif
if (ret)
{
@@ -458,12 +462,12 @@ static int update_reservation_object_fences_src(struct pvr_fence_frame *pvr_fenc
if (!pvr_fence_frame->have_blocking_fences)
{
- reservation_object_add_shared_fence(resv, fence_to_signal);
+ dma_resv_add_shared_fence(resv, fence_to_signal);
return 0;
}
- fence = reservation_object_get_excl(resv);
+ fence = dma_resv_get_excl(resv);
if (is_blocking_fence(fence))
{
if (allocate_blocking_fence_storage(pvr_fence_frame, 1))
@@ -481,7 +485,7 @@ static int update_reservation_object_fences_src(struct pvr_fence_frame *pvr_fenc
ret = 1;
}
- reservation_object_add_shared_fence(resv, fence_to_signal);
+ dma_resv_add_shared_fence(resv, fence_to_signal);
return update_reservation_return_value(ret, true);
}
@@ -714,7 +718,7 @@ IMG_HANDLE PVRLinuxFenceContextCreate(PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, IMG_H
return (IMG_HANDLE)pvr_fence_context;
}
-static int process_reservation_object(struct pvr_fence_context *pvr_fence_context, struct reservation_object *resv, bool is_dst, u32 tag, bool have_blocking_fences)
+static int process_dma_resv(struct pvr_fence_context *pvr_fence_context, struct dma_resv *resv, bool is_dst, u32 tag, bool have_blocking_fences)
{
PVRSRV_KERNEL_SYNC_INFO *psSyncInfo = pvr_fence_context->psSyncInfo;
struct pvr_fence_frame *pvr_fence_frame;
@@ -734,8 +738,8 @@ static int process_reservation_object(struct pvr_fence_context *pvr_fence_contex
INIT_LIST_HEAD(&pvr_fence_frame->fence_frame_list);
ret = is_dst ?
- update_reservation_object_fences_dst(pvr_fence_frame, resv) :
- update_reservation_object_fences_src(pvr_fence_frame, resv);
+ update_dma_resv_fences_dst(pvr_fence_frame, resv) :
+ update_dma_resv_fences_src(pvr_fence_frame, resv);
if (ret < 0)
{
kfree(pvr_fence_frame);
@@ -769,7 +773,7 @@ static int process_reservation_object(struct pvr_fence_context *pvr_fence_contex
static int process_syncinfo(PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, bool is_dst, u32 tag, bool have_blocking_fences)
{
struct pvr_fence_context *pvr_fence_context = (struct pvr_fence_context *)psSyncInfo->hFenceContext;
- struct reservation_object *resv;
+ struct dma_resv *resv;
int ret = 0;
if (!pvr_fence_context)
@@ -780,7 +784,7 @@ static int process_syncinfo(PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, bool is_dst, u3
mutex_lock(&pvr_fence_context->mutex);
if ((resv = DmaBufGetReservationObject(pvr_fence_context->hNativeSync)))
{
- ret = process_reservation_object(pvr_fence_context,
+ ret = process_dma_resv(pvr_fence_context,
resv,
is_dst,
tag,
@@ -809,9 +813,9 @@ static inline bool sync_enabled(const IMG_BOOL *pbEnabled,
return (!pbEnabled || pbEnabled[index]) && phSyncInfo && phSyncInfo[index];
}
-static bool resv_is_blocking(struct reservation_object *resv, bool is_dst)
+static bool resv_is_blocking(struct dma_resv *resv, bool is_dst)
{
- struct reservation_object_list *flist;
+ struct dma_resv_list *flist;
struct dma_fence *fence;
bool blocking;
unsigned shared_count;
@@ -867,7 +871,7 @@ unlock_retry:
goto retry;
}
-static unsigned count_reservation_objects(unsigned num_syncs,
+static unsigned count_dma_resvs(unsigned num_syncs,
IMG_HANDLE *phSyncInfo,
const IMG_BOOL *pbEnabled,
bool is_dst,
@@ -891,7 +895,7 @@ static unsigned count_reservation_objects(unsigned num_syncs,
pvr_fence_context = (struct pvr_fence_context *)psSyncInfo->hFenceContext;
if (pvr_fence_context)
{
- struct reservation_object *resv;
+ struct dma_resv *resv;
if ((resv = DmaBufGetReservationObject(pvr_fence_context->hNativeSync)))
{
@@ -910,8 +914,8 @@ static unsigned count_reservation_objects(unsigned num_syncs,
return count;
}
-static unsigned get_reservation_objects(unsigned num_resvs,
- struct reservation_object **resvs,
+static unsigned get_dma_resvs(unsigned num_resvs,
+ struct dma_resv **resvs,
unsigned num_syncs,
IMG_HANDLE *phSyncInfo,
const IMG_BOOL *pbEnabled)
@@ -933,7 +937,7 @@ static unsigned get_reservation_objects(unsigned num_resvs,
pvr_fence_context = (struct pvr_fence_context *)psSyncInfo->hFenceContext;
if (pvr_fence_context)
{
- struct reservation_object *resv;
+ struct dma_resv *resv;
if ((resv = DmaBufGetReservationObject(pvr_fence_context->hNativeSync)))
{
@@ -946,8 +950,8 @@ static unsigned get_reservation_objects(unsigned num_resvs,
return count;
}
-static void get_all_reservation_objects(unsigned num_resvs,
- struct reservation_object **resvs,
+static void get_all_dma_resvs(unsigned num_resvs,
+ struct dma_resv **resvs,
IMG_UINT32 ui32NumSrcSyncs,
IMG_HANDLE *phSrcSyncInfo,
const IMG_BOOL *pbSrcEnabled,
@@ -957,21 +961,21 @@ static void get_all_reservation_objects(unsigned num_resvs,
{
unsigned num_src_resvs;
- num_src_resvs = get_reservation_objects(num_resvs,
+ num_src_resvs = get_dma_resvs(num_resvs,
resvs,
ui32NumSrcSyncs,
phSrcSyncInfo,
pbSrcEnabled);
- get_reservation_objects(num_resvs - num_src_resvs,
+ get_dma_resvs(num_resvs - num_src_resvs,
&resvs[num_src_resvs],
ui32NumDstSyncs,
phDstSyncInfo,
pbDstEnabled);
}
-static void unlock_reservation_objects(unsigned num_resvs,
- struct reservation_object **resvs)
+static void unlock_dma_resvs(unsigned num_resvs,
+ struct dma_resv **resvs)
{
unsigned i;
@@ -984,11 +988,11 @@ static void unlock_reservation_objects(unsigned num_resvs,
}
}
-static int lock_reservation_objects_no_retry(struct ww_acquire_ctx *ww_acquire_ctx,
+static int lock_dma_resvs_no_retry(struct ww_acquire_ctx *ww_acquire_ctx,
bool interruptible,
unsigned num_resvs,
- struct reservation_object **resvs,
- struct reservation_object **contended_resv)
+ struct dma_resv **resvs,
+ struct dma_resv **contended_resv)
{
unsigned i;
@@ -1017,7 +1021,7 @@ static int lock_reservation_objects_no_retry(struct ww_acquire_ctx *ww_acquire_c
continue;
}
- unlock_reservation_objects(i, resvs);
+ unlock_dma_resvs(i, resvs);
if (*contended_resv)
{
@@ -1037,16 +1041,16 @@ static int lock_reservation_objects_no_retry(struct ww_acquire_ctx *ww_acquire_c
return 0;
}
-static int lock_reservation_objects(struct ww_acquire_ctx *ww_acquire_ctx,
+static int lock_dma_resvs(struct ww_acquire_ctx *ww_acquire_ctx,
bool interruptible,
unsigned num_resvs,
- struct reservation_object **resvs)
+ struct dma_resv **resvs)
{
int ret;
- struct reservation_object *contended_resv = NULL;
+ struct dma_resv *contended_resv = NULL;
do {
- ret = lock_reservation_objects_no_retry(ww_acquire_ctx,
+ ret = lock_dma_resvs_no_retry(ww_acquire_ctx,
interruptible,
num_resvs,
resvs,
@@ -1234,13 +1238,13 @@ IMG_UINT32 PVRLinuxFenceNumResvObjs(IMG_BOOL *pbBlockingFences,
unsigned count;
bool blocking_fences_src, blocking_fences_dst;
- count = count_reservation_objects(ui32NumSrcSyncs,
+ count = count_dma_resvs(ui32NumSrcSyncs,
phSrcSyncInfo,
pbSrcEnabled,
false,
&blocking_fences_src);
- count += count_reservation_objects(ui32NumDstSyncs,
+ count += count_dma_resvs(ui32NumDstSyncs,
phDstSyncInfo,
pbDstEnabled,
true,
@@ -1264,7 +1268,7 @@ PVRSRV_ERROR PVRLinuxFenceProcess(IMG_UINT32 *pui32Tag,
{
u32 tag;
struct ww_acquire_ctx ww_acquire_ctx;
- struct reservation_object **resvs = NULL;
+ struct dma_resv **resvs = NULL;
int ret;
if (!ui32NumResvObjs)
@@ -1282,7 +1286,7 @@ PVRSRV_ERROR PVRLinuxFenceProcess(IMG_UINT32 *pui32Tag,
goto exit;
}
- get_all_reservation_objects(ui32NumResvObjs,
+ get_all_dma_resvs(ui32NumResvObjs,
resvs,
ui32NumSrcSyncs,
phSrcSyncInfo,
@@ -1299,7 +1303,7 @@ PVRSRV_ERROR PVRLinuxFenceProcess(IMG_UINT32 *pui32Tag,
* started, so returning an error that may result in the
* GPU operation being retried may be inappropriate.
*/
- ret = lock_reservation_objects(&ww_acquire_ctx,
+ ret = lock_dma_resvs(&ww_acquire_ctx,
(bool)bBlockingFences,
ui32NumResvObjs,
resvs);
@@ -1319,7 +1323,7 @@ PVRSRV_ERROR PVRLinuxFenceProcess(IMG_UINT32 *pui32Tag,
pbDstEnabled,
(bool)bBlockingFences);
- unlock_reservation_objects(ui32NumResvObjs, resvs);
+ unlock_dma_resvs(ui32NumResvObjs, resvs);
ww_acquire_fini(&ww_acquire_ctx);