aboutsummaryrefslogtreecommitdiff
path: root/linux-core/intel_fb.c
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@fairlite.demon.co.uk>2007-05-18 14:16:10 +0100
committerAlan Hourihane <alanh@fairlite.demon.co.uk>2007-05-18 14:16:10 +0100
commit0c33a2cd2ec81478403d39b1b92aaa4431e7cf0a (patch)
treeb452501935a7e2247bfc01188edba04a4efa31f8 /linux-core/intel_fb.c
parent3851600b3450697e20286b1937f3e51397f1965a (diff)
Move fbo creation to the specified fb driver which gives
it a chance to allocate the memory from whichever buffer it wants to.
Diffstat (limited to 'linux-core/intel_fb.c')
-rw-r--r--linux-core/intel_fb.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/linux-core/intel_fb.c b/linux-core/intel_fb.c
index 3c865a2f..ceeefc8c 100644
--- a/linux-core/intel_fb.c
+++ b/linux-core/intel_fb.c
@@ -210,7 +210,6 @@ static int intelfb_set_par(struct fb_info *info)
struct drm_device *dev = par->dev;
struct drm_display_mode *drm_mode;
struct fb_var_screeninfo *var = &info->var;
- struct drm_output *output;
switch (var->bits_per_pixel) {
case 16:
@@ -444,8 +443,9 @@ int intelfb_probe(struct drm_device *dev, struct drm_crtc *crtc)
struct fb_info *info;
struct intelfb_par *par;
struct device *device = &dev->pdev->dev;
- struct drm_framebuffer *fb = crtc->fb;
+ struct drm_framebuffer *fb;
struct drm_display_mode *mode = crtc->desired_mode;
+ drm_buffer_object_t *fbo = NULL;
int ret;
info = framebuffer_alloc(sizeof(struct intelfb_par), device);
@@ -453,6 +453,41 @@ int intelfb_probe(struct drm_device *dev, struct drm_crtc *crtc)
return -EINVAL;
}
+ fb = drm_framebuffer_create(dev);
+ if (!fb) {
+ framebuffer_release(info);
+ DRM_ERROR("failed to allocate fb.\n");
+ return -EINVAL;
+ }
+ crtc->fb = fb;
+
+ fb->width = crtc->desired_mode->hdisplay;
+ fb->height = crtc->desired_mode->vdisplay;
+
+ fb->bits_per_pixel = 32;
+ fb->pitch = fb->width * ((fb->bits_per_pixel + 1) / 8);
+ fb->depth = 24;
+ ret = drm_buffer_object_create(dev,
+ fb->width * fb->height * 4,
+ drm_bo_type_kernel,
+ DRM_BO_FLAG_READ |
+ DRM_BO_FLAG_WRITE |
+ DRM_BO_FLAG_MEM_PRIV0 | /* FIXME! */
+ DRM_BO_FLAG_NO_MOVE,
+ 0, 0, 0,
+ &fbo);
+ if (ret || !fbo) {
+ printk(KERN_ERR "failed to allocate framebuffer\n");
+ drm_framebuffer_destroy(fb);
+ framebuffer_release(info);
+ return -EINVAL;
+ }
+ fb->offset = fbo->offset;
+ fb->bo = fbo;
+ printk("allocated %dx%d fb: 0x%08lx, bo %p\n", fb->width,
+ fb->height, fbo->offset, fbo);
+
+
fb->fbdev = info;
par = info->par;