Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/panfrost: Add an ioctl to query BO flags

This is useful when importing BOs, so we can know about cacheability
and flush the caches when needed.

v2:
- New commit

v3:
- Add Steve's R-b

v4:
- No changes

v5:
- No changes

v6:
- No changes

v7:
- No changes

v8:
- No changes

Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://patch.msgid.link/20251208100841.730527-12-boris.brezillon@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>

+52
+33
drivers/gpu/drm/panfrost/panfrost_drv.c
··· 630 630 return ret; 631 631 } 632 632 633 + static int panfrost_ioctl_query_bo_info(struct drm_device *dev, void *data, 634 + struct drm_file *file_priv) 635 + { 636 + struct drm_panfrost_query_bo_info *args = data; 637 + struct drm_gem_object *gem_obj; 638 + struct panfrost_gem_object *bo; 639 + 640 + gem_obj = drm_gem_object_lookup(file_priv, args->handle); 641 + if (!gem_obj) { 642 + DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); 643 + return -ENOENT; 644 + } 645 + 646 + bo = to_panfrost_bo(gem_obj); 647 + args->pad = 0; 648 + args->create_flags = 0; 649 + args->extra_flags = 0; 650 + 651 + if (drm_gem_is_imported(gem_obj)) { 652 + args->extra_flags |= DRM_PANFROST_BO_IS_IMPORTED; 653 + } else { 654 + if (bo->noexec) 655 + args->create_flags |= PANFROST_BO_NOEXEC; 656 + 657 + if (bo->is_heap) 658 + args->create_flags |= PANFROST_BO_HEAP; 659 + } 660 + 661 + drm_gem_object_put(gem_obj); 662 + return 0; 663 + } 664 + 633 665 int panfrost_unstable_ioctl_check(void) 634 666 { 635 667 if (!unstable_ioctls) ··· 732 700 PANFROST_IOCTL(JM_CTX_CREATE, jm_ctx_create, DRM_RENDER_ALLOW), 733 701 PANFROST_IOCTL(JM_CTX_DESTROY, jm_ctx_destroy, DRM_RENDER_ALLOW), 734 702 PANFROST_IOCTL(SYNC_BO, sync_bo, DRM_RENDER_ALLOW), 703 + PANFROST_IOCTL(QUERY_BO_INFO, query_bo_info, DRM_RENDER_ALLOW), 735 704 }; 736 705 737 706 static void panfrost_gpu_show_fdinfo(struct panfrost_device *pfdev,
+19
include/uapi/drm/panfrost_drm.h
··· 25 25 #define DRM_PANFROST_JM_CTX_CREATE 0x0a 26 26 #define DRM_PANFROST_JM_CTX_DESTROY 0x0b 27 27 #define DRM_PANFROST_SYNC_BO 0x0c 28 + #define DRM_PANFROST_QUERY_BO_INFO 0x0d 28 29 29 30 #define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) 30 31 #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) ··· 38 37 #define DRM_IOCTL_PANFROST_JM_CTX_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_JM_CTX_CREATE, struct drm_panfrost_jm_ctx_create) 39 38 #define DRM_IOCTL_PANFROST_JM_CTX_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_JM_CTX_DESTROY, struct drm_panfrost_jm_ctx_destroy) 40 39 #define DRM_IOCTL_PANFROST_SYNC_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SYNC_BO, struct drm_panfrost_sync_bo) 40 + #define DRM_IOCTL_PANFROST_QUERY_BO_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_QUERY_BO_INFO, struct drm_panfrost_query_bo_info) 41 41 42 42 /* 43 43 * Unstable ioctl(s): only exposed when the unsafe unstable_ioctls module ··· 352 350 /** Number of BO sync ops */ 353 351 __u32 op_count; 354 352 353 + __u32 pad; 354 + }; 355 + 356 + /** BO comes from a different subsystem. */ 357 + #define DRM_PANFROST_BO_IS_IMPORTED (1 << 0) 358 + 359 + struct drm_panfrost_query_bo_info { 360 + /** Handle of the object being queried. */ 361 + __u32 handle; 362 + 363 + /** Extra flags that are not coming from the BO_CREATE ioctl(). */ 364 + __u32 extra_flags; 365 + 366 + /** Flags passed at creation time. */ 367 + __u32 create_flags; 368 + 369 + /** Will be zero on return. */ 355 370 __u32 pad; 356 371 }; 357 372