History

drm/i915: compile-time consistency check on __EXEC_OBJECT flags

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.

Dave Gordon committed 10 years ago

Commit 9e2793f1 parent a8784872 files · +14 −9Browse files

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

Unified · Split

include/uapi/drm/i915_drm.h+6−5
@@ -698,12 +698,13 @@ struct drm_i915_gem_exec_object2 { · 697 unmodified lines
698698 */
699699 __u64 offset;
700700
701−#define EXEC_OBJECT_NEEDS_FENCE (1<<0)
702−#define EXEC_OBJECT_NEEDS_GTT (1<<1)
703−#define EXEC_OBJECT_WRITE (1<<2)
701+#define EXEC_OBJECT_NEEDS_FENCE (1<<0)
702+#define EXEC_OBJECT_NEEDS_GTT (1<<1)
703+#define EXEC_OBJECT_WRITE (1<<2)
704704 #define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3)
705−#define EXEC_OBJECT_PINNED (1<<4)
706−#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_PINNED<<1)
705+#define EXEC_OBJECT_PINNED (1<<4)
706+/* All remaining bits are MBZ and RESERVED FOR FUTURE USE */
707+#define __EXEC_OBJECT_UNKNOWN_FLAGS (-(EXEC_OBJECT_PINNED<<1))
707708 __u64 flags;
708709
709710 __u64 rsvd1;

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