Skip to content

Commit 0e39068

Browse files
committed
Introduce helper to detect buffer placement via usage
Signed-off-by: Weifeng Liu <[email protected]>
1 parent fefe45f commit 0e39068

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

utils/intel_blit.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
#include "UniqueFd.h"
2424

25+
/* Buffer is allocated on dGPU local memory if this flag is set */
26+
#define GRALLOC_USAGE_PRIVATE_2 (1ull << 30)
27+
2528
#define I915_TILING_4 9
2629

2730
struct intel_info {
@@ -49,6 +52,9 @@ int intel_create_buffer(struct intel_info *info,
4952
uint64_t modifier, uint32_t *out_handle);
5053
int intel_dgpu_fd();
5154
bool virtio_gpu_allow_p2p(int virtgpu_fd);
55+
inline bool has_local_memory_flag(uint64_t usage) {
56+
return (usage & GRALLOC_USAGE_PRIVATE_2) != 0;
57+
}
5258

5359
class IntelBlitter {
5460
public:

0 commit comments

Comments
 (0)