MLK-16291-2: Revert "MLK-15321 drm,imx: Add DRM support for dpu-blit"
authorMeng Mingming <mingming.meng@nxp.com>
Tue, 29 Aug 2017 09:47:07 +0000 (17:47 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:38:20 +0000 (15:38 -0500)
This reverts commit b4c70b278a5e ("MLK-15321 drm,imx: Add DRM support
for dpu-blit").

It's no need to invent register/unregister solution to
add dpu bliteng ioctl. It's complex and overengineering.
And currently we will choose a simple way as
drm->driver->ioctls = imx_drm_dpu_ioctls.

Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
drivers/gpu/drm/imx/dpu/Makefile
drivers/gpu/drm/imx/dpu/dpu-blit.c [deleted file]
drivers/gpu/drm/imx/imx-drm-core.c
drivers/gpu/drm/imx/imx-drm.h
include/uapi/drm/imx_drm.h [deleted file]

index c09e487..f29915f 100644 (file)
@@ -2,6 +2,3 @@ ccflags-y += -Idrivers/gpu/drm/imx
 
 imx-dpu-crtc-objs := dpu-crtc.o dpu-plane.o dpu-kms.o
 obj-$(CONFIG_DRM_IMX_DPU) += imx-dpu-crtc.o
-
-imx-dpu-render-objs := dpu-blit.o
-obj-$(CONFIG_DRM_IMX_DPU) += imx-dpu-render.o
diff --git a/drivers/gpu/drm/imx/dpu/dpu-blit.c b/drivers/gpu/drm/imx/dpu/dpu-blit.c
deleted file mode 100644 (file)
index 6fed8f4..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright 2017 NXP
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * for more details.
- */
-
-#include <drm/drmP.h>
-#include <drm/imx_drm.h>
-#include <linux/component.h>
-#include <linux/device.h>
-#include <linux/errno.h>
-#include <linux/export.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <video/dpu.h>
-
-#include "imx-drm.h"
-
-struct imx_drm_dpu_bliteng {
-       struct dpu_bliteng *dpu_be;
-       struct list_head list;
-};
-
-static DEFINE_MUTEX(imx_drm_dpu_bliteng_lock);
-static LIST_HEAD(imx_drm_dpu_bliteng_list);
-
-static int imx_dpu_num;
-
-static struct imx_drm_dpu_bliteng *imx_drm_dpu_bliteng_find_by_of_id(s32 id)
-{
-       struct imx_drm_dpu_bliteng *bliteng;
-
-       mutex_lock(&imx_drm_dpu_bliteng_lock);
-
-       list_for_each_entry(bliteng, &imx_drm_dpu_bliteng_list, list) {
-               if (id == dpu_bliteng_get_id(bliteng->dpu_be)) {
-                       mutex_unlock(&imx_drm_dpu_bliteng_lock);
-                       return bliteng;
-               }
-       }
-
-       mutex_unlock(&imx_drm_dpu_bliteng_lock);
-
-       return NULL;
-}
-
-static int imx_drm_dpu_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data,
-               struct drm_file *file)
-{
-       struct drm_imx_dpu_set_cmdlist *req;
-       struct imx_drm_dpu_bliteng *bliteng;
-       struct dpu_bliteng *dpu_be;
-       u32 cmd_nr, *cmd, *cmd_list;
-       void *user_data;
-       s32 id = 0;
-       int ret;
-
-       req = data;
-       user_data = (void *)(unsigned long)req->user_data;
-       if (copy_from_user(&id, (void __user *)user_data,
-               sizeof(id))) {
-               return -EFAULT;
-       }
-
-       if (id != 0 && id != 1)
-               return -EINVAL;
-
-       bliteng = imx_drm_dpu_bliteng_find_by_of_id(id);
-       if (!bliteng) {
-               DRM_ERROR("Failed to get dpu_bliteng\n");
-               return -ENODEV;
-       }
-
-       dpu_be = bliteng->dpu_be;
-
-retry:
-       ret = dpu_be_get(dpu_be);
-       if (ret == -EBUSY)
-               goto retry;
-
-       cmd_nr = req->cmd_nr;
-       cmd = (u32 *)(unsigned long)req->cmd;
-       cmd_list = dpu_bliteng_get_cmd_list(dpu_be);
-
-       if (copy_from_user(cmd_list, (void __user *)cmd,
-                       sizeof(*cmd) * cmd_nr)) {
-               ret = -EFAULT;
-               goto err;
-       }
-
-       ret = dpu_be_blit(dpu_be, cmd_list, cmd_nr);
-
-err:
-       dpu_be_put(dpu_be);
-
-       return ret;
-}
-
-static int imx_drm_dpu_wait_ioctl(struct drm_device *drm_dev, void *data,
-               struct drm_file *file)
-{
-       struct drm_imx_dpu_wait *wait;
-       struct imx_drm_dpu_bliteng *bliteng;
-       struct dpu_bliteng *dpu_be;
-       void *user_data;
-       s32 id = 0;
-       int ret;
-
-       wait = data;
-       user_data = (void *)(unsigned long)wait->user_data;
-       if (copy_from_user(&id, (void __user *)user_data,
-               sizeof(id))) {
-               return -EFAULT;
-       }
-
-       if (id != 0 && id != 1)
-               return -EINVAL;
-
-       bliteng = imx_drm_dpu_bliteng_find_by_of_id(id);
-       if (!bliteng) {
-               DRM_ERROR("Failed to get dpu_bliteng\n");
-               return -ENODEV;
-       }
-
-       dpu_be = bliteng->dpu_be;
-
-retry:
-       ret = dpu_be_get(dpu_be);
-       if (ret == -EBUSY)
-               goto retry;
-
-       dpu_be_wait(dpu_be);
-
-       dpu_be_put(dpu_be);
-
-       return ret;
-}
-
-static int imx_drm_dpu_get_param_ioctl(struct drm_device *drm_dev, void *data,
-               struct drm_file *file)
-{
-       enum drm_imx_dpu_param *param = data;
-       int ret;
-
-       switch (*param) {
-       case (DRM_IMX_MAX_DPUS):
-               ret = imx_dpu_num;
-               break;
-       default:
-               ret = -EINVAL;
-               DRM_ERROR("Unknown param![%d]\n", *param);
-               break;
-       }
-
-       return ret;
-}
-
-static struct drm_ioctl_desc imx_drm_ioctls[] = {
-       DRM_IOCTL_DEF_DRV(IMX_DPU_SET_CMDLIST, imx_drm_dpu_set_cmdlist_ioctl, DRM_RENDER_ALLOW),
-       DRM_IOCTL_DEF_DRV(IMX_DPU_WAIT, imx_drm_dpu_wait_ioctl, DRM_RENDER_ALLOW),
-       DRM_IOCTL_DEF_DRV(IMX_DPU_GET_PARAM, imx_drm_dpu_get_param_ioctl, DRM_RENDER_ALLOW),
-};
-
-
-static int dpu_bliteng_bind(struct device *dev, struct device *master,
-                               void *data)
-{
-       struct imx_drm_dpu_bliteng *bliteng;
-       struct dpu_bliteng *dpu_bliteng = NULL;
-       int ret, i;
-
-       bliteng = devm_kzalloc(dev, sizeof(*bliteng), GFP_KERNEL);
-       if (!bliteng)
-               return -ENOMEM;
-
-       INIT_LIST_HEAD(&bliteng->list);
-
-       ret = dpu_bliteng_get_empty_instance(&dpu_bliteng, dev);
-       if (ret)
-               return ret;
-
-       dpu_bliteng_set_id(dpu_bliteng, imx_dpu_num);
-       dpu_bliteng_set_dev(dpu_bliteng, dev);
-
-       ret = dpu_bliteng_init(dpu_bliteng);
-       if (ret)
-               return ret;
-
-       mutex_lock(&imx_drm_dpu_bliteng_lock);
-       bliteng->dpu_be = dpu_bliteng;
-       list_add_tail(&bliteng->list, &imx_drm_dpu_bliteng_list);
-       mutex_unlock(&imx_drm_dpu_bliteng_lock);
-
-       dev_set_drvdata(dev, dpu_bliteng);
-
-       if (imx_dpu_num == 0) {
-               for (i = 0; i < ARRAY_SIZE(imx_drm_ioctls); i++) {
-                       imx_drm_register_ioctl(&imx_drm_ioctls[i]);
-               }
-       }
-       imx_dpu_num++;
-
-       return 0;
-}
-
-static void dpu_bliteng_unbind(struct device *dev, struct device *master,
-                               void *data)
-{
-       struct imx_drm_dpu_bliteng *bliteng;
-       struct dpu_bliteng *dpu_bliteng = dev_get_drvdata(dev);
-       s32 id = dpu_bliteng_get_id(dpu_bliteng);
-       int i;
-
-       bliteng = imx_drm_dpu_bliteng_find_by_of_id(id);
-       list_del(&bliteng->list);
-       devm_kfree(dev, bliteng);
-
-       dpu_bliteng_fini(dpu_bliteng);
-       devm_kfree(dev, dpu_bliteng);
-
-       imx_dpu_num--;
-
-       if (imx_dpu_num == 0) {
-               for (i = 0; i < ARRAY_SIZE(imx_drm_ioctls); i++) {
-                       imx_drm_unregister_ioctl(&imx_drm_ioctls[i]);
-               }
-       }
-}
-
-static const struct component_ops dpu_bliteng_ops = {
-       .bind = dpu_bliteng_bind,
-       .unbind = dpu_bliteng_unbind,
-};
-
-static int dpu_bliteng_probe(struct platform_device *pdev)
-{
-       struct device *dev = &pdev->dev;
-
-       if (!dev->platform_data)
-               return -EINVAL;
-
-       return component_add(dev, &dpu_bliteng_ops);
-}
-
-static int dpu_bliteng_remove(struct platform_device *pdev)
-{
-       component_del(&pdev->dev, &dpu_bliteng_ops);
-       return 0;
-}
-
-struct platform_driver dpu_bliteng_driver = {
-       .driver = {
-               .name = "imx-drm-dpu-bliteng",
-       },
-       .probe = dpu_bliteng_probe,
-       .remove = dpu_bliteng_remove,
-};
-
-module_platform_driver(dpu_bliteng_driver);
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("NXP Semiconductor");
-MODULE_DESCRIPTION("i.MX DRM DPU BLITENG");
index 43a1533..10aca37 100644 (file)
@@ -26,7 +26,6 @@
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_of.h>
-#include <drm/imx_drm.h>
 #include <video/imx-ipu-v3.h>
 #include <video/dpu.h>
 
@@ -42,14 +41,6 @@ struct imx_drm_crtc {
        struct imx_drm_crtc_helper_funcs        imx_drm_helper_funcs;
 };
 
-struct {
-       struct mutex mutex;
-       struct list_head ioctls;
-} imx_ioctls = {
-       .mutex = __MUTEX_INITIALIZER(imx_ioctls.mutex),
-       .ioctls = LIST_HEAD_INIT(imx_ioctls.ioctls),
-};
-
 #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
 static int legacyfb_depth = 16;
 module_param(legacyfb_depth, int, 0444);
@@ -94,51 +85,11 @@ static void imx_drm_disable_vblank(struct drm_device *drm, unsigned int pipe)
        imx_drm_crtc->imx_drm_helper_funcs.disable_vblank(imx_drm_crtc->crtc);
 }
 
