Commit ed7ea13e authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

gma500: GEMify the frame buffer base bits

This then kills off the old bo_ interfaces
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0dfac1ce
...@@ -530,9 +530,8 @@ int mrst_pipe_set_base(struct drm_crtc *crtc, ...@@ -530,9 +530,8 @@ int mrst_pipe_set_base(struct drm_crtc *crtc,
/* struct drm_i915_master_private *master_priv; */ /* struct drm_i915_master_private *master_priv; */
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb); struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
struct psb_intel_mode_device *mode_dev = psb_intel_crtc->mode_dev;
int pipe = psb_intel_crtc->pipe; int pipe = psb_intel_crtc->pipe;
unsigned long Start, Offset; unsigned long start, offset;
/* FIXME: check if we need this surely MRST is pipe 0 only */ /* FIXME: check if we need this surely MRST is pipe 0 only */
int dspbase = (pipe == 0 ? DSPALINOFF : DSPBBASE); int dspbase = (pipe == 0 ? DSPALINOFF : DSPBBASE);
int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF); int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF);
...@@ -552,8 +551,8 @@ int mrst_pipe_set_base(struct drm_crtc *crtc, ...@@ -552,8 +551,8 @@ int mrst_pipe_set_base(struct drm_crtc *crtc,
if (!gma_power_begin(dev, true)) if (!gma_power_begin(dev, true))
return 0; return 0;
Start = mode_dev->bo_offset(dev, psbfb); start = psbfb->gtt->offset;
Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8); offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8);
REG_WRITE(dspstride, crtc->fb->pitch); REG_WRITE(dspstride, crtc->fb->pitch);
...@@ -581,14 +580,14 @@ int mrst_pipe_set_base(struct drm_crtc *crtc, ...@@ -581,14 +580,14 @@ int mrst_pipe_set_base(struct drm_crtc *crtc,
} }
REG_WRITE(dspcntr_reg, dspcntr); REG_WRITE(dspcntr_reg, dspcntr);
DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y); DRM_DEBUG("Writing base %08lX %08lX %d %d\n", start, offset, x, y);
if (0 /* FIXMEAC - check what PSB needs */) { if (0 /* FIXMEAC - check what PSB needs */) {
REG_WRITE(dspbase, Offset); REG_WRITE(dspbase, offset);
REG_READ(dspbase); REG_READ(dspbase);
REG_WRITE(dspsurf, Start); REG_WRITE(dspsurf, start);
REG_READ(dspsurf); REG_READ(dspsurf);
} else { } else {
REG_WRITE(dspbase, Start + Offset); REG_WRITE(dspbase, start + offset);
REG_READ(dspbase); REG_READ(dspbase);
} }
......
...@@ -160,7 +160,7 @@ static void psbfb_fillrect_accel(struct fb_info *info, ...@@ -160,7 +160,7 @@ static void psbfb_fillrect_accel(struct fb_info *info,
if (!fb) if (!fb)
return; return;
offset = psbfb->offset; offset = psbfb->gtt->offset;
stride = fb->pitch; stride = fb->pitch;
switch (fb->depth) { switch (fb->depth) {
...@@ -303,7 +303,7 @@ static void psbfb_copyarea_accel(struct fb_info *info, ...@@ -303,7 +303,7 @@ static void psbfb_copyarea_accel(struct fb_info *info,
if (!fb) if (!fb)
return; return;
offset = psbfb->offset; offset = psbfb->gtt->offset;
stride = fb->pitch; stride = fb->pitch;
switch (fb->depth) { switch (fb->depth) {
......
...@@ -219,17 +219,6 @@ struct drm_psb_register_rw_arg { ...@@ -219,17 +219,6 @@ struct drm_psb_register_rw_arg {
u32 subpicture_disable_mask; u32 subpicture_disable_mask;
}; };
struct psb_gtt_mapping_arg {
void *hKernelMemInfo;
u32 offset_pages;
};
struct drm_psb_getpageaddrs_arg {
u32 handle;
unsigned long *page_addrs;
unsigned long gtt_offset;
};
/* Controlling the kernel modesetting buffers */ /* Controlling the kernel modesetting buffers */
#define DRM_PSB_KMS_OFF 0x00 #define DRM_PSB_KMS_OFF 0x00
......
...@@ -870,11 +870,11 @@ static int psb_mode_operation_ioctl(struct drm_device *dev, void *data, ...@@ -870,11 +870,11 @@ static int psb_mode_operation_ioctl(struct drm_device *dev, void *data,
psb_fb = to_psb_fb(drm_fb); psb_fb = to_psb_fb(drm_fb);
if (gma_power_begin(dev, 0)) { if (gma_power_begin(dev, 0)) {
REG_WRITE(DSPASURF, psb_fb->offset); REG_WRITE(DSPASURF, psb_fb->gtt->offset);
REG_READ(DSPASURF); REG_READ(DSPASURF);
gma_power_end(dev); gma_power_end(dev);
} else { } else {
dev_priv->saveDSPASURF = psb_fb->offset; dev_priv->saveDSPASURF = psb_fb->gtt->offset;
} }
return 0; return 0;
......
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
/*Append new drm mode definition here, align with libdrm definition*/ /*Append new drm mode definition here, align with libdrm definition*/
#define DRM_MODE_SCALE_NO_SCALE 2 #define DRM_MODE_SCALE_NO_SCALE 2
extern struct ttm_bo_driver psb_ttm_bo_driver;
enum { enum {
CHIP_PSB_8108 = 0, CHIP_PSB_8108 = 0,
CHIP_PSB_8109 = 1, CHIP_PSB_8109 = 1,
......
...@@ -310,7 +310,7 @@ static struct fb_ops psbfb_ops = { ...@@ -310,7 +310,7 @@ static struct fb_ops psbfb_ops = {
static struct drm_framebuffer *psb_framebuffer_create static struct drm_framebuffer *psb_framebuffer_create
(struct drm_device *dev, struct drm_mode_fb_cmd *r, (struct drm_device *dev, struct drm_mode_fb_cmd *r,
void *mm_private) struct gtt_range *gt)
{ {
struct psb_framebuffer *fb; struct psb_framebuffer *fb;
int ret; int ret;
...@@ -326,7 +326,7 @@ static struct drm_framebuffer *psb_framebuffer_create ...@@ -326,7 +326,7 @@ static struct drm_framebuffer *psb_framebuffer_create
drm_helper_mode_fill_fb_struct(&fb->base, r); drm_helper_mode_fill_fb_struct(&fb->base, r);
fb->mem = mm_private; fb->gtt = gt;
return &fb->base; return &fb->base;
...@@ -380,7 +380,6 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -380,7 +380,6 @@ static int psbfb_create(struct psb_fbdev *fbdev,
goto out_err1; goto out_err1;
} }
psbfb = to_psb_fb(fb); psbfb = to_psb_fb(fb);
psbfb->size = size;
info = framebuffer_alloc(sizeof(struct psb_fbdev), device); info = framebuffer_alloc(sizeof(struct psb_fbdev), device);
if (!info) { if (!info) {
...@@ -524,7 +523,7 @@ int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev) ...@@ -524,7 +523,7 @@ int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
if (fbdev->psb_fb_helper.fbdev) { if (fbdev->psb_fb_helper.fbdev) {
info = fbdev->psb_fb_helper.fbdev; info = fbdev->psb_fb_helper.fbdev;
psb_gtt_free_range(dev, psbfb->mem); psb_gtt_free_range(dev, psbfb->gtt);
unregister_framebuffer(info); unregister_framebuffer(info);
iounmap(info->screen_base); iounmap(info->screen_base);
framebuffer_release(info); framebuffer_release(info);
...@@ -611,7 +610,7 @@ static int psb_user_framebuffer_create_handle(struct drm_framebuffer *fb, ...@@ -611,7 +610,7 @@ static int psb_user_framebuffer_create_handle(struct drm_framebuffer *fb,
unsigned int *handle) unsigned int *handle)
{ {
struct psb_framebuffer *psbfb = to_psb_fb(fb); struct psb_framebuffer *psbfb = to_psb_fb(fb);
struct gtt_range *r = psbfb->mem; struct gtt_range *r = psbfb->gtt;
return drm_gem_handle_create(file_priv, &r->gem, handle); return drm_gem_handle_create(file_priv, &r->gem, handle);
} }
...@@ -626,7 +625,7 @@ static void psb_user_framebuffer_destroy(struct drm_framebuffer *fb) ...@@ -626,7 +625,7 @@ static void psb_user_framebuffer_destroy(struct drm_framebuffer *fb)
{ {
struct drm_device *dev = fb->dev; struct drm_device *dev = fb->dev;
struct psb_framebuffer *psbfb = to_psb_fb(fb); struct psb_framebuffer *psbfb = to_psb_fb(fb);
struct gtt_range *r = psbfb->mem; struct gtt_range *r = psbfb->gtt;
if (psbfb->fbdev) if (psbfb->fbdev)
psbfb_remove(dev, fb); psbfb_remove(dev, fb);
...@@ -732,17 +731,6 @@ static void psb_setup_outputs(struct drm_device *dev) ...@@ -732,17 +731,6 @@ static void psb_setup_outputs(struct drm_device *dev)
} }
} }
/* FIXME: rewrite this in terms of the gtt_range and GEM objects
rather than faking them as we do now */
static size_t psb_bo_offset(struct drm_device *dev, void *obj)
{
struct psb_framebuffer *psbfb
= (struct psb_framebuffer *)obj;
return (size_t)psbfb->offset;
}
void psb_modeset_init(struct drm_device *dev) void psb_modeset_init(struct drm_device *dev)
{ {
struct drm_psb_private *dev_priv = struct drm_psb_private *dev_priv =
...@@ -751,8 +739,6 @@ void psb_modeset_init(struct drm_device *dev) ...@@ -751,8 +739,6 @@ void psb_modeset_init(struct drm_device *dev)
int i; int i;
PSB_DEBUG_ENTRY("\n"); PSB_DEBUG_ENTRY("\n");
/* Init mm functions */
mode_dev->bo_offset = psb_bo_offset;
drm_mode_config_init(dev); drm_mode_config_init(dev);
......
...@@ -32,10 +32,7 @@ struct psb_framebuffer { ...@@ -32,10 +32,7 @@ struct psb_framebuffer {
struct drm_framebuffer base; struct drm_framebuffer base;
struct address_space *addr_space; struct address_space *addr_space;
struct fb_info *fbdev; struct fb_info *fbdev;
struct gtt_range *mem; struct gtt_range *gtt;
void * hKernelMemInfo;
uint32_t size;
uint32_t offset;
}; };
struct psb_fbdev { struct psb_fbdev {
......
...@@ -343,7 +343,7 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc, ...@@ -343,7 +343,7 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb); struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
struct psb_intel_mode_device *mode_dev = psb_intel_crtc->mode_dev; struct psb_intel_mode_device *mode_dev = psb_intel_crtc->mode_dev;
int pipe = psb_intel_crtc->pipe; int pipe = psb_intel_crtc->pipe;
unsigned long Start, Offset; unsigned long start, offset;
int dspbase = (pipe == 0 ? DSPABASE : DSPBBASE); int dspbase = (pipe == 0 ? DSPABASE : DSPBBASE);
int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF); int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF);
int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE; int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE;
...@@ -362,8 +362,8 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc, ...@@ -362,8 +362,8 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
if (!gma_power_begin(dev, true)) if (!gma_power_begin(dev, true))
return 0; return 0;
Start = mode_dev->bo_offset(dev, psbfb); start = psbfb->gtt->offset;
Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8); offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8);
REG_WRITE(dspstride, crtc->fb->pitch); REG_WRITE(dspstride, crtc->fb->pitch);
...@@ -391,14 +391,14 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc, ...@@ -391,14 +391,14 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
} }
REG_WRITE(dspcntr_reg, dspcntr); REG_WRITE(dspcntr_reg, dspcntr);
DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y); DRM_DEBUG("Writing base %08lX %08lX %d %d\n", start, offset, x, y);
if (0 /* FIXMEAC - check what PSB needs */) { if (0 /* FIXMEAC - check what PSB needs */) {
REG_WRITE(dspbase, Offset); REG_WRITE(dspbase, offset);
REG_READ(dspbase); REG_READ(dspbase);
REG_WRITE(dspsurf, Start); REG_WRITE(dspsurf, start);
REG_READ(dspsurf); REG_READ(dspsurf);
} else { } else {
REG_WRITE(dspbase, Start + Offset); REG_WRITE(dspbase, start + offset);
REG_READ(dspbase); REG_READ(dspbase);
} }
......
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