Commit 15b273bb authored by Jesse Barnes's avatar Jesse Barnes Committed by Dave Airlie

drm/staging/gma500: fix linux-next build

Here's a patch to move things over to the new addfb2 interfaces at
least.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent b63e0f9c
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <drm/drmP.h> #include <drm/drmP.h>
#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 "psb_drv.h" #include "psb_drv.h"
#include "psb_intel_reg.h" #include "psb_intel_reg.h"
...@@ -273,14 +274,17 @@ static struct fb_ops psbfb_unaccel_ops = { ...@@ -273,14 +274,17 @@ static struct fb_ops psbfb_unaccel_ops = {
*/ */
static int psb_framebuffer_init(struct drm_device *dev, static int psb_framebuffer_init(struct drm_device *dev,
struct psb_framebuffer *fb, struct psb_framebuffer *fb,
struct drm_mode_fb_cmd *mode_cmd, struct drm_mode_fb_cmd2 *mode_cmd,
struct gtt_range *gt) struct gtt_range *gt)
{ {
u32 bpp, depth;
int ret; int ret;
if (mode_cmd->pitch & 63) drm_helper_get_fb_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
if (mode_cmd->pitches[0] & 63)
return -EINVAL; return -EINVAL;
switch (mode_cmd->bpp) { switch (bpp) {
case 8: case 8:
case 16: case 16:
case 24: case 24:
...@@ -313,7 +317,7 @@ static int psb_framebuffer_init(struct drm_device *dev, ...@@ -313,7 +317,7 @@ static int psb_framebuffer_init(struct drm_device *dev,
static struct drm_framebuffer *psb_framebuffer_create static struct drm_framebuffer *psb_framebuffer_create
(struct drm_device *dev, (struct drm_device *dev,
struct drm_mode_fb_cmd *mode_cmd, struct drm_mode_fb_cmd2 *mode_cmd,
struct gtt_range *gt) struct gtt_range *gt)
{ {
struct psb_framebuffer *fb; struct psb_framebuffer *fb;
...@@ -387,27 +391,28 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -387,27 +391,28 @@ static int psbfb_create(struct psb_fbdev *fbdev,
struct fb_info *info; struct fb_info *info;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
struct psb_framebuffer *psbfb = &fbdev->pfb; struct psb_framebuffer *psbfb = &fbdev->pfb;
struct drm_mode_fb_cmd mode_cmd; struct drm_mode_fb_cmd2 mode_cmd;
struct device *device = &dev->pdev->dev; struct device *device = &dev->pdev->dev;
int size; int size;
int ret; int ret;
struct gtt_range *backing; struct gtt_range *backing;
int gtt_roll = 1; int gtt_roll = 1;
u32 bpp, depth;
mode_cmd.width = sizes->surface_width; mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height; mode_cmd.height = sizes->surface_height;
mode_cmd.bpp = sizes->surface_bpp; bpp = sizes->surface_bpp;
/* No 24bit packed */ /* No 24bit packed */
if (mode_cmd.bpp == 24) if (bpp == 24)
mode_cmd.bpp = 32; bpp = 32;
/* Acceleration via the GTT requires pitch to be 4096 byte aligned /* Acceleration via the GTT requires pitch to be 4096 byte aligned
(ie 1024 or 2048 pixels in normal use) */ (ie 1024 or 2048 pixels in normal use) */
mode_cmd.pitch = ALIGN(mode_cmd.width * ((mode_cmd.bpp + 7) / 8), 4096); mode_cmd.pitches[0] = ALIGN(mode_cmd.width * ((bpp + 7) / 8), 4096);
mode_cmd.depth = sizes->surface_depth; depth = sizes->surface_depth;
size = mode_cmd.pitch * mode_cmd.height; size = mode_cmd.pitches[0] * mode_cmd.height;
size = ALIGN(size, PAGE_SIZE); size = ALIGN(size, PAGE_SIZE);
/* Allocate the framebuffer in the GTT with stolen page backing */ /* Allocate the framebuffer in the GTT with stolen page backing */
...@@ -421,10 +426,10 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -421,10 +426,10 @@ static int psbfb_create(struct psb_fbdev *fbdev,
gtt_roll = 0; /* Don't use GTT accelerated scrolling */ gtt_roll = 0; /* Don't use GTT accelerated scrolling */
mode_cmd.pitch = ALIGN(mode_cmd.width * ((mode_cmd.bpp + 7) / 8), 64); mode_cmd.pitches[0] = ALIGN(mode_cmd.width * ((bpp + 7) / 8), 64);
mode_cmd.depth = sizes->surface_depth; depth = sizes->surface_depth;
size = mode_cmd.pitch * mode_cmd.height; size = mode_cmd.pitches[0] * mode_cmd.height;
size = ALIGN(size, PAGE_SIZE); size = ALIGN(size, PAGE_SIZE);
/* Allocate the framebuffer in the GTT with stolen page /* Allocate the framebuffer in the GTT with stolen page
...@@ -443,6 +448,8 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -443,6 +448,8 @@ static int psbfb_create(struct psb_fbdev *fbdev,
} }
info->par = fbdev; info->par = fbdev;
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, psbfb, &mode_cmd, backing);
if (ret) if (ret)
goto out_unref; goto out_unref;
...@@ -555,7 +562,7 @@ static struct drm_framebuffer *psb_user_framebuffer_create ...@@ -555,7 +562,7 @@ static struct drm_framebuffer *psb_user_framebuffer_create
* Find the GEM object and thus the gtt range object that is * Find the GEM object and thus the gtt range object that is
* to back this space * to back this space
*/ */
obj = drm_gem_object_lookup(dev, filp, cmd->handle); obj = drm_gem_object_lookup(dev, filp, cmd->handles[0]);
if (obj == NULL) if (obj == NULL)
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
......
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