drm/gma500: Cleanup framebuffer and fbdev
Subsystems (3)
Thomas Zimmermann
maintainercover drm/gma500: Cleanup framebuffer and fbdev
These patches remove struct psb_framebuffer and struct psb_fbdev from gma500. Both are replaced by their equivalents from the DRM helpers.
The patchset has been tested by running the fbdev console, X11 and Weston on an Atom Z520 with Poulsbo graphics chip.
Thomas Zimmermann (6):
drm/gma500: Remove addr_space field from psb_framebuffer drm/gma500: Remove field 'fbdev' from struct psb_framebuffer drm/gma500: Replace struct psb_framebuffer with struct drm_framebuffer drm/gma500: Pass struct drm_gem_object to framebuffer functions drm/gma500: Store framebuffer in struct drm_fb_helper drm/gma500: Remove struct psb_fbdev
drivers/gpu/drm/gma500/accel_2d.c | 15 ++-- drivers/gpu/drm/gma500/framebuffer.c | 129 +++++++++++++-------------- drivers/gpu/drm/gma500/framebuffer.h | 15 ---- drivers/gpu/drm/gma500/psb_drv.c | 1 + drivers/gpu/drm/gma500/psb_drv.h | 8 +- 5 files changed, 74 insertions(+), 94 deletions(-)
--
2.23.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH 1/6 drm/gma500: Remove addr_space field from psb_framebuffer
The field 'addr_space' in struct psb_framebuffer serves no purpose. Remove it.
--- drivers/gpu/drm/gma500/framebuffer.c | 2 -- drivers/gpu/drm/gma500/framebuffer.h | 1 - 2 files changed, 3 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +0 -2
@@ -153,8 +153,6 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)if (vma->vm_pgoff > (~0UL >>PAGE_SHIFT ))return -EINVAL ; -if (!psbfb->addr_space) - psbfb->addr_space = vma->vm_file->f_mapping;/* * If this is a GEM object then info->screen_base is the virtual * kernel remapping of the object. FIXME: Review if this is
drivers/gpu/drm/gma500/framebuffer.h +0 -1
@@ -15,7 +15,6 @@struct psb_framebuffer {struct drm_framebuffer base; -struct address_space *addr_space;struct fb_info *fbdev; };
Signature · 6 lines
2.23.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH 2/6 drm/gma500: Remove field 'fbdev' from struct psb_framebuffer
In reply to Thomas ZimmermannThe field 'fbdev' in struct psb_framebuffer serves no purpose. Remove it.
--- drivers/gpu/drm/gma500/framebuffer.c | 1 - drivers/gpu/drm/gma500/framebuffer.h | 1 - 2 files changed, 2 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +0 -1
@@ -383,7 +383,6 @@ static int psbfb_create(struct psb_fbdev *fbdev, goto out; fb = &psbfb->base; - psbfb->fbdev = info; fbdev->psb_fb_helper.fb = fb;
drivers/gpu/drm/gma500/framebuffer.h +0 -1
@@ -15,7 +15,6 @@struct psb_framebuffer {struct drm_framebuffer base; -struct fb_info *fbdev; };struct psb_fbdev {
Signature · 6 lines
2.23.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH 3/6 drm/gma500: Replace struct psb_framebuffer with struct drm_framebuffer
In reply to Thomas ZimmermannAfter removing all unnecessary fields, struct psb_framebuffer is just a wrapper around struct drm_framebuffer. So we can replace the former with the latter.
--- drivers/gpu/drm/gma500/accel_2d.c | 6 ++-- drivers/gpu/drm/gma500/framebuffer.c | 48 +++++++++++++--------------- drivers/gpu/drm/gma500/framebuffer.h | 8 +---- 3 files changed, 25 insertions(+), 37 deletions(-)
drivers/gpu/drm/gma500/accel_2d.c +2 -4
@@ -227,8 +227,7 @@ static void psbfb_copyarea_accel(struct fb_info *info, const struct fb_copyarea *a) {struct psb_fbdev *fbdev = info->par; -struct psb_framebuffer *psbfb = &fbdev->pfb; -struct drm_device *dev = psbfb->base.dev; +struct drm_device *dev = fbdev->fb.dev;struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb;struct drm_psb_private *dev_priv = dev->dev_private;uint32_t offset;
@@ -310,8 +309,7 @@ void psbfb_copyarea(struct fb_info *info,int psbfb_sync (struct fb_info *info) {struct psb_fbdev *fbdev = info->par; -struct psb_framebuffer *psbfb = &fbdev->pfb; -struct drm_device *dev = psbfb->base.dev; +struct drm_device *dev = fbdev->fb.dev;struct drm_psb_private *dev_priv = dev->dev_private;unsigned long _end = jiffies +HZ ;int busy =0 ;
drivers/gpu/drm/gma500/framebuffer.c +22 -26
129 lines not on this page · raw message
drivers/gpu/drm/gma500/framebuffer.h +1 -7
@@ -13,17 +13,11 @@#include "psb_drv.h" -struct psb_framebuffer { -struct drm_framebuffer base; -}; -struct psb_fbdev {struct drm_fb_helper psb_fb_helper;/* must be first */ -struct psb_framebuffer pfb; +struct drm_framebuffer fb; }; -#define to_psb_fb (x) container_of(x, struct psb_framebuffer, base) -extern int gma_connector_clones (struct drm_device *dev,int type_mask);#endif
Signature · 6 lines
2.23.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH 4/6 drm/gma500: Pass struct drm_gem_object to framebuffer functions
In reply to Thomas ZimmermannSeveral framebuffer functions take a pointer to an object of type struct gtt_range when they actually need the GEM base object. Passing the GEM object removes some type casting and clutter.
--- drivers/gpu/drm/gma500/framebuffer.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +6 -8
@@ -209,7 +209,7 @@ static struct fb_ops psbfb_unaccel_ops = {static int psb_framebuffer_init (struct drm_device *dev,struct drm_framebuffer *fb,const struct drm_mode_fb_cmd2 *mode_cmd, -struct gtt_range *gt) +struct drm_gem_object *obj) {const struct drm_format_info *info;int ret;
@@ -226,7 +226,7 @@ static int psb_framebuffer_init(struct drm_device *dev,return -EINVAL ;drm_helper_mode_fill_fb_struct (dev, fb, mode_cmd); - fb->obj[0 ] = >->gem; + fb->obj[0 ] = obj; ret =drm_framebuffer_init (dev, fb, &psb_fb_funcs);if (ret) {dev_err (dev->dev,"framebuffer init failed: %d\n" , ret);
@@ -250,7 +250,7 @@ static int psb_framebuffer_init(struct drm_device *dev,static struct drm_framebuffer *psb_framebuffer_create (struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode_cmd, -struct gtt_range *gt) +struct drm_gem_object *obj) {struct drm_framebuffer *fb;int ret;
@@ -259,7 +259,7 @@ static struct drm_framebuffer *psb_framebuffer_createif (!fb)return ERR_PTR (-ENOMEM ); - ret =psb_framebuffer_init (dev, fb, mode_cmd, gt); + ret =psb_framebuffer_init (dev, fb, mode_cmd, obj);if (ret) {kfree (fb);return ERR_PTR (ret);
@@ -377,7 +377,7 @@ static int psbfb_create(struct psb_fbdev *fbdev, mode_cmd.pixel_format =drm_mode_legacy_fb_format (bpp, depth); - ret =psb_framebuffer_init (dev, fb, &mode_cmd, backing); + ret =psb_framebuffer_init (dev, fb, &mode_cmd, &backing->gem);if (ret) goto out;
@@ -432,7 +432,6 @@ static struct drm_framebuffer *psb_user_framebuffer_create (struct drm_device *dev, struct drm_file *filp, const struct drm_mode_fb_cmd2 *cmd) { -struct gtt_range *r;struct drm_gem_object *obj;/*
@@ -444,8 +443,7 @@ static struct drm_framebuffer *psb_user_framebuffer_createreturn ERR_PTR (-ENOENT );/* Let the core code do all the work */ - r = container_of(obj, struct gtt_range, gem); -return psb_framebuffer_create (dev, cmd, r); +return psb_framebuffer_create (dev, cmd, obj); } static int psbfb_probe(struct drm_fb_helper *helper,
Signature · 6 lines
2.23.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH 5/6 drm/gma500: Store framebuffer in struct drm_fb_helper
In reply to Thomas ZimmermannThe gma500 driver stores the console framebuffer in struct psb_fbdev. Moving it into struct drm_fb_helper will allow for removal of struct psb_fbdev.
--- drivers/gpu/drm/gma500/accel_2d.c | 5 +++-- drivers/gpu/drm/gma500/framebuffer.c | 16 ++++++++++------ drivers/gpu/drm/gma500/framebuffer.h | 1 - 3 files changed, 13 insertions(+), 9 deletions(-)
drivers/gpu/drm/gma500/accel_2d.c +3 -2
@@ -227,8 +227,8 @@ static void psbfb_copyarea_accel(struct fb_info *info, const struct fb_copyarea *a) {struct psb_fbdev *fbdev = info->par; -struct drm_device *dev = fbdev->fb.dev;struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; +struct drm_device *dev = fb->dev;struct drm_psb_private *dev_priv = dev->dev_private;uint32_t offset;uint32_t stride;
@@ -309,7 +309,8 @@ void psbfb_copyarea(struct fb_info *info,int psbfb_sync (struct fb_info *info) {struct psb_fbdev *fbdev = info->par; -struct drm_device *dev = fbdev->fb.dev; +struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; +struct drm_device *dev = fb->dev;struct drm_psb_private *dev_priv = dev->dev_private;unsigned long _end = jiffies +HZ ;int busy =0 ;
drivers/gpu/drm/gma500/framebuffer.c +10 -6
@@ -78,7 +78,7 @@ static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green,static int psbfb_pan (struct fb_var_screeninfo *var,struct fb_info *info) {struct psb_fbdev *fbdev = info->par; -struct drm_framebuffer *fb = &fbdev->fb; +struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb;struct drm_device *dev = fb->dev;struct gtt_range *gtt =to_gtt_range (fb->obj[0 ]);
@@ -146,7 +146,7 @@ static const struct vm_operations_struct psbfb_vm_ops = {static int psbfb_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct psb_fbdev *fbdev = info->par; -struct drm_framebuffer *fb = &fbdev->fb; +struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb;if (vma->vm_pgoff !=0 )return -EINVAL ;
@@ -304,7 +304,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,struct drm_device *dev = fbdev->psb_fb_helper.dev;struct drm_psb_private *dev_priv = dev->dev_private;struct fb_info *info; -struct drm_framebuffer *fb = &fbdev->fb; +struct drm_framebuffer *fb;struct drm_mode_fb_cmd2 mode_cmd;int size;int ret;
@@ -377,9 +377,11 @@ static int psbfb_create(struct psb_fbdev *fbdev, mode_cmd.pixel_format =drm_mode_legacy_fb_format (bpp, depth); - ret =psb_framebuffer_init (dev, fb, &mode_cmd, &backing->gem); -if (ret) + fb =psb_framebuffer_create (dev, &mode_cmd, &backing->gem); +if (IS_ERR (fb)) { + ret =PTR_ERR (fb); goto out; + } fbdev->psb_fb_helper.fb = fb;
@@ -477,7 +479,7 @@ 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 drm_framebuffer *fb = &fbdev->fb; +struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb;drm_fb_helper_unregister_fbi (&fbdev->psb_fb_helper);
@@ -487,6 +489,8 @@ static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)if (fb->obj[0 ])drm_gem_object_put_unlocked (fb->obj[0 ]); +kfree (fb); +return 0 ; }
drivers/gpu/drm/gma500/framebuffer.h +0 -1
@@ -15,7 +15,6 @@struct psb_fbdev {struct drm_fb_helper psb_fb_helper;/* must be first */ -struct drm_framebuffer fb; };extern int gma_connector_clones (struct drm_device *dev,int type_mask);
Signature · 6 lines
2.23.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH 6/6 drm/gma500: Remove struct psb_fbdev
In reply to Thomas ZimmermannGma500's struct psb_fbdev is an, otherwise empty, wrapper around struct drm_fb_helper. Remove it.
--- drivers/gpu/drm/gma500/accel_2d.c | 10 ++-- drivers/gpu/drm/gma500/framebuffer.c | 70 ++++++++++++++-------------- drivers/gpu/drm/gma500/framebuffer.h | 6 --- drivers/gpu/drm/gma500/psb_drv.c | 1 + drivers/gpu/drm/gma500/psb_drv.h | 8 ++-- 5 files changed, 45 insertions(+), 50 deletions(-)
drivers/gpu/drm/gma500/accel_2d.c +5 -5
@@ -21,9 +21,9 @@#include <drm/drm.h> #include <drm/drm_crtc.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fourcc.h> -#include "framebuffer.h" #include "psb_drv.h" #include "psb_reg.h"
@@ -226,8 +226,8 @@ static int psb_accel_2d_copy(struct drm_psb_private *dev_priv,static void psbfb_copyarea_accel (struct fb_info *info,const struct fb_copyarea *a) { -struct psb_fbdev *fbdev = info->par; -struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; +struct drm_fb_helper *fb_helper = info->par; +struct drm_framebuffer *fb = fb_helper->fb;struct drm_device *dev = fb->dev;struct drm_psb_private *dev_priv = dev->dev_private;uint32_t offset;
@@ -308,8 +308,8 @@ void psbfb_copyarea(struct fb_info *info,*/ int psbfb_sync (struct fb_info *info) { -struct psb_fbdev *fbdev = info->par; -struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; +struct drm_fb_helper *fb_helper = info->par; +struct drm_framebuffer *fb = fb_helper->fb;struct drm_device *dev = fb->dev;struct drm_psb_private *dev_priv = dev->dev_private;unsigned long _end = jiffies +HZ ;
drivers/gpu/drm/gma500/framebuffer.c +34 -36
175 lines not on this page · raw message
drivers/gpu/drm/gma500/framebuffer.h +0 -6
@@ -9,14 +9,8 @@#ifndef _FRAMEBUFFER_H_#define _FRAMEBUFFER_H_ -#include <drm/drm_fb_helper.h> -#include "psb_drv.h" -struct psb_fbdev { -struct drm_fb_helper psb_fb_helper;/* must be first */ -}; -extern int gma_connector_clones (struct drm_device *dev,int type_mask);#endif
drivers/gpu/drm/gma500/psb_drv.c +1 -0
@@ -19,6 +19,7 @@#include <drm/drm.h> #include <drm/drm_drv.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_file.h> #include <drm/drm_ioctl.h> #include <drm/drm_irq.h>
drivers/gpu/drm/gma500/psb_drv.h +5 -3
@@ -229,6 +229,8 @@ enum {#define KSEL_BYPASS_25 6#define KSEL_BYPASS_83_100 7 +struct drm_fb_helper ; +struct opregion_header ;struct opregion_acpi ;struct opregion_swsci ;
@@ -432,7 +434,7 @@ struct drm_psb_private {struct pci_dev *lpc_pdev;/* Currently only used by mrst */ const struct psb_ops *ops;const struct psb_offset *regmap; - +struct child_device_config *child_dev;int child_dev_num;
@@ -540,7 +542,7 @@ struct drm_psb_private {/* Oaktrail HDMI state */ struct oaktrail_hdmi_dev *hdmi_priv; - +/* Register state */ struct psb_save_area regs;
@@ -572,7 +574,7 @@ struct drm_psb_private {uint32_t blc_adj1;uint32_t blc_adj2; -void *fbdev; +struct drm_fb_helper *fb_helper;/* 2D acceleration */ spinlock_t lock_2d;
Signature · 6 lines
2.23.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Thomas Zimmermann
These patches remove struct
psb_framebufferand structpsb_fbdevfrom gma500. Both are replaced by their equivalents from the DRM helpers.The patchset has been tested by running the fbdev console, X11 and Weston on an Atom Z520 with Poulsbo graphics chip.
On the series: Acked-by: Daniel Vetter <[email protected]>
Quoted 19 lines
Thomas Zimmermann (6):
drm/gma500: Removeaddr_spacefield frompsb_framebufferdrm/gma500: Remove field 'fbdev' from structpsb_framebufferdrm/gma500: Replace structpsb_framebufferwith structdrm_framebufferdrm/gma500: Pass structdrm_gem_objectto framebuffer functions drm/gma500: Store framebuffer in structdrm_fb_helperdrm/gma500: Remove structpsb_fbdevdrivers/gpu/drm/gma500/accel_2d.c | 15 ++-- drivers/gpu/drm/gma500/framebuffer.c | 129 +++++++++++++-------------- drivers/gpu/drm/gma500/framebuffer.h | 15 ---- drivers/gpu/drm/gma500/psb_drv.c | 1 + drivers/gpu/drm/gma500/psb_drv.h | 8 +- 5 files changed, 74 insertions(+), 94 deletions(-)--
2.23.0
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patrik Jakobsson
maintainerQuoted 7 lines · Thomas Zimmermann
These patches remove struct
psb_framebufferand structpsb_fbdevfrom gma500. Both are replaced by their equivalents from the DRM helpers.The patchset has been tested by running the fbdev console, X11 and Weston on an Atom Z520 with Poulsbo graphics chip.
Hi Thomas, nice cleanups!
I'll apply to drm-misc-next
For series:
Thanks
Quoted 16 lines
Thomas Zimmermann (6):
drm/gma500: Removeaddr_spacefield frompsb_framebufferdrm/gma500: Remove field 'fbdev' from structpsb_framebufferdrm/gma500: Replace structpsb_framebufferwith structdrm_framebufferdrm/gma500: Pass structdrm_gem_objectto framebuffer functions drm/gma500: Store framebuffer in structdrm_fb_helperdrm/gma500: Remove structpsb_fbdevdrivers/gpu/drm/gma500/accel_2d.c | 15 ++-- drivers/gpu/drm/gma500/framebuffer.c | 129 +++++++++++++-------------- drivers/gpu/drm/gma500/framebuffer.h | 15 ---- drivers/gpu/drm/gma500/psb_drv.c | 1 + drivers/gpu/drm/gma500/psb_drv.h | 8 +- 5 files changed, 74 insertions(+), 94 deletions(-)
Quoted 3 lines
--
2.23.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel