ivpu_gem.h (594ce0b8a998aa4d05827cd7c0d0dcec9a1e3ae2) ivpu_gem.h (2c3801b17459da806f44d3f63f89e999f23e9e60)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2020-2023 Intel Corporation
4 */
5#ifndef __IVPU_GEM_H__
6#define __IVPU_GEM_H__
7
8#include <drm/drm_gem.h>

--- 46 unchanged lines hidden (view full) ---

55 return bo->base.base.size;
56}
57
58static inline u32 ivpu_bo_cache_mode(struct ivpu_bo *bo)
59{
60 return bo->flags & DRM_IVPU_BO_CACHE_MASK;
61}
62
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2020-2023 Intel Corporation
4 */
5#ifndef __IVPU_GEM_H__
6#define __IVPU_GEM_H__
7
8#include <drm/drm_gem.h>

--- 46 unchanged lines hidden (view full) ---

55 return bo->base.base.size;
56}
57
58static inline u32 ivpu_bo_cache_mode(struct ivpu_bo *bo)
59{
60 return bo->flags & DRM_IVPU_BO_CACHE_MASK;
61}
62
63static inline bool ivpu_bo_is_snooped(struct ivpu_bo *bo)
63static inline struct ivpu_device *ivpu_bo_to_vdev(struct ivpu_bo *bo)
64{
64{
65 return ivpu_bo_cache_mode(bo) == DRM_IVPU_BO_CACHED;
65 return to_ivpu_device(bo->base.base.dev);
66}
67
66}
67
68static inline struct ivpu_device *ivpu_bo_to_vdev(struct ivpu_bo *bo)
68static inline bool ivpu_bo_is_snooped(struct ivpu_bo *bo)
69{
69{
70 return to_ivpu_device(bo->base.base.dev);
70 if (ivpu_is_force_snoop_enabled(ivpu_bo_to_vdev(bo)))
71 return true;
72
73 return ivpu_bo_cache_mode(bo) == DRM_IVPU_BO_CACHED;
71}
72
73static inline void *ivpu_to_cpu_addr(struct ivpu_bo *bo, u32 vpu_addr)
74{
75 if (vpu_addr < bo->vpu_addr)
76 return NULL;
77
78 if (vpu_addr >= (bo->vpu_addr + ivpu_bo_size(bo)))

--- 17 unchanged lines hidden ---
74}
75
76static inline void *ivpu_to_cpu_addr(struct ivpu_bo *bo, u32 vpu_addr)
77{
78 if (vpu_addr < bo->vpu_addr)
79 return NULL;
80
81 if (vpu_addr >= (bo->vpu_addr + ivpu_bo_size(bo)))

--- 17 unchanged lines hidden ---