[Intel-gfx] [RFC] drm/i915: Introduce documentation for register subfields

Damien Lespiau damien.lespiau at intel.com
Fri Jun 19 03:44:25 PDT 2015


On Fri, Jun 19, 2015 at 10:52:15AM +0100, Chris Wilson wrote:
> An interesting point was raised in some recent patches to document the
> various widths of the register subfields. I disagreed with that patch in
> that it transformed illegal values into some random potentially harmful
> valid value (and not transforming an invalid value would end up writing
> bits in other subfields, so equally bad). Most of our register usage is
> with static values so unlikely to be of concern, but for those we can
> document the register subfields and provide compile time checking.

I've thought about things like this in the past as well, we can even
automatically generate all of that from the specs!

I had other per-register metadata in mind, like:
  - is the register is a masked one or not (and then warn if we're
    trying to write it wihtout the _MASKED_*() macros)
  - is the register part of the render context (and then warn if we try
    to write it with a MMIO write).

#define FOO			0x1234
#define FOO_IS_MASKED		1
#define FOO_IS_IN_RENDER_CTX	1

should be enough for the compile-time warns like you do here.

-- 
Damien


More information about the Intel-gfx mailing list