|
@@ -174,6 +174,8 @@ void drm_master_put(struct drm_master **master)
|
|
|
int drm_setmaster_ioctl(struct drm_device *dev, void *data,
|
|
|
struct drm_file *file_priv)
|
|
|
{
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
if (file_priv->is_master)
|
|
|
return 0;
|
|
|
|
|
@@ -188,6 +190,13 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
|
|
|
mutex_lock(&dev->struct_mutex);
|
|
|
file_priv->minor->master = drm_master_get(file_priv->master);
|
|
|
file_priv->is_master = 1;
|
|
|
+ if (dev->driver->master_set) {
|
|
|
+ ret = dev->driver->master_set(dev, file_priv, false);
|
|
|
+ if (unlikely(ret != 0)) {
|
|
|
+ file_priv->is_master = 0;
|
|
|
+ drm_master_put(&file_priv->minor->master);
|
|
|
+ }
|
|
|
+ }
|
|
|
mutex_unlock(&dev->struct_mutex);
|
|
|
}
|
|
|
|
|
@@ -204,6 +213,8 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
|
|
|
return -EINVAL;
|
|
|
|
|
|
mutex_lock(&dev->struct_mutex);
|
|
|
+ if (dev->driver->master_drop)
|
|
|
+ dev->driver->master_drop(dev, file_priv, false);
|
|
|
drm_master_put(&file_priv->minor->master);
|
|
|
file_priv->is_master = 0;
|
|
|
mutex_unlock(&dev->struct_mutex);
|