From mboxrd@z Thu Jan 1 00:00:00 1970 From: Damien Lespiau Subject: [RFC] Subclassing struct drm_device Date: Wed, 8 Jan 2014 18:31:47 +0000 Message-ID: <1389205912-16632-1-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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