Rev 4104 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4104 | Rev 4280 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | #include |
41 | #include |
42 | #include "intel_drv.h" |
42 | #include "intel_drv.h" |
43 | #include |
43 | #include |
44 | #include "i915_drv.h" |
44 | #include "i915_drv.h" |
Line 45... | Line -... | ||
45 | - | ||
46 | static struct drm_i915_gem_object *fb_obj; |
- | |
47 | 45 | ||
48 | struct drm_i915_gem_object *get_fb_obj() |
- | |
49 | { |
- | |
50 | return fb_obj; |
- | |
Line 51... | Line 46... | ||
51 | }; |
46 | struct drm_i915_gem_object *fb_obj; |
52 | 47 | ||
53 | struct fb_info *framebuffer_alloc(size_t size, struct device *dev) |
48 | struct fb_info *framebuffer_alloc(size_t size, struct device *dev) |
54 | { |
49 | { |
Line 103... | Line 98... | ||
103 | struct drm_mode_fb_cmd2 mode_cmd = {}; |
98 | struct drm_mode_fb_cmd2 mode_cmd = {}; |
104 | struct drm_i915_gem_object *obj; |
99 | struct drm_i915_gem_object *obj; |
105 | struct device *device = &dev->pdev->dev; |
100 | struct device *device = &dev->pdev->dev; |
106 | int size, ret; |
101 | int size, ret; |
Line -... | Line 102... | ||
- | 102 | ||
- | 103 | ENTER(); |
|
107 | 104 | ||
108 | /* we don't do packed 24bpp */ |
105 | /* we don't do packed 24bpp */ |
109 | if (sizes->surface_bpp == 24) |
106 | if (sizes->surface_bpp == 24) |
Line 110... | Line 107... | ||
110 | sizes->surface_bpp = 32; |
107 | sizes->surface_bpp = 32; |
111 | 108 | ||
Line 112... | Line 109... | ||
112 | mode_cmd.width = sizes->surface_width; |
109 | mode_cmd.width = sizes->surface_width; |
113 | mode_cmd.height = sizes->surface_height; |
110 | mode_cmd.height = sizes->surface_height; |
114 | 111 | ||
115 | mode_cmd.pitches[0] = ALIGN(mode_cmd.width * ((sizes->surface_bpp + 7) / |
112 | mode_cmd.pitches[0] = ALIGN(mode_cmd.width * ((sizes->surface_bpp + 7) / |
Line 116... | Line 113... | ||
116 | 8), 64); |
113 | 8), 512); |
117 | mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, |
114 | mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, |
118 | sizes->surface_depth); |
115 | sizes->surface_depth); |
119 | 116 | ||
120 | size = mode_cmd.pitches[0] * mode_cmd.height; |
117 | size = mode_cmd.pitches[0] * mode_cmd.height; |
121 | size = ALIGN(size, PAGE_SIZE); |
118 | size = ALIGN(size, PAGE_SIZE); |
122 | obj = i915_gem_alloc_object(dev, size); |
119 | obj = fb_obj; |
123 | if (!obj) { |
120 | if (!obj) { |
Line 124... | Line 121... | ||
124 | DRM_ERROR("failed to allocate framebuffer\n"); |
121 | DRM_ERROR("failed to allocate framebuffer\n"); |
Line 125... | Line -... | ||
125 | ret = -ENOMEM; |
- | |
126 | goto out; |
122 | ret = -ENOMEM; |
Line 127... | Line 123... | ||
127 | } |
123 | goto out; |
128 | 124 | } |
|
129 | mutex_lock(&dev->struct_mutex); |
125 | |
130 | 126 | obj->stride = mode_cmd.pitches[0]; |
|
131 | #if 0 |
127 | |
132 | // skip this part and use existing framebiffer |
128 | mutex_lock(&dev->struct_mutex); |
133 | - | ||
134 | /* Flush everything out, we'll be doing GTT only from now on */ |
- | |
135 | ret = intel_pin_and_fence_fb_obj(dev, obj, false); |
- | |
136 | if (ret) { |
- | |
137 | DRM_ERROR("failed to pin fb: %d\n", ret); |
- | |
138 | goto out_unref; |
- | |
139 | } |
- | |
140 | #endif |
- | |
141 | - | ||
142 | /***********************************************************************/ |
- | |
143 | { |
- | |
144 | #define LFB_SIZE 0xC00000 |
- | |
145 | - | ||
146 | static struct drm_mm_node lfb_vm_node; |
- | |
147 | - | ||
148 | lfb_vm_node.size = LFB_SIZE; |
- | |
149 | lfb_vm_node.start = 0; |
- | |
150 | lfb_vm_node.mm = NULL; |
- | |
151 | - | ||
Line 152... | Line 129... | ||
152 | obj->pin_count = 2; |
129 | |
153 | obj->cache_level = I915_CACHE_NONE; |
130 | /* Flush everything out, we'll be doing GTT only from now on */ |
154 | obj->base.write_domain = 0; |
131 | ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); |
155 | obj->base.read_domains = I915_GEM_DOMAIN_GTT; |
132 | if (ret) { |
Line 192... | Line 169... | ||
192 | info->fix.smem_len = size; |
169 | info->fix.smem_len = size; |
Line 193... | Line 170... | ||
193 | 170 | ||
194 | info->screen_base = (void*) 0xFE000000; |
171 | info->screen_base = (void*) 0xFE000000; |
Line -... | Line 172... | ||
- | 172 | info->screen_size = size; |
|
- | 173 | ||
Line 195... | Line 174... | ||
195 | info->screen_size = size; |
174 | /* This driver doesn't need a VT switch to restore the mode on resume */ |
196 | 175 | info->skip_vt_switch = true; |
|
Line 197... | Line 176... | ||
197 | 176 | ||
Line 204... | Line 183... | ||
204 | fb->width, fb->height, |
183 | fb->width, fb->height, |
205 | i915_gem_obj_ggtt_offset(obj), obj); |
184 | i915_gem_obj_ggtt_offset(obj), obj); |
Line 206... | Line 185... | ||
206 | 185 | ||
207 | - | ||
208 | mutex_unlock(&dev->struct_mutex); |
- | |
209 | - | ||
210 | fb_obj = obj; |
186 | |
Line 211... | Line 187... | ||
211 | 187 | mutex_unlock(&dev->struct_mutex); |
|
212 | return 0; |
188 | return 0; |
213 | 189 |