imagination: Update allocation flags for buffers in submit job
v4 cover imagination: Update allocation flags for buffers in submit job
Update BO allocation flags to match expectation:
- Remove the CPU_ACCESS flag from BOs that are not host-accessed.
---
Changes in v4:
- Drop patch 3 for dropping DRM_PVR_BO_PM_FW_PROTECT for MList from v3.
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- Fixed a formatting in Patch 1 as suggested by Luigi.
- Added RB tags for patch 1 and patch 2.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Update as per Kamil's feedback.
- Updated description to map commits are specific to Imagination.
- Spilt lib/igt change to two: Interface update and flags update.
- Link to v1: https://patch.msgid.link/[email protected]
---
Brajesh Gupta (2):
lib/igt_pvr: Update general heap allocation interface to pass flags
imagination: Skip CPU access flag for a few Render related allocations
lib/igt_pvr.c | 29 +++++++++++++++++------------ lib/igt_pvr.h | 3 ++- tests/imagination/pvr_submit_jobs.c | 13 ++++++++++--- 3 files changed, 29 insertions(+), 16 deletions(-)
---
base-commit: fc75d6d7ffcb79e8a3316e80c7085460568a7670
change-id: 20261029-b4-render_update-79d0cf70eb0e
Best regards,
Signature · 1 line
Brajesh Gupta <[email protected]>
PATCH v4 1/2 lib/igt_pvr: Update general heap allocation interface to pass flags
Update igt_pvr_allocate_general() interface to pass flags for allocation.
--- lib/igt_pvr.c | 36 ++++++++++++++++++++++++------------ lib/igt_pvr.h | 3 ++- tests/imagination/pvr_submit_jobs.c | 13 ++++++++++--- 3 files changed, 36 insertions(+), 16 deletions(-)
lib/igt_pvr.c +24 -12
@@ -399,7 +399,9 @@ uint32_t igt_pvr_ioctl_create_context(int fd, enum drm_pvr_ctx_type type, create_context_args.callstack_addr =igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx_handle, -POWERVR_GPU_PAGE_SIZE )); +POWERVR_GPU_PAGE_SIZE , +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE )); create_context_args.static_context_state =to_user_pointer (init_render_context_stream); create_context_args.static_context_state_len =init_render_context_state_stream (init_render_context_stream);
@@ -673,17 +675,15 @@ struct igt_pvr_allocation *igt_pvr_allocate(int fd, uint32_t vm_ctx, size_t size* @fd: The file descriptor of the DRM device. * @vm_ctx: The virtual memory context. * @size: The size of the allocation. +* @flags: Allocation flags. * * Function to allocate and map GPU memory from the general heap. * * Returns: Pointer to the allocation structure. */ -struct igt_pvr_allocation *igt_pvr_allocate_general (int fd,uint32_t vm_ctx,size_t size) +struct igt_pvr_allocation *igt_pvr_allocate_general (int fd,uint32_t vm_ctx,size_t size,uint64_t flags) { -return igt_pvr_allocate (fd, vm_ctx, size, -DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | -DRM_PVR_BO_BYPASS_DEVICE_CACHE , -DRM_PVR_HEAP_GENERAL ); +return igt_pvr_allocate (fd, vm_ctx, size, flags,DRM_PVR_HEAP_GENERAL ); }/**
@@ -817,11 +817,17 @@ static void igt_pvr_create_hwrt_geom_data_args(int fd, uint32_t vm_ctx, *geom_data_args) { geom_data_args->rtc_dev_addr = -igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE )); +igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE )); geom_data_args->tpc_dev_addr = -igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE )); +igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE )); geom_data_args->vheap_table_dev_addr = -igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE )); +igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE )); geom_data_args->tpc_size =POWERVR_GPU_PAGE_SIZE ; geom_data_args->tpc_stride =0x1 ; }
@@ -839,11 +845,17 @@ static void igt_pvr_create_hwrt_rt_data_args(int fd, uint32_t vm_ctx, struct drm_pvr_create_hwrt_rt_data_args *rt_data_args) { rt_data_args->pm_mlist_dev_addr = -igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE )); +igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE )); rt_data_args->macrotile_array_dev_addr = -igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE )); +igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE )); rt_data_args->region_header_dev_addr = -igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE )); +igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE )); }/**
lib/igt_pvr.h +2 -1
@@ -67,7 +67,8 @@ struct igt_pvr_allocation *igt_pvr_allocate_addr(int fd, uint32_t vm_ctx, size_t uint64_t flags, uint64_t gpu_addr);struct igt_pvr_allocation *igt_pvr_allocate (int fd,uint32_t vm_ctx,size_t size,uint64_t flags,uint32_t heap_index); -struct igt_pvr_allocation *igt_pvr_allocate_general (int fd,uint32_t vm_ctx,size_t size); +struct igt_pvr_allocation *igt_pvr_allocate_general (int fd,uint32_t vm_ctx,size_t size, +uint64_t flags);void *igt_pvr_get_cpu_addr (int fd,struct igt_pvr_allocation *alloc);uint64_t igt_pvr_get_gpu_addr (struct igt_pvr_allocation *alloc);size_t igt_pvr_get_size (struct igt_pvr_allocation *alloc);
tests/imagination/pvr_submit_jobs.c +10 -3
@@ -52,7 +52,10 @@ static uint32_t init_compute_cmd_stream(int fd, uint32_t vm_ctx,void *cdm_stream_map;uint32_t stream_length; -struct igt_pvr_allocation *cdm_stream_alloc =igt_pvr_allocate_general (fd, vm_ctx,0x1000 ); +struct igt_pvr_allocation *cdm_stream_alloc = +igt_pvr_allocate_general (fd, vm_ctx,0x1000 , +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE ); cdm_stream_gpu_addr =igt_pvr_get_gpu_addr (cdm_stream_alloc);
@@ -212,14 +215,18 @@ int igt_main() pds_buffer_base[0x20 ] =pds_inst_encode_halt (); vdm_alloc = -igt_pvr_allocate_general (fd, render_vm_ctx_handle, size); +igt_pvr_allocate_general (fd, render_vm_ctx_handle, size, +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE ); vdm_buffer =igt_pvr_get_cpu_addr (fd, vdm_alloc); size =PVR_BO_SIZE ; ppp_alloc = -igt_pvr_allocate_general (fd, render_vm_ctx_handle, size); +igt_pvr_allocate_general (fd, render_vm_ctx_handle, size, +DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS | +DRM_PVR_BO_BYPASS_DEVICE_CACHE ); ppp_buffer_base =igt_pvr_get_cpu_addr (fd, ppp_alloc);
Signature · 1 line
2.43.0
Kamil Konieczny
AppliedRe: [PATCH i-g-t v4 1/2] lib/igt_pvr: Update general heap allocation interface to pass flags
Hi Brajesh,
Quoted 4 lines · Brajesh Gupta
Update
igt_pvr_allocate_general()interface to pass flags for allocation.Reviewed-by Luigi Santivetti <[email protected]>Signed-off-by Brajesh Gupta <[email protected]>
Applied, thank you all!
Regards,
Kamil
PS. when resending after a rebase on new top, please also update base-commit in cover letter, or just do not use it. Stale commit hash could broke my automated workflow...
Quoted 6 lines
--- lib/igt_pvr.c | 36 ++++++++++++++++++++++++------------ lib/igt_pvr.h | 3 ++- tests/imagination/pvr_submit_jobs.c | 13 ++++++++++--- 3 files changed, 36 insertions(+), 16 deletions(-)
[cut]
PATCH v4 2/2 imagination: Skip CPU access flag for a few Render related allocations
In reply to Brajesh GuptaSkip passing CPU access flag for BO's that don't need host access.
--- lib/igt_pvr.c | 7 ------- 1 file changed, 7 deletions(-)
lib/igt_pvr.c +0 -7
@@ -400,7 +400,6 @@ uint32_t igt_pvr_ioctl_create_context(int fd, enum drm_pvr_ctx_type type,igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx_handle,POWERVR_GPU_PAGE_SIZE , -DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |DRM_PVR_BO_BYPASS_DEVICE_CACHE )); create_context_args.static_context_state =to_user_pointer (init_render_context_stream); create_context_args.static_context_state_len =
@@ -818,15 +817,12 @@ static void igt_pvr_create_hwrt_geom_data_args(int fd, uint32_t vm_ctx, { geom_data_args->rtc_dev_addr =igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , -DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |DRM_PVR_BO_BYPASS_DEVICE_CACHE )); geom_data_args->tpc_dev_addr =igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , -DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |DRM_PVR_BO_BYPASS_DEVICE_CACHE )); geom_data_args->vheap_table_dev_addr =igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , -DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |DRM_PVR_BO_BYPASS_DEVICE_CACHE )); geom_data_args->tpc_size =POWERVR_GPU_PAGE_SIZE ; geom_data_args->tpc_stride =0x1 ;
@@ -846,15 +842,12 @@ static void igt_pvr_create_hwrt_rt_data_args(int fd, uint32_t vm_ctx, { rt_data_args->pm_mlist_dev_addr =igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , -DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |DRM_PVR_BO_BYPASS_DEVICE_CACHE )); rt_data_args->macrotile_array_dev_addr =igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , -DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |DRM_PVR_BO_BYPASS_DEVICE_CACHE )); rt_data_args->region_header_dev_addr =igt_pvr_get_gpu_addr (igt_pvr_allocate_general (fd, vm_ctx,POWERVR_GPU_PAGE_SIZE , -DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS |DRM_PVR_BO_BYPASS_DEVICE_CACHE )); }
Signature · 1 line
2.43.0