Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282446
b: refs/heads/master
c: a9a644a
h: refs/heads/master
v: v3
  • Loading branch information
Dave Airlie committed Nov 28, 2011
1 parent e7f1b3c commit 363f15a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 15b273bb26085a0d7876df10fca2bedcb4e03287
refs/heads/master: a9a644ac9e8d6c8efdcc0581b120a0260d1f477d
33 changes: 20 additions & 13 deletions trunk/drivers/gpu/drm/gma500/framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <drm/drmP.h>
#include <drm/drm.h>
#include <drm/drm_crtc.h>
#include <drm/drm_fb_helper.h>

#include "psb_drv.h"
#include "psb_intel_reg.h"
Expand Down Expand Up @@ -240,14 +241,17 @@ static struct fb_ops psbfb_unaccel_ops = {
*/
static int psb_framebuffer_init(struct drm_device *dev,
struct psb_framebuffer *fb,
struct drm_mode_fb_cmd *mode_cmd,
struct drm_mode_fb_cmd2 *mode_cmd,
struct gtt_range *gt)
{
u32 bpp, depth;
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;
switch (mode_cmd->bpp) {
switch (bpp) {
case 8:
case 16:
case 24:
Expand Down Expand Up @@ -280,7 +284,7 @@ static int psb_framebuffer_init(struct drm_device *dev,

static struct drm_framebuffer *psb_framebuffer_create
(struct drm_device *dev,
struct drm_mode_fb_cmd *mode_cmd,
struct drm_mode_fb_cmd2 *mode_cmd,
struct gtt_range *gt)
{
struct psb_framebuffer *fb;
Expand Down Expand Up @@ -352,25 +356,26 @@ static int psbfb_create(struct psb_fbdev *fbdev,
struct fb_info *info;
struct drm_framebuffer *fb;
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;
int size;
int ret;
struct gtt_range *backing;
u32 bpp, depth;

mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
mode_cmd.bpp = sizes->surface_bpp;
bpp = sizes->surface_bpp;

/* No 24bit packed */
if (mode_cmd.bpp == 24)
mode_cmd.bpp = 32;
if (bpp == 24)
bpp = 32;

/* HW requires pitch to be 64 byte aligned */
mode_cmd.pitch = ALIGN(mode_cmd.width * ((mode_cmd.bpp + 7) / 8), 64);
mode_cmd.depth = sizes->surface_depth;
mode_cmd.pitches[0] = ALIGN(mode_cmd.width * ((bpp + 7) / 8), 64);
depth = sizes->surface_depth;

size = mode_cmd.pitch * mode_cmd.height;
size = mode_cmd.pitches[0] * mode_cmd.height;
size = ALIGN(size, PAGE_SIZE);

/* Allocate the framebuffer in the GTT with stolen page backing */
Expand All @@ -387,6 +392,8 @@ static int psbfb_create(struct psb_fbdev *fbdev,
}
info->par = fbdev;

mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);

ret = psb_framebuffer_init(dev, psbfb, &mode_cmd, backing);
if (ret)
goto out_unref;
Expand Down Expand Up @@ -485,7 +492,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
*/
static struct drm_framebuffer *psb_user_framebuffer_create
(struct drm_device *dev, struct drm_file *filp,
struct drm_mode_fb_cmd *cmd)
struct drm_mode_fb_cmd2 *cmd)
{
struct gtt_range *r;
struct drm_gem_object *obj;
Expand All @@ -494,7 +501,7 @@ static struct drm_framebuffer *psb_user_framebuffer_create
* Find the GEM object and thus the gtt range object that is
* 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)
return ERR_PTR(-ENOENT);

Expand Down

0 comments on commit 363f15a

Please sign in to comment.