11 #include <linux/module.h>
19 static void cirrus_dirty_update(
struct cirrus_fbdev *afbdev,
23 struct drm_gem_object *obj;
25 int src_offset, dst_offset;
26 int bpp = (afbdev->
gfb.base.bits_per_pixel + 7)/8;
30 obj = afbdev->
gfb.obj;
35 DRM_ERROR(
"failed to reserve fb bo\n");
39 if (!bo->
kmap.virtual) {
42 DRM_ERROR(
"failed to kmap fb updates\n");
48 for (i = y; i < y +
height; i++) {
50 src_offset = dst_offset = i * afbdev->
gfb.base.pitches[0] + (x *
bpp);
65 cirrus_dirty_update(afbdev, rect->
dx, rect->
dy, rect->
width,
74 cirrus_dirty_update(afbdev, area->
dx, area->
dy, area->
width,
83 cirrus_dirty_update(afbdev, image->
dx, image->
dy, image->
width,
88 static struct fb_ops cirrusfb_ops = {
92 .fb_fillrect = cirrus_fillrect,
93 .fb_copyarea = cirrus_copyarea,
94 .fb_imageblit = cirrus_imageblit,
100 static int cirrusfb_create_object(
struct cirrus_fbdev *afbdev,
102 struct drm_gem_object **gobj_p)
107 struct drm_gem_object *gobj;
133 struct drm_gem_object *gobj =
NULL;
144 ret = cirrusfb_create_object(gfbdev, &mode_cmd, &gobj);
146 DRM_ERROR(
"failed to create fbcon backing object %d\n", ret);
169 fb = &gfbdev->
gfb.base;
171 DRM_INFO(
"fb is NULL\n");
183 info->
fbops = &cirrusfb_ops;
195 info->
apertures->ranges[0].base = cdev->
dev->mode_config.fb_base;
196 info->
apertures->ranges[0].size = cdev->
mc.vram_size;
201 info->
fix.mmio_start = 0;
202 info->
fix.mmio_len = 0;
206 DRM_ERROR(
"%s: can't allocate color map\n", info->
fix.id);
211 DRM_INFO(
"fb mappable at 0x%lX\n", info->
fix.smem_start);
212 DRM_INFO(
"vram aper at 0x%lX\n", (
unsigned long)info->
fix.smem_start);
213 DRM_INFO(
"size %lu\n", (
unsigned long)info->
fix.smem_len);
214 DRM_INFO(
"fb depth is %d\n", fb->
depth);
215 DRM_INFO(
" pitch is %d\n", fb->
pitches[0]);
222 static int cirrus_fb_find_or_create_single(
struct drm_fb_helper *helper,
231 ret = cirrusfb_create(gfbdev, sizes);
239 static int cirrus_fbdev_destroy(
struct drm_device *dev,
245 if (gfbdev->
helper.fbdev) {
246 info = gfbdev->
helper.fbdev;
255 drm_gem_object_unreference_unlocked(gfb->
obj);
269 .fb_probe = cirrus_fb_find_or_create_single,
284 gfbdev->
helper.funcs = &cirrus_fb_helper_funcs;
303 cirrus_fbdev_destroy(cdev->
dev, cdev->
mode_info.gfbdev);