Two different sets of flag bits are stored in the 'flags' member of a 'struct drm_i915_gem_exec_object2', and they're defined in two different source files, increasing the risk of an accidental clash. Some flags in this field are supplied by the user; these are defined in i915_drm.h, and they start from the LSB and work up. Other flags are defined in i915_gem_execbuffer, for internal use within that file only; they start from the MSB and work down. So here we add a compile-time check that the two sets of flags do not overlap, which would cause all sorts of confusion.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -698,12 +698,13 @@ struct drm_i915_gem_exec_object2 { · 697 unmodified lines | |||
| 698 | */ | 698 | */ |
| 699 | __u64 offset; | 699 | __u64 offset; |
| 700 | 700 | ||
| 701 | #define EXEC_OBJECT_NEEDS_FENCE (1<<0) | 701 | #define EXEC_OBJECT_NEEDS_FENCE (1<<0) |
| 702 | #define EXEC_OBJECT_NEEDS_GTT (1<<1) | 702 | #define EXEC_OBJECT_NEEDS_GTT (1<<1) |
| 703 | #define EXEC_OBJECT_WRITE (1<<2) | 703 | #define EXEC_OBJECT_WRITE (1<<2) |
| 704 | #define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) | 704 | #define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) |
| 705 | #define EXEC_OBJECT_PINNED (1<<4) | 705 | #define EXEC_OBJECT_PINNED (1<<4) |
| 706 | #define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_PINNED<<1) | 706 | /* All remaining bits are MBZ and RESERVED FOR FUTURE USE */ |
| 707 | #define __EXEC_OBJECT_UNKNOWN_FLAGS (-(EXEC_OBJECT_PINNED<<1)) | ||
| 707 | __u64 flags; | 708 | __u64 flags; |
| 708 | 709 | ||
| 709 | __u64 rsvd1; | 710 | __u64 rsvd1; |