Commit e18da8ce authored by Thomas Zimmermann's avatar Thomas Zimmermann Committed by Patrik Jakobsson

drm/gma500: Replace struct psb_framebuffer with struct drm_framebuffer

After removing all unnecessary fields, struct psb_framebuffer is just a
wrapper around struct drm_framebuffer. So we can replace the former with
the latter.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191122100545.16812-4-tzimmermann@suse.de
parent 86eda5a4
...@@ -227,8 +227,7 @@ static void psbfb_copyarea_accel(struct fb_info *info, ...@@ -227,8 +227,7 @@ static void psbfb_copyarea_accel(struct fb_info *info,
const struct fb_copyarea *a) const struct fb_copyarea *a)
{ {
struct psb_fbdev *fbdev = info->par; struct psb_fbdev *fbdev = info->par;
struct psb_framebuffer *psbfb = &fbdev->pfb; struct drm_device *dev = fbdev->fb.dev;
struct drm_device *dev = psbfb->base.dev;
struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
uint32_t offset; uint32_t offset;
...@@ -310,8 +309,7 @@ void psbfb_copyarea(struct fb_info *info, ...@@ -310,8 +309,7 @@ void psbfb_copyarea(struct fb_info *info,
int psbfb_sync(struct fb_info *info) int psbfb_sync(struct fb_info *info)
{ {
struct psb_fbdev *fbdev = info->par; struct psb_fbdev *fbdev = info->par;
struct psb_framebuffer *psbfb = &fbdev->pfb; struct drm_device *dev = fbdev->fb.dev;
struct drm_device *dev = psbfb->base.dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long _end = jiffies + HZ; unsigned long _end = jiffies + HZ;
int busy = 0; int busy = 0;
......
...@@ -78,9 +78,9 @@ static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -78,9 +78,9 @@ static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green,
static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info) static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info)
{ {
struct psb_fbdev *fbdev = info->par; struct psb_fbdev *fbdev = info->par;
struct psb_framebuffer *psbfb = &fbdev->pfb; struct drm_framebuffer *fb = &fbdev->fb;
struct drm_device *dev = psbfb->base.dev; struct drm_device *dev = fb->dev;
struct gtt_range *gtt = to_gtt_range(psbfb->base.obj[0]); struct gtt_range *gtt = to_gtt_range(fb->obj[0]);
/* /*
* We have to poke our nose in here. The core fb code assumes * We have to poke our nose in here. The core fb code assumes
...@@ -99,10 +99,10 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -99,10 +99,10 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info)
static vm_fault_t psbfb_vm_fault(struct vm_fault *vmf) static vm_fault_t psbfb_vm_fault(struct vm_fault *vmf)
{ {
struct vm_area_struct *vma = vmf->vma; struct vm_area_struct *vma = vmf->vma;
struct psb_framebuffer *psbfb = vma->vm_private_data; struct drm_framebuffer *fb = vma->vm_private_data;
struct drm_device *dev = psbfb->base.dev; struct drm_device *dev = fb->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct gtt_range *gtt = to_gtt_range(psbfb->base.obj[0]); struct gtt_range *gtt = to_gtt_range(fb->obj[0]);
int page_num; int page_num;
int i; int i;
unsigned long address; unsigned long address;
...@@ -146,7 +146,7 @@ static const struct vm_operations_struct psbfb_vm_ops = { ...@@ -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) static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{ {
struct psb_fbdev *fbdev = info->par; struct psb_fbdev *fbdev = info->par;
struct psb_framebuffer *psbfb = &fbdev->pfb; struct drm_framebuffer *fb = &fbdev->fb;
if (vma->vm_pgoff != 0) if (vma->vm_pgoff != 0)
return -EINVAL; return -EINVAL;
...@@ -159,7 +159,7 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma) ...@@ -159,7 +159,7 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
* suitable for our mmap work * suitable for our mmap work
*/ */
vma->vm_ops = &psbfb_vm_ops; vma->vm_ops = &psbfb_vm_ops;
vma->vm_private_data = (void *)psbfb; vma->vm_private_data = (void *)fb;
vma->vm_flags |= VM_IO | VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTDUMP; vma->vm_flags |= VM_IO | VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTDUMP;
return 0; return 0;
} }
...@@ -207,7 +207,7 @@ static struct fb_ops psbfb_unaccel_ops = { ...@@ -207,7 +207,7 @@ static struct fb_ops psbfb_unaccel_ops = {
* 0 on success or an error code if we fail. * 0 on success or an error code if we fail.
*/ */
static int psb_framebuffer_init(struct drm_device *dev, static int psb_framebuffer_init(struct drm_device *dev,
struct psb_framebuffer *fb, struct drm_framebuffer *fb,
const struct drm_mode_fb_cmd2 *mode_cmd, const struct drm_mode_fb_cmd2 *mode_cmd,
struct gtt_range *gt) struct gtt_range *gt)
{ {
...@@ -225,9 +225,9 @@ static int psb_framebuffer_init(struct drm_device *dev, ...@@ -225,9 +225,9 @@ static int psb_framebuffer_init(struct drm_device *dev,
if (mode_cmd->pitches[0] & 63) if (mode_cmd->pitches[0] & 63)
return -EINVAL; return -EINVAL;
drm_helper_mode_fill_fb_struct(dev, &fb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
fb->base.obj[0] = &gt->gem; fb->obj[0] = &gt->gem;
ret = drm_framebuffer_init(dev, &fb->base, &psb_fb_funcs); ret = drm_framebuffer_init(dev, fb, &psb_fb_funcs);
if (ret) { if (ret) {
dev_err(dev->dev, "framebuffer init failed: %d\n", ret); dev_err(dev->dev, "framebuffer init failed: %d\n", ret);
return ret; return ret;
...@@ -252,7 +252,7 @@ static struct drm_framebuffer *psb_framebuffer_create ...@@ -252,7 +252,7 @@ static struct drm_framebuffer *psb_framebuffer_create
const struct drm_mode_fb_cmd2 *mode_cmd, const struct drm_mode_fb_cmd2 *mode_cmd,
struct gtt_range *gt) struct gtt_range *gt)
{ {
struct psb_framebuffer *fb; struct drm_framebuffer *fb;
int ret; int ret;
fb = kzalloc(sizeof(*fb), GFP_KERNEL); fb = kzalloc(sizeof(*fb), GFP_KERNEL);
...@@ -264,7 +264,7 @@ static struct drm_framebuffer *psb_framebuffer_create ...@@ -264,7 +264,7 @@ static struct drm_framebuffer *psb_framebuffer_create
kfree(fb); kfree(fb);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
return &fb->base; return fb;
} }
/** /**
...@@ -304,8 +304,7 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -304,8 +304,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
struct drm_device *dev = fbdev->psb_fb_helper.dev; struct drm_device *dev = fbdev->psb_fb_helper.dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct fb_info *info; struct fb_info *info;
struct drm_framebuffer *fb; struct drm_framebuffer *fb = &fbdev->fb;
struct psb_framebuffer *psbfb = &fbdev->pfb;
struct drm_mode_fb_cmd2 mode_cmd; struct drm_mode_fb_cmd2 mode_cmd;
int size; int size;
int ret; int ret;
...@@ -378,12 +377,10 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -378,12 +377,10 @@ static int psbfb_create(struct psb_fbdev *fbdev,
mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth); mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);
ret = psb_framebuffer_init(dev, psbfb, &mode_cmd, backing); ret = psb_framebuffer_init(dev, fb, &mode_cmd, backing);
if (ret) if (ret)
goto out; goto out;
fb = &psbfb->base;
fbdev->psb_fb_helper.fb = fb; fbdev->psb_fb_helper.fb = fb;
if (dev_priv->ops->accel_2d && pitch_lines > 8) /* 2D engine */ if (dev_priv->ops->accel_2d && pitch_lines > 8) /* 2D engine */
...@@ -415,8 +412,7 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -415,8 +412,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
dev_dbg(dev->dev, "allocated %dx%d fb\n", dev_dbg(dev->dev, "allocated %dx%d fb\n", fb->width, fb->height);
psbfb->base.width, psbfb->base.height);
return 0; return 0;
out: out:
...@@ -487,16 +483,16 @@ static const struct drm_fb_helper_funcs psb_fb_helper_funcs = { ...@@ -487,16 +483,16 @@ static const struct drm_fb_helper_funcs psb_fb_helper_funcs = {
static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev) static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
{ {
struct psb_framebuffer *psbfb = &fbdev->pfb; struct drm_framebuffer *fb = &fbdev->fb;
drm_fb_helper_unregister_fbi(&fbdev->psb_fb_helper); drm_fb_helper_unregister_fbi(&fbdev->psb_fb_helper);
drm_fb_helper_fini(&fbdev->psb_fb_helper); drm_fb_helper_fini(&fbdev->psb_fb_helper);
drm_framebuffer_unregister_private(&psbfb->base); drm_framebuffer_unregister_private(fb);
drm_framebuffer_cleanup(&psbfb->base); drm_framebuffer_cleanup(fb);
if (psbfb->base.obj[0]) if (fb->obj[0])
drm_gem_object_put_unlocked(psbfb->base.obj[0]); drm_gem_object_put_unlocked(fb->obj[0]);
return 0; return 0;
} }
......
...@@ -13,17 +13,11 @@ ...@@ -13,17 +13,11 @@
#include "psb_drv.h" #include "psb_drv.h"
struct psb_framebuffer {
struct drm_framebuffer base;
};
struct psb_fbdev { struct psb_fbdev {
struct drm_fb_helper psb_fb_helper; /* must be first */ 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); extern int gma_connector_clones(struct drm_device *dev, int type_mask);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment