Commit 46d8f405 authored by Eric Anholt's avatar Eric Anholt

drm: Consider drivers setting DRIVER_ATOMIC as atomic.

Drivers such as vc4 don't initialize mode_config.funcs until later in
initialization, but we know they're atomic since they've got the flag
set.  This avoids oopsing on dereferencing funcs in the new atomic
methods sanity checks.

I moved the atomic check function down below the core flag check, to
avoid needing a prototype.
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Fixes: ba1f665f ("drm: Add checks for atomic_[duplicate/destroy]_state with atomic drivers")
Link: https://patchwork.freedesktop.org/patch/msgid/20180621195428.17447-1-eric@anholt.netReviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 4adc1837
...@@ -97,6 +97,16 @@ struct pci_controller; ...@@ -97,6 +97,16 @@ struct pci_controller;
#define DRM_IF_VERSION(maj, min) (maj << 16 | min) #define DRM_IF_VERSION(maj, min) (maj << 16 | min)
#define DRM_SWITCH_POWER_ON 0
#define DRM_SWITCH_POWER_OFF 1
#define DRM_SWITCH_POWER_CHANGING 2
#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
static inline bool drm_core_check_feature(struct drm_device *dev, int feature)
{
return dev->driver->driver_features & feature;
}
/** /**
* drm_drv_uses_atomic_modeset - check if the driver implements * drm_drv_uses_atomic_modeset - check if the driver implements
* atomic_commit() * atomic_commit()
...@@ -107,17 +117,8 @@ struct pci_controller; ...@@ -107,17 +117,8 @@ struct pci_controller;
*/ */
static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev) static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
{ {
return dev->mode_config.funcs->atomic_commit != NULL; return drm_core_check_feature(dev, DRIVER_ATOMIC) ||
} dev->mode_config.funcs->atomic_commit != NULL;
#define DRM_SWITCH_POWER_ON 0
#define DRM_SWITCH_POWER_OFF 1
#define DRM_SWITCH_POWER_CHANGING 2
#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
static inline bool drm_core_check_feature(struct drm_device *dev, int feature)
{
return dev->driver->driver_features & feature;
} }
/* returns true if currently okay to sleep */ /* returns true if currently okay to sleep */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment