drm: Extract drm_is_current_master
[cascardo/linux.git] / drivers / gpu / drm / vmwgfx / vmwgfx_drv.c
index 6cbb7d4..6064664 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
+ * Copyright © 2009-2016 VMware, Inc., Palo Alto, CA., USA
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
 #define VMW_MIN_INITIAL_WIDTH 800
 #define VMW_MIN_INITIAL_HEIGHT 600
 
+#ifndef VMWGFX_GIT_VERSION
+#define VMWGFX_GIT_VERSION "Unknown"
+#endif
+
+#define VMWGFX_REPO "In Tree"
+
 
 /**
  * Fully encoded drm commands. Might move to vmw_drm.h
@@ -326,7 +332,7 @@ static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv)
        if (unlikely(ret != 0))
                return ret;
 
-       ret = ttm_bo_reserve(&vbo->base, false, true, false, NULL);
+       ret = ttm_bo_reserve(&vbo->base, false, true, NULL);
        BUG_ON(ret != 0);
        vmw_bo_pin_reserved(vbo, true);
 
@@ -613,6 +619,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
        uint32_t svga_id;
        enum vmw_res_type i;
        bool refuse_dma = false;
+       char host_log[100] = {0};
 
        dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
        if (unlikely(dev_priv == NULL)) {
@@ -628,6 +635,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
        mutex_init(&dev_priv->cmdbuf_mutex);
        mutex_init(&dev_priv->release_mutex);
        mutex_init(&dev_priv->binding_mutex);
+       mutex_init(&dev_priv->global_kms_state_mutex);
        rwlock_init(&dev_priv->resource_lock);
        ttm_lock_init(&dev_priv->reservation_sem);
        spin_lock_init(&dev_priv->hw_lock);
@@ -873,6 +881,16 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 
        DRM_INFO("DX: %s\n", dev_priv->has_dx ? "yes." : "no.");
 
+       snprintf(host_log, sizeof(host_log), "vmwgfx: %s-%s",
+               VMWGFX_REPO, VMWGFX_GIT_VERSION);
+       vmw_host_log(host_log);
+
+       memset(host_log, 0, sizeof(host_log));
+       snprintf(host_log, sizeof(host_log), "vmwgfx: Module Version: %d.%d.%d",
+               VMWGFX_DRIVER_MAJOR, VMWGFX_DRIVER_MINOR,
+               VMWGFX_DRIVER_PATCHLEVEL);
+       vmw_host_log(host_log);
+
        if (dev_priv->enable_fb) {
                vmw_fifo_resource_inc(dev_priv);
                vmw_svga_enable(dev_priv);
@@ -1031,7 +1049,7 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev,
        if (unlikely(ret != 0))
                return ERR_PTR(-ERESTARTSYS);
 
-       if (file_priv->is_master) {
+       if (drm_is_current_master(file_priv)) {
                mutex_unlock(&dev->master_mutex);
                return NULL;
        }
@@ -1210,8 +1228,7 @@ static int vmw_master_set(struct drm_device *dev,
 }
 
 static void vmw_master_drop(struct drm_device *dev,
-                           struct drm_file *file_priv,
-                           bool from_release)
+                           struct drm_file *file_priv)
 {
        struct vmw_private *dev_priv = vmw_priv(dev);
        struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv);
@@ -1530,10 +1547,8 @@ static int __init vmwgfx_init(void)
 {
        int ret;
 
-#ifdef CONFIG_VGA_CONSOLE
        if (vgacon_text_force())
                return -EINVAL;
-#endif
 
        ret = drm_pci_init(&driver, &vmw_pci_driver);
        if (ret)