On Thu, Sep 13, 2018 at 04:52:34PM +0200, Michel Dänzer wrote: > On 2018-09-13 4:29 p.m., Ville Syrjälä wrote: > > On Thu, Sep 13, 2018 at 03:50:01PM +0200, Daniel Vetter wrote: > >> On Thu, Sep 13, 2018 at 04:16:21PM +0300, Ville Syrjala wrote: > >>> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > >>> > >>> We wish to control certain driver_features flags on a per-device basis > >>> while still sharing a single drm_driver instance across all the > >>> devices. To that end introduce device.driver_features. By default > >>> it will be set to ~0 to not impose any limits beyond > >>> driver.driver_features. Drivers can then clear specific flags > >>> in the per-device bitmask to limit the capabilities of the device. > >>> > >>> An alternative approach would be to copy the driver_features from > >>> the driver into the device in drm_dev_init(), however that would > >>> require verifying that no driver is currently changing > >>> driver.driver_features after drm_dev_init(). Hence the ~0 apporach > >>> was easier. > >>> > >>> Ideally we'd also make drm_driver const but there is plenty of code > >>> left that wants to mutate it (eg. various vfunc assignments). We'll > >>> need to fix all that up before we can make it const. > >>> > >>> And while at it fix up the type of the feature flag passed to > >>> drm_core_check_feature(). > >>> > >>> v2: Streamline the && vs. & (Chris) > >>> s/int/u32/ in drm_core_check_feature() args > >>> > >>> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > >>> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > >> > >> git grep DRIVER_ATOMIC -- drivers/gpu/drm/nouveau has a 2nd supporting > >> case for this. Exactly same problem as we have here. Would be good to also > >> convert that one, for a bit of OCD. > > > > Thanks for pointing it out. I'll cook it up and send separately after > > this lands. > > I don't suppose you'd like to do amdgpu as well, while you're at it? :) Sure. I'll take a gander at it as well. -- Ville Syrjälä Intel _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel