drm: fb emulation: Step 1: Create new drm_fb_helper wrapper funcs
Subsystems (20)
A message that is not in the archive (sent off-list or not yet received): [email protected]
v2 cover drm: fb emulation: Step 1: Create new drm_fb_helper wrapper funcs
DRM drivers using drm_fb_helpers still call some fbdev core functions. This makes the driver depend on CONFIG_FB, resulting in complicated Kconfig options, and preventing us from creating a top level drm config option to enable/disable FBDEV emulation.
Create new drm_fb_helper functions that replace these fbdev functions.
In most cases, the new helper funcs simply wrap around the original fbdev functions. For a few (like framebufer_alloc), we actually do some work that is currently redundant across multiple drivers.
With these patches, the drivers don't call any fbdev functions directly. They are now called through functions in drm_fb_helper.c. We will later create a fbdev emulation config option to stub out the fb helpers.
The only exception is vmwgfx driver. This doesn't use drm_fb_helper. It creates a fb device how a driver in drivers/video/fbdev would. Maybe this needs to be converted to use drm_fb_helpers.
For more info, have a look at the threads:
http://lists.freedesktop.org/archives/dri-devel/2015-March/078729.html
http://lists.freedesktop.org/archives/dri-devel/2015-March/078975.html
changes in v2:
- Incorporated comments
- Misc fixes for build wannings/errors
- resend version has v2 changes in changelog, 'compile tested only' is removed.
Archit Taneja (25):
drm/fb_helper: Add drm_fb_helper functions to manage fb_info creation drm/fb_helper: Create a wrapper for unlink_framebuffer drm/fb_helper: Create wrappers for fb_sys_read/write funcs drm/fb_helper: Create wrappers for blit, copyarea and fillrect funcs drm/fb_helper: Create a wrapper for fb_set_suspend drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers drm/cirrus: Use new drm_fb_helper functions
drm/rockchip: Use new drm_fb_helper functions
drm/armada: Use new drm_fb_helper functions
drm/ast: Use new drm_fb_helper functions
drm/omap: Use new drm_fb_helper functions
drm/tegra: Use new drm_fb_helper functions
drm/msm: Use new drm_fb_helper functions
drm/exynos: Use new drm_fb_helper functions
drm/gma500: Use new drm_fb_helper functions
drm/mgag200: Use new drm_fb_helper functions
drm/radeon: Use new drm_fb_helper functions
drm/qxl: Use new drm_fb_helper functions
drm/i915: Use new drm_fb_helper functions
drm/nouveau: Use new drm_fb_helper functions
drm/udl: Use new drm_fb_helper functions
drm/bochs: Use new drm_fb_helper functions
drm/amdgpu: Use new drm_fb_helper functions
drm/virtio: Use new drm_fb_helper functions drm/fb_cma_helper: Use new drm_fb_helper functions
drivers/gpu/drm/Kconfig | 7 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 45 ++---- drivers/gpu/drm/armada/armada_fbdev.c | 33 ++-- drivers/gpu/drm/ast/ast_fb.c | 48 ++---- drivers/gpu/drm/bochs/bochs_drv.c | 6 +- drivers/gpu/drm/bochs/bochs_fbdev.c | 36 ++--- drivers/gpu/drm/cirrus/cirrus_drv.c | 7 +- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 41 +---- drivers/gpu/drm/drm_fb_cma_helper.c | 45 ++---- drivers/gpu/drm/drm_fb_helper.c | 225 ++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 47 ++---- drivers/gpu/drm/gma500/accel_2d.c | 6 +- drivers/gpu/drm/gma500/framebuffer.c | 48 ++---- drivers/gpu/drm/i915/i915_dma.c | 3 +- drivers/gpu/drm/i915/intel_fbdev.c | 40 ++--- drivers/gpu/drm/mgag200/mgag200_drv.c | 3 +- drivers/gpu/drm/mgag200/mgag200_fb.c | 39 +---- drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- drivers/gpu/drm/msm/msm_fbdev.c | 34 ++-- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 39 ++--- drivers/gpu/drm/omapdrm/omap_fbdev.c | 34 ++-- drivers/gpu/drm/qxl/qxl_fb.c | 40 ++--- drivers/gpu/drm/radeon/radeon_drv.c | 4 +- drivers/gpu/drm/radeon/radeon_fb.c | 42 ++--- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 47 ++---- drivers/gpu/drm/tegra/fb.c | 35 ++-- drivers/gpu/drm/udl/udl_fb.c | 41 ++--- drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 3 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_fb.c | 32 ++-- include/drm/drm_fb_helper.h | 31 ++++ 33 files changed, 508 insertions(+), 563 deletions(-)
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 1/25 drm/fb_helper: Add drm_fb_helper functions to manage fb_info creation
Every drm driver calls framebuffer_alloc, fb_alloc_cmap, unregister_framebuffer, fb_dealloc_cmap and framebuffer_release in order to emulate fbdev support.
Create drm_fb_helper functions that perform the above operations.
This is part of an effort to prevent drm drivers from calling fbdev functions directly. It also removes repetitive code from drivers.
There are some drivers that call alloc_apertures after framebuffer_alloc and some that don't. Make the helper always call alloc_apertures. This would make certain drivers allocate memory for apertures but not use them. Since it's a small amount of memory, it shouldn't be an issue.
v2:
- Added kerneldocs
- Added a check for non-NULL fb_helper before proceeding. This will make the helpers work when we have a module param for fbdev emulation
--- drivers/gpu/drm/drm_fb_helper.c | 80 +++++++++++++++++++++++++++++++++++++++++ include/drm/drm_fb_helper.h | 4 +++ 2 files changed, 84 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +80 -0
@@ -667,6 +667,86 @@ out_free: }EXPORT_SYMBOL (drm_fb_helper_init); +/** +* drm_fb_helper_alloc_fbi - allocate fb_info and some of its members +* @fb_helper: driver-allocated fbdev helper +* +* A helper to alloc fb_info and the members cmap and apertures. Called +* by the driver within the fb_probe fb_helper callback function. +* +* RETURNS: +* fb_info pointer if things went okay, pointer containing error code +* otherwise +*/ +struct fb_info *drm_fb_helper_alloc_fbi (struct drm_fb_helper *fb_helper) +{ +struct device *dev = fb_helper->dev->dev; +struct fb_info *info; +int ret; + + info =framebuffer_alloc (0 , dev); +if (!info) +return ERR_PTR (-ENOMEM ); + + ret =fb_alloc_cmap (&info->cmap,256 ,0 ); +if (ret) + goto err_release; + + info->apertures =alloc_apertures (1 ); +if (!info->apertures) { + ret = -ENOMEM ; + goto err_free_cmap; + } + + fb_helper->fbdev = info; + +return info; + +err_free_cmap: +fb_dealloc_cmap (&info->cmap); +err_release: +framebuffer_release (info); +return ERR_PTR (ret); +} +EXPORT_SYMBOL (drm_fb_helper_alloc_fbi); + +/** +* drm_fb_helper_unregister_fbi - unregister fb_info framebuffer device +* @fb_helper: driver-allocated fbdev helper +* +* A wrapper around unregister_framebuffer, to release the fb_info +* framebuffer device +*/ +void drm_fb_helper_unregister_fbi (struct drm_fb_helper *fb_helper) +{ +if (fb_helper && fb_helper->fbdev) +unregister_framebuffer (fb_helper->fbdev); +} +EXPORT_SYMBOL (drm_fb_helper_unregister_fbi); + +/** +* drm_fb_helper_release_fbi - dealloc fb_info and its members +* @fb_helper: driver-allocated fbdev helper +* +* A helper to free memory taken by fb_info and the members cmap and +* apertures +*/ +void drm_fb_helper_release_fbi (struct drm_fb_helper *fb_helper) +{ +if (fb_helper) { +struct fb_info *info = fb_helper->fbdev; + +if (info) { +if (info->cmap.len) +fb_dealloc_cmap (&info->cmap); +framebuffer_release (info); + } + + fb_helper->fbdev =NULL ; + } +} +EXPORT_SYMBOL (drm_fb_helper_release_fbi); +void drm_fb_helper_fini (struct drm_fb_helper *fb_helper) {if (!list_empty (&fb_helper->kernel_fb_list)) {
include/drm/drm_fb_helper.h +4 -0
@@ -136,6 +136,10 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, struct fb_info *info);bool drm_fb_helper_restore_fbdev_mode_unlocked (struct drm_fb_helper *fb_helper); + +struct fb_info *drm_fb_helper_alloc_fbi (struct drm_fb_helper *fb_helper); +void drm_fb_helper_unregister_fbi (struct drm_fb_helper *fb_helper); +void drm_fb_helper_release_fbi (struct drm_fb_helper *fb_helper);void drm_fb_helper_fill_var (struct fb_info *info,struct drm_fb_helper *fb_helper,uint32_t fb_width,uint32_t fb_height); void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 2/25 drm/fb_helper: Create a wrapper for unlink_framebuffer
In reply to Archit TanejaSome drm drivers call unlink_framebuffer. Create a drm_fb_helper function that wraps around these calls.
This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Added a check for non-NULL fb_helper before proceeding. This will make the helpers work when we have a module param for fbdev emulation
--- drivers/gpu/drm/drm_fb_helper.c | 13 +++++++++++++ include/drm/drm_fb_helper.h | 2 ++ 2 files changed, 15 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +13 -0
@@ -764,6 +764,19 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper) }EXPORT_SYMBOL (drm_fb_helper_fini); +/** +* drm_fb_helper_unlink_fbi - wrapper around unlink_framebuffer +* @fb_helper: driver-allocated fbdev helper +* +* A wrapper around unlink_framebuffer implemented by fbdev core +*/ +void drm_fb_helper_unlink_fbi (struct drm_fb_helper *fb_helper) +{ +if (fb_helper && fb_helper->fbdev) +unlink_framebuffer (fb_helper->fbdev); +} +EXPORT_SYMBOL (drm_fb_helper_unlink_fbi); +static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {
include/drm/drm_fb_helper.h +2 -0
@@ -145,6 +145,8 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpevoid drm_fb_helper_fill_fix (struct fb_info *info,uint32_t pitch,uint32_t depth); +void drm_fb_helper_unlink_fbi (struct drm_fb_helper *fb_helper); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 3/25 drm/fb_helper: Create wrappers for fb_sys_read/write funcs
In reply to Archit TanejaSome drm drivers populate their fb_ops with fb_sys_read/write fb sysfs ops.
Create a drm_fb_helper function that wraps around these calls.
This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitions
- Remove unnecessary checks for non NULL fb_info
--- drivers/gpu/drm/Kconfig | 1 + drivers/gpu/drm/drm_fb_helper.c | 26 ++++++++++++++++++++++++++ include/drm/drm_fb_helper.h | 5 +++++ 3 files changed, 32 insertions(+)
drivers/gpu/drm/Kconfig +1 -0
@@ -37,6 +37,7 @@ config DRM_KMS_FB_HELPER select FB select FRAMEBUFFER_CONSOLE if !EXPERT select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE + select FB_SYS_FOPS help FBDEV helpers for KMS drivers.
drivers/gpu/drm/drm_fb_helper.c +26 -0
@@ -777,6 +777,32 @@ void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper) }EXPORT_SYMBOL (drm_fb_helper_unlink_fbi); +/** +* drm_fb_helper_sys_read - wrapper around fb_sys_read +* @fb_helper: driver-allocated fbdev helper +* +* A wrapper around fb_sys_read implemented by fbdev core +*/ +ssize_t drm_fb_helper_sys_read (struct fb_info *info,char __user *buf, +size_t count,loff_t *ppos) +{ +return fb_sys_read (info, buf, count, ppos); +} +EXPORT_SYMBOL (drm_fb_helper_sys_read); + +/** +* drm_fb_helper_sys_write - wrapper around fb_sys_write +* @fb_helper: driver-allocated fbdev helper +* +* A wrapper around fb_sys_write implemented by fbdev core +*/ +ssize_t drm_fb_helper_sys_write (struct fb_info *info,const char __user *buf, +size_t count,loff_t *ppos) +{ +return fb_sys_write (info, buf, count, ppos); +} +EXPORT_SYMBOL (drm_fb_helper_sys_write); +static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {
include/drm/drm_fb_helper.h +5 -0
@@ -147,6 +147,11 @@ void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,void drm_fb_helper_unlink_fbi (struct drm_fb_helper *fb_helper); +ssize_t drm_fb_helper_sys_read (struct fb_info *info,char __user *buf, +size_t count,loff_t *ppos); +ssize_t drm_fb_helper_sys_write (struct fb_info *info,const char __user *buf, +size_t count,loff_t *ppos); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 4/25 drm/fb_helper: Create wrappers for blit, copyarea and fillrect funcs
In reply to Archit Tanejadrm drivers that emulate fbdev populate their fb_fillrect, fb_copyarea and fb_imageblit fb_ops with the help of cfb_* or sys_* fbdev core helper functions.
Create drm_fb_helper functions that wrap around these calls.
This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitions
- Remove unnecessary checks for non NULL fb_info
--- drivers/gpu/drm/Kconfig | 6 ++++ drivers/gpu/drm/drm_fb_helper.c | 78 +++++++++++++++++++++++++++++++++++++++++ include/drm/drm_fb_helper.h | 14 ++++++++ 3 files changed, 98 insertions(+)
drivers/gpu/drm/Kconfig +6 -0
@@ -38,6 +38,12 @@ config DRM_KMS_FB_HELPER select FRAMEBUFFER_CONSOLE if !EXPERT select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE select FB_SYS_FOPS + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT help FBDEV helpers for KMS drivers.
drivers/gpu/drm/drm_fb_helper.c +78 -0
84 lines not on this page · raw message
include/drm/drm_fb_helper.h +14 -0
@@ -152,6 +152,20 @@ ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,ssize_t drm_fb_helper_sys_write (struct fb_info *info,const char __user *buf,size_t count,loff_t *ppos); +void drm_fb_helper_sys_fillrect (struct fb_info *info, +const struct fb_fillrect *rect); +void drm_fb_helper_sys_copyarea (struct fb_info *info, +const struct fb_copyarea *area); +void drm_fb_helper_sys_imageblit (struct fb_info *info, +const struct fb_image *image); + +void drm_fb_helper_cfb_fillrect (struct fb_info *info, +const struct fb_fillrect *rect); +void drm_fb_helper_cfb_copyarea (struct fb_info *info, +const struct fb_copyarea *area); +void drm_fb_helper_cfb_imageblit (struct fb_info *info, +const struct fb_image *image); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 5/25 drm/fb_helper: Create a wrapper for fb_set_suspend
In reply to Archit TanejaSome drm drivers call fb_set_suspend. Create a drm_fb_helper function that wraps around these calls.
This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Added a check for non-NULL fb_helper before proceeding. This will make the helpers work when we have a module param for fbdev emulation
- Follow the drm way of aligning of arguments in func definitions
--- drivers/gpu/drm/drm_fb_helper.c | 13 +++++++++++++ include/drm/drm_fb_helper.h | 2 ++ 2 files changed, 15 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +13 -0
@@ -881,6 +881,19 @@ void drm_fb_helper_cfb_imageblit(struct fb_info *info, }EXPORT_SYMBOL (drm_fb_helper_cfb_imageblit); +/** +* drm_fb_helper_set_suspend - wrapper around fb_set_suspend +* @fb_helper: driver-allocated fbdev helper +* +* A wrapper around fb_set_suspend implemented by fbdev core +*/ +void drm_fb_helper_set_suspend (struct drm_fb_helper *fb_helper,int state) +{ +if (fb_helper && fb_helper->fbdev) +fb_set_suspend (fb_helper->fbdev, state); +} +EXPORT_SYMBOL (drm_fb_helper_set_suspend); +static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {
include/drm/drm_fb_helper.h +2 -0
@@ -166,6 +166,8 @@ void drm_fb_helper_cfb_copyarea(struct fb_info *info,void drm_fb_helper_cfb_imageblit (struct fb_info *info,const struct fb_image *image); +void drm_fb_helper_set_suspend (struct drm_fb_helper *fb_helper,int state); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 6/25 drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers
In reply to Archit TanejaSome drm drivers call remove_conflicting_framebuffers. Create a drm_fb_helper function that wraps around these calls.
This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitions
--- drivers/gpu/drm/drm_fb_helper.c | 15 +++++++++++++++ include/drm/drm_fb_helper.h | 4 ++++ 2 files changed, 19 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +15 -0
@@ -894,6 +894,21 @@ void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) }EXPORT_SYMBOL (drm_fb_helper_set_suspend); +/** +* drm_fb_helper_remove_conflicting_framebuffers - wrapper around +* remove_conflicting_framebuffers +* @fb_helper: driver-allocated fbdev helper +* +* A wrapper around remove_conflicting_framebuffers implemented by fbdev core +*/ +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary) +{ +return remove_conflicting_framebuffers (a, name, primary); +} +EXPORT_SYMBOL (drm_fb_helper_remove_conflicting_framebuffers); +static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {
include/drm/drm_fb_helper.h +4 -0
@@ -168,6 +168,10 @@ void drm_fb_helper_cfb_imageblit(struct fb_info *info,void drm_fb_helper_set_suspend (struct drm_fb_helper *fb_helper,int state); +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RESEND v2 06/25] drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers
Quoted 29 lines · Archit Taneja
Some drm drivers call
remove_conflicting_framebuffers. Create adrm_fb_helperfunction that wraps around these calls.This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitionsSigned-off-by Archit Taneja <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 15 +++++++++++++++ include/drm/drm_fb_helper.h | 4 ++++ 2 files changed, 19 insertions(+)drivers/gpu/drm/drm_fb_helper.c +4
-0@@ -894,6 +894,21 @@ void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) }EXPORT_SYMBOL (drm_fb_helper_set_suspend); +/** +* drm_fb_helper_remove_conflicting_framebuffers - wrapper around +* remove_conflicting_framebuffers +* @fb_helper: driver-allocated fbdev helper
drivers/gpu/drm/drm_fb_helper.c void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) · line 910
Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +10
-0+* +* A wrapper around remove_conflicting_framebuffers implemented by fbdev core +*/ +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary) +{ +return remove_conflicting_framebuffers (a, name, primary); +} +EXPORT_SYMBOL (drm_fb_helper_remove_conflicting_framebuffers);
Chris Wilson reported on irc that if he builds with I915_FBDEV=n then there's a missing symbol problem here because i915 wants to kick out other framebuffers (well we have to for correctness) even when fbdev emulation is disabled. If you look at i915_dma.c you'll see that the call to remove_conflicting_framebuffers is conditional upon CONFIG_FB and not CONFIG_I915_FBDEV.
I think the proper solution here would be to provide a static inline helper for remove_conflicting_framebuffer itself when CONFIG_FB=n, since a all drivers who call this still want to call this even when fbdev emulation is disabled.
Plan B would be to move this into core drm and make the static inline one selected for CONFIG_FB=n. If you do that then maybe also rename it to drm_remove_conflicting_framebuffer since this really is only tangetial to fbdev emulation.
Anyway current patch unfortunately won't work since we really must remove other framebuffers even in the FB=y, I915_FBDEV=n case. So I dropped it from drm-misc for now. Unfortunately that means all the driver conversions won't apply anymore either :(
Thanks, Daniel
Quoted 23 lines
drivers/gpu/drm/drm_fb_helper.c +1
-0+static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {include/drm/drm_fb_helper.h +4
-0@@ -168,6 +168,10 @@ void drm_fb_helper_cfb_imageblit(struct fb_info *info,void drm_fb_helper_set_suspend (struct drm_fb_helper *fb_helper,int state); +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RESEND v2 06/25] drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers
Quoted 58 lines · Daniel Vetter
Quoted 29 lines · Archit Taneja
Some drm drivers call
remove_conflicting_framebuffers. Create adrm_fb_helperfunction that wraps around these calls.This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitionsSigned-off-by Archit Taneja <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 15 +++++++++++++++ include/drm/drm_fb_helper.h | 4 ++++ 2 files changed, 19 insertions(+)drivers/gpu/drm/drm_fb_helper.c +4
-0@@ -894,6 +894,21 @@ void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) }EXPORT_SYMBOL (drm_fb_helper_set_suspend); +/** +* drm_fb_helper_remove_conflicting_framebuffers - wrapper around +* remove_conflicting_framebuffers +* @fb_helper: driver-allocated fbdev helper drivers/gpu/drm/drm_fb_helper.c void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) · line 910
Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +10
-0+* +* A wrapper around remove_conflicting_framebuffers implemented by fbdev core +*/ +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary) +{ +return remove_conflicting_framebuffers (a, name, primary); +} +EXPORT_SYMBOL (drm_fb_helper_remove_conflicting_framebuffers);Chris Wilson reported on irc that if he builds with I915_FBDEV=n then there's a missing symbol problem here because i915 wants to kick out other framebuffers (well we have to for correctness) even when fbdev emulation is disabled. If you look at
i915_dma.cyou'll see that the call toremove_conflicting_framebuffersis conditional uponCONFIG_FBand notCONFIG_I915_FBDEV.I think the proper solution here would be to provide a static inline helper for
remove_conflicting_framebufferitself whenCONFIG_FB=n, since a all drivers who call this still want to call this even when fbdev emulation is disabled.Plan B would be to move this into core drm and make the static inline one selected for
CONFIG_FB=n. If you do that then maybe also rename it todrm_remove_conflicting_framebuffersince this really is only tangetial to fbdev emulation.
Quoted 4 lines
Anyway current patch unfortunately won't work since we really must remove other framebuffers even in the FB=y, I915_FBDEV=n case. So I dropped it from drm-misc for now. Unfortunately that means all the driver conversions won't apply anymore either :(
Ok I didn't have to drop all of the driver specific patches since all the arm ones don't have calls to remove_conflicting_framebuffers. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RESEND v2 06/25] drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers
Quoted 59 lines · Daniel Vetter
Quoted 58 lines · Daniel Vetter
Quoted 29 lines · Archit Taneja
Some drm drivers call
remove_conflicting_framebuffers. Create adrm_fb_helperfunction that wraps around these calls.This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitionsSigned-off-by Archit Taneja <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 15 +++++++++++++++ include/drm/drm_fb_helper.h | 4 ++++ 2 files changed, 19 insertions(+)drivers/gpu/drm/drm_fb_helper.c +4
-0@@ -894,6 +894,21 @@ void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) }EXPORT_SYMBOL (drm_fb_helper_set_suspend); +/** +* drm_fb_helper_remove_conflicting_framebuffers - wrapper around +* remove_conflicting_framebuffers +* @fb_helper: driver-allocated fbdev helper drivers/gpu/drm/drm_fb_helper.c void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) · line 910
Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +10
-0+* +* A wrapper around remove_conflicting_framebuffers implemented by fbdev core +*/ +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary) +{ +return remove_conflicting_framebuffers (a, name, primary); +} +EXPORT_SYMBOL (drm_fb_helper_remove_conflicting_framebuffers);Chris Wilson reported on irc that if he builds with I915_FBDEV=n then there's a missing symbol problem here because i915 wants to kick out other framebuffers (well we have to for correctness) even when fbdev emulation is disabled. If you look at
i915_dma.cyou'll see that the call toremove_conflicting_framebuffersis conditional uponCONFIG_FBand notCONFIG_I915_FBDEV.I think the proper solution here would be to provide a static inline helper for
remove_conflicting_framebufferitself whenCONFIG_FB=n, since a all drivers who call this still want to call this even when fbdev emulation is disabled.Plan B would be to move this into core drm and make the static inline one selected for
CONFIG_FB=n. If you do that then maybe also rename it todrm_remove_conflicting_framebuffersince this really is only tangetial to fbdev emulation.
Quoted 7 lines
Quoted 4 lines
Anyway current patch unfortunately won't work since we really must remove other framebuffers even in the FB=y, I915_FBDEV=n case. So I dropped it from drm-misc for now. Unfortunately that means all the driver conversions won't apply anymore either :(
Ok I didn't have to drop all of the driver specific patches since all the arm ones don't have calls to
remove_conflicting_framebuffers.
I can re-spin the x86 ones and make them stick to the original remove_conflicting_framebuffers call. This way we can at least use the other helpers.
Archit
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RESEND v2 06/25] drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers
Quoted 67 lines · Archit Taneja
Quoted 64 lines · Daniel Vetter
Quoted 62 lines · Daniel Vetter
Quoted 29 lines · Archit Taneja
Some drm drivers call
remove_conflicting_framebuffers. Create adrm_fb_helperfunction that wraps around these calls.This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitionsSigned-off-by Archit Taneja <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 15 +++++++++++++++ include/drm/drm_fb_helper.h | 4 ++++ 2 files changed, 19 insertions(+)drivers/gpu/drm/drm_fb_helper.c +4
-0@@ -894,6 +894,21 @@ void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) }EXPORT_SYMBOL (drm_fb_helper_set_suspend); +/** +* drm_fb_helper_remove_conflicting_framebuffers - wrapper around +* remove_conflicting_framebuffers +* @fb_helper: driver-allocated fbdev helper drivers/gpu/drm/drm_fb_helper.c void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) · line 910
Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +10
-0+* +* A wrapper around remove_conflicting_framebuffers implemented by fbdev core +*/ +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary) +{ +return remove_conflicting_framebuffers (a, name, primary); +} +EXPORT_SYMBOL (drm_fb_helper_remove_conflicting_framebuffers);Chris Wilson reported on irc that if he builds with I915_FBDEV=n then there's a missing symbol problem here because i915 wants to kick out other framebuffers (well we have to for correctness) even when fbdev emulation is disabled. If you look at
i915_dma.cyou'll see that the call toremove_conflicting_framebuffersis conditional uponCONFIG_FBand notCONFIG_I915_FBDEV.I think the proper solution here would be to provide a static inline helper for
remove_conflicting_framebufferitself whenCONFIG_FB=n, since a all drivers who call this still want to call this even when fbdev emulation is disabled.Plan B would be to move this into core drm and make the static inline one selected for
CONFIG_FB=n. If you do that then maybe also rename it todrm_remove_conflicting_framebuffersince this really is only tangetial to fbdev emulation.Anyway current patch unfortunately won't work since we really must remove other framebuffers even in the FB=y, I915_FBDEV=n case. So I dropped it from drm-misc for now. Unfortunately that means all the driver conversions won't apply anymore either :(
Quoted 6 lines
Quoted 2 lines
Ok I didn't have to drop all of the driver specific patches since all the arm ones don't have calls to
remove_conflicting_framebuffers.I can re-spin the x86 ones and make them stick to the original
remove_conflicting_framebufferscall. This way we can at least use the other helpers.
Yeah that would work. btw for the kerneldoc I guess it would be easier if you just provide a fixup patch, changed my mind there. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RESEND v2 06/25] drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers
In reply to Daniel VetterQuoted 53 lines · Daniel Vetter
Quoted 29 lines · Archit Taneja
Some drm drivers call
remove_conflicting_framebuffers. Create adrm_fb_helperfunction that wraps around these calls.This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitionsSigned-off-by Archit Taneja <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 15 +++++++++++++++ include/drm/drm_fb_helper.h | 4 ++++ 2 files changed, 19 insertions(+)drivers/gpu/drm/drm_fb_helper.c +4
-0@@ -894,6 +894,21 @@ void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) }EXPORT_SYMBOL (drm_fb_helper_set_suspend); +/** +* drm_fb_helper_remove_conflicting_framebuffers - wrapper around +* remove_conflicting_framebuffers +* @fb_helper: driver-allocated fbdev helper drivers/gpu/drm/drm_fb_helper.c void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) · line 910
Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +10
-0+* +* A wrapper around remove_conflicting_framebuffers implemented by fbdev core +*/ +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary) +{ +return remove_conflicting_framebuffers (a, name, primary); +} +EXPORT_SYMBOL (drm_fb_helper_remove_conflicting_framebuffers);Chris Wilson reported on irc that if he builds with I915_FBDEV=n then there's a missing symbol problem here because i915 wants to kick out other framebuffers (well we have to for correctness) even when fbdev emulation is disabled. If you look at
i915_dma.cyou'll see that the call toremove_conflicting_framebuffersis conditional uponCONFIG_FBand notCONFIG_I915_FBDEV.I think the proper solution here would be to provide a static inline helper for
remove_conflicting_framebufferitself whenCONFIG_FB=n, since a all drivers who call this still want to call this even when fbdev emulation is disabled.
Quoted 4 lines
Plan B would be to move this into core drm and make the static inline one selected for
CONFIG_FB=n. If you do that then maybe also rename it todrm_remove_conflicting_framebuffersince this really is only tangetial to fbdev emulation.
The remove_conflicting_framebuffers calls do_unregister_framebuffer(), which seems to be quite central to fb core, and can't just work without other fb core funcs.
What I don't get is, if legacy fb was never enabled, how did we end up registering fbs in the first place?
Could you briefly explain what these other 'framebuffers' are that remove_conflicting_framebuffers removes? The comments say that they are firmware allocated fbs. I'm not well versed with what happens in desktop graphics.
Archit
Quoted 31 lines
Anyway current patch unfortunately won't work since we really must remove other framebuffers even in the FB=y, I915_FBDEV=n case. So I dropped it from drm-misc for now. Unfortunately that means all the driver conversions won't apply anymore either :(
Thanks, Daniel
Quoted 23 lines
drivers/gpu/drm/drm_fb_helper.c +1
-0+static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {include/drm/drm_fb_helper.h +4
-1@@ -168,6 +168,10 @@ void drm_fb_helper_cfb_imageblit(struct fb_info *info,void drm_fb_helper_set_suspend (struct drm_fb_helper *fb_helper,int state); +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper); --The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RESEND v2 06/25] drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers
Quoted 65 lines · Archit Taneja
Quoted 53 lines · Daniel Vetter
Quoted 29 lines · Archit Taneja
Some drm drivers call
remove_conflicting_framebuffers. Create adrm_fb_helperfunction that wraps around these calls.This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitionsSigned-off-by Archit Taneja <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 15 +++++++++++++++ include/drm/drm_fb_helper.h | 4 ++++ 2 files changed, 19 insertions(+)drivers/gpu/drm/drm_fb_helper.c +4
-0@@ -894,6 +894,21 @@ void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) }EXPORT_SYMBOL (drm_fb_helper_set_suspend); +/** +* drm_fb_helper_remove_conflicting_framebuffers - wrapper around +* remove_conflicting_framebuffers +* @fb_helper: driver-allocated fbdev helper drivers/gpu/drm/drm_fb_helper.c void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state) · line 910
Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +10
-0+* +* A wrapper around remove_conflicting_framebuffers implemented by fbdev core +*/ +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary) +{ +return remove_conflicting_framebuffers (a, name, primary); +} +EXPORT_SYMBOL (drm_fb_helper_remove_conflicting_framebuffers);Chris Wilson reported on irc that if he builds with I915_FBDEV=n then there's a missing symbol problem here because i915 wants to kick out other framebuffers (well we have to for correctness) even when fbdev emulation is disabled. If you look at
i915_dma.cyou'll see that the call toremove_conflicting_framebuffersis conditional uponCONFIG_FBand notCONFIG_I915_FBDEV.I think the proper solution here would be to provide a static inline helper for
remove_conflicting_framebufferitself whenCONFIG_FB=n, since a all drivers who call this still want to call this even when fbdev emulation is disabled.Quoted 4 lines
Plan B would be to move this into core drm and make the static inline one selected for
CONFIG_FB=n. If you do that then maybe also rename it todrm_remove_conflicting_framebuffersince this really is only tangetial to fbdev emulation.The
remove_conflicting_framebufferscallsdo_unregister_framebuffer(), which seems to be quite central to fb core, and can't just work without other fb core funcs.
Quoted 7 lines
What I don't get is, if legacy fb was never enabled, how did we end up registering fbs in the first place?
Could you briefly explain what these other 'framebuffers' are that
remove_conflicting_framebuffersremoves? The comments say that they are firmware allocated fbs. I'm not well versed with what happens in desktop graphics.
Following config is the relevant one:
CONFIG_FB=yCONFIG_DRM_I915_FBDEV=n
I.e. core fbdev is enabled and so we might load vesafb or efifb and similar firmware fbdev drivers. But drm/i915 fbdev emulation isn't enabled. Still we absolutely must kick off these firmware fbs in that case.
-Daniel
Quoted 38 lines
Archit
Quoted 31 lines
Anyway current patch unfortunately won't work since we really must remove other framebuffers even in the FB=y, I915_FBDEV=n case. So I dropped it from drm-misc for now. Unfortunately that means all the driver conversions won't apply anymore either :(
Thanks, Daniel
Quoted 23 lines
drivers/gpu/drm/drm_fb_helper.c +1
-0+static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {include/drm/drm_fb_helper.h +4
-1@@ -168,6 +168,10 @@ void drm_fb_helper_cfb_imageblit(struct fb_info *info,void drm_fb_helper_set_suspend (struct drm_fb_helper *fb_helper,int state); +int drm_fb_helper_remove_conflicting_framebuffers (struct apertures_struct *a, +const char *name, +bool primary); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper); --The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 7/25 drm/cirrus: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly.
v2:
- Remove stray goto label out_iounmap
--- drivers/gpu/drm/cirrus/cirrus_drv.c | 7 +++--- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 41 +++++++---------------------------- 2 files changed, 12 insertions(+), 36 deletions(-)
drivers/gpu/drm/cirrus/cirrus_drv.c +4 -3
@@ -56,7 +56,8 @@ static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev)#ifdef CONFIG_X86 primary = pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ;#endif -remove_conflicting_framebuffers (ap,"cirrusdrmfb" , primary); +drm_fb_helper_remove_conflicting_framebuffers (ap,"cirrusdrmfb" , + primary);kfree (ap);return 0 ;
@@ -92,7 +93,7 @@ static int cirrus_pm_suspend(struct device *dev)if (cdev->mode_info.gfbdev) {console_lock (); -fb_set_suspend (cdev->mode_info.gfbdev->helper.fbdev,1 ); +drm_fb_helper_set_suspend (&cdev->mode_info.gfbdev->helper,1 );console_unlock (); }
@@ -109,7 +110,7 @@ static int cirrus_pm_resume(struct device *dev)if (cdev->mode_info.gfbdev) {console_lock (); -fb_set_suspend (cdev->mode_info.gfbdev->helper.fbdev,0 ); +drm_fb_helper_set_suspend (&cdev->mode_info.gfbdev->helper,0 );console_unlock (); }
drivers/gpu/drm/cirrus/cirrus_fbdev.c +8 -33
109 lines not on this page · raw message
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 8/25 drm/rockchip: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
This is an effort to create a top level drm fbdev emulation option.
--- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 47 +++++++-------------------- 1 file changed, 12 insertions(+), 35 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c +12 -35
@@ -37,9 +37,9 @@ static int rockchip_fbdev_mmap(struct fb_info *info,static struct fb_ops rockchip_drm_fbdev_ops = { .owner =THIS_MODULE , .fb_mmap = rockchip_fbdev_mmap, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank,
@@ -77,10 +77,10 @@ static int rockchip_drm_fbdev_create(struct drm_fb_helper *helper, private->fbdev_bo = &rk_obj->base; - fbi =framebuffer_alloc (0 , dev->dev); -if (!fbi) { -dev_err (dev->dev,"Failed to allocate framebuffer info.\n" ); - ret = -ENOMEM ; + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) { +dev_err (dev->dev,"Failed to create framebuffer info.\n" ); + ret =PTR_ERR (fbi); goto err_rockchip_gem_free_object; }
@@ -89,21 +89,13 @@ static int rockchip_drm_fbdev_create(struct drm_fb_helper *helper,if (IS_ERR (helper->fb)) {dev_err (dev->dev,"Failed to allocate DRM framebuffer.\n" ); ret =PTR_ERR (helper->fb); - goto err_framebuffer_release; + goto err_release_fbi; } - helper->fbdev = fbi; - fbi->par = helper; fbi->flags =FBINFO_FLAG_DEFAULT ; fbi->fbops = &rockchip_drm_fbdev_ops; - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { -dev_err (dev->dev,"Failed to allocate color map.\n" ); - goto err_drm_framebuffer_unref; - } - fb = helper->fb;drm_fb_helper_fill_fix (fbi, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (fbi, helper, sizes->fb_width, sizes->fb_height);
@@ -124,10 +116,8 @@ static int rockchip_drm_fbdev_create(struct drm_fb_helper *helper,return 0 ; -err_drm_framebuffer_unref: -drm_framebuffer_unreference (helper->fb); -err_framebuffer_release: -framebuffer_release (fbi); +err_release_fbi: +drm_fb_helper_release_fbi (helper); err_rockchip_gem_free_object:rockchip_gem_free_object (&rk_obj->base);return ret;
@@ -190,21 +180,8 @@ void rockchip_drm_fbdev_fini(struct drm_device *dev) helper = &private->fbdev_helper; -if (helper->fbdev) { -struct fb_info *info; -int ret; - - info = helper->fbdev; - ret =unregister_framebuffer (info); -if (ret <0 ) -DRM_DEBUG_KMS ("failed unregister_framebuffer() - %d\n" , - ret); - -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (helper); +drm_fb_helper_release_fbi (helper);if (helper->fb)drm_framebuffer_unreference (helper->fb);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 9/25 drm/armada: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/armada/armada_fbdev.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-)
drivers/gpu/drm/armada/armada_fbdev.c +10 -23
@@ -22,9 +22,9 @@ static /*const*/ struct fb_ops armada_fb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -80,18 +80,12 @@ static int armada_fb_create(struct drm_fb_helper *fbh,if (IS_ERR (dfb))return PTR_ERR (dfb); - info =framebuffer_alloc (0 , dev->dev); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (fbh); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto err_fballoc; } - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto err_fbcmap; - } -strlcpy (info->fix.id,"armada-drmfb" ,sizeof (info->fix.id)); info->par = fbh; info->flags =FBINFO_DEFAULT |FBINFO_CAN_FORCE_OUTPUT ;
@@ -101,7 +95,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh, info->screen_size = obj->obj.size; info->screen_base = ptr; fbh->fb = &dfb->fb; - fbh->fbdev = info; +drm_fb_helper_fill_fix (info, dfb->fb.pitches[0 ], dfb->fb.depth);drm_fb_helper_fill_var (info, fbh, sizes->fb_width, sizes->fb_height);
@@ -111,8 +105,6 @@ static int armada_fb_create(struct drm_fb_helper *fbh,return 0 ; - err_fbcmap: -framebuffer_release (info); err_fballoc: dfb->fb.funcs->destroy (&dfb->fb);return ret;
@@ -171,6 +163,7 @@ int armada_fbdev_init(struct drm_device *dev)return 0 ; err_fb_setup: +drm_fb_helper_release_fbi (fbh);drm_fb_helper_fini (fbh); err_fb_helper: priv->fbdev =NULL ;
@@ -191,14 +184,8 @@ void armada_fbdev_fini(struct drm_device *dev)struct drm_fb_helper *fbh = priv->fbdev;if (fbh) { -struct fb_info *info = fbh->fbdev; - -if (info) { -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (fbh); +drm_fb_helper_release_fbi (fbh);drm_fb_helper_fini (fbh);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 10/25 drm/ast: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
Cleaned up the error handling in astfb_create a bit.
v2:
- removed unused variable 'device' in astfb_create
--- drivers/gpu/drm/ast/ast_fb.c | 48 ++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 31 deletions(-)
drivers/gpu/drm/ast/ast_fb.c +17 -31
@@ -125,7 +125,7 @@ static void ast_fillrect(struct fb_info *info, const struct fb_fillrect *rect) {struct ast_fbdev *afbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);ast_dirty_update (afbdev, rect->dx, rect->dy, rect->width, rect->height); }
@@ -134,7 +134,7 @@ static void ast_copyarea(struct fb_info *info, const struct fb_copyarea *area) {struct ast_fbdev *afbdev = info->par; -sys_copyarea (info, area); +drm_fb_helper_sys_copyarea (info, area);ast_dirty_update (afbdev, area->dx, area->dy, area->width, area->height); }
@@ -143,7 +143,7 @@ static void ast_imageblit(struct fb_info *info, const struct fb_image *image) {struct ast_fbdev *afbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);ast_dirty_update (afbdev, image->dx, image->dy, image->width, image->height); }
@@ -193,7 +193,6 @@ static int astfb_create(struct drm_fb_helper *helper,struct drm_framebuffer *fb;struct fb_info *info;int size, ret; -struct device *device = &dev->pdev->dev;void *sysram;struct drm_gem_object *gobj =NULL ;struct ast_bo *bo =NULL ;
@@ -217,40 +216,28 @@ static int astfb_create(struct drm_fb_helper *helper,if (!sysram)return -ENOMEM ; - info =framebuffer_alloc (0 , device); -if (!info) { - ret = -ENOMEM ; - goto out; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); + goto err_free_vram; } info->par = afbdev; ret =ast_framebuffer_init (dev, &afbdev->afb, &mode_cmd, gobj);if (ret) - goto out; + goto err_release_fbi; afbdev->sysram = sysram; afbdev->size = size; fb = &afbdev->afb.base; afbdev->helper.fb = fb; - afbdev->helper.fbdev = info;strcpy (info->fix.id,"astdrmfb" ); info->flags =FBINFO_DEFAULT |FBINFO_CAN_FORCE_OUTPUT ; info->fbops = &astfb_ops; - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out; - } - - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out; - } info->apertures->ranges[0 ].base =pci_resource_start (dev->pdev,0 ); info->apertures->ranges[0 ].size =pci_resource_len (dev->pdev,0 );
@@ -266,7 +253,11 @@ static int astfb_create(struct drm_fb_helper *helper, fb->width, fb->height);return 0 ; -out: + +err_release_fbi: +drm_fb_helper_release_fbi (helper); +err_free_vram: +vfree (afbdev->sysram);return ret; }
@@ -297,15 +288,10 @@ static const struct drm_fb_helper_funcs ast_fb_helper_funcs = {static void ast_fbdev_destroy (struct drm_device *dev,struct ast_fbdev *afbdev) { -struct fb_info *info;struct ast_framebuffer *afb = &afbdev->afb; -if (afbdev->helper.fbdev) { - info = afbdev->helper.fbdev; -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } + +drm_fb_helper_unregister_fbi (&afbdev->helper); +drm_fb_helper_release_fbi (&afbdev->helper);if (afb->obj) {drm_gem_object_unreference_unlocked (afb->obj);
@@ -377,5 +363,5 @@ void ast_fbdev_set_suspend(struct drm_device *dev, int state)if (!ast->fbdev)return ; -fb_set_suspend (ast->fbdev->helper.fbdev, state); +drm_fb_helper_set_suspend (&ast->fbdev->helper, state); }
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 11/25 drm/omap: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/omapdrm/omap_fbdev.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-)
drivers/gpu/drm/omapdrm/omap_fbdev.c +11 -23
@@ -86,11 +86,11 @@ static struct fb_ops omap_fb_ops = {/* Note: to properly handle manual update displays, we wrap the * basic fbdev ops which write to the framebuffer */ - .fb_read = fb_sys_read, - .fb_write = fb_sys_write, - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_read = drm_fb_helper_sys_read, + .fb_write = drm_fb_helper_sys_write, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par,
@@ -179,7 +179,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,mutex_lock (&dev->struct_mutex); - fbi =framebuffer_alloc (0 , dev->dev); + fbi =drm_fb_helper_alloc_fbi (helper);if (!fbi) {dev_err (dev->dev,"failed to allocate fb info\n" ); ret = -ENOMEM ;
@@ -190,7 +190,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, fbdev->fb = fb; helper->fb = fb; - helper->fbdev = fbi; fbi->par = helper; fbi->flags =FBINFO_DEFAULT ;
@@ -198,12 +197,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,strcpy (fbi->fix.id,MODULE_NAME ); - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto fail_unlock; - } -drm_fb_helper_fill_fix (fbi, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (fbi, helper, sizes->fb_width, sizes->fb_height);
@@ -236,8 +229,9 @@ fail_unlock: fail:if (ret) { -if (fbi) -framebuffer_release (fbi); + +drm_fb_helper_release_fbi (helper); +if (fb) {drm_framebuffer_unregister_private (fb);drm_framebuffer_remove (fb);
@@ -312,17 +306,11 @@ void omap_fbdev_free(struct drm_device *dev)struct omap_drm_private *priv = dev->dev_private;struct drm_fb_helper *helper = priv->fbdev;struct omap_fbdev *fbdev; -struct fb_info *fbi;DBG (); - fbi = helper->fbdev; - -/* only cleanup framebuffer if it is present */ -if (fbi) { -unregister_framebuffer (fbi); -framebuffer_release (fbi); - } +drm_fb_helper_unregister_fbi (helper); +drm_fb_helper_release_fbi (helper);drm_fb_helper_fini (helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 12/25 drm/tegra: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- Fix up error handling path in tegra_fbdev_probe
--- drivers/gpu/drm/tegra/fb.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-)
drivers/gpu/drm/tegra/fb.c +9 -26
@@ -184,9 +184,9 @@ unreference:#ifdef CONFIG_DRM_TEGRA_FBDEV static struct fb_ops tegra_fb_ops = { .owner =THIS_MODULE , - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank,
@@ -224,11 +224,11 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,if (IS_ERR (bo))return PTR_ERR (bo); - info =framebuffer_alloc (0 , drm->dev); -if (!info) { + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) {dev_err (drm->dev,"failed to allocate framebuffer info\n" );drm_gem_object_unreference_unlocked (&bo->gem); -return -ENOMEM ; +return PTR_ERR (info); } fbdev->fb =tegra_fb_alloc (drm, &cmd, &bo,1 );
@@ -248,12 +248,6 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, info->flags =FBINFO_FLAG_DEFAULT ; info->fbops = &tegra_fb_ops; - err =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (err <0 ) { -dev_err (drm->dev,"failed to allocate color map: %d\n" , err); - goto destroy; - } -drm_fb_helper_fill_fix (info, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (info, helper, fb->width, fb->height);
@@ -282,7 +276,7 @@ destroy:drm_framebuffer_unregister_private (fb);tegra_fb_destroy (fb); release: -framebuffer_release (info); +drm_fb_helper_release_fbi (helper);return err; }
@@ -347,20 +341,9 @@ fini:static void tegra_fbdev_exit (struct tegra_fbdev *fbdev) { -struct fb_info *info = fbdev->base.fbdev; - -if (info) { -int err; - err =unregister_framebuffer (info); -if (err <0 ) -DRM_DEBUG_KMS ("failed to unregister framebuffer\n" ); - -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&fbdev->base); +drm_fb_helper_release_fbi (&fbdev->base);if (fbdev->fb) {drm_framebuffer_unregister_private (&fbdev->fb->base);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 13/25 drm/msm: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/msm/msm_fbdev.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-)
drivers/gpu/drm/msm/msm_fbdev.c +10 -24
@@ -43,11 +43,11 @@ static struct fb_ops msm_fb_ops = {/* Note: to properly handle manual update displays, we wrap the * basic fbdev ops which write to the framebuffer */ - .fb_read = fb_sys_read, - .fb_write = fb_sys_write, - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_read = drm_fb_helper_sys_read, + .fb_write = drm_fb_helper_sys_write, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_mmap = msm_fbdev_mmap, .fb_check_var = drm_fb_helper_check_var,
@@ -144,10 +144,10 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, goto fail_unlock; } - fbi =framebuffer_alloc (0 , dev->dev); -if (!fbi) { + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) {dev_err (dev->dev,"failed to allocate fb info\n" ); - ret = -ENOMEM ; + ret =PTR_ERR (fbi); goto fail_unlock; }
@@ -155,7 +155,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, fbdev->fb = fb; helper->fb = fb; - helper->fbdev = fbi; fbi->par = helper; fbi->flags =FBINFO_DEFAULT ;
@@ -163,12 +162,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,strcpy (fbi->fix.id,"msm" ); - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto fail_unlock; - } -drm_fb_helper_fill_fix (fbi, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (fbi, helper, sizes->fb_width, sizes->fb_height);
@@ -191,7 +184,6 @@ fail_unlock: fail:if (ret) { -framebuffer_release (fbi);if (fb) {drm_framebuffer_unregister_private (fb);drm_framebuffer_remove (fb);
@@ -266,17 +258,11 @@ void msm_fbdev_free(struct drm_device *dev)struct msm_drm_private *priv = dev->dev_private;struct drm_fb_helper *helper = priv->fbdev;struct msm_fbdev *fbdev; -struct fb_info *fbi;DBG (); - fbi = helper->fbdev; - -/* only cleanup framebuffer if it is present */ -if (fbi) { -unregister_framebuffer (fbi); -framebuffer_release (fbi); - } +drm_fb_helper_unregister_fbi (helper); +drm_fb_helper_release_fbi (helper);drm_fb_helper_fini (helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 14/25 drm/exynos: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- Remove unnecessary dealloc cmap in error handling path
--- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 47 ++++++++----------------------- 1 file changed, 12 insertions(+), 35 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +12 -35
@@ -65,9 +65,9 @@ static int exynos_drm_fb_mmap(struct fb_info *info,static struct fb_ops exynos_drm_fb_ops = { .owner =THIS_MODULE , .fb_mmap = exynos_drm_fb_mmap, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank,
@@ -142,10 +142,10 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,mutex_lock (&dev->struct_mutex); - fbi =framebuffer_alloc (0 , &pdev->dev); -if (!fbi) { + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) {DRM_ERROR ("failed to allocate fb info.\n" ); - ret = -ENOMEM ; + ret =PTR_ERR (fbi); goto out; }
@@ -165,7 +165,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,if (IS_ERR (exynos_gem_obj)) { ret =PTR_ERR (exynos_gem_obj); - goto err_release_framebuffer; + goto err_release_fbi; } exynos_fbdev->exynos_gem_obj = exynos_gem_obj;
@@ -178,33 +178,23 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, goto err_destroy_gem; } - helper->fbdev = fbi; - fbi->par = helper; fbi->flags =FBINFO_FLAG_DEFAULT ; fbi->fbops = &exynos_drm_fb_ops; - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { -DRM_ERROR ("failed to allocate cmap.\n" ); - goto err_destroy_framebuffer; - } - ret =exynos_drm_fbdev_update (helper, sizes, helper->fb);if (ret <0 ) - goto err_dealloc_cmap; + goto err_destroy_framebuffer;mutex_unlock (&dev->struct_mutex);return ret; -err_dealloc_cmap: -fb_dealloc_cmap (&fbi->cmap); err_destroy_framebuffer:drm_framebuffer_cleanup (helper->fb); err_destroy_gem:exynos_drm_gem_destroy (exynos_gem_obj); -err_release_framebuffer: -framebuffer_release (fbi); +err_release_fbi: +drm_fb_helper_release_fbi (helper);/* * if failed, all resources allocated above would be released by
@@ -312,21 +302,8 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, } } -/* release linux framebuffer */ -if (fb_helper->fbdev) { -struct fb_info *info; -int ret; - - info = fb_helper->fbdev; - ret =unregister_framebuffer (info); -if (ret <0 ) -DRM_DEBUG_KMS ("failed unregister_framebuffer()\n" ); - -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (fb_helper); +drm_fb_helper_release_fbi (fb_helper);drm_fb_helper_fini (fb_helper); }
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 15/25 drm/gma500: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- removed unused variable 'device' in psbfb_create
--- drivers/gpu/drm/gma500/accel_2d.c | 6 ++--- drivers/gpu/drm/gma500/framebuffer.c | 48 ++++++++++++------------------------ 2 files changed, 19 insertions(+), 35 deletions(-)
drivers/gpu/drm/gma500/accel_2d.c +3 -3
@@ -276,12 +276,12 @@ static void psbfb_copyarea_accel(struct fb_info *info,break ;default :/* software fallback */ -cfb_copyarea (info, a); +drm_fb_helper_cfb_copyarea (info, a);return ; }if (!gma_power_begin (dev, false)) { -cfb_copyarea (info, a); +drm_fb_helper_cfb_copyarea (info, a);return ; } psb_accel_2d_copy(dev_priv,
@@ -308,7 +308,7 @@ void psbfb_copyarea(struct fb_info *info,/* Avoid the 8 pixel erratum */ if (region->width ==8 || region->height ==8 || (info->flags &FBINFO_HWACCEL_DISABLED )) -return cfb_copyarea (info, region); +return drm_fb_helper_cfb_copyarea (info, region);psbfb_copyarea_accel (info, region); }
drivers/gpu/drm/gma500/framebuffer.c +16 -32
111 lines not on this page · raw message
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RESEND v2 15/25] drm/gma500: Use new drm_fb_helper functions
Quoted 169 lines · Archit Taneja
Use the newly created wrapper
drm_fb_helperfunctions instead of calling core fbdev functions directly. They also simplify thefb_infocreation.v2:
- removed unused variable 'device' inpsbfb_createCc Patrik Jakobsson <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Archit Taneja <[email protected]>--- drivers/gpu/drm/gma500/accel_2d.c | 6 ++--- drivers/gpu/drm/gma500/framebuffer.c | 48 ++++++++++++------------------------ 2 files changed, 19 insertions(+), 35 deletions(-)drivers/gpu/drm/gma500/accel_2d.c +3
-3@@ -276,12 +276,12 @@ static void psbfb_copyarea_accel(struct fb_info *info,break ;default :/* software fallback */ -cfb_copyarea (info, a); +drm_fb_helper_cfb_copyarea (info, a);return ; }if (!gma_power_begin (dev, false)) { -cfb_copyarea (info, a); +drm_fb_helper_cfb_copyarea (info, a);return ; } psb_accel_2d_copy(dev_priv,@@ -308,7 +308,7 @@ void psbfb_copyarea(struct fb_info *info,/* Avoid the 8 pixel erratum */ if (region->width ==8 || region->height ==8 || (info->flags &FBINFO_HWACCEL_DISABLED )) -return cfb_copyarea (info, region); +return drm_fb_helper_cfb_copyarea (info, region);psbfb_copyarea_accel (info, region); }drivers/gpu/drm/gma500/framebuffer.c +16
-33@@ -194,9 +194,9 @@ static struct fb_ops psbfb_ops = { .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank, .fb_setcolreg = psbfb_setcolreg, - .fb_fillrect = cfb_fillrect, + .fb_fillrect = drm_fb_helper_cfb_fillrect, .fb_copyarea = psbfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_mmap = psbfb_mmap, .fb_sync = psbfb_sync, .fb_ioctl = psbfb_ioctl,@@ -208,9 +208,9 @@ static struct fb_ops psbfb_roll_ops = { .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank, .fb_setcolreg = psbfb_setcolreg, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_pan_display = psbfb_pan, .fb_mmap = psbfb_mmap, .fb_ioctl = psbfb_ioctl,@@ -222,9 +222,9 @@ static struct fb_ops psbfb_unaccel_ops = { .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank, .fb_setcolreg = psbfb_setcolreg, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_mmap = psbfb_mmap, .fb_ioctl = psbfb_ioctl, };@@ -343,7 +343,6 @@ static int psbfb_create(struct psb_fbdev *fbdev,struct drm_framebuffer *fb;struct psb_framebuffer *psbfb = &fbdev->pfb;struct drm_mode_fb_cmd2 mode_cmd; -struct device *device = &dev->pdev->dev;int size;int ret;struct gtt_range *backing;@@ -409,9 +408,9 @@ static int psbfb_create(struct psb_fbdev *fbdev,mutex_lock (&dev->struct_mutex); - info =framebuffer_alloc (0 , device); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (&fbdev->psb_fb_helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_err1; } info->par = fbdev;@@ -426,7 +425,6 @@ static int psbfb_create(struct psb_fbdev *fbdev, psbfb->fbdev = info; fbdev->psb_fb_helper.fb = fb; - fbdev->psb_fb_helper.fbdev = info;drm_fb_helper_fill_fix (info, fb->pitches[0 ], fb->depth);strcpy (info->fix.id,"psbdrmfb" );@@ -440,12 +438,6 @@ static int psbfb_create(struct psb_fbdev *fbdev, }else /* Software */ info->fbops = &psbfb_unaccel_ops; - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out_unref; - } - info->fix.smem_start = dev->mode_config.fb_base; info->fix.smem_len = size; info->fix.ywrapstep = gtt_roll;@@ -456,11 +448,6 @@ static int psbfb_create(struct psb_fbdev *fbdev, info->screen_size = size;if (dev_priv->gtt.stolen_size) { - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out_unref; - } info->apertures->ranges[0 ].base = dev->mode_config.fb_base; info->apertures->ranges[0 ].size = dev_priv->gtt.stolen_size; }@@ -483,6 +470,8 @@ out_unref:psb_gtt_free_range (dev, backing); else drm_gem_object_unreference(&backing->gem); + +drm_fb_helper_release_fbi (&fbdev->psb_fb_helper); out_err1:mutex_unlock (&dev->struct_mutex);psb_gtt_free_range (dev, backing);@@ -570,16 +559,11 @@ static const struct drm_fb_helper_funcs psb_fb_helper_funcs = {static int psb_fbdev_destroy (struct drm_device *dev,struct psb_fbdev *fbdev) { -struct fb_info *info;struct psb_framebuffer *psbfb = &fbdev->pfb; -if (fbdev->psb_fb_helper.fbdev) { - info = fbdev->psb_fb_helper.fbdev; -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&fbdev->psb_fb_helper); +drm_fb_helper_release_fbi (&fbdev->psb_fb_helper); +drm_fb_helper_fini (&fbdev->psb_fb_helper);drm_framebuffer_unregister_private (&psbfb->base);drm_framebuffer_cleanup (&psbfb->base); --
Quoted 3 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 16/25 drm/mgag200: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- remove unused goto label 'out'
--- drivers/gpu/drm/mgag200/mgag200_drv.c | 3 ++- drivers/gpu/drm/mgag200/mgag200_fb.c | 39 +++++++--------------------------- drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- 3 files changed, 11 insertions(+), 33 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +2 -1
@@ -55,7 +55,8 @@ static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev)#ifdef CONFIG_X86 primary = pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ;#endif -remove_conflicting_framebuffers (ap,"mgag200drmfb" , primary); +drm_fb_helper_remove_conflicting_framebuffers (ap,"mgag200drmfb" , + primary);kfree (ap); }
drivers/gpu/drm/mgag200/mgag200_fb.c +8 -31
@@ -101,7 +101,7 @@ static void mga_fillrect(struct fb_info *info, const struct fb_fillrect *rect) {struct mga_fbdev *mfbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);mga_dirty_update (mfbdev, rect->dx, rect->dy, rect->width, rect->height); }
@@ -110,7 +110,7 @@ static void mga_copyarea(struct fb_info *info, const struct fb_copyarea *area) {struct mga_fbdev *mfbdev = info->par; -sys_copyarea (info, area); +drm_fb_helper_sys_copyarea (info, area);mga_dirty_update (mfbdev, area->dx, area->dy, area->width, area->height); }
@@ -119,7 +119,7 @@ static void mga_imageblit(struct fb_info *info, const struct fb_image *image) {struct mga_fbdev *mfbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);mga_dirty_update (mfbdev, image->dx, image->dy, image->width, image->height); }
@@ -166,7 +166,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper,struct fb_info *info;struct drm_framebuffer *fb;struct drm_gem_object *gobj =NULL ; -struct device *device = &dev->pdev->dev;struct mgag200_bo *bo;int ret;void *sysram;
@@ -191,9 +190,9 @@ static int mgag200fb_create(struct drm_fb_helper *helper,if (!sysram)return -ENOMEM ; - info =framebuffer_alloc (0 , device); -if (info ==NULL ) -return -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) +return PTR_ERR (info); info->par = mfbdev;
@@ -208,14 +207,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper,/* setup helper */ mfbdev->helper.fb = fb; - mfbdev->helper.fbdev = info; - - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { -DRM_ERROR ("%s: can't allocate color map\n" , info->fix.id); - ret = -ENOMEM ; - goto out; - }strcpy (info->fix.id,"mgadrmfb" );
@@ -223,11 +214,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper, info->fbops = &mgag200fb_ops;/* setup aperture base/size for vesafb takeover */ - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out; - } info->apertures->ranges[0 ].base = mdev->dev->mode_config.fb_base; info->apertures->ranges[0 ].size = mdev->mc.vram_size;
@@ -242,24 +228,15 @@ static int mgag200fb_create(struct drm_fb_helper *helper,DRM_DEBUG_KMS ("allocated %dx%d\n" , fb->width, fb->height);return 0 ; -out: -return ret; }static int mga_fbdev_destroy (struct drm_device *dev,struct mga_fbdev *mfbdev) { -struct fb_info *info;struct mga_framebuffer *mfb = &mfbdev->mfb; -if (mfbdev->helper.fbdev) { - info = mfbdev->helper.fbdev; - -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&mfbdev->helper); +drm_fb_helper_release_fbi (&mfbdev->helper);if (mfb->obj) {drm_gem_object_unreference_unlocked (mfb->obj);
drivers/gpu/drm/mgag200/mgag200_main.c +1 -1
@@ -128,7 +128,7 @@ static int mga_vram_init(struct mga_device *mdev) aper->ranges[0 ].base = mdev->mc.vram_base; aper->ranges[0 ].size = mdev->mc.vram_window; -remove_conflicting_framebuffers (aper,"mgafb" , true); +drm_fb_helper_remove_conflicting_framebuffers (aper,"mgafb" , true);kfree (aper); if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window,
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 17/25 drm/radeon: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- Fix build break because of missing include of drm_fb_helper in radeon_drv.c
--- drivers/gpu/drm/radeon/radeon_drv.c | 4 +++- drivers/gpu/drm/radeon/radeon_fb.c | 42 +++++++++++-------------------------- 2 files changed, 15 insertions(+), 31 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +3 -1
@@ -39,6 +39,7 @@#include <linux/pm_runtime.h> #include <linux/vga_switcheroo.h> #include <drm/drm_gem.h> +#include <drm/drm_fb_helper.h> #include "drm_crtc_helper.h" #include "radeon_kfd.h"
@@ -390,7 +391,8 @@ static int radeon_kick_out_firmware_fb(struct pci_dev *pdev)#ifdef CONFIG_X86 primary = pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ;#endif -remove_conflicting_framebuffers (ap,"radeondrmfb" , primary); +drm_fb_helper_remove_conflicting_framebuffers (ap,"radeondrmfb" , + primary);kfree (ap);return 0 ;
drivers/gpu/drm/radeon/radeon_fb.c +12 -30
98 lines not on this page · raw message
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 18/25 drm/qxl: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/qxl/qxl_fb.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)
drivers/gpu/drm/qxl/qxl_fb.c +13 -27
@@ -197,7 +197,7 @@ static void qxl_fb_fillrect(struct fb_info *info, {struct qxl_fbdev *qfbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);qxl_dirty_update (qfbdev, rect->dx, rect->dy, rect->width, rect->height); }
@@ -207,7 +207,7 @@ static void qxl_fb_copyarea(struct fb_info *info, {struct qxl_fbdev *qfbdev = info->par; -sys_copyarea (info, area); +drm_fb_helper_sys_copyarea (info, area);qxl_dirty_update (qfbdev, area->dx, area->dy, area->width, area->height); }
@@ -217,7 +217,7 @@ static void qxl_fb_imageblit(struct fb_info *info, {struct qxl_fbdev *qfbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);qxl_dirty_update (qfbdev, image->dx, image->dy, image->width, image->height); }
@@ -345,7 +345,6 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,struct drm_mode_fb_cmd2 mode_cmd;struct drm_gem_object *gobj =NULL ;struct qxl_bo *qbo =NULL ; -struct device *device = &qdev->pdev->dev;int ret;int size;int bpp = sizes->surface_bpp;
@@ -374,9 +373,9 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev, shadow); size = mode_cmd.pitches[0 ] * mode_cmd.height; - info =framebuffer_alloc (0 , device); -if (info ==NULL ) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (&qfbdev->helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_unref; }
@@ -388,7 +387,7 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,/* setup helper with fb data */ qfbdev->helper.fb = fb; - qfbdev->helper.fbdev = info; + qfbdev->shadow = shadow;strcpy (info->fix.id,"qxldrmfb" );
@@ -410,11 +409,6 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev, sizes->fb_height);/* setup aperture base/size for vesafb takeover */ - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out_unref; - } info->apertures->ranges[0 ].base = qdev->ddev->mode_config.fb_base; info->apertures->ranges[0 ].size = qdev->vram_size;
@@ -423,13 +417,7 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,if (info->screen_base ==NULL ) { ret = -ENOSPC ; - goto out_unref; - } - - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out_unref; + goto out_destroy_fbi; } info->fbdefio = &qxl_defio;
@@ -441,6 +429,8 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,DRM_INFO ("fb: depth %d, pitch %d, width %d, height %d\n" , fb->depth, fb->pitches[0 ], fb->width, fb->height);return 0 ; +out_destroy_fbi: +drm_fb_helper_release_fbi (&qfbdev->helper); out_unref:if (qbo) { ret =qxl_bo_reserve (qbo, false);
@@ -479,15 +469,11 @@ static int qxl_fb_find_or_create_single(static int qxl_fbdev_destroy (struct drm_device *dev,struct qxl_fbdev *qfbdev) { -struct fb_info *info;struct qxl_framebuffer *qfb = &qfbdev->qfb; -if (qfbdev->helper.fbdev) { - info = qfbdev->helper.fbdev; +drm_fb_helper_unregister_fbi (&qfbdev->helper); +drm_fb_helper_release_fbi (&qfbdev->helper); -unregister_framebuffer (info); -framebuffer_release (info); - }if (qfb->obj) {qxlfb_destroy_pinned_object (qfb->obj); qfb->obj =NULL ;
@@ -557,7 +543,7 @@ void qxl_fbdev_fini(struct qxl_device *qdev)void qxl_fbdev_set_suspend (struct qxl_device *qdev,int state) { -fb_set_suspend (qdev->mode_info.qfbdev->helper.fbdev, state); +drm_fb_helper_set_suspend (&qdev->mode_info.qfbdev->helper, state); }bool qxl_fbdev_qobj_is_fb (struct qxl_device *qdev,struct qxl_bo *qobj)
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 19/25 drm/i915: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/i915/i915_dma.c | 3 ++- drivers/gpu/drm/i915/intel_fbdev.c | 40 ++++++++++++-------------------------- 2 files changed, 14 insertions(+), 29 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +2 -1
@@ -498,7 +498,8 @@ static int i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) primary = pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ; - ret =remove_conflicting_framebuffers (ap,"inteldrmfb" , primary); + ret =drm_fb_helper_remove_conflicting_framebuffers (ap,"inteldrmfb" , + primary);kfree (ap);
drivers/gpu/drm/i915/intel_fbdev.c +12 -28
@@ -126,9 +126,9 @@ static struct fb_ops intelfb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = intel_fbdev_set_par, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_pan_display = intel_fbdev_pan_display, .fb_blank = intel_fbdev_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -237,9 +237,9 @@ static int intelfb_create(struct drm_fb_helper *helper, obj = intel_fb->obj; size = obj->base.size; - info =framebuffer_alloc (0 , &dev->pdev->dev); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_unpin; }
@@ -248,24 +248,13 @@ static int intelfb_create(struct drm_fb_helper *helper, fb = &ifbdev->fb->base; ifbdev->helper.fb = fb; - ifbdev->helper.fbdev = info;strcpy (info->fix.id,"inteldrmfb" ); info->flags =FBINFO_DEFAULT |FBINFO_CAN_FORCE_OUTPUT ; info->fbops = &intelfb_ops; - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out_unpin; - }/* setup aperture base/size for vesafb takeover */ - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out_unpin; - } info->apertures->ranges[0 ].base = dev->mode_config.fb_base; info->apertures->ranges[0 ].size = dev_priv->gtt.mappable_end;
@@ -277,7 +266,7 @@ static int intelfb_create(struct drm_fb_helper *helper, size);if (!info->screen_base) { ret = -ENOSPC ; - goto out_unpin; + goto out_destroy_fbi; } info->screen_size = size;
@@ -304,6 +293,8 @@ static int intelfb_create(struct drm_fb_helper *helper,vga_switcheroo_client_fb_set (dev->pdev, info);return 0 ; +out_destroy_fbi: +drm_fb_helper_release_fbi (helper); out_unpin:i915_gem_object_ggtt_unpin (obj);drm_gem_object_unreference (&obj->base);
@@ -550,16 +541,9 @@ static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {static void intel_fbdev_destroy (struct drm_device *dev,struct intel_fbdev *ifbdev) { -if (ifbdev->helper.fbdev) { -struct fb_info *info = ifbdev->helper.fbdev; -unregister_framebuffer (info); -iounmap (info->screen_base); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&ifbdev->helper); +drm_fb_helper_release_fbi (&ifbdev->helper);drm_fb_helper_fini (&ifbdev->helper);
@@ -810,7 +794,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronousif (state ==FBINFO_STATE_RUNNING && ifbdev->fb->obj->stolen)memset_io (info->screen_base,0 , info->screen_size); -fb_set_suspend (info, state); +drm_fb_helper_set_suspend (&ifbdev->helper, state);console_unlock (); }
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 20/25 drm/nouveau: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- remove unused variable pdev in nouveau_fbcon_create
--- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 ++- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 39 ++++++++++----------------------- 2 files changed, 14 insertions(+), 28 deletions(-)
drivers/gpu/drm/nouveau/nouveau_drm.c +2 -1
@@ -317,7 +317,8 @@ static int nouveau_drm_probe(struct pci_dev *pdev, boot = pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ;#endif if (nouveau_modeset !=2 ) -remove_conflicting_framebuffers (aper,"nouveaufb" , boot); +drm_fb_helper_remove_conflicting_framebuffers (aper,"nouveaufb" , + boot);kfree (aper); ret = nvkm_device_create(pdev, NVKM_BUS_PCI,
drivers/gpu/drm/nouveau/nouveau_fbcon.c +12 -27
@@ -84,7 +84,7 @@ nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)if (ret != -ENODEV )nouveau_fbcon_gpu_lockup (info); -cfb_fillrect (info, rect); +drm_fb_helper_cfb_fillrect (info, rect); } static void
@@ -116,7 +116,7 @@ nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image)if (ret != -ENODEV )nouveau_fbcon_gpu_lockup (info); -cfb_copyarea (info, image); +drm_fb_helper_cfb_copyarea (info, image); } static void
@@ -148,7 +148,7 @@ nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)if (ret != -ENODEV )nouveau_fbcon_gpu_lockup (info); -cfb_imageblit (info, image); +drm_fb_helper_cfb_imageblit (info, image); } static int
@@ -197,9 +197,9 @@ static struct fb_ops nouveau_fbcon_sw_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -319,7 +319,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,struct nouveau_channel *chan;struct nouveau_bo *nvbo;struct drm_mode_fb_cmd2 mode_cmd; -struct pci_dev *pdev = dev->pdev;int size, ret; mode_cmd.width = sizes->surface_width;
@@ -365,20 +364,13 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,mutex_lock (&dev->struct_mutex); - info =framebuffer_alloc (0 , &pdev->dev); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_unlock; } info->skip_vt_switch =1 ; - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; -framebuffer_release (info); - goto out_unlock; - } - info->par = fbcon;nouveau_framebuffer_init (dev, &fbcon->nouveau_fb, &mode_cmd, nvbo);
@@ -388,7 +380,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,/* setup helper */ fbcon->helper.fb = fb; - fbcon->helper.fbdev = info;strcpy (info->fix.id,"nouveaufb" );if (!chan)
@@ -450,15 +441,9 @@ static int nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon) { struct nouveau_framebuffer *nouveau_fb = &fbcon->nouveau_fb; -struct fb_info *info; -if (fbcon->helper.fbdev) { - info = fbcon->helper.fbdev; -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&fbcon->helper); +drm_fb_helper_release_fbi (&fbcon->helper);if (nouveau_fb->nvbo) {nouveau_bo_unmap (nouveau_fb->nvbo);
@@ -496,7 +481,7 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state)console_lock ();if (state ==FBINFO_STATE_RUNNING )nouveau_fbcon_accel_restore (dev); -fb_set_suspend (drm->fbcon->helper.fbdev, state); +drm_fb_helper_set_suspend (&drm->fbcon->helper, state);if (state !=FBINFO_STATE_RUNNING )nouveau_fbcon_accel_save_disable (dev);console_unlock ();
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 21/25 drm/udl: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- remove unused variable device in udlfb_create
--- drivers/gpu/drm/udl/udl_fb.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-)
drivers/gpu/drm/udl/udl_fb.c +12 -29
@@ -288,7 +288,7 @@ static void udl_fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect {struct udl_fbdev *ufbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);udl_handle_damage (&ufbdev->ufb, rect->dx, rect->dy, rect->width, rect->height);
@@ -298,7 +298,7 @@ static void udl_fb_copyarea(struct fb_info *info, const struct fb_copyarea *regi {struct udl_fbdev *ufbdev = info->par; -sys_copyarea (info, region); +drm_fb_helper_sys_copyarea (info, region);udl_handle_damage (&ufbdev->ufb, region->dx, region->dy, region->width, region->height);
@@ -308,7 +308,7 @@ static void udl_fb_imageblit(struct fb_info *info, const struct fb_image *image) {struct udl_fbdev *ufbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);udl_handle_damage (&ufbdev->ufb, image->dx, image->dy, image->width, image->height);
@@ -476,7 +476,6 @@ static int udlfb_create(struct drm_fb_helper *helper, container_of(helper, struct udl_fbdev, helper);struct drm_device *dev = ufbdev->helper.dev;struct fb_info *info; -struct device *device = dev->dev;struct drm_framebuffer *fb;struct drm_mode_fb_cmd2 mode_cmd;struct udl_gem_object *obj;
@@ -506,21 +505,20 @@ static int udlfb_create(struct drm_fb_helper *helper, goto out_gfree; } - info =framebuffer_alloc (0 , device); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_gfree; } info->par = ufbdev; ret =udl_framebuffer_init (dev, &ufbdev->ufb, &mode_cmd, obj);if (ret) - goto out_gfree; + goto out_destroy_fbi; fb = &ufbdev->ufb.base; ufbdev->helper.fb = fb; - ufbdev->helper.fbdev = info;strcpy (info->fix.id,"udldrmfb" );
@@ -533,18 +531,13 @@ static int udlfb_create(struct drm_fb_helper *helper,drm_fb_helper_fill_fix (info, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (info, &ufbdev->helper, sizes->fb_width, sizes->fb_height); - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out_gfree; - } - -DRM_DEBUG_KMS ("allocated %dx%d vmal %p\n" , fb->width, fb->height, ufbdev->ufb.obj->vmapping);return ret; +out_destroy_fbi: +drm_fb_helper_release_fbi (helper); out_gfree:drm_gem_object_unreference (&ufbdev->ufb.obj->base); out:
@@ -558,14 +551,8 @@ static const struct drm_fb_helper_funcs udl_fb_helper_funcs = {static void udl_fbdev_destroy (struct drm_device *dev,struct udl_fbdev *ufbdev) { -struct fb_info *info; -if (ufbdev->helper.fbdev) { - info = ufbdev->helper.fbdev; -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&ufbdev->helper); +drm_fb_helper_release_fbi (&ufbdev->helper);drm_fb_helper_fini (&ufbdev->helper);drm_framebuffer_unregister_private (&ufbdev->ufb.base);drm_framebuffer_cleanup (&ufbdev->ufb.base);
@@ -631,11 +618,7 @@ void udl_fbdev_unplug(struct drm_device *dev)return ; ufbdev = udl->fbdev; -if (ufbdev->helper.fbdev) { -struct fb_info *info; - info = ufbdev->helper.fbdev; -unlink_framebuffer (info); - } +drm_fb_helper_unlink_fbi (&ufbdev->helper); } struct drm_framebuffer *
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 22/25 drm/bochs: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- remove unused variable device in bochsfb_create
--- drivers/gpu/drm/bochs/bochs_drv.c | 6 +++--- drivers/gpu/drm/bochs/bochs_fbdev.c | 36 +++++++++++------------------------- 2 files changed, 14 insertions(+), 28 deletions(-)
drivers/gpu/drm/bochs/bochs_drv.c +3 -3
@@ -109,7 +109,7 @@ static int bochs_pm_suspend(struct device *dev)if (bochs->fb.initialized) {console_lock (); -fb_set_suspend (bochs->fb.helper.fbdev,1 ); +drm_fb_helper_set_suspend (&bochs->fb.helper,1 );console_unlock (); }
@@ -126,7 +126,7 @@ static int bochs_pm_resume(struct device *dev)if (bochs->fb.initialized) {console_lock (); -fb_set_suspend (bochs->fb.helper.fbdev,0 ); +drm_fb_helper_set_suspend (&bochs->fb.helper,0 );console_unlock (); }
@@ -153,7 +153,7 @@ static int bochs_kick_out_firmware_fb(struct pci_dev *pdev) ap->ranges[0 ].base =pci_resource_start (pdev,0 ); ap->ranges[0 ].size =pci_resource_len (pdev,0 ); -remove_conflicting_framebuffers (ap,"bochsdrmfb" , false); +drm_fb_helper_remove_conflicting_framebuffers (ap,"bochsdrmfb" , false);kfree (ap);return 0 ;
drivers/gpu/drm/bochs/bochs_fbdev.c +11 -25
@@ -24,9 +24,9 @@ static struct fb_ops bochsfb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -56,11 +56,9 @@ static int bochsfb_create(struct drm_fb_helper *helper, {struct bochs_device *bochs = container_of(helper, struct bochs_device, fb.helper); -struct drm_device *dev = bochs->dev;struct fb_info *info;struct drm_framebuffer *fb;struct drm_mode_fb_cmd2 mode_cmd; -struct device *device = &dev->pdev->dev;struct drm_gem_object *gobj =NULL ;struct bochs_bo *bo =NULL ;int size, ret;
@@ -106,22 +104,23 @@ static int bochsfb_create(struct drm_fb_helper *helper,ttm_bo_unreserve (&bo->bo);/* init fb device */ - info =framebuffer_alloc (0 , device); -if (info ==NULL ) -return -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) +return PTR_ERR (info); info->par = &bochs->fb.helper; ret =bochs_framebuffer_init (bochs->dev, &bochs->fb.gfb, &mode_cmd, gobj); -if (ret) +if (ret) { +drm_fb_helper_release_fbi (helper);return ret; + } bochs->fb.size = size;/* setup helper */ fb = &bochs->fb.gfb.base; bochs->fb.helper.fb = fb; - bochs->fb.helper.fbdev = info;strcpy (info->fix.id,"bochsdrmfb" );
@@ -139,30 +138,17 @@ static int bochsfb_create(struct drm_fb_helper *helper, info->fix.smem_start =0 ; info->fix.smem_len = size; - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { -DRM_ERROR ("%s: can't allocate color map\n" , info->fix.id); -return -ENOMEM ; - } -return 0 ; }static int bochs_fbdev_destroy (struct bochs_device *bochs) {struct bochs_framebuffer *gfb = &bochs->fb.gfb; -struct fb_info *info;DRM_DEBUG_DRIVER ("\n" ); -if (bochs->fb.helper.fbdev) { - info = bochs->fb.helper.fbdev; - -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&bochs->fb.helper); +drm_fb_helper_release_fbi (&bochs->fb.helper);if (gfb->obj) {drm_gem_object_unreference_unlocked (gfb->obj);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 23/25 drm/amdgpu: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- Fixed PTR_ERR issue mentioned by kbuild bot
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 45 ++++++++++----------------------- 2 files changed, 17 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
@@ -35,6 +35,7 @@#include "amdgpu_drv.h" #include <drm/drm_pciids.h> +#include <drm/drm_fb_helper.h> #include <linux/console.h> #include <linux/module.h> #include <linux/pm_runtime.h>
@@ -267,7 +268,8 @@ static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev)#ifdef CONFIG_X86 primary = pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ;#endif -remove_conflicting_framebuffers (ap,"amdgpudrmfb" , primary); +drm_fb_helper_remove_conflicting_framebuffers (ap,"amdgpudrmfb" , + primary);kfree (ap);return 0 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +14 -31
107 lines not on this page · raw message
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 24/25 drm/virtio: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v2:
- add missing header for virtgpu_fb.c
--- drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 3 ++- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_fb.c | 32 +++++++++----------------------- 3 files changed, 12 insertions(+), 24 deletions(-)
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +2 -1
@@ -52,7 +52,8 @@ static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev) primary = pci_dev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ; -remove_conflicting_framebuffers (ap,"virtiodrmfb" , primary); +drm_fb_helper_remove_conflicting_framebuffers (ap,"virtiodrmfb" , + primary);kfree (ap); }
drivers/gpu/drm/virtio/virtgpu_drv.h +1 -0
@@ -34,6 +34,7 @@#include <drm/drmP.h> #include <drm/drm_gem.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <ttm/ttm_bo_api.h> #include <ttm/ttm_bo_driver.h> #include <ttm/ttm_placement.h>
drivers/gpu/drm/virtio/virtgpu_fb.c +9 -23
@@ -173,7 +173,7 @@ static void virtio_gpu_3d_fillrect(struct fb_info *info, const struct fb_fillrect *rect) {struct virtio_gpu_fbdev *vfbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);virtio_gpu_dirty_update (&vfbdev->vgfb, true, rect->dx, rect->dy, rect->width, rect->height);schedule_delayed_work (&vfbdev->work,VIRTIO_GPU_FBCON_POLL_PERIOD );
@@ -183,7 +183,7 @@ static void virtio_gpu_3d_copyarea(struct fb_info *info, const struct fb_copyarea *area) {struct virtio_gpu_fbdev *vfbdev = info->par; -sys_copyarea (info, area); +drm_fb_helper_sys_copyarea (info, area);virtio_gpu_dirty_update (&vfbdev->vgfb, true, area->dx, area->dy, area->width, area->height);schedule_delayed_work (&vfbdev->work,VIRTIO_GPU_FBCON_POLL_PERIOD );
@@ -193,7 +193,7 @@ static void virtio_gpu_3d_imageblit(struct fb_info *info, const struct fb_image *image) {struct virtio_gpu_fbdev *vfbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);virtio_gpu_dirty_update (&vfbdev->vgfb, true, image->dx, image->dy, image->width, image->height);schedule_delayed_work (&vfbdev->work,VIRTIO_GPU_FBCON_POLL_PERIOD );
@@ -230,7 +230,6 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,struct drm_framebuffer *fb;struct drm_mode_fb_cmd2 mode_cmd = {};struct virtio_gpu_object *obj; -struct device *device = vgdev->dev;uint32_t resid, format, size;int ret;
@@ -317,18 +316,12 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,if (ret) goto err_obj_attach; - info =framebuffer_alloc (0 , device); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto err_fb_alloc; } - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto err_fb_alloc_cmap; - } - info->par = helper; ret = virtio_gpu_framebuffer_init(dev, &vfbdev->vgfb,
@@ -339,7 +332,6 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper, fb = &vfbdev->vgfb.base; vfbdev->helper.fb = fb; - vfbdev->helper.fbdev = info;strcpy (info->fix.id,"virtiodrmfb" ); info->flags =FBINFO_DEFAULT ;
@@ -357,9 +349,7 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,return 0 ; err_fb_init: -fb_dealloc_cmap (&info->cmap); -err_fb_alloc_cmap: -framebuffer_release (info); +drm_fb_helper_release_fbi (helper); err_fb_alloc:virtio_gpu_cmd_resource_inval_backing (vgdev, resid); err_obj_attach:
@@ -371,15 +361,11 @@ err_obj_vmap:static int virtio_gpu_fbdev_destroy (struct drm_device *dev,struct virtio_gpu_fbdev *vgfbdev) { -struct fb_info *info;struct virtio_gpu_framebuffer *vgfb = &vgfbdev->vgfb; -if (vgfbdev->helper.fbdev) { - info = vgfbdev->helper.fbdev; +drm_fb_helper_unregister_fbi (&vgfbdev->helper); +drm_fb_helper_release_fbi (&vgfbdev->helper); -unregister_framebuffer (info); -framebuffer_release (info); - }if (vgfb->obj) vgfb->obj =NULL ;drm_fb_helper_fini (&vgfbdev->helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH RESEND v2 25/25 drm/fb_cma_helper: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/drm_fb_cma_helper.c | 45 +++++++++---------------------------- 1 file changed, 11 insertions(+), 34 deletions(-)
drivers/gpu/drm/drm_fb_cma_helper.c +11 -34
@@ -234,9 +234,9 @@ EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show);static struct fb_ops drm_fbdev_cma_ops = { .owner =THIS_MODULE , - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank,
@@ -275,10 +275,9 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper,if (IS_ERR (obj))return -ENOMEM ; - fbi =framebuffer_alloc (0 , dev->dev); -if (!fbi) { -dev_err (dev->dev,"Failed to allocate framebuffer info.\n" ); - ret = -ENOMEM ; + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) { + ret =PTR_ERR (fbi); goto err_drm_gem_cma_free_object; }
@@ -286,23 +285,16 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper,if (IS_ERR (fbdev_cma->fb)) {dev_err (dev->dev,"Failed to allocate DRM framebuffer.\n" ); ret =PTR_ERR (fbdev_cma->fb); - goto err_framebuffer_release; + goto err_fb_info_destroy; } fb = &fbdev_cma->fb->fb; helper->fb = fb; - helper->fbdev = fbi; fbi->par = helper; fbi->flags =FBINFO_FLAG_DEFAULT ; fbi->fbops = &drm_fbdev_cma_ops; - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { -dev_err (dev->dev,"Failed to allocate color map.\n" ); - goto err_drm_fb_cma_destroy; - } -drm_fb_helper_fill_fix (fbi, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (fbi, helper, sizes->fb_width, sizes->fb_height);
@@ -317,11 +309,8 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper,return 0 ; -err_drm_fb_cma_destroy: -drm_framebuffer_unregister_private (fb); -drm_fb_cma_destroy (fb); -err_framebuffer_release: -framebuffer_release (fbi); +err_fb_info_destroy: +drm_fb_helper_release_fbi (helper); err_drm_gem_cma_free_object:drm_gem_cma_free_object (&obj->base);return ret;
@@ -397,20 +386,8 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);*/ void drm_fbdev_cma_fini (struct drm_fbdev_cma *fbdev_cma) { -if (fbdev_cma->fb_helper.fbdev) { -struct fb_info *info; -int ret; - - info = fbdev_cma->fb_helper.fbdev; - ret =unregister_framebuffer (info); -if (ret <0 ) -DRM_DEBUG_KMS ("failed unregister_framebuffer()\n" ); - -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&fbdev_cma->fb_helper); +drm_fb_helper_release_fbi (&fbdev_cma->fb_helper);if (fbdev_cma->fb) {drm_framebuffer_unregister_private (&fbdev_cma->fb->fb);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
v3 cover drm: fb emulation: Step 1: Create new drm_fb_helper wrapper funcs
In reply to Archit TanejaDRM drivers using drm_fb_helpers still call some fbdev core functions. This makes the driver depend on CONFIG_FB, resulting in complicated Kconfig options, and preventing us from creating a top level drm config option to enable/disable FBDEV emulation.
Create new drm_fb_helper functions that replace these fbdev functions.
In most cases, the new helper funcs simply wrap around the original fbdev functions. For a few (like framebufer_alloc), we actually do some work that is currently redundant across multiple drivers.
With these patches, the drivers don't call any fbdev functions directly. They are now called through functions in drm_fb_helper.c. We will later create a fbdev emulation config option to stub out the fb helpers.
The only exception is vmwgfx driver. This doesn't use drm_fb_helper. It creates a fb device how a driver in drivers/video/fbdev would. Maybe this needs to be converted to use drm_fb_helpers.
For more info, have a look at the threads:
http://lists.freedesktop.org/archives/dri-devel/2015-March/078729.html
http://lists.freedesktop.org/archives/dri-devel/2015-March/078975.html
changes in v3:
- Removed drm_fb_helper for remove_conflicting_framebuffers.
- Fixed kerneldoc header errors
- Some fixes pointed out on the mailing list
changes in v2:
- Incorporated comments
- Misc fixes for build wannings/errors
- resend version has v2 changes in changelog, 'compile tested only' is removed.
Archit Taneja (24):
drm/fb_helper: Add drm_fb_helper functions to manage fb_info creation drm/fb_helper: Create a wrapper for unlink_framebuffer drm/fb_helper: Create wrappers for fb_sys_read/write funcs drm/fb_helper: Create wrappers for blit, copyarea and fillrect funcs drm/fb_helper: Create a wrapper for fb_set_suspend drm/cirrus: Use new drm_fb_helper functions
drm/rockchip: Use new drm_fb_helper functions
drm/armada: Use new drm_fb_helper functions
drm/ast: Use new drm_fb_helper functions
drm/omap: Use new drm_fb_helper functions
drm/tegra: Use new drm_fb_helper functions
drm/msm: Use new drm_fb_helper functions
drm/exynos: Use new drm_fb_helper functions
drm/gma500: Use new drm_fb_helper functions
drm/mgag200: Use new drm_fb_helper functions
drm/radeon: Use new drm_fb_helper functions
drm/qxl: Use new drm_fb_helper functions
drm/i915: Use new drm_fb_helper functions
drm/nouveau: Use new drm_fb_helper functions
drm/udl: Use new drm_fb_helper functions
drm/bochs: Use new drm_fb_helper functions
drm/amdgpu: Use new drm_fb_helper functions
drm/virtio: Use new drm_fb_helper functions drm/fb_cma_helper: Use new drm_fb_helper functions
drivers/gpu/drm/Kconfig | 7 + drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 45 ++---- drivers/gpu/drm/armada/armada_fbdev.c | 33 ++-- drivers/gpu/drm/ast/ast_fb.c | 48 ++---- drivers/gpu/drm/bochs/bochs_drv.c | 4 +- drivers/gpu/drm/bochs/bochs_fbdev.c | 36 ++--- drivers/gpu/drm/cirrus/cirrus_drv.c | 4 +- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 41 +---- drivers/gpu/drm/drm_fb_cma_helper.c | 45 ++---- drivers/gpu/drm/drm_fb_helper.c | 223 ++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 47 ++---- drivers/gpu/drm/gma500/accel_2d.c | 6 +- drivers/gpu/drm/gma500/framebuffer.c | 48 ++---- drivers/gpu/drm/i915/intel_fbdev.c | 40 ++--- drivers/gpu/drm/mgag200/mgag200_fb.c | 39 +---- drivers/gpu/drm/msm/msm_fbdev.c | 34 ++-- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 39 ++--- drivers/gpu/drm/omapdrm/omap_fbdev.c | 38 ++--- drivers/gpu/drm/qxl/qxl_fb.c | 40 ++--- drivers/gpu/drm/radeon/radeon_fb.c | 42 ++--- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 47 ++---- drivers/gpu/drm/tegra/fb.c | 35 ++-- drivers/gpu/drm/udl/udl_fb.c | 41 ++--- drivers/gpu/drm/virtio/virtgpu_fb.c | 32 ++-- include/drm/drm_fb_helper.h | 27 ++++ 25 files changed, 485 insertions(+), 556 deletions(-)
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
v3 cover rm: fb emulation: Step 1: Create new drm_fb_helper wrapper funcs
DRM drivers using drm_fb_helpers still call some fbdev core functions. This makes the driver depend on CONFIG_FB, resulting in complicated Kconfig options, and preventing us from creating a top level drm config option to enable/disable FBDEV emulation.
Create new drm_fb_helper functions that replace these fbdev functions.
In most cases, the new helper funcs simply wrap around the original fbdev functions. For a few (like framebufer_alloc), we actually do some work that is currently redundant across multiple drivers.
With these patches, the drivers don't call any fbdev functions directly. They are now called through functions in drm_fb_helper.c. We will later create a fbdev emulation config option to stub out the fb helpers.
The only exception is vmwgfx driver. This doesn't use drm_fb_helper. It creates a fb device how a driver in drivers/video/fbdev would. Maybe this needs to be converted to use drm_fb_helpers.
For more info, have a look at the threads:
http://lists.freedesktop.org/archives/dri-devel/2015-March/078729.html
http://lists.freedesktop.org/archives/dri-devel/2015-March/078975.html
changes in v3:
- Removed drm_fb_helper for remove_conflicting_framebuffers.
- Fixed kerneldoc header errors
- Some fixes pointed out on the mailing list
changes in v2:
- Incorporated comments
- Misc fixes for build wannings/errors
- resend version has v2 changes in changelog, 'compile tested only' is removed.
Archit Taneja (24):
drm/fb_helper: Add drm_fb_helper functions to manage fb_info creation drm/fb_helper: Create a wrapper for unlink_framebuffer drm/fb_helper: Create wrappers for fb_sys_read/write funcs drm/fb_helper: Create wrappers for blit, copyarea and fillrect funcs drm/fb_helper: Create a wrapper for fb_set_suspend drm/cirrus: Use new drm_fb_helper functions
drm/rockchip: Use new drm_fb_helper functions
drm/armada: Use new drm_fb_helper functions
drm/ast: Use new drm_fb_helper functions
drm/omap: Use new drm_fb_helper functions
drm/tegra: Use new drm_fb_helper functions
drm/msm: Use new drm_fb_helper functions
drm/exynos: Use new drm_fb_helper functions
drm/gma500: Use new drm_fb_helper functions
drm/mgag200: Use new drm_fb_helper functions
drm/radeon: Use new drm_fb_helper functions
drm/qxl: Use new drm_fb_helper functions
drm/i915: Use new drm_fb_helper functions
drm/nouveau: Use new drm_fb_helper functions
drm/udl: Use new drm_fb_helper functions
drm/bochs: Use new drm_fb_helper functions
drm/amdgpu: Use new drm_fb_helper functions
drm/virtio: Use new drm_fb_helper functions drm/fb_cma_helper: Use new drm_fb_helper functions
drivers/gpu/drm/Kconfig | 7 + drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 45 ++---- drivers/gpu/drm/armada/armada_fbdev.c | 33 ++-- drivers/gpu/drm/ast/ast_fb.c | 48 ++---- drivers/gpu/drm/bochs/bochs_drv.c | 4 +- drivers/gpu/drm/bochs/bochs_fbdev.c | 36 ++--- drivers/gpu/drm/cirrus/cirrus_drv.c | 4 +- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 41 +---- drivers/gpu/drm/drm_fb_cma_helper.c | 45 ++---- drivers/gpu/drm/drm_fb_helper.c | 223 ++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 47 ++---- drivers/gpu/drm/gma500/accel_2d.c | 6 +- drivers/gpu/drm/gma500/framebuffer.c | 48 ++---- drivers/gpu/drm/i915/intel_fbdev.c | 40 ++--- drivers/gpu/drm/mgag200/mgag200_fb.c | 39 +---- drivers/gpu/drm/msm/msm_fbdev.c | 34 ++-- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 39 ++--- drivers/gpu/drm/omapdrm/omap_fbdev.c | 38 ++--- drivers/gpu/drm/qxl/qxl_fb.c | 40 ++--- drivers/gpu/drm/radeon/radeon_fb.c | 42 ++--- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 47 ++---- drivers/gpu/drm/tegra/fb.c | 35 ++-- drivers/gpu/drm/udl/udl_fb.c | 41 ++--- drivers/gpu/drm/virtio/virtgpu_fb.c | 32 ++-- include/drm/drm_fb_helper.h | 27 ++++ 25 files changed, 485 insertions(+), 556 deletions(-)
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 1/24 drm/fb_helper: Add drm_fb_helper functions to manage fb_info creation
In reply to Archit TanejaEvery drm driver calls framebuffer_alloc, fb_alloc_cmap, unregister_framebuffer, fb_dealloc_cmap and framebuffer_release in order to emulate fbdev support.
Create drm_fb_helper functions that perform the above operations.
This is part of an effort to prevent drm drivers from calling fbdev functions directly. It also removes repetitive code from drivers.
There are some drivers that call alloc_apertures after framebuffer_alloc and some that don't. Make the helper always call alloc_apertures. This would make certain drivers allocate memory for apertures but not use them. Since it's a small amount of memory, it shouldn't be an issue.
v3:
- No changes
v2:
- Added kerneldocs
- Added a check for non-NULL fb_helper before proceeding. This will make the helpers work when we have a module param for fbdev emulation
--- drivers/gpu/drm/drm_fb_helper.c | 80 +++++++++++++++++++++++++++++++++++++++++ include/drm/drm_fb_helper.h | 4 +++ 2 files changed, 84 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +80 -0
@@ -667,6 +667,86 @@ out_free: }EXPORT_SYMBOL (drm_fb_helper_init); +/** +* drm_fb_helper_alloc_fbi - allocate fb_info and some of its members +* @fb_helper: driver-allocated fbdev helper +* +* A helper to alloc fb_info and the members cmap and apertures. Called +* by the driver within the fb_probe fb_helper callback function. +* +* RETURNS: +* fb_info pointer if things went okay, pointer containing error code +* otherwise +*/ +struct fb_info *drm_fb_helper_alloc_fbi (struct drm_fb_helper *fb_helper) +{ +struct device *dev = fb_helper->dev->dev; +struct fb_info *info; +int ret; + + info =framebuffer_alloc (0 , dev); +if (!info) +return ERR_PTR (-ENOMEM ); + + ret =fb_alloc_cmap (&info->cmap,256 ,0 ); +if (ret) + goto err_release; + + info->apertures =alloc_apertures (1 ); +if (!info->apertures) { + ret = -ENOMEM ; + goto err_free_cmap; + } + + fb_helper->fbdev = info; + +return info; + +err_free_cmap: +fb_dealloc_cmap (&info->cmap); +err_release: +framebuffer_release (info); +return ERR_PTR (ret); +} +EXPORT_SYMBOL (drm_fb_helper_alloc_fbi); + +/** +* drm_fb_helper_unregister_fbi - unregister fb_info framebuffer device +* @fb_helper: driver-allocated fbdev helper +* +* A wrapper around unregister_framebuffer, to release the fb_info +* framebuffer device +*/ +void drm_fb_helper_unregister_fbi (struct drm_fb_helper *fb_helper) +{ +if (fb_helper && fb_helper->fbdev) +unregister_framebuffer (fb_helper->fbdev); +} +EXPORT_SYMBOL (drm_fb_helper_unregister_fbi); + +/** +* drm_fb_helper_release_fbi - dealloc fb_info and its members +* @fb_helper: driver-allocated fbdev helper +* +* A helper to free memory taken by fb_info and the members cmap and +* apertures +*/ +void drm_fb_helper_release_fbi (struct drm_fb_helper *fb_helper) +{ +if (fb_helper) { +struct fb_info *info = fb_helper->fbdev; + +if (info) { +if (info->cmap.len) +fb_dealloc_cmap (&info->cmap); +framebuffer_release (info); + } + + fb_helper->fbdev =NULL ; + } +} +EXPORT_SYMBOL (drm_fb_helper_release_fbi); +void drm_fb_helper_fini (struct drm_fb_helper *fb_helper) {if (!list_empty (&fb_helper->kernel_fb_list)) {
include/drm/drm_fb_helper.h +4 -0
@@ -136,6 +136,10 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, struct fb_info *info);bool drm_fb_helper_restore_fbdev_mode_unlocked (struct drm_fb_helper *fb_helper); + +struct fb_info *drm_fb_helper_alloc_fbi (struct drm_fb_helper *fb_helper); +void drm_fb_helper_unregister_fbi (struct drm_fb_helper *fb_helper); +void drm_fb_helper_release_fbi (struct drm_fb_helper *fb_helper);void drm_fb_helper_fill_var (struct fb_info *info,struct drm_fb_helper *fb_helper,uint32_t fb_width,uint32_t fb_height); void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 2/24 drm/fb_helper: Create a wrapper for unlink_framebuffer
In reply to Archit TanejaSome drm drivers call unlink_framebuffer. Create a drm_fb_helper function that wraps around these calls.
This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v3:
- No changes
v2:
- Added kerneldocs
- Added a check for non-NULL fb_helper before proceeding. This will make the helpers work when we have a module param for fbdev emulation
--- drivers/gpu/drm/drm_fb_helper.c | 13 +++++++++++++ include/drm/drm_fb_helper.h | 2 ++ 2 files changed, 15 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +13 -0
@@ -764,6 +764,19 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper) }EXPORT_SYMBOL (drm_fb_helper_fini); +/** +* drm_fb_helper_unlink_fbi - wrapper around unlink_framebuffer +* @fb_helper: driver-allocated fbdev helper +* +* A wrapper around unlink_framebuffer implemented by fbdev core +*/ +void drm_fb_helper_unlink_fbi (struct drm_fb_helper *fb_helper) +{ +if (fb_helper && fb_helper->fbdev) +unlink_framebuffer (fb_helper->fbdev); +} +EXPORT_SYMBOL (drm_fb_helper_unlink_fbi); +static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {
include/drm/drm_fb_helper.h +2 -0
@@ -145,6 +145,8 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpevoid drm_fb_helper_fill_fix (struct fb_info *info,uint32_t pitch,uint32_t depth); +void drm_fb_helper_unlink_fbi (struct drm_fb_helper *fb_helper); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 3/24 drm/fb_helper: Create wrappers for fb_sys_read/write funcs
In reply to Archit TanejaSome drm drivers populate their fb_ops with fb_sys_read/write fb sysfs ops.
Create a drm_fb_helper function that wraps around these calls.
This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v3:
- Fix kerneldoc errors
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitions
- Remove unnecessary checks for non NULL fb_info
--- drivers/gpu/drm/Kconfig | 1 + drivers/gpu/drm/drm_fb_helper.c | 32 ++++++++++++++++++++++++++++++++ include/drm/drm_fb_helper.h | 5 +++++ 3 files changed, 38 insertions(+)
drivers/gpu/drm/Kconfig +1 -0
@@ -37,6 +37,7 @@ config DRM_KMS_FB_HELPER select FB select FRAMEBUFFER_CONSOLE if !EXPERT select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE + select FB_SYS_FOPS help FBDEV helpers for KMS drivers.
drivers/gpu/drm/drm_fb_helper.c +32 -0
@@ -777,6 +777,38 @@ void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper) }EXPORT_SYMBOL (drm_fb_helper_unlink_fbi); +/** +* drm_fb_helper_sys_read - wrapper around fb_sys_read +* @info: fb_info struct pointer +* @buf: userspace buffer to read from framebuffer memory +* @count: number of bytes to read from framebuffer memory +* @ppos: read offset within framebuffer memory +* +* A wrapper around fb_sys_read implemented by fbdev core +*/ +ssize_t drm_fb_helper_sys_read (struct fb_info *info,char __user *buf, +size_t count,loff_t *ppos) +{ +return fb_sys_read (info, buf, count, ppos); +} +EXPORT_SYMBOL (drm_fb_helper_sys_read); + +/** +* drm_fb_helper_sys_write - wrapper around fb_sys_write +* @info: fb_info struct pointer +* @buf: userspace buffer to write to framebuffer memory +* @count: number of bytes to write to framebuffer memory +* @ppos: write offset within framebuffer memory +* +* A wrapper around fb_sys_write implemented by fbdev core +*/ +ssize_t drm_fb_helper_sys_write (struct fb_info *info,const char __user *buf, +size_t count,loff_t *ppos) +{ +return fb_sys_write (info, buf, count, ppos); +} +EXPORT_SYMBOL (drm_fb_helper_sys_write); +static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {
include/drm/drm_fb_helper.h +5 -0
@@ -147,6 +147,11 @@ void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,void drm_fb_helper_unlink_fbi (struct drm_fb_helper *fb_helper); +ssize_t drm_fb_helper_sys_read (struct fb_info *info,char __user *buf, +size_t count,loff_t *ppos); +ssize_t drm_fb_helper_sys_write (struct fb_info *info,const char __user *buf, +size_t count,loff_t *ppos); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 4/24 drm/fb_helper: Create wrappers for blit, copyarea and fillrect funcs
In reply to Archit Tanejadrm drivers that emulate fbdev populate their fb_fillrect, fb_copyarea and fb_imageblit fb_ops with the help of cfb_* or sys_* fbdev core helper functions.
Create drm_fb_helper functions that wrap around these calls.
This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v3:
- Fixed kerneldoc errors
v2:
- Added kerneldocs
- Follow the drm way of aligning of arguments in func definitions
- Remove unnecessary checks for non NULL fb_info
--- drivers/gpu/drm/Kconfig | 6 +++ drivers/gpu/drm/drm_fb_helper.c | 84 +++++++++++++++++++++++++++++++++++++++++ include/drm/drm_fb_helper.h | 14 +++++++ 3 files changed, 104 insertions(+)
drivers/gpu/drm/Kconfig +6 -0
@@ -38,6 +38,12 @@ config DRM_KMS_FB_HELPER select FRAMEBUFFER_CONSOLE if !EXPERT select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE select FB_SYS_FOPS + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT help FBDEV helpers for KMS drivers.
drivers/gpu/drm/drm_fb_helper.c +84 -0
90 lines not on this page · raw message
include/drm/drm_fb_helper.h +14 -0
@@ -152,6 +152,20 @@ ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,ssize_t drm_fb_helper_sys_write (struct fb_info *info,const char __user *buf,size_t count,loff_t *ppos); +void drm_fb_helper_sys_fillrect (struct fb_info *info, +const struct fb_fillrect *rect); +void drm_fb_helper_sys_copyarea (struct fb_info *info, +const struct fb_copyarea *area); +void drm_fb_helper_sys_imageblit (struct fb_info *info, +const struct fb_image *image); + +void drm_fb_helper_cfb_fillrect (struct fb_info *info, +const struct fb_fillrect *rect); +void drm_fb_helper_cfb_copyarea (struct fb_info *info, +const struct fb_copyarea *area); +void drm_fb_helper_cfb_imageblit (struct fb_info *info, +const struct fb_image *image); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 5/24 drm/fb_helper: Create a wrapper for fb_set_suspend
In reply to Archit TanejaSome drm drivers call fb_set_suspend. Create a drm_fb_helper function that wraps around these calls.
This is part of an effort to prevent drm drivers from calling fbdev functions directly, in order to make fbdev emulation a top level drm option.
v3:
- Fixed kerneldoc errors
v2:
- Added kerneldocs
- Added a check for non-NULL fb_helper before proceeding. This will make the helpers work when we have a module param for fbdev emulation
- Follow the drm way of aligning of arguments in func definitions
--- drivers/gpu/drm/drm_fb_helper.c | 14 ++++++++++++++ include/drm/drm_fb_helper.h | 2 ++ 2 files changed, 16 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +14 -0
@@ -893,6 +893,20 @@ void drm_fb_helper_cfb_imageblit(struct fb_info *info, }EXPORT_SYMBOL (drm_fb_helper_cfb_imageblit); +/** +* drm_fb_helper_set_suspend - wrapper around fb_set_suspend +* @fb_helper: driver-allocated fbdev helper +* @state: desired state, zero to resume, non-zero to suspend +* +* A wrapper around fb_set_suspend implemented by fbdev core +*/ +void drm_fb_helper_set_suspend (struct drm_fb_helper *fb_helper,int state) +{ +if (fb_helper && fb_helper->fbdev) +fb_set_suspend (fb_helper->fbdev, state); +} +EXPORT_SYMBOL (drm_fb_helper_set_suspend); +static int setcolreg (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,u16 regno,struct fb_info *info) {
include/drm/drm_fb_helper.h +2 -0
@@ -166,6 +166,8 @@ void drm_fb_helper_cfb_copyarea(struct fb_info *info,void drm_fb_helper_cfb_imageblit (struct fb_info *info,const struct fb_image *image); +void drm_fb_helper_set_suspend (struct drm_fb_helper *fb_helper,int state); +int drm_fb_helper_setcmap (struct fb_cmap *cmap,struct fb_info *info);int drm_fb_helper_hotplug_event (struct drm_fb_helper *fb_helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 6/24 drm/cirrus: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly.
v3:
- Don't touch remove_conflicting_framebuffers
v2:
- Remove stray goto label out_iounmap
--- drivers/gpu/drm/cirrus/cirrus_drv.c | 4 ++-- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 41 +++++++---------------------------- 2 files changed, 10 insertions(+), 35 deletions(-)
drivers/gpu/drm/cirrus/cirrus_drv.c +2 -2
@@ -92,7 +92,7 @@ static int cirrus_pm_suspend(struct device *dev)if (cdev->mode_info.gfbdev) {console_lock (); -fb_set_suspend (cdev->mode_info.gfbdev->helper.fbdev,1 ); +drm_fb_helper_set_suspend (&cdev->mode_info.gfbdev->helper,1 );console_unlock (); }
@@ -109,7 +109,7 @@ static int cirrus_pm_resume(struct device *dev)if (cdev->mode_info.gfbdev) {console_lock (); -fb_set_suspend (cdev->mode_info.gfbdev->helper.fbdev,0 ); +drm_fb_helper_set_suspend (&cdev->mode_info.gfbdev->helper,0 );console_unlock (); }
drivers/gpu/drm/cirrus/cirrus_fbdev.c +8 -33
109 lines not on this page · raw message
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 7/24 drm/rockchip: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
This is an effort to create a top level drm fbdev emulation option.
v3:
- No changes
v2:
- No changes
--- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 47 +++++++-------------------- 1 file changed, 12 insertions(+), 35 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c +12 -35
@@ -37,9 +37,9 @@ static int rockchip_fbdev_mmap(struct fb_info *info,static struct fb_ops rockchip_drm_fbdev_ops = { .owner =THIS_MODULE , .fb_mmap = rockchip_fbdev_mmap, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank,
@@ -77,10 +77,10 @@ static int rockchip_drm_fbdev_create(struct drm_fb_helper *helper, private->fbdev_bo = &rk_obj->base; - fbi =framebuffer_alloc (0 , dev->dev); -if (!fbi) { -dev_err (dev->dev,"Failed to allocate framebuffer info.\n" ); - ret = -ENOMEM ; + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) { +dev_err (dev->dev,"Failed to create framebuffer info.\n" ); + ret =PTR_ERR (fbi); goto err_rockchip_gem_free_object; }
@@ -89,21 +89,13 @@ static int rockchip_drm_fbdev_create(struct drm_fb_helper *helper,if (IS_ERR (helper->fb)) {dev_err (dev->dev,"Failed to allocate DRM framebuffer.\n" ); ret =PTR_ERR (helper->fb); - goto err_framebuffer_release; + goto err_release_fbi; } - helper->fbdev = fbi; - fbi->par = helper; fbi->flags =FBINFO_FLAG_DEFAULT ; fbi->fbops = &rockchip_drm_fbdev_ops; - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { -dev_err (dev->dev,"Failed to allocate color map.\n" ); - goto err_drm_framebuffer_unref; - } - fb = helper->fb;drm_fb_helper_fill_fix (fbi, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (fbi, helper, sizes->fb_width, sizes->fb_height);
@@ -124,10 +116,8 @@ static int rockchip_drm_fbdev_create(struct drm_fb_helper *helper,return 0 ; -err_drm_framebuffer_unref: -drm_framebuffer_unreference (helper->fb); -err_framebuffer_release: -framebuffer_release (fbi); +err_release_fbi: +drm_fb_helper_release_fbi (helper); err_rockchip_gem_free_object:rockchip_gem_free_object (&rk_obj->base);return ret;
@@ -190,21 +180,8 @@ void rockchip_drm_fbdev_fini(struct drm_device *dev) helper = &private->fbdev_helper; -if (helper->fbdev) { -struct fb_info *info; -int ret; - - info = helper->fbdev; - ret =unregister_framebuffer (info); -if (ret <0 ) -DRM_DEBUG_KMS ("failed unregister_framebuffer() - %d\n" , - ret); - -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (helper); +drm_fb_helper_release_fbi (helper);if (helper->fb)drm_framebuffer_unreference (helper->fb);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 8/24 drm/armada: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/armada/armada_fbdev.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-)
drivers/gpu/drm/armada/armada_fbdev.c +10 -23
@@ -22,9 +22,9 @@ static /*const*/ struct fb_ops armada_fb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -80,18 +80,12 @@ static int armada_fb_create(struct drm_fb_helper *fbh,if (IS_ERR (dfb))return PTR_ERR (dfb); - info =framebuffer_alloc (0 , dev->dev); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (fbh); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto err_fballoc; } - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto err_fbcmap; - } -strlcpy (info->fix.id,"armada-drmfb" ,sizeof (info->fix.id)); info->par = fbh; info->flags =FBINFO_DEFAULT |FBINFO_CAN_FORCE_OUTPUT ;
@@ -101,7 +95,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh, info->screen_size = obj->obj.size; info->screen_base = ptr; fbh->fb = &dfb->fb; - fbh->fbdev = info; +drm_fb_helper_fill_fix (info, dfb->fb.pitches[0 ], dfb->fb.depth);drm_fb_helper_fill_var (info, fbh, sizes->fb_width, sizes->fb_height);
@@ -111,8 +105,6 @@ static int armada_fb_create(struct drm_fb_helper *fbh,return 0 ; - err_fbcmap: -framebuffer_release (info); err_fballoc: dfb->fb.funcs->destroy (&dfb->fb);return ret;
@@ -171,6 +163,7 @@ int armada_fbdev_init(struct drm_device *dev)return 0 ; err_fb_setup: +drm_fb_helper_release_fbi (fbh);drm_fb_helper_fini (fbh); err_fb_helper: priv->fbdev =NULL ;
@@ -191,14 +184,8 @@ void armada_fbdev_fini(struct drm_device *dev)struct drm_fb_helper *fbh = priv->fbdev;if (fbh) { -struct fb_info *info = fbh->fbdev; - -if (info) { -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (fbh); +drm_fb_helper_release_fbi (fbh);drm_fb_helper_fini (fbh);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 9/24 drm/ast: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
Cleaned up the error handling in astfb_create a bit.
v3:
- No changes
v2:
- removed unused variable 'device' in astfb_create
--- drivers/gpu/drm/ast/ast_fb.c | 48 ++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 31 deletions(-)
drivers/gpu/drm/ast/ast_fb.c +17 -31
@@ -125,7 +125,7 @@ static void ast_fillrect(struct fb_info *info, const struct fb_fillrect *rect) {struct ast_fbdev *afbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);ast_dirty_update (afbdev, rect->dx, rect->dy, rect->width, rect->height); }
@@ -134,7 +134,7 @@ static void ast_copyarea(struct fb_info *info, const struct fb_copyarea *area) {struct ast_fbdev *afbdev = info->par; -sys_copyarea (info, area); +drm_fb_helper_sys_copyarea (info, area);ast_dirty_update (afbdev, area->dx, area->dy, area->width, area->height); }
@@ -143,7 +143,7 @@ static void ast_imageblit(struct fb_info *info, const struct fb_image *image) {struct ast_fbdev *afbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);ast_dirty_update (afbdev, image->dx, image->dy, image->width, image->height); }
@@ -193,7 +193,6 @@ static int astfb_create(struct drm_fb_helper *helper,struct drm_framebuffer *fb;struct fb_info *info;int size, ret; -struct device *device = &dev->pdev->dev;void *sysram;struct drm_gem_object *gobj =NULL ;struct ast_bo *bo =NULL ;
@@ -217,40 +216,28 @@ static int astfb_create(struct drm_fb_helper *helper,if (!sysram)return -ENOMEM ; - info =framebuffer_alloc (0 , device); -if (!info) { - ret = -ENOMEM ; - goto out; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); + goto err_free_vram; } info->par = afbdev; ret =ast_framebuffer_init (dev, &afbdev->afb, &mode_cmd, gobj);if (ret) - goto out; + goto err_release_fbi; afbdev->sysram = sysram; afbdev->size = size; fb = &afbdev->afb.base; afbdev->helper.fb = fb; - afbdev->helper.fbdev = info;strcpy (info->fix.id,"astdrmfb" ); info->flags =FBINFO_DEFAULT |FBINFO_CAN_FORCE_OUTPUT ; info->fbops = &astfb_ops; - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out; - } - - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out; - } info->apertures->ranges[0 ].base =pci_resource_start (dev->pdev,0 ); info->apertures->ranges[0 ].size =pci_resource_len (dev->pdev,0 );
@@ -266,7 +253,11 @@ static int astfb_create(struct drm_fb_helper *helper, fb->width, fb->height);return 0 ; -out: + +err_release_fbi: +drm_fb_helper_release_fbi (helper); +err_free_vram: +vfree (afbdev->sysram);return ret; }
@@ -297,15 +288,10 @@ static const struct drm_fb_helper_funcs ast_fb_helper_funcs = {static void ast_fbdev_destroy (struct drm_device *dev,struct ast_fbdev *afbdev) { -struct fb_info *info;struct ast_framebuffer *afb = &afbdev->afb; -if (afbdev->helper.fbdev) { - info = afbdev->helper.fbdev; -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } + +drm_fb_helper_unregister_fbi (&afbdev->helper); +drm_fb_helper_release_fbi (&afbdev->helper);if (afb->obj) {drm_gem_object_unreference_unlocked (afb->obj);
@@ -377,5 +363,5 @@ void ast_fbdev_set_suspend(struct drm_device *dev, int state)if (!ast->fbdev)return ; -fb_set_suspend (ast->fbdev->helper.fbdev, state); +drm_fb_helper_set_suspend (&ast->fbdev->helper, state); }
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 10/24 drm/omap: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- Update error handling for new drm_fb_helper funcs. Check using IS_ERR() instead of checking for NULL.
v2:
- No changes
--- drivers/gpu/drm/omapdrm/omap_fbdev.c | 38 ++++++++++++------------------------ 1 file changed, 13 insertions(+), 25 deletions(-)
drivers/gpu/drm/omapdrm/omap_fbdev.c +13 -25
@@ -86,11 +86,11 @@ static struct fb_ops omap_fb_ops = {/* Note: to properly handle manual update displays, we wrap the * basic fbdev ops which write to the framebuffer */ - .fb_read = fb_sys_read, - .fb_write = fb_sys_write, - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_read = drm_fb_helper_sys_read, + .fb_write = drm_fb_helper_sys_write, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par,
@@ -179,10 +179,10 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,mutex_lock (&dev->struct_mutex); - fbi =framebuffer_alloc (0 , dev->dev); -if (!fbi) { + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) {dev_err (dev->dev,"failed to allocate fb info\n" ); - ret = -ENOMEM ; + ret =PTR_ERR (fbi); goto fail_unlock; }
@@ -190,7 +190,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, fbdev->fb = fb; helper->fb = fb; - helper->fbdev = fbi; fbi->par = helper; fbi->flags =FBINFO_DEFAULT ;
@@ -198,12 +197,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,strcpy (fbi->fix.id,MODULE_NAME ); - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto fail_unlock; - } -drm_fb_helper_fill_fix (fbi, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (fbi, helper, sizes->fb_width, sizes->fb_height);
@@ -236,8 +229,9 @@ fail_unlock: fail:if (ret) { -if (fbi) -framebuffer_release (fbi); + +drm_fb_helper_release_fbi (helper); +if (fb) {drm_framebuffer_unregister_private (fb);drm_framebuffer_remove (fb);
@@ -312,17 +306,11 @@ void omap_fbdev_free(struct drm_device *dev)struct omap_drm_private *priv = dev->dev_private;struct drm_fb_helper *helper = priv->fbdev;struct omap_fbdev *fbdev; -struct fb_info *fbi;DBG (); - fbi = helper->fbdev; - -/* only cleanup framebuffer if it is present */ -if (fbi) { -unregister_framebuffer (fbi); -framebuffer_release (fbi); - } +drm_fb_helper_unregister_fbi (helper); +drm_fb_helper_release_fbi (helper);drm_fb_helper_fini (helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 10/24] drm/omap: Use new drm_fb_helper functions
Hi Archit,
Thank you for the patch.
Quoted 9 lines · On Friday 31 July 2015 16:21:48 Archit Taneja wrote:
Use the newly created wrapper
drm_fb_helperfunctions instead of calling core fbdev functions directly. They also simplify thefb_infocreation.v3:
- Update error handling for newdrm_fb_helperfuncs. Check usingIS_ERR()instead of checking for NULL.Reported-by Dan Carpenter <[email protected]>
Quoted 7 lines
v2:
- No changesCc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Signed-off-by Archit Taneja <[email protected]>
Quoted 94 lines
--- drivers/gpu/drm/omapdrm/omap_fbdev.c | 38 +++++++++++--------------------- 1 file changed, 13 insertions(+), 25 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/omapdrm/omap_fbdev.cindex 23b5a84..4916543 100644drivers/gpu/drm/omapdrm/omap_fbdev.c +8
-9@@ -86,11 +86,11 @@ static struct fb_ops omap_fb_ops = {/* Note: to properly handle manual update displays, we wrap the * basic fbdev ops which write to the framebuffer */ - .fb_read = fb_sys_read, - .fb_write = fb_sys_write, - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_read = drm_fb_helper_sys_read, + .fb_write = drm_fb_helper_sys_write, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par,@@ -179,10 +179,10 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,mutex_lock (&dev->struct_mutex); - fbi =framebuffer_alloc (0 , dev->dev); -if (!fbi) { + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) {dev_err (dev->dev,"failed to allocate fb info\n" ); - ret = -ENOMEM ; + ret =PTR_ERR (fbi); goto fail_unlock; }@@ -190,7 +190,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, fbdev->fb = fb; helper->fb = fb; - helper->fbdev = fbi; fbi->par = helper;drivers/gpu/drm/omapdrm/omap_fbdev.c +5
-16fbi->flags =FBINFO_DEFAULT ;@@ -198,12 +197,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,strcpy (fbi->fix.id,MODULE_NAME ); - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto fail_unlock; - } -drm_fb_helper_fill_fix (fbi, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (fbi, helper, sizes->fb_width, sizes->fb_height);@@ -236,8 +229,9 @@ fail_unlock: fail:if (ret) { -if (fbi) -framebuffer_release (fbi); + +drm_fb_helper_release_fbi (helper); +if (fb) {drm_framebuffer_unregister_private (fb);drm_framebuffer_remove (fb);@@ -312,17 +306,11 @@ void omap_fbdev_free(struct drm_device *dev)struct omap_drm_private *priv = dev->dev_private;struct drm_fb_helper *helper = priv->fbdev;struct omap_fbdev *fbdev; -struct fb_info *fbi;DBG (); - fbi = helper->fbdev; - -/* only cleanup framebuffer if it is present */ -if (fbi) { -unregister_framebuffer (fbi); -framebuffer_release (fbi); - } +drm_fb_helper_unregister_fbi (helper); +drm_fb_helper_release_fbi (helper);drm_fb_helper_fini (helper);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 10/24] drm/omap: Use new drm_fb_helper functions
In reply to Archit TanejaQuoted 12 lines · Archit Taneja
Use the newly created wrapper
drm_fb_helperfunctions instead of calling core fbdev functions directly. They also simplify thefb_infocreation.v3:
- Update error handling for newdrm_fb_helperfuncs. Check usingIS_ERR()instead of checking for NULL.Reported-by Dan Carpenter <[email protected]>v2:
- No changes
Quoted 7 lines
Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Signed-off-by Archit Taneja <[email protected]>--- drivers/gpu/drm/omapdrm/omap_fbdev.c | 38 ++++++++++++------------------------ 1 file changed, 13 insertions(+), 25 deletions(-)
Tomi
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 11/24 drm/tegra: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- No changes
v2:
- Fix up error handling path in tegra_fbdev_probe
--- drivers/gpu/drm/tegra/fb.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-)
drivers/gpu/drm/tegra/fb.c +9 -26
@@ -184,9 +184,9 @@ unreference:#ifdef CONFIG_DRM_TEGRA_FBDEV static struct fb_ops tegra_fb_ops = { .owner =THIS_MODULE , - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank,
@@ -224,11 +224,11 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,if (IS_ERR (bo))return PTR_ERR (bo); - info =framebuffer_alloc (0 , drm->dev); -if (!info) { + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) {dev_err (drm->dev,"failed to allocate framebuffer info\n" );drm_gem_object_unreference_unlocked (&bo->gem); -return -ENOMEM ; +return PTR_ERR (info); } fbdev->fb =tegra_fb_alloc (drm, &cmd, &bo,1 );
@@ -248,12 +248,6 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, info->flags =FBINFO_FLAG_DEFAULT ; info->fbops = &tegra_fb_ops; - err =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (err <0 ) { -dev_err (drm->dev,"failed to allocate color map: %d\n" , err); - goto destroy; - } -drm_fb_helper_fill_fix (info, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (info, helper, fb->width, fb->height);
@@ -282,7 +276,7 @@ destroy:drm_framebuffer_unregister_private (fb);tegra_fb_destroy (fb); release: -framebuffer_release (info); +drm_fb_helper_release_fbi (helper);return err; }
@@ -347,20 +341,9 @@ fini:static void tegra_fbdev_exit (struct tegra_fbdev *fbdev) { -struct fb_info *info = fbdev->base.fbdev; - -if (info) { -int err; - err =unregister_framebuffer (info); -if (err <0 ) -DRM_DEBUG_KMS ("failed to unregister framebuffer\n" ); - -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&fbdev->base); +drm_fb_helper_release_fbi (&fbdev->base);if (fbdev->fb) {drm_framebuffer_unregister_private (&fbdev->fb->base);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 12/24 drm/msm: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/msm/msm_fbdev.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-)
drivers/gpu/drm/msm/msm_fbdev.c +10 -24
@@ -43,11 +43,11 @@ static struct fb_ops msm_fb_ops = {/* Note: to properly handle manual update displays, we wrap the * basic fbdev ops which write to the framebuffer */ - .fb_read = fb_sys_read, - .fb_write = fb_sys_write, - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_read = drm_fb_helper_sys_read, + .fb_write = drm_fb_helper_sys_write, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_mmap = msm_fbdev_mmap, .fb_check_var = drm_fb_helper_check_var,
@@ -144,10 +144,10 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, goto fail_unlock; } - fbi =framebuffer_alloc (0 , dev->dev); -if (!fbi) { + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) {dev_err (dev->dev,"failed to allocate fb info\n" ); - ret = -ENOMEM ; + ret =PTR_ERR (fbi); goto fail_unlock; }
@@ -155,7 +155,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, fbdev->fb = fb; helper->fb = fb; - helper->fbdev = fbi; fbi->par = helper; fbi->flags =FBINFO_DEFAULT ;
@@ -163,12 +162,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,strcpy (fbi->fix.id,"msm" ); - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto fail_unlock; - } -drm_fb_helper_fill_fix (fbi, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (fbi, helper, sizes->fb_width, sizes->fb_height);
@@ -191,7 +184,6 @@ fail_unlock: fail:if (ret) { -framebuffer_release (fbi);if (fb) {drm_framebuffer_unregister_private (fb);drm_framebuffer_remove (fb);
@@ -266,17 +258,11 @@ void msm_fbdev_free(struct drm_device *dev)struct msm_drm_private *priv = dev->dev_private;struct drm_fb_helper *helper = priv->fbdev;struct msm_fbdev *fbdev; -struct fb_info *fbi;DBG (); - fbi = helper->fbdev; - -/* only cleanup framebuffer if it is present */ -if (fbi) { -unregister_framebuffer (fbi); -framebuffer_release (fbi); - } +drm_fb_helper_unregister_fbi (helper); +drm_fb_helper_release_fbi (helper);drm_fb_helper_fini (helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 13/24 drm/exynos: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- No changes
v2:
- Remove unnecessary dealloc cmap in error handling path
--- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 47 ++++++++----------------------- 1 file changed, 12 insertions(+), 35 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +12 -35
@@ -65,9 +65,9 @@ static int exynos_drm_fb_mmap(struct fb_info *info,static struct fb_ops exynos_drm_fb_ops = { .owner =THIS_MODULE , .fb_mmap = exynos_drm_fb_mmap, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank,
@@ -142,10 +142,10 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,mutex_lock (&dev->struct_mutex); - fbi =framebuffer_alloc (0 , &pdev->dev); -if (!fbi) { + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) {DRM_ERROR ("failed to allocate fb info.\n" ); - ret = -ENOMEM ; + ret =PTR_ERR (fbi); goto out; }
@@ -165,7 +165,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,if (IS_ERR (exynos_gem_obj)) { ret =PTR_ERR (exynos_gem_obj); - goto err_release_framebuffer; + goto err_release_fbi; } exynos_fbdev->exynos_gem_obj = exynos_gem_obj;
@@ -178,33 +178,23 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, goto err_destroy_gem; } - helper->fbdev = fbi; - fbi->par = helper; fbi->flags =FBINFO_FLAG_DEFAULT ; fbi->fbops = &exynos_drm_fb_ops; - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { -DRM_ERROR ("failed to allocate cmap.\n" ); - goto err_destroy_framebuffer; - } - ret =exynos_drm_fbdev_update (helper, sizes, helper->fb);if (ret <0 ) - goto err_dealloc_cmap; + goto err_destroy_framebuffer;mutex_unlock (&dev->struct_mutex);return ret; -err_dealloc_cmap: -fb_dealloc_cmap (&fbi->cmap); err_destroy_framebuffer:drm_framebuffer_cleanup (helper->fb); err_destroy_gem:exynos_drm_gem_destroy (exynos_gem_obj); -err_release_framebuffer: -framebuffer_release (fbi); +err_release_fbi: +drm_fb_helper_release_fbi (helper);/* * if failed, all resources allocated above would be released by
@@ -312,21 +302,8 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, } } -/* release linux framebuffer */ -if (fb_helper->fbdev) { -struct fb_info *info; -int ret; - - info = fb_helper->fbdev; - ret =unregister_framebuffer (info); -if (ret <0 ) -DRM_DEBUG_KMS ("failed unregister_framebuffer()\n" ); - -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (fb_helper); +drm_fb_helper_release_fbi (fb_helper);drm_fb_helper_fini (fb_helper); }
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 14/24 drm/gma500: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- No changes
v2:
- removed unused variable 'device' in psbfb_create
--- drivers/gpu/drm/gma500/accel_2d.c | 6 ++--- drivers/gpu/drm/gma500/framebuffer.c | 48 ++++++++++++------------------------ 2 files changed, 19 insertions(+), 35 deletions(-)
drivers/gpu/drm/gma500/accel_2d.c +3 -3
@@ -276,12 +276,12 @@ static void psbfb_copyarea_accel(struct fb_info *info,break ;default :/* software fallback */ -cfb_copyarea (info, a); +drm_fb_helper_cfb_copyarea (info, a);return ; }if (!gma_power_begin (dev, false)) { -cfb_copyarea (info, a); +drm_fb_helper_cfb_copyarea (info, a);return ; } psb_accel_2d_copy(dev_priv,
@@ -308,7 +308,7 @@ void psbfb_copyarea(struct fb_info *info,/* Avoid the 8 pixel erratum */ if (region->width ==8 || region->height ==8 || (info->flags &FBINFO_HWACCEL_DISABLED )) -return cfb_copyarea (info, region); +return drm_fb_helper_cfb_copyarea (info, region);psbfb_copyarea_accel (info, region); }
drivers/gpu/drm/gma500/framebuffer.c +16 -32
111 lines not on this page · raw message
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 15/24 drm/mgag200: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- Don't touch remove_conflicting_framebuffers
v2:
- remove unused goto label 'out'
--- drivers/gpu/drm/mgag200/mgag200_fb.c | 39 ++++++++---------------------------- 1 file changed, 8 insertions(+), 31 deletions(-)
drivers/gpu/drm/mgag200/mgag200_fb.c +8 -31
@@ -101,7 +101,7 @@ static void mga_fillrect(struct fb_info *info, const struct fb_fillrect *rect) {struct mga_fbdev *mfbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);mga_dirty_update (mfbdev, rect->dx, rect->dy, rect->width, rect->height); }
@@ -110,7 +110,7 @@ static void mga_copyarea(struct fb_info *info, const struct fb_copyarea *area) {struct mga_fbdev *mfbdev = info->par; -sys_copyarea (info, area); +drm_fb_helper_sys_copyarea (info, area);mga_dirty_update (mfbdev, area->dx, area->dy, area->width, area->height); }
@@ -119,7 +119,7 @@ static void mga_imageblit(struct fb_info *info, const struct fb_image *image) {struct mga_fbdev *mfbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);mga_dirty_update (mfbdev, image->dx, image->dy, image->width, image->height); }
@@ -166,7 +166,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper,struct fb_info *info;struct drm_framebuffer *fb;struct drm_gem_object *gobj =NULL ; -struct device *device = &dev->pdev->dev;struct mgag200_bo *bo;int ret;void *sysram;
@@ -191,9 +190,9 @@ static int mgag200fb_create(struct drm_fb_helper *helper,if (!sysram)return -ENOMEM ; - info =framebuffer_alloc (0 , device); -if (info ==NULL ) -return -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) +return PTR_ERR (info); info->par = mfbdev;
@@ -208,14 +207,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper,/* setup helper */ mfbdev->helper.fb = fb; - mfbdev->helper.fbdev = info; - - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { -DRM_ERROR ("%s: can't allocate color map\n" , info->fix.id); - ret = -ENOMEM ; - goto out; - }strcpy (info->fix.id,"mgadrmfb" );
@@ -223,11 +214,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper, info->fbops = &mgag200fb_ops;/* setup aperture base/size for vesafb takeover */ - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out; - } info->apertures->ranges[0 ].base = mdev->dev->mode_config.fb_base; info->apertures->ranges[0 ].size = mdev->mc.vram_size;
@@ -242,24 +228,15 @@ static int mgag200fb_create(struct drm_fb_helper *helper,DRM_DEBUG_KMS ("allocated %dx%d\n" , fb->width, fb->height);return 0 ; -out: -return ret; }static int mga_fbdev_destroy (struct drm_device *dev,struct mga_fbdev *mfbdev) { -struct fb_info *info;struct mga_framebuffer *mfb = &mfbdev->mfb; -if (mfbdev->helper.fbdev) { - info = mfbdev->helper.fbdev; - -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&mfbdev->helper); +drm_fb_helper_release_fbi (&mfbdev->helper);if (mfb->obj) {drm_gem_object_unreference_unlocked (mfb->obj);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 16/24 drm/radeon: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- Don't touch remove_conflicting_framebuffers
v2:
- Fix build break because of missing include of drm_fb_helper in radeon_drv.c
--- drivers/gpu/drm/radeon/radeon_fb.c | 42 +++++++++++--------------------------- 1 file changed, 12 insertions(+), 30 deletions(-)
drivers/gpu/drm/radeon/radeon_fb.c +12 -30
@@ -82,9 +82,9 @@ static struct fb_ops radeonfb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = radeon_fb_helper_set_par, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -227,7 +227,6 @@ static int radeonfb_create(struct drm_fb_helper *helper,struct drm_mode_fb_cmd2 mode_cmd;struct drm_gem_object *gobj =NULL ;struct radeon_bo *rbo =NULL ; -struct device *device = &rdev->pdev->dev;int ret;unsigned long tmp;
@@ -250,9 +249,9 @@ static int radeonfb_create(struct drm_fb_helper *helper, rbo =gem_to_radeon_bo (gobj);/* okay we have an object now allocate the framebuffer */ - info =framebuffer_alloc (0 , device); -if (info ==NULL ) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_unref; }
@@ -261,14 +260,13 @@ static int radeonfb_create(struct drm_fb_helper *helper, ret =radeon_framebuffer_init (rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj);if (ret) {DRM_ERROR ("failed to initialize framebuffer %d\n" , ret); - goto out_unref; + goto out_destroy_fbi; } fb = &rfbdev->rfb.base;/* setup helper */ rfbdev->helper.fb = fb; - rfbdev->helper.fbdev = info;memset_io (rbo->kptr,0x0 ,radeon_bo_size (rbo));
@@ -288,11 +286,6 @@ static int radeonfb_create(struct drm_fb_helper *helper,drm_fb_helper_fill_var (info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);/* setup aperture base/size for vesafb takeover */ - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out_unref; - } info->apertures->ranges[0 ].base = rdev->ddev->mode_config.fb_base; info->apertures->ranges[0 ].size = rdev->mc.aper_size;
@@ -300,13 +293,7 @@ static int radeonfb_create(struct drm_fb_helper *helper,if (info->screen_base ==NULL ) { ret = -ENOSPC ; - goto out_unref; - } - - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out_unref; + goto out_destroy_fbi; }DRM_INFO ("fb mappable at 0x%lX\n" , info->fix.smem_start);
@@ -318,6 +305,8 @@ static int radeonfb_create(struct drm_fb_helper *helper,vga_switcheroo_client_fb_set (rdev->ddev->pdev, info);return 0 ; +out_destroy_fbi: +drm_fb_helper_release_fbi (helper); out_unref:if (rbo) {
@@ -338,17 +327,10 @@ void radeon_fb_output_poll_changed(struct radeon_device *rdev)static int radeon_fbdev_destroy (struct drm_device *dev,struct radeon_fbdev *rfbdev) { -struct fb_info *info;struct radeon_framebuffer *rfb = &rfbdev->rfb; -if (rfbdev->helper.fbdev) { - info = rfbdev->helper.fbdev; - -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&rfbdev->helper); +drm_fb_helper_release_fbi (&rfbdev->helper);if (rfb->obj) {radeonfb_destroy_pinned_object (rfb->obj);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 17/24 drm/qxl: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/qxl/qxl_fb.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)
drivers/gpu/drm/qxl/qxl_fb.c +13 -27
@@ -197,7 +197,7 @@ static void qxl_fb_fillrect(struct fb_info *info, {struct qxl_fbdev *qfbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);qxl_dirty_update (qfbdev, rect->dx, rect->dy, rect->width, rect->height); }
@@ -207,7 +207,7 @@ static void qxl_fb_copyarea(struct fb_info *info, {struct qxl_fbdev *qfbdev = info->par; -sys_copyarea (info, area); +drm_fb_helper_sys_copyarea (info, area);qxl_dirty_update (qfbdev, area->dx, area->dy, area->width, area->height); }
@@ -217,7 +217,7 @@ static void qxl_fb_imageblit(struct fb_info *info, {struct qxl_fbdev *qfbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);qxl_dirty_update (qfbdev, image->dx, image->dy, image->width, image->height); }
@@ -345,7 +345,6 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,struct drm_mode_fb_cmd2 mode_cmd;struct drm_gem_object *gobj =NULL ;struct qxl_bo *qbo =NULL ; -struct device *device = &qdev->pdev->dev;int ret;int size;int bpp = sizes->surface_bpp;
@@ -374,9 +373,9 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev, shadow); size = mode_cmd.pitches[0 ] * mode_cmd.height; - info =framebuffer_alloc (0 , device); -if (info ==NULL ) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (&qfbdev->helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_unref; }
@@ -388,7 +387,7 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,/* setup helper with fb data */ qfbdev->helper.fb = fb; - qfbdev->helper.fbdev = info; + qfbdev->shadow = shadow;strcpy (info->fix.id,"qxldrmfb" );
@@ -410,11 +409,6 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev, sizes->fb_height);/* setup aperture base/size for vesafb takeover */ - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out_unref; - } info->apertures->ranges[0 ].base = qdev->ddev->mode_config.fb_base; info->apertures->ranges[0 ].size = qdev->vram_size;
@@ -423,13 +417,7 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,if (info->screen_base ==NULL ) { ret = -ENOSPC ; - goto out_unref; - } - - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out_unref; + goto out_destroy_fbi; } info->fbdefio = &qxl_defio;
@@ -441,6 +429,8 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,DRM_INFO ("fb: depth %d, pitch %d, width %d, height %d\n" , fb->depth, fb->pitches[0 ], fb->width, fb->height);return 0 ; +out_destroy_fbi: +drm_fb_helper_release_fbi (&qfbdev->helper); out_unref:if (qbo) { ret =qxl_bo_reserve (qbo, false);
@@ -479,15 +469,11 @@ static int qxl_fb_find_or_create_single(static int qxl_fbdev_destroy (struct drm_device *dev,struct qxl_fbdev *qfbdev) { -struct fb_info *info;struct qxl_framebuffer *qfb = &qfbdev->qfb; -if (qfbdev->helper.fbdev) { - info = qfbdev->helper.fbdev; +drm_fb_helper_unregister_fbi (&qfbdev->helper); +drm_fb_helper_release_fbi (&qfbdev->helper); -unregister_framebuffer (info); -framebuffer_release (info); - }if (qfb->obj) {qxlfb_destroy_pinned_object (qfb->obj); qfb->obj =NULL ;
@@ -557,7 +543,7 @@ void qxl_fbdev_fini(struct qxl_device *qdev)void qxl_fbdev_set_suspend (struct qxl_device *qdev,int state) { -fb_set_suspend (qdev->mode_info.qfbdev->helper.fbdev, state); +drm_fb_helper_set_suspend (&qdev->mode_info.qfbdev->helper, state); }bool qxl_fbdev_qobj_is_fb (struct qxl_device *qdev,struct qxl_bo *qobj)
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 18/24 drm/i915: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- Don't touch remove_conflicting_framebuffers
v2:
- No changes
--- drivers/gpu/drm/i915/intel_fbdev.c | 40 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/intel_fbdev.c +12 -28
@@ -126,9 +126,9 @@ static struct fb_ops intelfb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = intel_fbdev_set_par, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_pan_display = intel_fbdev_pan_display, .fb_blank = intel_fbdev_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -237,9 +237,9 @@ static int intelfb_create(struct drm_fb_helper *helper, obj = intel_fb->obj; size = obj->base.size; - info =framebuffer_alloc (0 , &dev->pdev->dev); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_unpin; }
@@ -248,24 +248,13 @@ static int intelfb_create(struct drm_fb_helper *helper, fb = &ifbdev->fb->base; ifbdev->helper.fb = fb; - ifbdev->helper.fbdev = info;strcpy (info->fix.id,"inteldrmfb" ); info->flags =FBINFO_DEFAULT |FBINFO_CAN_FORCE_OUTPUT ; info->fbops = &intelfb_ops; - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out_unpin; - }/* setup aperture base/size for vesafb takeover */ - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out_unpin; - } info->apertures->ranges[0 ].base = dev->mode_config.fb_base; info->apertures->ranges[0 ].size = dev_priv->gtt.mappable_end;
@@ -277,7 +266,7 @@ static int intelfb_create(struct drm_fb_helper *helper, size);if (!info->screen_base) { ret = -ENOSPC ; - goto out_unpin; + goto out_destroy_fbi; } info->screen_size = size;
@@ -304,6 +293,8 @@ static int intelfb_create(struct drm_fb_helper *helper,vga_switcheroo_client_fb_set (dev->pdev, info);return 0 ; +out_destroy_fbi: +drm_fb_helper_release_fbi (helper); out_unpin:i915_gem_object_ggtt_unpin (obj);drm_gem_object_unreference (&obj->base);
@@ -550,16 +541,9 @@ static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {static void intel_fbdev_destroy (struct drm_device *dev,struct intel_fbdev *ifbdev) { -if (ifbdev->helper.fbdev) { -struct fb_info *info = ifbdev->helper.fbdev; -unregister_framebuffer (info); -iounmap (info->screen_base); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&ifbdev->helper); +drm_fb_helper_release_fbi (&ifbdev->helper);drm_fb_helper_fini (&ifbdev->helper);
@@ -810,7 +794,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronousif (state ==FBINFO_STATE_RUNNING && ifbdev->fb->obj->stolen)memset_io (info->screen_base,0 , info->screen_size); -fb_set_suspend (info, state); +drm_fb_helper_set_suspend (&ifbdev->helper, state);console_unlock (); }
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 19/24 drm/nouveau: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- Don't touch remove_conflicting_framebuffers
v2:
- remove unused variable pdev in nouveau_fbcon_create
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 39 ++++++++++----------------------- 1 file changed, 12 insertions(+), 27 deletions(-)
drivers/gpu/drm/nouveau/nouveau_fbcon.c +12 -27
@@ -84,7 +84,7 @@ nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)if (ret != -ENODEV )nouveau_fbcon_gpu_lockup (info); -cfb_fillrect (info, rect); +drm_fb_helper_cfb_fillrect (info, rect); } static void
@@ -116,7 +116,7 @@ nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image)if (ret != -ENODEV )nouveau_fbcon_gpu_lockup (info); -cfb_copyarea (info, image); +drm_fb_helper_cfb_copyarea (info, image); } static void
@@ -148,7 +148,7 @@ nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)if (ret != -ENODEV )nouveau_fbcon_gpu_lockup (info); -cfb_imageblit (info, image); +drm_fb_helper_cfb_imageblit (info, image); } static int
@@ -197,9 +197,9 @@ static struct fb_ops nouveau_fbcon_sw_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -319,7 +319,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,struct nouveau_channel *chan;struct nouveau_bo *nvbo;struct drm_mode_fb_cmd2 mode_cmd; -struct pci_dev *pdev = dev->pdev;int size, ret; mode_cmd.width = sizes->surface_width;
@@ -365,20 +364,13 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,mutex_lock (&dev->struct_mutex); - info =framebuffer_alloc (0 , &pdev->dev); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_unlock; } info->skip_vt_switch =1 ; - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; -framebuffer_release (info); - goto out_unlock; - } - info->par = fbcon;nouveau_framebuffer_init (dev, &fbcon->nouveau_fb, &mode_cmd, nvbo);
@@ -388,7 +380,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,/* setup helper */ fbcon->helper.fb = fb; - fbcon->helper.fbdev = info;strcpy (info->fix.id,"nouveaufb" );if (!chan)
@@ -450,15 +441,9 @@ static int nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon) { struct nouveau_framebuffer *nouveau_fb = &fbcon->nouveau_fb; -struct fb_info *info; -if (fbcon->helper.fbdev) { - info = fbcon->helper.fbdev; -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&fbcon->helper); +drm_fb_helper_release_fbi (&fbcon->helper);if (nouveau_fb->nvbo) {nouveau_bo_unmap (nouveau_fb->nvbo);
@@ -496,7 +481,7 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state)console_lock ();if (state ==FBINFO_STATE_RUNNING )nouveau_fbcon_accel_restore (dev); -fb_set_suspend (drm->fbcon->helper.fbdev, state); +drm_fb_helper_set_suspend (&drm->fbcon->helper, state);if (state !=FBINFO_STATE_RUNNING )nouveau_fbcon_accel_save_disable (dev);console_unlock ();
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 20/24 drm/udl: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- No changes
v2:
- remove unused variable device in udlfb_create
--- drivers/gpu/drm/udl/udl_fb.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-)
drivers/gpu/drm/udl/udl_fb.c +12 -29
@@ -288,7 +288,7 @@ static void udl_fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect {struct udl_fbdev *ufbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);udl_handle_damage (&ufbdev->ufb, rect->dx, rect->dy, rect->width, rect->height);
@@ -298,7 +298,7 @@ static void udl_fb_copyarea(struct fb_info *info, const struct fb_copyarea *regi {struct udl_fbdev *ufbdev = info->par; -sys_copyarea (info, region); +drm_fb_helper_sys_copyarea (info, region);udl_handle_damage (&ufbdev->ufb, region->dx, region->dy, region->width, region->height);
@@ -308,7 +308,7 @@ static void udl_fb_imageblit(struct fb_info *info, const struct fb_image *image) {struct udl_fbdev *ufbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);udl_handle_damage (&ufbdev->ufb, image->dx, image->dy, image->width, image->height);
@@ -476,7 +476,6 @@ static int udlfb_create(struct drm_fb_helper *helper, container_of(helper, struct udl_fbdev, helper);struct drm_device *dev = ufbdev->helper.dev;struct fb_info *info; -struct device *device = dev->dev;struct drm_framebuffer *fb;struct drm_mode_fb_cmd2 mode_cmd;struct udl_gem_object *obj;
@@ -506,21 +505,20 @@ static int udlfb_create(struct drm_fb_helper *helper, goto out_gfree; } - info =framebuffer_alloc (0 , device); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_gfree; } info->par = ufbdev; ret =udl_framebuffer_init (dev, &ufbdev->ufb, &mode_cmd, obj);if (ret) - goto out_gfree; + goto out_destroy_fbi; fb = &ufbdev->ufb.base; ufbdev->helper.fb = fb; - ufbdev->helper.fbdev = info;strcpy (info->fix.id,"udldrmfb" );
@@ -533,18 +531,13 @@ static int udlfb_create(struct drm_fb_helper *helper,drm_fb_helper_fill_fix (info, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (info, &ufbdev->helper, sizes->fb_width, sizes->fb_height); - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out_gfree; - } - -DRM_DEBUG_KMS ("allocated %dx%d vmal %p\n" , fb->width, fb->height, ufbdev->ufb.obj->vmapping);return ret; +out_destroy_fbi: +drm_fb_helper_release_fbi (helper); out_gfree:drm_gem_object_unreference (&ufbdev->ufb.obj->base); out:
@@ -558,14 +551,8 @@ static const struct drm_fb_helper_funcs udl_fb_helper_funcs = {static void udl_fbdev_destroy (struct drm_device *dev,struct udl_fbdev *ufbdev) { -struct fb_info *info; -if (ufbdev->helper.fbdev) { - info = ufbdev->helper.fbdev; -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&ufbdev->helper); +drm_fb_helper_release_fbi (&ufbdev->helper);drm_fb_helper_fini (&ufbdev->helper);drm_framebuffer_unregister_private (&ufbdev->ufb.base);drm_framebuffer_cleanup (&ufbdev->ufb.base);
@@ -631,11 +618,7 @@ void udl_fbdev_unplug(struct drm_device *dev)return ; ufbdev = udl->fbdev; -if (ufbdev->helper.fbdev) { -struct fb_info *info; - info = ufbdev->helper.fbdev; -unlink_framebuffer (info); - } +drm_fb_helper_unlink_fbi (&ufbdev->helper); } struct drm_framebuffer *
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 21/24 drm/bochs: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- Don't touch remove_conflicting_framebuffers
v2:
- remove unused variable device in bochsfb_create
--- drivers/gpu/drm/bochs/bochs_drv.c | 4 ++-- drivers/gpu/drm/bochs/bochs_fbdev.c | 36 +++++++++++------------------------- 2 files changed, 13 insertions(+), 27 deletions(-)
drivers/gpu/drm/bochs/bochs_drv.c +2 -2
@@ -109,7 +109,7 @@ static int bochs_pm_suspend(struct device *dev)if (bochs->fb.initialized) {console_lock (); -fb_set_suspend (bochs->fb.helper.fbdev,1 ); +drm_fb_helper_set_suspend (&bochs->fb.helper,1 );console_unlock (); }
@@ -126,7 +126,7 @@ static int bochs_pm_resume(struct device *dev)if (bochs->fb.initialized) {console_lock (); -fb_set_suspend (bochs->fb.helper.fbdev,0 ); +drm_fb_helper_set_suspend (&bochs->fb.helper,0 );console_unlock (); }
drivers/gpu/drm/bochs/bochs_fbdev.c +11 -25
@@ -24,9 +24,9 @@ static struct fb_ops bochsfb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -56,11 +56,9 @@ static int bochsfb_create(struct drm_fb_helper *helper, {struct bochs_device *bochs = container_of(helper, struct bochs_device, fb.helper); -struct drm_device *dev = bochs->dev;struct fb_info *info;struct drm_framebuffer *fb;struct drm_mode_fb_cmd2 mode_cmd; -struct device *device = &dev->pdev->dev;struct drm_gem_object *gobj =NULL ;struct bochs_bo *bo =NULL ;int size, ret;
@@ -106,22 +104,23 @@ static int bochsfb_create(struct drm_fb_helper *helper,ttm_bo_unreserve (&bo->bo);/* init fb device */ - info =framebuffer_alloc (0 , device); -if (info ==NULL ) -return -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) +return PTR_ERR (info); info->par = &bochs->fb.helper; ret =bochs_framebuffer_init (bochs->dev, &bochs->fb.gfb, &mode_cmd, gobj); -if (ret) +if (ret) { +drm_fb_helper_release_fbi (helper);return ret; + } bochs->fb.size = size;/* setup helper */ fb = &bochs->fb.gfb.base; bochs->fb.helper.fb = fb; - bochs->fb.helper.fbdev = info;strcpy (info->fix.id,"bochsdrmfb" );
@@ -139,30 +138,17 @@ static int bochsfb_create(struct drm_fb_helper *helper, info->fix.smem_start =0 ; info->fix.smem_len = size; - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { -DRM_ERROR ("%s: can't allocate color map\n" , info->fix.id); -return -ENOMEM ; - } -return 0 ; }static int bochs_fbdev_destroy (struct bochs_device *bochs) {struct bochs_framebuffer *gfb = &bochs->fb.gfb; -struct fb_info *info;DRM_DEBUG_DRIVER ("\n" ); -if (bochs->fb.helper.fbdev) { - info = bochs->fb.helper.fbdev; - -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&bochs->fb.helper); +drm_fb_helper_release_fbi (&bochs->fb.helper);if (gfb->obj) {drm_gem_object_unreference_unlocked (gfb->obj);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 22/24 drm/amdgpu: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- Don't touch remove_conflicting_framebuffers
v2:
- Fixed PTR_ERR issue mentioned by kbuild bot
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 45 +++++++++++----------------------- 1 file changed, 14 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +14 -31
@@ -53,9 +53,9 @@ static struct fb_ops amdgpufb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = drm_fb_helper_cfb_fillrect, + .fb_copyarea = drm_fb_helper_cfb_copyarea, + .fb_imageblit = drm_fb_helper_cfb_imageblit, .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap,
@@ -179,7 +179,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,struct drm_mode_fb_cmd2 mode_cmd;struct drm_gem_object *gobj =NULL ;struct amdgpu_bo *rbo =NULL ; -struct device *device = &adev->pdev->dev;int ret;unsigned long tmp;
@@ -201,9 +200,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper, rbo =gem_to_amdgpu_bo (gobj);/* okay we have an object now allocate the framebuffer */ - info =framebuffer_alloc (0 , device); -if (info ==NULL ) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto out_unref; }
@@ -212,14 +211,13 @@ static int amdgpufb_create(struct drm_fb_helper *helper, ret =amdgpu_framebuffer_init (adev->ddev, &rfbdev->rfb, &mode_cmd, gobj);if (ret) {DRM_ERROR ("failed to initialize framebuffer %d\n" , ret); - goto out_unref; + goto out_destroy_fbi; } fb = &rfbdev->rfb.base;/* setup helper */ rfbdev->helper.fb = fb; - rfbdev->helper.fbdev = info;memset_io (rbo->kptr,0x0 ,amdgpu_bo_size (rbo));
@@ -239,11 +237,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,drm_fb_helper_fill_var (info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);/* setup aperture base/size for vesafb takeover */ - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { - ret = -ENOMEM ; - goto out_unref; - } info->apertures->ranges[0 ].base = adev->ddev->mode_config.fb_base; info->apertures->ranges[0 ].size = adev->mc.aper_size;
@@ -251,13 +244,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,if (info->screen_base ==NULL ) { ret = -ENOSPC ; - goto out_unref; - } - - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto out_unref; + goto out_destroy_fbi; }DRM_INFO ("fb mappable at 0x%lX\n" , info->fix.smem_start);
@@ -269,6 +256,8 @@ static int amdgpufb_create(struct drm_fb_helper *helper,vga_switcheroo_client_fb_set (adev->ddev->pdev, info);return 0 ; +out_destroy_fbi: +drm_fb_helper_release_fbi (helper); out_unref:if (rbo) {
@@ -290,17 +279,10 @@ void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev)static int amdgpu_fbdev_destroy (struct drm_device *dev,struct amdgpu_fbdev *rfbdev) { -struct fb_info *info;struct amdgpu_framebuffer *rfb = &rfbdev->rfb; -if (rfbdev->helper.fbdev) { - info = rfbdev->helper.fbdev; - -unregister_framebuffer (info); -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&rfbdev->helper); +drm_fb_helper_release_fbi (&rfbdev->helper);if (rfb->obj) {amdgpufb_destroy_pinned_object (rfb->obj);
@@ -395,7 +377,8 @@ void amdgpu_fbdev_fini(struct amdgpu_device *adev)void amdgpu_fbdev_set_suspend (struct amdgpu_device *adev,int state) {if (adev->mode_info.rfbdev) -fb_set_suspend (adev->mode_info.rfbdev->helper.fbdev, state); +drm_fb_helper_set_suspend (&adev->mode_info.rfbdev->helper, + state); }int amdgpu_fbdev_total_size (struct amdgpu_device *adev)
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 23/24 drm/virtio: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
v3:
- Don't touch remove_conflicting_framebuffers
v2:
- add missing header for virtgpu_fb.c
--- drivers/gpu/drm/virtio/virtgpu_fb.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-)
drivers/gpu/drm/virtio/virtgpu_fb.c +9 -23
@@ -173,7 +173,7 @@ static void virtio_gpu_3d_fillrect(struct fb_info *info, const struct fb_fillrect *rect) {struct virtio_gpu_fbdev *vfbdev = info->par; -sys_fillrect (info, rect); +drm_fb_helper_sys_fillrect (info, rect);virtio_gpu_dirty_update (&vfbdev->vgfb, true, rect->dx, rect->dy, rect->width, rect->height);schedule_delayed_work (&vfbdev->work,VIRTIO_GPU_FBCON_POLL_PERIOD );
@@ -183,7 +183,7 @@ static void virtio_gpu_3d_copyarea(struct fb_info *info, const struct fb_copyarea *area) {struct virtio_gpu_fbdev *vfbdev = info->par; -sys_copyarea (info, area); +drm_fb_helper_sys_copyarea (info, area);virtio_gpu_dirty_update (&vfbdev->vgfb, true, area->dx, area->dy, area->width, area->height);schedule_delayed_work (&vfbdev->work,VIRTIO_GPU_FBCON_POLL_PERIOD );
@@ -193,7 +193,7 @@ static void virtio_gpu_3d_imageblit(struct fb_info *info, const struct fb_image *image) {struct virtio_gpu_fbdev *vfbdev = info->par; -sys_imageblit (info, image); +drm_fb_helper_sys_imageblit (info, image);virtio_gpu_dirty_update (&vfbdev->vgfb, true, image->dx, image->dy, image->width, image->height);schedule_delayed_work (&vfbdev->work,VIRTIO_GPU_FBCON_POLL_PERIOD );
@@ -230,7 +230,6 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,struct drm_framebuffer *fb;struct drm_mode_fb_cmd2 mode_cmd = {};struct virtio_gpu_object *obj; -struct device *device = vgdev->dev;uint32_t resid, format, size;int ret;
@@ -317,18 +316,12 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,if (ret) goto err_obj_attach; - info =framebuffer_alloc (0 , device); -if (!info) { - ret = -ENOMEM ; + info =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (info)) { + ret =PTR_ERR (info); goto err_fb_alloc; } - ret =fb_alloc_cmap (&info->cmap,256 ,0 ); -if (ret) { - ret = -ENOMEM ; - goto err_fb_alloc_cmap; - } - info->par = helper; ret = virtio_gpu_framebuffer_init(dev, &vfbdev->vgfb,
@@ -339,7 +332,6 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper, fb = &vfbdev->vgfb.base; vfbdev->helper.fb = fb; - vfbdev->helper.fbdev = info;strcpy (info->fix.id,"virtiodrmfb" ); info->flags =FBINFO_DEFAULT ;
@@ -357,9 +349,7 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,return 0 ; err_fb_init: -fb_dealloc_cmap (&info->cmap); -err_fb_alloc_cmap: -framebuffer_release (info); +drm_fb_helper_release_fbi (helper); err_fb_alloc:virtio_gpu_cmd_resource_inval_backing (vgdev, resid); err_obj_attach:
@@ -371,15 +361,11 @@ err_obj_vmap:static int virtio_gpu_fbdev_destroy (struct drm_device *dev,struct virtio_gpu_fbdev *vgfbdev) { -struct fb_info *info;struct virtio_gpu_framebuffer *vgfb = &vgfbdev->vgfb; -if (vgfbdev->helper.fbdev) { - info = vgfbdev->helper.fbdev; +drm_fb_helper_unregister_fbi (&vgfbdev->helper); +drm_fb_helper_release_fbi (&vgfbdev->helper); -unregister_framebuffer (info); -framebuffer_release (info); - }if (vgfb->obj) vgfb->obj =NULL ;drm_fb_helper_fini (&vgfbdev->helper);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 24/24 drm/fb_cma_helper: Use new drm_fb_helper functions
In reply to Archit TanejaUse the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation.
--- drivers/gpu/drm/drm_fb_cma_helper.c | 45 +++++++++---------------------------- 1 file changed, 11 insertions(+), 34 deletions(-)
drivers/gpu/drm/drm_fb_cma_helper.c +11 -34
@@ -234,9 +234,9 @@ EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show);static struct fb_ops drm_fbdev_cma_ops = { .owner =THIS_MODULE , - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_blank = drm_fb_helper_blank,
@@ -275,10 +275,9 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper,if (IS_ERR (obj))return -ENOMEM ; - fbi =framebuffer_alloc (0 , dev->dev); -if (!fbi) { -dev_err (dev->dev,"Failed to allocate framebuffer info.\n" ); - ret = -ENOMEM ; + fbi =drm_fb_helper_alloc_fbi (helper); +if (IS_ERR (fbi)) { + ret =PTR_ERR (fbi); goto err_drm_gem_cma_free_object; }
@@ -286,23 +285,16 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper,if (IS_ERR (fbdev_cma->fb)) {dev_err (dev->dev,"Failed to allocate DRM framebuffer.\n" ); ret =PTR_ERR (fbdev_cma->fb); - goto err_framebuffer_release; + goto err_fb_info_destroy; } fb = &fbdev_cma->fb->fb; helper->fb = fb; - helper->fbdev = fbi; fbi->par = helper; fbi->flags =FBINFO_FLAG_DEFAULT ; fbi->fbops = &drm_fbdev_cma_ops; - ret =fb_alloc_cmap (&fbi->cmap,256 ,0 ); -if (ret) { -dev_err (dev->dev,"Failed to allocate color map.\n" ); - goto err_drm_fb_cma_destroy; - } -drm_fb_helper_fill_fix (fbi, fb->pitches[0 ], fb->depth);drm_fb_helper_fill_var (fbi, helper, sizes->fb_width, sizes->fb_height);
@@ -317,11 +309,8 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper,return 0 ; -err_drm_fb_cma_destroy: -drm_framebuffer_unregister_private (fb); -drm_fb_cma_destroy (fb); -err_framebuffer_release: -framebuffer_release (fbi); +err_fb_info_destroy: +drm_fb_helper_release_fbi (helper); err_drm_gem_cma_free_object:drm_gem_cma_free_object (&obj->base);return ret;
@@ -397,20 +386,8 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);*/ void drm_fbdev_cma_fini (struct drm_fbdev_cma *fbdev_cma) { -if (fbdev_cma->fb_helper.fbdev) { -struct fb_info *info; -int ret; - - info = fbdev_cma->fb_helper.fbdev; - ret =unregister_framebuffer (info); -if (ret <0 ) -DRM_DEBUG_KMS ("failed unregister_framebuffer()\n" ); - -if (info->cmap.len) -fb_dealloc_cmap (&info->cmap); - -framebuffer_release (info); - } +drm_fb_helper_unregister_fbi (&fbdev_cma->fb_helper); +drm_fb_helper_release_fbi (&fbdev_cma->fb_helper);if (fbdev_cma->fb) {drm_framebuffer_unregister_private (&fbdev_cma->fb->fb);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel