Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs()

Add drm_fb_cma_create_with_funcs() for drivers that need to set the
dirty() callback.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463077523-23959-3-git-send-email-noralf@tronnes.org

authored by

Noralf Trønnes and committed by
Daniel Vetter
3995b395 fdce1846

+28 -6
+25 -6
drivers/gpu/drm/drm_fb_cma_helper.c
··· 159 159 } 160 160 161 161 /** 162 - * drm_fb_cma_create() - (struct drm_mode_config_funcs *)->fb_create callback function 162 + * drm_fb_cma_create_with_funcs() - helper function for the 163 + * &drm_mode_config_funcs ->fb_create 164 + * callback function 163 165 * 164 - * If your hardware has special alignment or pitch requirements these should be 165 - * checked before calling this function. 166 + * This can be used to set &drm_framebuffer_funcs for drivers that need the 167 + * dirty() callback. Use drm_fb_cma_create() if you don't need to change 168 + * &drm_framebuffer_funcs. 166 169 */ 167 - struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, 168 - struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd) 170 + struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev, 171 + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd, 172 + const struct drm_framebuffer_funcs *funcs) 169 173 { 170 174 struct drm_fb_cma *fb_cma; 171 175 struct drm_gem_cma_object *objs[4]; ··· 206 202 objs[i] = to_drm_gem_cma_obj(obj); 207 203 } 208 204 209 - fb_cma = drm_fb_cma_alloc(dev, mode_cmd, objs, i, &drm_fb_cma_funcs); 205 + fb_cma = drm_fb_cma_alloc(dev, mode_cmd, objs, i, funcs); 210 206 if (IS_ERR(fb_cma)) { 211 207 ret = PTR_ERR(fb_cma); 212 208 goto err_gem_object_unreference; ··· 218 214 for (i--; i >= 0; i--) 219 215 drm_gem_object_unreference_unlocked(&objs[i]->base); 220 216 return ERR_PTR(ret); 217 + } 218 + EXPORT_SYMBOL_GPL(drm_fb_cma_create_with_funcs); 219 + 220 + /** 221 + * drm_fb_cma_create() - &drm_mode_config_funcs ->fb_create callback function 222 + * 223 + * If your hardware has special alignment or pitch requirements these should be 224 + * checked before calling this function. Use drm_fb_cma_create_with_funcs() if 225 + * you need to set &drm_framebuffer_funcs ->dirty. 226 + */ 227 + struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, 228 + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd) 229 + { 230 + return drm_fb_cma_create_with_funcs(dev, file_priv, mode_cmd, 231 + &drm_fb_cma_funcs); 221 232 } 222 233 EXPORT_SYMBOL_GPL(drm_fb_cma_create); 223 234
+3
include/drm/drm_fb_cma_helper.h
··· 31 31 int drm_fb_cma_create_handle(struct drm_framebuffer *fb, 32 32 struct drm_file *file_priv, unsigned int *handle); 33 33 34 + struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev, 35 + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd, 36 + const struct drm_framebuffer_funcs *funcs); 34 37 struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, 35 38 struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd); 36 39