diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-12-22 09:07:12 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-11 15:35:40 -0500 |
commit | 35c3047ad15849335242b847c94f180ef45db490 (patch) | |
tree | f298d7ecf12a9c3dbfa103a8e4cf0766f261260b /drivers/gpu/drm/i915/intel_fb.c | |
parent | a6044e23b784544fe567db75dbf9c4f684bd6d5b (diff) |
drm/i915: Use the mappable sizes determined by GTT for consistency.
There should be no difference, but we can eliminate redundant code.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_fb.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_fb.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 701e830d0012..ee145a257287 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -62,6 +62,7 @@ static int intelfb_create(struct intel_fbdev *ifbdev, | |||
62 | struct drm_fb_helper_surface_size *sizes) | 62 | struct drm_fb_helper_surface_size *sizes) |
63 | { | 63 | { |
64 | struct drm_device *dev = ifbdev->helper.dev; | 64 | struct drm_device *dev = ifbdev->helper.dev; |
65 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
65 | struct fb_info *info; | 66 | struct fb_info *info; |
66 | struct drm_framebuffer *fb; | 67 | struct drm_framebuffer *fb; |
67 | struct drm_mode_fb_cmd mode_cmd; | 68 | struct drm_mode_fb_cmd mode_cmd; |
@@ -77,7 +78,7 @@ static int intelfb_create(struct intel_fbdev *ifbdev, | |||
77 | mode_cmd.height = sizes->surface_height; | 78 | mode_cmd.height = sizes->surface_height; |
78 | 79 | ||
79 | mode_cmd.bpp = sizes->surface_bpp; | 80 | mode_cmd.bpp = sizes->surface_bpp; |
80 | mode_cmd.pitch = ALIGN(mode_cmd.width * ((mode_cmd.bpp + 1) / 8), 64); | 81 | mode_cmd.pitch = ALIGN(mode_cmd.width * ((mode_cmd.bpp + 7) / 8), 64); |
81 | mode_cmd.depth = sizes->surface_depth; | 82 | mode_cmd.depth = sizes->surface_depth; |
82 | 83 | ||
83 | size = mode_cmd.pitch * mode_cmd.height; | 84 | size = mode_cmd.pitch * mode_cmd.height; |
@@ -120,6 +121,11 @@ static int intelfb_create(struct intel_fbdev *ifbdev, | |||
120 | info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT; | 121 | info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT; |
121 | info->fbops = &intelfb_ops; | 122 | info->fbops = &intelfb_ops; |
122 | 123 | ||
124 | ret = fb_alloc_cmap(&info->cmap, 256, 0); | ||
125 | if (ret) { | ||
126 | ret = -ENOMEM; | ||
127 | goto out_unpin; | ||
128 | } | ||
123 | /* setup aperture base/size for vesafb takeover */ | 129 | /* setup aperture base/size for vesafb takeover */ |
124 | info->apertures = alloc_apertures(1); | 130 | info->apertures = alloc_apertures(1); |
125 | if (!info->apertures) { | 131 | if (!info->apertures) { |
@@ -127,10 +133,8 @@ static int intelfb_create(struct intel_fbdev *ifbdev, | |||
127 | goto out_unpin; | 133 | goto out_unpin; |
128 | } | 134 | } |
129 | info->apertures->ranges[0].base = dev->mode_config.fb_base; | 135 | info->apertures->ranges[0].base = dev->mode_config.fb_base; |
130 | if (!IS_GEN2(dev)) | 136 | info->apertures->ranges[0].size = |
131 | info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 2); | 137 | dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; |
132 | else | ||
133 | info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0); | ||
134 | 138 | ||
135 | info->fix.smem_start = dev->mode_config.fb_base + obj->gtt_offset; | 139 | info->fix.smem_start = dev->mode_config.fb_base + obj->gtt_offset; |
136 | info->fix.smem_len = size; | 140 | info->fix.smem_len = size; |
@@ -140,12 +144,6 @@ static int intelfb_create(struct intel_fbdev *ifbdev, | |||
140 | ret = -ENOSPC; | 144 | ret = -ENOSPC; |
141 | goto out_unpin; | 145 | goto out_unpin; |
142 | } | 146 | } |
143 | |||
144 | ret = fb_alloc_cmap(&info->cmap, 256, 0); | ||
145 | if (ret) { | ||
146 | ret = -ENOMEM; | ||
147 | goto out_unpin; | ||
148 | } | ||
149 | info->screen_size = size; | 147 | info->screen_size = size; |
150 | 148 | ||
151 | // memset(info->screen_base, 0, size); | 149 | // memset(info->screen_base, 0, size); |