[RFC] Subclassing struct drm_device

Damien Lespiau damien.lespiau at intel.com
Wed Jan 8 10:31:47 PST 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 dri-devel mailing list