diff options
author | Dave Airlie <airlied@redhat.com> | 2016-05-19 06:48:29 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-05-19 06:48:29 +1000 |
commit | 24e04d72eb43d36d28fa7908f9f8d506d1cb06e7 (patch) | |
tree | dfcf3735129272f37d2a39ce3e38cccdf6ad8a34 /drivers/gpu/drm/drm_fb_cma_helper.c | |
parent | 7c10ddf87472c07eabc206e273dc59f77c700858 (diff) | |
parent | c6740c9c9e914742fd2ec159142c40701f7df966 (diff) |
Merge tag 'topic/drm-misc-2016-05-18' of git://anongit.freedesktop.org/drm-intel into drm-next
Update drm-misc pull with a few more fixes included, plus the two from
Arnd for the fallout from the drm_gem_object_lookup() refactor that I
failed to spot :(
* tag 'topic/drm-misc-2016-05-18' of git://anongit.freedesktop.org/drm-intel:
drm: remove unused dev variables
drm: mediatek: fixup drm_gem_object_lookup API change
drm/tegra: Fix crash caused by reference count imbalance
drm: Fix error handling in drm_connector_register
drm: Avoid connector reference imbalance on error path
drm/fb_helper: Fix references to dev->mode_config.num_connector
drm/i915/fbdev: Fix num_connector references in intel_fb_initial_config()
qxl: catch qxlfb_create_pinned_object failures
drm/exynos/hdmi: add a missing tab
drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs()
drm/fb-cma-helper: Use const for drm_framebuffer_funcs argument
drm: Drop connector argument from __drm_atomic_helper_connector_destroy_state
drm: Drop plane argument from __drm_atomic_helper_plane_destroy_state
drm: Drop crtc argument from __drm_atomic_helper_crtc_destroy_state
drm: Remove unused drm_device from drm_gem_object_lookup()
Diffstat (limited to 'drivers/gpu/drm/drm_fb_cma_helper.c')
-rw-r--r-- | drivers/gpu/drm/drm_fb_cma_helper.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index 3165ac0e93e5..172cafe11c71 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c @@ -133,7 +133,7 @@ static struct drm_framebuffer_funcs drm_fb_cma_funcs = { static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_cma_object **obj, - unsigned int num_planes, struct drm_framebuffer_funcs *funcs) + unsigned int num_planes, const struct drm_framebuffer_funcs *funcs) { struct drm_fb_cma *fb_cma; int ret; @@ -159,13 +159,17 @@ static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev, } /** - * drm_fb_cma_create() - (struct drm_mode_config_funcs *)->fb_create callback function + * drm_fb_cma_create_with_funcs() - helper function for the + * &drm_mode_config_funcs ->fb_create + * callback function * - * If your hardware has special alignment or pitch requirements these should be - * checked before calling this function. + * This can be used to set &drm_framebuffer_funcs for drivers that need the + * dirty() callback. Use drm_fb_cma_create() if you don't need to change + * &drm_framebuffer_funcs. */ -struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, - struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd) +struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev, + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd, + const struct drm_framebuffer_funcs *funcs) { struct drm_fb_cma *fb_cma; struct drm_gem_cma_object *objs[4]; @@ -183,7 +187,7 @@ struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, unsigned int height = mode_cmd->height / (i ? vsub : 1); unsigned int min_size; - obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[i]); + obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[i]); if (!obj) { dev_err(dev->dev, "Failed to lookup GEM object\n"); ret = -ENXIO; @@ -202,7 +206,7 @@ struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, objs[i] = to_drm_gem_cma_obj(obj); } - fb_cma = drm_fb_cma_alloc(dev, mode_cmd, objs, i, &drm_fb_cma_funcs); + fb_cma = drm_fb_cma_alloc(dev, mode_cmd, objs, i, funcs); if (IS_ERR(fb_cma)) { ret = PTR_ERR(fb_cma); goto err_gem_object_unreference; @@ -215,6 +219,21 @@ err_gem_object_unreference: drm_gem_object_unreference_unlocked(&objs[i]->base); return ERR_PTR(ret); } +EXPORT_SYMBOL_GPL(drm_fb_cma_create_with_funcs); + +/** + * drm_fb_cma_create() - &drm_mode_config_funcs ->fb_create callback function + * + * If your hardware has special alignment or pitch requirements these should be + * checked before calling this function. Use drm_fb_cma_create_with_funcs() if + * you need to set &drm_framebuffer_funcs ->dirty. + */ +struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd) +{ + return drm_fb_cma_create_with_funcs(dev, file_priv, mode_cmd, + &drm_fb_cma_funcs); +} EXPORT_SYMBOL_GPL(drm_fb_cma_create); /** @@ -350,7 +369,7 @@ static void drm_fbdev_cma_defio_fini(struct fb_info *fbi) */ int drm_fbdev_cma_create_with_funcs(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes, - struct drm_framebuffer_funcs *funcs) + const struct drm_framebuffer_funcs *funcs) { struct drm_fbdev_cma *fbdev_cma = to_fbdev_cma(helper); struct drm_mode_fb_cmd2 mode_cmd = { 0 }; |