MGS-2730 gpu-viv : Set Unique for Vivante DRM Driver
authorPrabhu Sundararaj <prabhu.sundararaj@nxp.com>
Fri, 10 Mar 2017 23:10:29 +0000 (17:10 -0600)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:10:53 +0000 (15:10 -0500)
1. unique need to be set to get proper busid.
   Vivante driver is very simple and does not use drm_dev_alloc
   which in turn calls drm_dev_set_unique.
   Use set_busid to set the unique.

   https://patchwork.kernel.org/patch/9182749/

2. driver_features = DRIVER_LEGACY added to do mmap of SHM.
   https://patchwork.kernel.org/patch/8694561/

fix the problem that X11 cannot work with 4.9 kernel upgrade

Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
drivers/gpu/drm/vivante/vivante_drv.c

index c251c5b..a19d212 100644 (file)
 static char platformdevicename[] = "Vivante GCCore";
 static struct platform_device *pplatformdev;
 
+
+int viv_set_busid(struct drm_device *dev, struct drm_master *master)
+{
+       int id;
+
+        id = dev->platformdev->id;
+        if (id < 0)
+                id = 0;
+
+        master->unique = kasprintf(GFP_KERNEL, "platform:%s:%02d",
+                                                dev->platformdev->name, id);
+        if (!master->unique)
+                return -ENOMEM;
+
+        master->unique_len = strlen(master->unique);
+        return 0;
+}
+
 static const struct file_operations viv_driver_fops = {
        .owner = THIS_MODULE,
        .open = drm_open,
@@ -71,12 +89,14 @@ static const struct file_operations viv_driver_fops = {
 
 static struct drm_driver driver = {
        .fops = &viv_driver_fops,
+       .set_busid = viv_set_busid,
        .name = DRIVER_NAME,
        .desc = DRIVER_DESC,
        .date = DRIVER_DATE,
        .major = DRIVER_MAJOR,
        .minor = DRIVER_MINOR,
        .patchlevel = DRIVER_PATCHLEVEL,
+       .driver_features = DRIVER_LEGACY,
 };
 
 static int __init vivante_init(void)