27 #include <linux/module.h>
28 #include <linux/kernel.h>
29 #include <linux/errno.h>
30 #include <linux/string.h>
32 #include <linux/tty.h>
37 #include <linux/screen_info.h>
60 static int nouveau_nofbaccel = 0;
128 nouveau_fbcon_imageblit(
struct fb_info *info,
const struct fb_image *image)
160 nouveau_fbcon_sync(
struct fb_info *info)
186 static struct fb_ops nouveau_fbcon_ops = {
190 .fb_fillrect = nouveau_fbcon_fillrect,
191 .fb_copyarea = nouveau_fbcon_copyarea,
192 .fb_imageblit = nouveau_fbcon_imageblit,
193 .fb_sync = nouveau_fbcon_sync,
201 static struct fb_ops nouveau_fbcon_sw_ops = {
220 nv_crtc->
lut.r[regno] =
red;
230 *red = nv_crtc->
lut.r[regno];
231 *green = nv_crtc->
lut.g[regno];
232 *blue = nv_crtc->
lut.b[regno];
245 rect.
dx = rect.
dy = 0;
246 rect.
width = info->
var.xres_virtual;
250 info->
fbops->fb_fillrect(info, &rect);
272 mode_cmd.pitches[0] = mode_cmd.width * (sizes->
surface_bpp >> 3);
273 mode_cmd.pitches[0] =
roundup(mode_cmd.pitches[0], 256);
278 size = mode_cmd.pitches[0] * mode_cmd.height;
284 NV_ERROR(drm,
"failed to allocate framebuffer\n");
290 NV_ERROR(drm,
"failed to pin fb: %d\n", ret);
291 nouveau_bo_ref(
NULL, &nvbo);
297 NV_ERROR(drm,
"failed to map fb: %d\n", ret);
299 nouveau_bo_ref(
NULL, &nvbo);
304 if (chan && device->
card_type >= NV_50) {
308 NV_ERROR(drm,
"failed to map fb into chan: %d\n", ret);
332 fb = &nouveau_fb->
base;
339 if (nouveau_nofbaccel)
346 info->
fbops = &nouveau_fbcon_sw_ops;
347 info->
fix.smem_start = nvbo->
bo.mem.bus.base +
348 nvbo->
bo.mem.bus.offset;
372 info->
fbops = &nouveau_fbcon_ops;
375 nouveau_fbcon_zfill(dev, fbcon);
378 NV_INFO(drm,
"allocated %dx%d fb: 0x%lx, bo %p\n",
379 nouveau_fb->
base.width, nouveau_fb->
base.height,
380 nvbo->
bo.offset, nvbo);
392 nouveau_fbcon_find_or_create_single(
struct drm_fb_helper *helper,
400 ret = nouveau_fbcon_create(fbcon, sizes);
421 if (fbcon->
helper.fbdev) {
422 info = fbcon->
helper.fbdev;
429 if (nouveau_fb->
nvbo) {
432 drm_gem_object_unreference_unlocked(nouveau_fb->
nvbo->gem);
445 NV_ERROR(drm,
"GPU lockup - switching to software fbcon\n");
450 .gamma_set = nouveau_fbcon_gamma_set,
451 .gamma_get = nouveau_fbcon_gamma_get,
452 .fb_probe = nouveau_fbcon_find_or_create_single,
460 struct nouveau_fb *pfb = nouveau_fb(drm->
device);
465 if (!dev->mode_config.num_crtc)
474 fbcon->
helper.funcs = &nouveau_fbcon_helper_funcs;
477 dev->mode_config.num_crtc, 4);
485 if (pfb->
ram.size <= 32 * 1024 * 1024)
488 if (pfb->
ram.size <= 64 * 1024 * 1024)
505 nouveau_fbcon_destroy(dev, drm->
fbcon);
514 drm->
fbcon->saved_flags = drm->
fbcon->helper.fbdev->flags;
521 drm->
fbcon->helper.fbdev->flags = drm->
fbcon->saved_flags;
539 nouveau_fbcon_zfill(dev, drm->
fbcon);