26 #include <linux/module.h>
27 #include <linux/slab.h>
51 static struct fb_ops radeonfb_ops = {
74 pitch_mask = align_large ? 255 : 127;
77 pitch_mask = align_large ? 127 : 31;
81 pitch_mask = align_large ? 63 : 15;
85 aligned += pitch_mask;
86 aligned &= ~pitch_mask;
90 static void radeonfb_destroy_pinned_object(
struct drm_gem_object *gobj)
99 radeon_bo_unreserve(rbo);
101 drm_gem_object_unreference_unlocked(gobj);
104 static int radeonfb_create_pinned_object(
struct radeon_fbdev *rfbdev,
106 struct drm_gem_object **gobj_p)
109 struct drm_gem_object *gobj =
NULL;
111 bool fb_tiled =
false;
114 int aligned_size,
size;
122 fb_tiled) * ((bpp + 1) / 8);
159 dev_err(rdev->
dev,
"FB failed to set tiling flags\n");
171 radeon_bo_unreserve(rbo);
177 radeon_bo_unreserve(rbo);
185 radeonfb_destroy_pinned_object(gobj);
197 struct drm_gem_object *gobj =
NULL;
213 ret = radeonfb_create_pinned_object(rfbdev, &mode_cmd, &gobj);
215 DRM_ERROR(
"failed to create fbcon object %d\n", ret);
232 DRM_ERROR(
"failed to initalise framebuffer %d\n", ret);
236 fb = &rfbdev->
rfb.base;
249 info->
fbops = &radeonfb_ops;
251 tmp = radeon_bo_gpu_offset(rbo) - rdev->
mc.vram_start;
252 info->
fix.smem_start = rdev->
mc.aper_base +
tmp;
253 info->
fix.smem_len = radeon_bo_size(rbo);
265 info->
apertures->ranges[0].base = rdev->
ddev->mode_config.fb_base;
266 info->
apertures->ranges[0].size = rdev->
mc.aper_size;
281 DRM_INFO(
"fb mappable at 0x%lX\n", info->
fix.smem_start);
282 DRM_INFO(
"vram apper at 0x%lX\n", (
unsigned long)rdev->
mc.aper_base);
283 DRM_INFO(
"size %lu\n", (
unsigned long)radeon_bo_size(rbo));
284 DRM_INFO(
"fb depth is %d\n", fb->
depth);
285 DRM_INFO(
" pitch is %d\n", fb->
pitches[0]);
295 drm_gem_object_unreference(gobj);
302 static int radeon_fb_find_or_create_single(
struct drm_fb_helper *helper,
310 ret = radeonfb_create(rfbdev, sizes);
328 if (rfbdev->
helper.fbdev) {
329 info = rfbdev->
helper.fbdev;
338 radeonfb_destroy_pinned_object(rfb->
obj);
350 .fb_probe = radeon_fb_find_or_create_single,
360 if (
ASIC_IS_RN50(rdev) || rdev->
mc.real_vram_size <= (32*1024*1024))
369 rfbdev->
helper.funcs = &radeon_fb_helper_funcs;
405 size += radeon_bo_size(robj);