[Intel-gfx] [RFC] Subclassing struct drm_device

Damien Lespiau damien.lespiau at intel.com
Wed Jan 8 19:31:47 CET 2014


I was reminded on Monday that we'd like to be able to subclass struct
drm_device so we don't have to always juggle between a pointer to a struct
drm_device and its drv_private field to access everything we care about.

It'd be nicer for those two pointers to have the same value to avoid a few
extra instructions pretty everywhere.

Turns out, there's a cheap way to go towards that goal, just make DRM core
allocate enough space for drivers that want to subclass struct drm_device and
have a transition path where dev_private points to the start of the structure.

I've converted i915 to do just that, seems to still boot. Of course, a number
of nice refactoring are possible once dev == dev_priv, but that'd be for follow
up patches on top.

Thoughts?

-- 
Damien




More information about the Intel-gfx mailing list