-static long
-imx_drm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
-{
-       struct drm_file *file_priv = NULL;
-       struct drm_device *dev = NULL;
-
-#define MAX_DATA_STACK 128
-       char data[MAX_DATA_STACK];
-       unsigned int in_size;
-       struct imx_drm_ioctl *pos;
-
-       file_priv = filp->private_data;
-       if (!file_priv) {
-               return -EFAULT;
-       }
-
-       dev = file_priv->minor->dev;
-       if (!dev) {
-               return -EFAULT;
-       }
-
-       in_size = _IOC_SIZE(cmd);
-       if (copy_from_user(data, (void __user *) arg, in_size) != 0) {
-               return -EFAULT;
-       }
-
-       list_for_each_entry(pos, &imx_ioctls.ioctls, next) {
-               if (pos->ioctl->cmd == cmd) {
-                       long ret;
-                       mutex_lock(&imx_ioctls.mutex);
-                       ret = pos->ioctl->func(dev, data, file_priv);
-                       mutex_unlock(&imx_ioctls.mutex);
-                       return ret;
-               }
-       }
-
-
-       return drm_ioctl(filp, cmd, arg);
-}
-
 static const struct file_operations imx_drm_driver_fops = {
        .owner = THIS_MODULE,
        .open = drm_open,
        .release = drm_release,
-       .unlocked_ioctl = imx_drm_ioctl,
+       .unlocked_ioctl = drm_ioctl,
        .mmap = drm_gem_cma_mmap,
        .poll = drm_poll,
        .read = drm_read,
@@ -243,56 +194,13 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
 }
 EXPORT_SYMBOL_GPL(imx_drm_encoder_parse_of);
 
