History

drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl

This ioctl will allow us to purge inactive userspace buffers when the system is running out of contiguous memory. For now, the purge logic is rather dumb in that it does not try to release only the amount of BO needed to meet the last CMA alloc request but instead purges all objects placed in the purgeable pool as soon as we experience a CMA allocation failure. Note that the in-kernel BO cache is always purged before the purgeable cache because those objects are known to be unused while objects marked as purgeable by a userspace application/library might have to be restored when they are marked back as unpurgeable, which can be expensive.

Boris Brezillon committed 9 years ago

Commit b9f19251 parent 06e733e6 files · +507 −15Browse files

Showing the changes to include/uapi (1 of 6 files). Show all

Unified · Split

include/uapi/drm/vc4_drm.h+19−0
@@ -41,6 +41,7 @@ extern "C" { · 40 unmodified lines
41#define DRM_VC4_SET_TILING 0x0841#define DRM_VC4_SET_TILING 0x08
42#define DRM_VC4_GET_TILING 0x0942#define DRM_VC4_GET_TILING 0x09
43#define DRM_VC4_LABEL_BO 0x0a43#define DRM_VC4_LABEL_BO 0x0a
44#define DRM_VC4_GEM_MADVISE 0x0b
44 45
45#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl)46#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl)
46#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno)47#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno)
@@ -53,6 +54,7 @@ extern "C" { · 6 unmodified lines
53#define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling)54#define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling)
54#define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling)55#define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling)
55#define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo)56#define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo)
57#define DRM_IOCTL_VC4_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise)
56 58
57struct drm_vc4_submit_rcl_surface {59struct drm_vc4_submit_rcl_surface {
58 __u32 hindex; /* Handle index, or ~0 if not present. */60 __u32 hindex; /* Handle index, or ~0 if not present. */
@@ -305,6 +307,7 @@ struct drm_vc4_get_hang_state { · 246 unmodified lines
305#define DRM_VC4_PARAM_SUPPORTS_ETC1 4307#define DRM_VC4_PARAM_SUPPORTS_ETC1 4
306#define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5308#define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5
307#define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6309#define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6
310#define DRM_VC4_PARAM_SUPPORTS_MADVISE 7
308 311
309struct drm_vc4_get_param {312struct drm_vc4_get_param {
310 __u32 param;313 __u32 param;
@@ -333,6 +336,22 @@ struct drm_vc4_label_bo { · 22 unmodified lines
333 __u64 name;336 __u64 name;
334};337};
335 338
339/*
340 * States prefixed with '__' are internal states and cannot be passed to the
341 * DRM_IOCTL_VC4_GEM_MADVISE ioctl.
342 */
343#define VC4_MADV_WILLNEED 0
344#define VC4_MADV_DONTNEED 1
345#define __VC4_MADV_PURGED 2
346#define __VC4_MADV_NOTSUPP 3
347
348struct drm_vc4_gem_madvise {
349 __u32 handle;
350 __u32 madv;
351 __u32 retained;
352 __u32 pad;
353};
354
336#if defined(__cplusplus)355#if defined(__cplusplus)
337}356}
338#endif357#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t