]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
drm/<drivers>: Unified handling of unimplemented fb->create_handle
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 13 Dec 2012 22:07:50 +0000 (23:07 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 20 Jan 2013 14:57:57 +0000 (15:57 +0100)
Some drivers don't have real ->create_handle callbacks.

- cirrus/ast/mga200: Returns either 0 or -EINVAL.

- udl: Didn't even bother with a callback, leading to a nice
  userspace-triggerable OOPS.

- vmwgfx: This driver bothered with an implementation to return 0 as
  the handle (which is the canonical no-obj gem handle).

All have in common that ->create_handle doesn't really make too much
sense for them - that ioctl is used only for seamless fb takeover in
the radeon/nouveau/i915 ddx drivers. So allow drivers to not implement
this and return a consistent -ENODEV.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/cirrus/cirrus_main.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/mgag200/mgag200_main.c
drivers/gpu/drm/udl/udl_fb.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

index d5ba7097e5b53bcf9eb50b67de7bb678b8c527a9..f60fd7bd11839f0511bf2a436f1ebc79330f27c4 100644 (file)
@@ -246,16 +246,8 @@ static void ast_user_framebuffer_destroy(struct drm_framebuffer *fb)
        kfree(fb);
 }
 
-static int ast_user_framebuffer_create_handle(struct drm_framebuffer *fb,
-                                             struct drm_file *file,
-                                             unsigned int *handle)
-{
-       return -EINVAL;
-}
-
 static const struct drm_framebuffer_funcs ast_fb_funcs = {
        .destroy = ast_user_framebuffer_destroy,
-       .create_handle = ast_user_framebuffer_create_handle,
 };
 
 
index 364474c66202cc9587fa51d8acddda5e0af03fd1..35cbae8277715ad2944a00dcce1c39e4482109b6 100644 (file)
@@ -23,16 +23,8 @@ static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb)
        kfree(fb);
 }
 
-static int cirrus_user_framebuffer_create_handle(struct drm_framebuffer *fb,
-                                                struct drm_file *file_priv,
-                                                unsigned int *handle)
-{
-       return 0;
-}
-
 static const struct drm_framebuffer_funcs cirrus_fb_funcs = {
        .destroy = cirrus_user_framebuffer_destroy,
-       .create_handle = cirrus_user_framebuffer_create_handle,
 };
 
 int cirrus_framebuffer_init(struct drm_device *dev,
index 8d665fafc15e68541f94131eb04f5481628dac9c..a9abf49bb3eff7bd66698e8d8b7701234e4ed514 100644 (file)
@@ -2384,7 +2384,10 @@ int drm_mode_getfb(struct drm_device *dev,
        r->depth = fb->depth;
        r->bpp = fb->bits_per_pixel;
        r->pitch = fb->pitches[0];
-       fb->funcs->create_handle(fb, file_priv, &r->handle);
+       if (fb->funcs->create_handle)
+               ret = fb->funcs->create_handle(fb, file_priv, &r->handle);
+       else
+               ret = -ENODEV;
 
 out:
        mutex_unlock(&dev->mode_config.mutex);
index 266438af61eacd59a339fea1f2ff1e1ef7088f2d..64297c72464f996404730df6f3ec2eb67beccc33 100644 (file)
@@ -23,16 +23,8 @@ static void mga_user_framebuffer_destroy(struct drm_framebuffer *fb)
        kfree(fb);
 }
 
-static int mga_user_framebuffer_create_handle(struct drm_framebuffer *fb,
-                                                struct drm_file *file_priv,
-                                                unsigned int *handle)
-{
-       return 0;
-}
-
 static const struct drm_framebuffer_funcs mga_fb_funcs = {
        .destroy = mga_user_framebuffer_destroy,
-       .create_handle = mga_user_framebuffer_create_handle,
 };
 
 int mgag200_framebuffer_init(struct drm_device *dev,
index 829c4a76938c44e147c7c81be2ddcb673aca5b4e..f8904b4e68dee0eb6dc35e02543daac6db980223 100644 (file)
@@ -422,7 +422,6 @@ static void udl_user_framebuffer_destroy(struct drm_framebuffer *fb)
 static const struct drm_framebuffer_funcs udlfb_funcs = {
        .destroy = udl_user_framebuffer_destroy,
        .dirty = udl_user_framebuffer_dirty,
-       .create_handle = NULL,
 };
 
 
index edc97929c9a342806bfe2544eb79649ac335722a..9c0876b908ae8a4939637bbe826bb731639a545d 100644 (file)
@@ -373,16 +373,6 @@ void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv)
  * Generic framebuffer code
  */
 
-int vmw_framebuffer_create_handle(struct drm_framebuffer *fb,
-                                 struct drm_file *file_priv,
-                                 unsigned int *handle)
-{
-       if (handle)
-               *handle = 0;
-
-       return 0;
-}
-
 /*
  * Surface framebuffer code
  */
@@ -610,7 +600,6 @@ int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
 static struct drm_framebuffer_funcs vmw_framebuffer_surface_funcs = {
        .destroy = vmw_framebuffer_surface_destroy,
        .dirty = vmw_framebuffer_surface_dirty,
-       .create_handle = vmw_framebuffer_create_handle,
 };
 
 static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
@@ -961,7 +950,6 @@ int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
 static struct drm_framebuffer_funcs vmw_framebuffer_dmabuf_funcs = {
        .destroy = vmw_framebuffer_dmabuf_destroy,
        .dirty = vmw_framebuffer_dmabuf_dirty,
-       .create_handle = vmw_framebuffer_create_handle,
 };
 
 /**