-int
-imx_drm_register_ioctl(struct drm_ioctl_desc *ioctl_desc)
-{
-       struct imx_drm_ioctl *__ioctl = kzalloc(sizeof(*__ioctl), GFP_KERNEL);
-
-       if (!__ioctl)
-               return -EFAULT;
-
-       __ioctl->ioctl = ioctl_desc;
-       INIT_LIST_HEAD(&__ioctl->next);
-
-       mutex_lock(&imx_ioctls.mutex);
-       list_add_tail(&__ioctl->next, &imx_ioctls.ioctls);
-       mutex_unlock(&imx_ioctls.mutex);
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(imx_drm_register_ioctl);
-
-int
-imx_drm_unregister_ioctl(struct drm_ioctl_desc *ioctl_desc)
-{
-       int err = -ENOENT;
-       struct imx_drm_ioctl *pos;
-
-       mutex_lock(&imx_ioctls.mutex);
-       list_for_each_entry(pos, &imx_ioctls.ioctls, next) {
-               if (pos->ioctl->cmd == ioctl_desc->cmd) {
-                       list_del(&pos->next);
-                       kfree(pos);
-                       err = 0;
-                       break;
-               }
-       }
-       mutex_unlock(&imx_ioctls.mutex);
-
-       return err;
-}
-EXPORT_SYMBOL_GPL(imx_drm_unregister_ioctl);
-
-
 static const struct drm_ioctl_desc imx_drm_ioctls[] = {
        /* none so far */
 };
 
-EXPORT_SYMBOL_GPL(imx_drm_ioctls);
-
 static struct drm_driver imx_drm_driver = {
        .driver_features        = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
-                                 DRIVER_ATOMIC | DRIVER_RENDER,
+                                 DRIVER_ATOMIC,
        .lastclose              = imx_drm_driver_lastclose,
        .gem_free_object_unlocked = drm_gem_cma_free_object,
        .gem_vm_ops             = &drm_gem_cma_vm_ops,
index d6b26f2..487189b 100644 (file)
@@ -31,12 +31,6 @@ struct imx_crtc_state {
        int                                     di_vsync_pin;
 };
 
-/* useful structure to embedded a drm_ioctl_desc */
-struct imx_drm_ioctl {
-       struct drm_ioctl_desc *ioctl;
-       struct list_head next;
-};
-
 static inline struct imx_crtc_state *to_imx_crtc_state(struct drm_crtc_state *s)
 {
        return container_of(s, struct imx_crtc_state, base);
@@ -68,7 +62,4 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
 void imx_drm_connector_destroy(struct drm_connector *connector);
 void imx_drm_encoder_destroy(struct drm_encoder *encoder);
 
-int imx_drm_register_ioctl(struct drm_ioctl_desc *ioctl);
-int imx_drm_unregister_ioctl(struct drm_ioctl_desc *ioctl);
-
 #endif /* _IMX_DRM_H_ */
diff --git a/include/uapi/drm/imx_drm.h b/include/uapi/drm/imx_drm.h
deleted file mode 100644 (file)
index 8d35a79..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2017 NXP
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _UAPI_IMX_DRM_H_
-#define _UAPI_IMX_DRM_H_
-
-#include "drm.h"
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-#define DRM_IMX_DPU_SET_CMDLIST                 0x00
-#define DRM_IMX_DPU_WAIT                        0x01
-#define DRM_IMX_DPU_GET_PARAM                   0x02
-
-#define DRM_IOCTL_IMX_DPU_SET_CMDLIST   DRM_IOWR(DRM_COMMAND_BASE + \
-               DRM_IMX_DPU_SET_CMDLIST, struct drm_imx_dpu_set_cmdlist)
-#define DRM_IOCTL_IMX_DPU_WAIT          DRM_IOWR(DRM_COMMAND_BASE + \
-               DRM_IMX_DPU_WAIT, struct drm_imx_dpu_wait)
-#define DRM_IOCTL_IMX_DPU_GET_PARAM     DRM_IOWR(DRM_COMMAND_BASE + \
-               DRM_IMX_DPU_GET_PARAM, enum drm_imx_dpu_param)
-
-/**
- * struct drm_imx_dpu_set_cmdlist - ioctl argument for
- * DRM_IMX_DPU_SET_CMDLIST.
- */
-struct drm_imx_dpu_set_cmdlist {
-       __u64   cmd;
-       __u32   cmd_nr;
-
-       /* reserverd */
-       __u64   user_data;
-};
-
-/**
- * struct drm_imx_dpu_wait - ioctl argument for
- * DRM_IMX_DPU_WAIT.
- *
- */
-struct drm_imx_dpu_wait {
-       /* reserverd */
-       __u64   user_data;
-};
-
-/**
- * enum drm_imx_dpu_param - ioctl argument for
- * DRM_IMX_DPU_GET_PARAM.
- *
- */
-enum drm_imx_dpu_param {
-       DRM_IMX_MAX_DPUS,
-};
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* _UAPI_IMX_DRM_H_ */