]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: check for kms in dri1 ioctls
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 24 Apr 2012 06:29:42 +0000 (08:29 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 3 May 2012 09:18:14 +0000 (11:18 +0200)
Calling these when gem assumes full control of the hw won't end
in anything else than tears. So be a bit more paranoid here.

Just serves as documentation.

v2: Bail out with ENODEV as suggested by Chris Wilson.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_irq.c

index d49bd82e24e926379b6d8c0f512f4f8236bfe071..e2983a9a1255b01cb4bf8f0ad578fac7c89c1d6f 100644 (file)
@@ -239,6 +239,9 @@ static int i915_dma_init(struct drm_device *dev, void *data,
        drm_i915_init_t *init = data;
        int retcode = 0;
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        switch (init->func) {
        case I915_INIT_DMA:
                retcode = i915_initialize(dev, init);
@@ -581,6 +584,9 @@ static int i915_flush_ioctl(struct drm_device *dev, void *data,
 {
        int ret;
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
 
        mutex_lock(&dev->struct_mutex);
@@ -601,6 +607,9 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,
        int ret;
        struct drm_clip_rect *cliprects = NULL;
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        if (!dev_priv->allow_batchbuffer) {
                DRM_ERROR("Batchbuffer ioctl disabled\n");
                return -EINVAL;
@@ -658,6 +667,9 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
        DRM_DEBUG_DRIVER("i915 cmdbuffer, buf %p sz %d cliprects %d\n",
                        cmdbuf->buf, cmdbuf->sz, cmdbuf->num_cliprects);
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
 
        if (cmdbuf->num_cliprects < 0)
@@ -714,6 +726,9 @@ static int i915_flip_bufs(struct drm_device *dev, void *data,
 {
        int ret;
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        DRM_DEBUG_DRIVER("%s\n", __func__);
 
        RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
@@ -850,6 +865,9 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
        drm_i915_hws_addr_t *hws = data;
        struct intel_ring_buffer *ring = LP_RING(dev_priv);
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        if (!I915_NEED_GFX_HWS(dev))
                return -EINVAL;
 
index 24e1dd25257558fd504042788bc3ff629a241bb5..0211263aad7d4e1ecd6e3c38ff7eb07c8b415595 100644 (file)
@@ -1612,6 +1612,9 @@ int i915_irq_emit(struct drm_device *dev, void *data,
        drm_i915_irq_emit_t *emit = data;
        int result;
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        if (!dev_priv || !LP_RING(dev_priv)->virtual_start) {
                DRM_ERROR("called with no initialization\n");
                return -EINVAL;
@@ -1639,6 +1642,9 @@ int i915_irq_wait(struct drm_device *dev, void *data,
        drm_i915_private_t *dev_priv = dev->dev_private;
        drm_i915_irq_wait_t *irqwait = data;
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        if (!dev_priv) {
                DRM_ERROR("called with no initialization\n");
                return -EINVAL;
@@ -1801,6 +1807,9 @@ int i915_vblank_pipe_set(struct drm_device *dev, void *data,
 {
        drm_i915_private_t *dev_priv = dev->dev_private;
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        if (!dev_priv) {
                DRM_ERROR("called with no initialization\n");
                return -EINVAL;
@@ -1815,6 +1824,9 @@ int i915_vblank_pipe_get(struct drm_device *dev, void *data,
        drm_i915_private_t *dev_priv = dev->dev_private;
        drm_i915_vblank_pipe_t *pipe = data;
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return -ENODEV;
+
        if (!dev_priv) {
                DRM_ERROR("called with no initialization\n");
                return -EINVAL;