Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af26ef3b authored by Daniel Vetter's avatar Daniel Vetter
Browse files

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: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 0ae6d7bc
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -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,
};


+0 −8
Original line number Diff line number Diff line
@@ -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,
+4 −1
Original line number Diff line number Diff line
@@ -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);
+0 −8
Original line number Diff line number Diff line
@@ -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,
+0 −1
Original line number Diff line number Diff line
@@ -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,
};


Loading