mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-07 07:05:20 +00:00
drm/i915: Fix gtt_view asserts
gcc is too smart for us and doesn't evaluate BUILD_BUG_ON()s in unused static inlines. Collect them up in one static inline and actually call it to make sure gcc sees it. Cc: Chris Wilson <chris@chris-wilson.co.uk> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180828133723.18505-1-ville.syrjala@linux.intel.com Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
1895759ee9
commit
ed11e41584
2 changed files with 6 additions and 11 deletions
|
@ -167,29 +167,22 @@ struct intel_rotation_info {
|
||||||
} plane[2];
|
} plane[2];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
static inline void assert_intel_rotation_info_is_packed(void)
|
|
||||||
{
|
|
||||||
BUILD_BUG_ON(sizeof(struct intel_rotation_info) != 8*sizeof(unsigned int));
|
|
||||||
}
|
|
||||||
|
|
||||||
struct intel_partial_info {
|
struct intel_partial_info {
|
||||||
u64 offset;
|
u64 offset;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
static inline void assert_intel_partial_info_is_packed(void)
|
|
||||||
{
|
|
||||||
BUILD_BUG_ON(sizeof(struct intel_partial_info) != sizeof(u64) + sizeof(unsigned int));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum i915_ggtt_view_type {
|
enum i915_ggtt_view_type {
|
||||||
I915_GGTT_VIEW_NORMAL = 0,
|
I915_GGTT_VIEW_NORMAL = 0,
|
||||||
I915_GGTT_VIEW_ROTATED = sizeof(struct intel_rotation_info),
|
I915_GGTT_VIEW_ROTATED = sizeof(struct intel_rotation_info),
|
||||||
I915_GGTT_VIEW_PARTIAL = sizeof(struct intel_partial_info),
|
I915_GGTT_VIEW_PARTIAL = sizeof(struct intel_partial_info),
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void assert_i915_ggtt_view_type_is_unique(void)
|
static inline void assert_i915_gem_gtt_types(void)
|
||||||
{
|
{
|
||||||
|
BUILD_BUG_ON(sizeof(struct intel_rotation_info) != 8*sizeof(unsigned int));
|
||||||
|
BUILD_BUG_ON(sizeof(struct intel_partial_info) != sizeof(u64) + sizeof(unsigned int));
|
||||||
|
|
||||||
/* As we encode the size of each branch inside the union into its type,
|
/* As we encode the size of each branch inside the union into its type,
|
||||||
* we have to be careful that each branch has a unique size.
|
* we have to be careful that each branch has a unique size.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -251,6 +251,8 @@ i915_vma_compare(struct i915_vma *vma,
|
||||||
if (cmp)
|
if (cmp)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
||||||
|
assert_i915_gem_gtt_types();
|
||||||
|
|
||||||
/* ggtt_view.type also encodes its size so that we both distinguish
|
/* ggtt_view.type also encodes its size so that we both distinguish
|
||||||
* different views using it as a "type" and also use a compact (no
|
* different views using it as a "type" and also use a compact (no
|
||||||
* accessing of uninitialised padding bytes) memcmp without storing
|
* accessing of uninitialised padding bytes) memcmp without storing
|
||||||
|
|
Loading…
Add table
Reference in a new issue