aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_fb.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-01-12 00:37:42 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-01-12 00:37:42 -0500
commit83eb95b852902f952ba594447a796ad8146b9462 (patch)
tree33c199aeeae58b69ad8d6d2a33c2d96ba2b98ddf /drivers/gpu/drm/i915/intel_fb.c
parentefb3e34b6176d30c4fe8635fa8e1beb6280cc2cd (diff)
parent9bbe7b984096ac45586da2adf26c14069ecb79b2 (diff)
Merge branch 'sh/sdio' into sh-latest
Diffstat (limited to 'drivers/gpu/drm/i915/intel_fb.c')
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index af2a1dddc28e..701e830d0012 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -65,10 +65,9 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
65 struct fb_info *info; 65 struct fb_info *info;
66 struct drm_framebuffer *fb; 66 struct drm_framebuffer *fb;
67 struct drm_mode_fb_cmd mode_cmd; 67 struct drm_mode_fb_cmd mode_cmd;
68 struct drm_gem_object *fbo = NULL; 68 struct drm_i915_gem_object *obj;
69 struct drm_i915_gem_object *obj_priv;
70 struct device *device = &dev->pdev->dev; 69 struct device *device = &dev->pdev->dev;
71 int size, ret, mmio_bar = IS_GEN2(dev) ? 1 : 0; 70 int size, ret;
72 71
73 /* we don't do packed 24bpp */ 72 /* we don't do packed 24bpp */
74 if (sizes->surface_bpp == 24) 73 if (sizes->surface_bpp == 24)
@@ -83,18 +82,17 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
83 82
84 size = mode_cmd.pitch * mode_cmd.height; 83 size = mode_cmd.pitch * mode_cmd.height;
85 size = ALIGN(size, PAGE_SIZE); 84 size = ALIGN(size, PAGE_SIZE);
86 fbo = i915_gem_alloc_object(dev, size); 85 obj = i915_gem_alloc_object(dev, size);
87 if (!fbo) { 86 if (!obj) {
88 DRM_ERROR("failed to allocate framebuffer\n"); 87 DRM_ERROR("failed to allocate framebuffer\n");
89 ret = -ENOMEM; 88 ret = -ENOMEM;
90 goto out; 89 goto out;
91 } 90 }
92 obj_priv = to_intel_bo(fbo);
93 91
94 mutex_lock(&dev->struct_mutex); 92 mutex_lock(&dev->struct_mutex);
95 93
96 /* Flush everything out, we'll be doing GTT only from now on */ 94 /* Flush everything out, we'll be doing GTT only from now on */
97 ret = intel_pin_and_fence_fb_obj(dev, fbo, false); 95 ret = intel_pin_and_fence_fb_obj(dev, obj, false);
98 if (ret) { 96 if (ret) {
99 DRM_ERROR("failed to pin fb: %d\n", ret); 97 DRM_ERROR("failed to pin fb: %d\n", ret);
100 goto out_unref; 98 goto out_unref;
@@ -108,7 +106,7 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
108 106
109 info->par = ifbdev; 107 info->par = ifbdev;
110 108
111 ret = intel_framebuffer_init(dev, &ifbdev->ifb, &mode_cmd, fbo); 109 ret = intel_framebuffer_init(dev, &ifbdev->ifb, &mode_cmd, obj);
112 if (ret) 110 if (ret)
113 goto out_unpin; 111 goto out_unpin;
114 112
@@ -134,11 +132,10 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
134 else 132 else
135 info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0); 133 info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);
136 134
137 info->fix.smem_start = dev->mode_config.fb_base + obj_priv->gtt_offset; 135 info->fix.smem_start = dev->mode_config.fb_base + obj->gtt_offset;
138 info->fix.smem_len = size; 136 info->fix.smem_len = size;
139 137
140 info->screen_base = ioremap_wc(dev->agp->base + obj_priv->gtt_offset, 138 info->screen_base = ioremap_wc(dev->agp->base + obj->gtt_offset, size);
141 size);
142 if (!info->screen_base) { 139 if (!info->screen_base) {
143 ret = -ENOSPC; 140 ret = -ENOSPC;
144 goto out_unpin; 141 goto out_unpin;
@@ -153,13 +150,8 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
153 150
154// memset(info->screen_base, 0, size); 151// memset(info->screen_base, 0, size);
155 152
156 drm_fb_helper_fill_fix(info, fb->pitch, fb->depth);
157 drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height); 153 drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height);
158 154
159 /* FIXME: we really shouldn't expose mmio space at all */
160 info->fix.mmio_start = pci_resource_start(dev->pdev, mmio_bar);
161 info->fix.mmio_len = pci_resource_len(dev->pdev, mmio_bar);
162
163 info->pixmap.size = 64*1024; 155 info->pixmap.size = 64*1024;
164 info->pixmap.buf_align = 8; 156 info->pixmap.buf_align = 8;
165 info->pixmap.access_align = 32; 157 info->pixmap.access_align = 32;
@@ -168,7 +160,7 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
168 160
169 DRM_DEBUG_KMS("allocated %dx%d fb: 0x%08x, bo %p\n", 161 DRM_DEBUG_KMS("allocated %dx%d fb: 0x%08x, bo %p\n",
170 fb->width, fb->height, 162 fb->width, fb->height,
171 obj_priv->gtt_offset, fbo); 163 obj->gtt_offset, obj);
172 164
173 165
174 mutex_unlock(&dev->struct_mutex); 166 mutex_unlock(&dev->struct_mutex);
@@ -176,9 +168,9 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
176 return 0; 168 return 0;
177 169
178out_unpin: 170out_unpin:
179 i915_gem_object_unpin(fbo); 171 i915_gem_object_unpin(obj);
180out_unref: 172out_unref:
181 drm_gem_object_unreference(fbo); 173 drm_gem_object_unreference(&obj->base);
182 mutex_unlock(&dev->struct_mutex); 174 mutex_unlock(&dev->struct_mutex);
183out: 175out:
184 return ret; 176 return ret;
@@ -225,7 +217,7 @@ static void intel_fbdev_destroy(struct drm_device *dev,
225 217
226 drm_framebuffer_cleanup(&ifb->base); 218 drm_framebuffer_cleanup(&ifb->base);
227 if (ifb->obj) { 219 if (ifb->obj) {
228 drm_gem_object_unreference_unlocked(ifb->obj); 220 drm_gem_object_unreference_unlocked(&ifb->obj->base);
229 ifb->obj = NULL; 221 ifb->obj = NULL;
230 } 222 }
231} 223}