Commit 6b7ce2c4 authored by Thomas Zimmermann's avatar Thomas Zimmermann Committed by Patrik Jakobsson

drm/gma500: Remove struct psb_fbdev

Gma500's struct psb_fbdev is an, otherwise empty, wrapper around
struct drm_fb_helper. Remove it.
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-7-tzimmermann@suse.de
parent 0a8ec2ed
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
#include <drm/drm.h> #include <drm/drm.h>
#include <drm/drm_crtc.h> #include <drm/drm_crtc.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_fourcc.h> #include <drm/drm_fourcc.h>
#include "framebuffer.h"
#include "psb_drv.h" #include "psb_drv.h"
#include "psb_reg.h" #include "psb_reg.h"
...@@ -226,8 +226,8 @@ static int psb_accel_2d_copy(struct drm_psb_private *dev_priv, ...@@ -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, 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 drm_fb_helper *fb_helper = info->par;
struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; struct drm_framebuffer *fb = fb_helper->fb;
struct drm_device *dev = fb->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;
uint32_t offset; uint32_t offset;
...@@ -308,8 +308,8 @@ void psbfb_copyarea(struct fb_info *info, ...@@ -308,8 +308,8 @@ 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 drm_fb_helper *fb_helper = info->par;
struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; struct drm_framebuffer *fb = fb_helper->fb;
struct drm_device *dev = fb->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;
unsigned long _end = jiffies + HZ; unsigned long _end = jiffies + HZ;
......
...@@ -40,8 +40,8 @@ static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -40,8 +40,8 @@ static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, unsigned blue, unsigned transp,
struct fb_info *info) struct fb_info *info)
{ {
struct psb_fbdev *fbdev = info->par; struct drm_fb_helper *fb_helper = info->par;
struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; struct drm_framebuffer *fb = fb_helper->fb;
uint32_t v; uint32_t v;
if (!fb) if (!fb)
...@@ -77,8 +77,8 @@ static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -77,8 +77,8 @@ 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 drm_fb_helper *fb_helper = info->par;
struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; struct drm_framebuffer *fb = fb_helper->fb;
struct drm_device *dev = fb->dev; struct drm_device *dev = fb->dev;
struct gtt_range *gtt = to_gtt_range(fb->obj[0]); struct gtt_range *gtt = to_gtt_range(fb->obj[0]);
...@@ -145,8 +145,8 @@ static const struct vm_operations_struct psbfb_vm_ops = { ...@@ -145,8 +145,8 @@ 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 drm_fb_helper *fb_helper = info->par;
struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; struct drm_framebuffer *fb = fb_helper->fb;
if (vma->vm_pgoff != 0) if (vma->vm_pgoff != 0)
return -EINVAL; return -EINVAL;
...@@ -298,10 +298,10 @@ static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size) ...@@ -298,10 +298,10 @@ static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size)
* *
* Create a framebuffer to the specifications provided * Create a framebuffer to the specifications provided
*/ */
static int psbfb_create(struct psb_fbdev *fbdev, static int psbfb_create(struct drm_fb_helper *fb_helper,
struct drm_fb_helper_surface_size *sizes) struct drm_fb_helper_surface_size *sizes)
{ {
struct drm_device *dev = fbdev->psb_fb_helper.dev; struct drm_device *dev = 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;
...@@ -369,7 +369,7 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -369,7 +369,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
memset(dev_priv->vram_addr + backing->offset, 0, size); memset(dev_priv->vram_addr + backing->offset, 0, size);
info = drm_fb_helper_alloc_fbi(&fbdev->psb_fb_helper); info = drm_fb_helper_alloc_fbi(fb_helper);
if (IS_ERR(info)) { if (IS_ERR(info)) {
ret = PTR_ERR(info); ret = PTR_ERR(info);
goto out; goto out;
...@@ -383,7 +383,7 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -383,7 +383,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
goto out; goto out;
} }
fbdev->psb_fb_helper.fb = fb; 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 */
info->fbops = &psbfb_ops; info->fbops = &psbfb_ops;
...@@ -407,7 +407,7 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -407,7 +407,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
info->apertures->ranges[0].size = dev_priv->gtt.stolen_size; info->apertures->ranges[0].size = dev_priv->gtt.stolen_size;
} }
drm_fb_helper_fill_info(info, &fbdev->psb_fb_helper, sizes); drm_fb_helper_fill_info(info, fb_helper, sizes);
info->fix.mmio_start = pci_resource_start(dev->pdev, 0); info->fix.mmio_start = pci_resource_start(dev->pdev, 0);
info->fix.mmio_len = pci_resource_len(dev->pdev, 0); info->fix.mmio_len = pci_resource_len(dev->pdev, 0);
...@@ -448,12 +448,10 @@ static struct drm_framebuffer *psb_user_framebuffer_create ...@@ -448,12 +448,10 @@ static struct drm_framebuffer *psb_user_framebuffer_create
return psb_framebuffer_create(dev, cmd, obj); return psb_framebuffer_create(dev, cmd, obj);
} }
static int psbfb_probe(struct drm_fb_helper *helper, static int psbfb_probe(struct drm_fb_helper *fb_helper,
struct drm_fb_helper_surface_size *sizes) struct drm_fb_helper_surface_size *sizes)
{ {
struct psb_fbdev *psb_fbdev = struct drm_device *dev = fb_helper->dev;
container_of(helper, struct psb_fbdev, psb_fb_helper);
struct drm_device *dev = psb_fbdev->psb_fb_helper.dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
unsigned int fb_size; unsigned int fb_size;
int bytespp; int bytespp;
...@@ -474,20 +472,21 @@ static int psbfb_probe(struct drm_fb_helper *helper, ...@@ -474,20 +472,21 @@ static int psbfb_probe(struct drm_fb_helper *helper,
sizes->surface_depth = 16; sizes->surface_depth = 16;
} }
return psbfb_create(psb_fbdev, sizes); return psbfb_create(fb_helper, sizes);
} }
static const struct drm_fb_helper_funcs psb_fb_helper_funcs = { static const struct drm_fb_helper_funcs psb_fb_helper_funcs = {
.fb_probe = psbfb_probe, .fb_probe = psbfb_probe,
}; };
static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev) static int psb_fbdev_destroy(struct drm_device *dev,
struct drm_fb_helper *fb_helper)
{ {
struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; struct drm_framebuffer *fb = fb_helper->fb;
drm_fb_helper_unregister_fbi(&fbdev->psb_fb_helper); drm_fb_helper_unregister_fbi(fb_helper);
drm_fb_helper_fini(&fbdev->psb_fb_helper); drm_fb_helper_fini(fb_helper);
drm_framebuffer_unregister_private(fb); drm_framebuffer_unregister_private(fb);
drm_framebuffer_cleanup(fb); drm_framebuffer_cleanup(fb);
...@@ -500,42 +499,41 @@ static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev) ...@@ -500,42 +499,41 @@ static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
int psb_fbdev_init(struct drm_device *dev) int psb_fbdev_init(struct drm_device *dev)
{ {
struct psb_fbdev *fbdev; struct drm_fb_helper *fb_helper;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
int ret; int ret;
fbdev = kzalloc(sizeof(struct psb_fbdev), GFP_KERNEL); fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
if (!fbdev) { if (!fb_helper) {
dev_err(dev->dev, "no memory\n"); dev_err(dev->dev, "no memory\n");
return -ENOMEM; return -ENOMEM;
} }
dev_priv->fbdev = fbdev; dev_priv->fb_helper = fb_helper;
drm_fb_helper_prepare(dev, &fbdev->psb_fb_helper, &psb_fb_helper_funcs); drm_fb_helper_prepare(dev, fb_helper, &psb_fb_helper_funcs);
ret = drm_fb_helper_init(dev, &fbdev->psb_fb_helper, ret = drm_fb_helper_init(dev, fb_helper, INTELFB_CONN_LIMIT);
INTELFB_CONN_LIMIT);
if (ret) if (ret)
goto free; goto free;
ret = drm_fb_helper_single_add_all_connectors(&fbdev->psb_fb_helper); ret = drm_fb_helper_single_add_all_connectors(fb_helper);
if (ret) if (ret)
goto fini; goto fini;
/* disable all the possible outputs/crtcs before entering KMS mode */ /* disable all the possible outputs/crtcs before entering KMS mode */
drm_helper_disable_unused_functions(dev); drm_helper_disable_unused_functions(dev);
ret = drm_fb_helper_initial_config(&fbdev->psb_fb_helper, 32); ret = drm_fb_helper_initial_config(fb_helper, 32);
if (ret) if (ret)
goto fini; goto fini;
return 0; return 0;
fini: fini:
drm_fb_helper_fini(&fbdev->psb_fb_helper); drm_fb_helper_fini(fb_helper);
free: free:
kfree(fbdev); kfree(fb_helper);
return ret; return ret;
} }
...@@ -543,12 +541,12 @@ static void psb_fbdev_fini(struct drm_device *dev) ...@@ -543,12 +541,12 @@ static void psb_fbdev_fini(struct drm_device *dev)
{ {
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
if (!dev_priv->fbdev) if (!dev_priv->fb_helper)
return; return;
psb_fbdev_destroy(dev, dev_priv->fbdev); psb_fbdev_destroy(dev, dev_priv->fb_helper);
kfree(dev_priv->fbdev); kfree(dev_priv->fb_helper);
dev_priv->fbdev = NULL; dev_priv->fb_helper = NULL;
} }
static const struct drm_mode_config_funcs psb_mode_funcs = { static const struct drm_mode_config_funcs psb_mode_funcs = {
......
...@@ -9,14 +9,8 @@ ...@@ -9,14 +9,8 @@
#ifndef _FRAMEBUFFER_H_ #ifndef _FRAMEBUFFER_H_
#define _FRAMEBUFFER_H_ #define _FRAMEBUFFER_H_
#include <drm/drm_fb_helper.h>
#include "psb_drv.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); extern int gma_connector_clones(struct drm_device *dev, int type_mask);
#endif #endif
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <drm/drm.h> #include <drm/drm.h>
#include <drm/drm_drv.h> #include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
#include <drm/drm_ioctl.h> #include <drm/drm_ioctl.h>
#include <drm/drm_irq.h> #include <drm/drm_irq.h>
......
...@@ -229,6 +229,8 @@ enum { ...@@ -229,6 +229,8 @@ enum {
#define KSEL_BYPASS_25 6 #define KSEL_BYPASS_25 6
#define KSEL_BYPASS_83_100 7 #define KSEL_BYPASS_83_100 7
struct drm_fb_helper;
struct opregion_header; struct opregion_header;
struct opregion_acpi; struct opregion_acpi;
struct opregion_swsci; struct opregion_swsci;
...@@ -432,7 +434,7 @@ struct drm_psb_private { ...@@ -432,7 +434,7 @@ struct drm_psb_private {
struct pci_dev *lpc_pdev; /* Currently only used by mrst */ struct pci_dev *lpc_pdev; /* Currently only used by mrst */
const struct psb_ops *ops; const struct psb_ops *ops;
const struct psb_offset *regmap; const struct psb_offset *regmap;
struct child_device_config *child_dev; struct child_device_config *child_dev;
int child_dev_num; int child_dev_num;
...@@ -540,7 +542,7 @@ struct drm_psb_private { ...@@ -540,7 +542,7 @@ struct drm_psb_private {
/* Oaktrail HDMI state */ /* Oaktrail HDMI state */
struct oaktrail_hdmi_dev *hdmi_priv; struct oaktrail_hdmi_dev *hdmi_priv;
/* Register state */ /* Register state */
struct psb_save_area regs; struct psb_save_area regs;
...@@ -572,7 +574,7 @@ struct drm_psb_private { ...@@ -572,7 +574,7 @@ struct drm_psb_private {
uint32_t blc_adj1; uint32_t blc_adj1;
uint32_t blc_adj2; uint32_t blc_adj2;
void *fbdev; struct drm_fb_helper *fb_helper;
/* 2D acceleration */ /* 2D acceleration */
spinlock_t lock_2d; spinlock_t lock_2d;
......
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