aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-13 17:07:50 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-01-20 09:57:57 -0500
commitaf26ef3b3978349cfbd864163a6ebb4906b733b5 (patch)
tree38efb55b2aac85582180caa018c26b7c3202e77c
parent0ae6d7bc0e70dafc1739d50b2b8d9d7c61968395 (diff)
drm/<drivers>: Unified handling of unimplemented fb->create_handle
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>
-rw-r--r--drivers/gpu/drm/ast/ast_main.c8
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_main.c8
-rw-r--r--drivers/gpu/drm/drm_crtc.c5
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_main.c8
-rw-r--r--drivers/gpu/drm/udl/udl_fb.c1
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c12
6 files changed, 4 insertions, 38 deletions
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index d5ba7097e5b5..f60fd7bd1183 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -246,16 +246,8 @@ static void ast_user_framebuffer_destroy(struct drm_framebuffer *fb)
246 kfree(fb); 246 kfree(fb);
247} 247}
248 248
249static int ast_user_framebuffer_create_handle(struct drm_framebuffer *fb,
250 struct drm_file *file,
251 unsigned int *handle)
252{
253 return -EINVAL;
254}
255
256static const struct drm_framebuffer_funcs ast_fb_funcs = { 249static const struct drm_framebuffer_funcs ast_fb_funcs = {
257 .destroy = ast_user_framebuffer_destroy, 250 .destroy = ast_user_framebuffer_destroy,
258 .create_handle = ast_user_framebuffer_create_handle,
259}; 251};
260 252
261 253
diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c b/drivers/gpu/drm/cirrus/cirrus_main.c
index 364474c66202..35cbae827771 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -23,16 +23,8 @@ static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb)
23 kfree(fb); 23 kfree(fb);
24} 24}
25 25
26static int cirrus_user_framebuffer_create_handle(struct drm_framebuffer *fb,
27 struct drm_file *file_priv,
28 unsigned int *handle)
29{
30 return 0;
31}
32
33static const struct drm_framebuffer_funcs cirrus_fb_funcs = { 26static const struct drm_framebuffer_funcs cirrus_fb_funcs = {
34 .destroy = cirrus_user_framebuffer_destroy, 27 .destroy = cirrus_user_framebuffer_destroy,
35 .create_handle = cirrus_user_framebuffer_create_handle,
36}; 28};
37 29
38int cirrus_framebuffer_init(struct drm_device *dev, 30int cirrus_framebuffer_init(struct drm_device *dev,
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 8d665fafc15e..a9abf49bb3ef 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2384,7 +2384,10 @@ int drm_mode_getfb(struct drm_device *dev,
2384 r->depth = fb->depth; 2384 r->depth = fb->depth;
2385 r->bpp = fb->bits_per_pixel; 2385 r->bpp = fb->bits_per_pixel;
2386 r->pitch = fb->pitches[0]; 2386 r->pitch = fb->pitches[0];
2387 fb->funcs->create_handle(fb, file_priv, &r->handle); 2387 if (fb->funcs->create_handle)
2388 ret = fb->funcs->create_handle(fb, file_priv, &r->handle);
2389 else
2390 ret = -ENODEV;
2388 2391
2389out: 2392out:
2390 mutex_unlock(&dev->mode_config.mutex); 2393 mutex_unlock(&dev->mode_config.mutex);
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c
index 266438af61ea..64297c72464f 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -23,16 +23,8 @@ static void mga_user_framebuffer_destroy(struct drm_framebuffer *fb)
23 kfree(fb); 23 kfree(fb);
24} 24}
25 25
26static int mga_user_framebuffer_create_handle(struct drm_framebuffer *fb,
27 struct drm_file *file_priv,
28 unsigned int *handle)
29{
30 return 0;
31}
32
33static const struct drm_framebuffer_funcs mga_fb_funcs = { 26static const struct drm_framebuffer_funcs mga_fb_funcs = {
34 .destroy = mga_user_framebuffer_destroy, 27 .destroy = mga_user_framebuffer_destroy,
35 .create_handle = mga_user_framebuffer_create_handle,
36}; 28};
37 29
38int mgag200_framebuffer_init(struct drm_device *dev, 30int mgag200_framebuffer_init(struct drm_device *dev,
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index 829c4a76938c..f8904b4e68de 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -422,7 +422,6 @@ static void udl_user_framebuffer_destroy(struct drm_framebuffer *fb)
422static const struct drm_framebuffer_funcs udlfb_funcs = { 422static const struct drm_framebuffer_funcs udlfb_funcs = {
423 .destroy = udl_user_framebuffer_destroy, 423 .destroy = udl_user_framebuffer_destroy,
424 .dirty = udl_user_framebuffer_dirty, 424 .dirty = udl_user_framebuffer_dirty,
425 .create_handle = NULL,
426}; 425};
427 426
428 427
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index edc97929c9a3..9c0876b908ae 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -373,16 +373,6 @@ void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv)
373 * Generic framebuffer code 373 * Generic framebuffer code
374 */ 374 */
375 375
376int vmw_framebuffer_create_handle(struct drm_framebuffer *fb,
377 struct drm_file *file_priv,
378 unsigned int *handle)
379{
380 if (handle)
381 *handle = 0;
382
383 return 0;
384}
385
386/* 376/*
387 * Surface framebuffer code 377 * Surface framebuffer code
388 */ 378 */
@@ -610,7 +600,6 @@ int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
610static struct drm_framebuffer_funcs vmw_framebuffer_surface_funcs = { 600static struct drm_framebuffer_funcs vmw_framebuffer_surface_funcs = {
611 .destroy = vmw_framebuffer_surface_destroy, 601 .destroy = vmw_framebuffer_surface_destroy,
612 .dirty = vmw_framebuffer_surface_dirty, 602 .dirty = vmw_framebuffer_surface_dirty,
613 .create_handle = vmw_framebuffer_create_handle,
614}; 603};
615 604
616static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv, 605static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
@@ -961,7 +950,6 @@ int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
961static struct drm_framebuffer_funcs vmw_framebuffer_dmabuf_funcs = { 950static struct drm_framebuffer_funcs vmw_framebuffer_dmabuf_funcs = {
962 .destroy = vmw_framebuffer_dmabuf_destroy, 951 .destroy = vmw_framebuffer_dmabuf_destroy,
963 .dirty = vmw_framebuffer_dmabuf_dirty, 952 .dirty = vmw_framebuffer_dmabuf_dirty,
964 .create_handle = vmw_framebuffer_create_handle,
965}; 953};
966 954
967/** 955/**