2 * Copyright © 2007 David Airlie
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
30 #include <linux/module.h>
31 #include <linux/kernel.h>
32 #include <linux/errno.h>
33 #include <linux/string.h>
35 #include <linux/tty.h>
36 #include <linux/slab.h>
37 #include <linux/delay.h>
39 #include <linux/init.h>
44 #include "intel_drv.h"
49 struct drm_device *dev;
50 struct drm_display_mode *our_mode;
51 struct intel_framebuffer *intel_fb;
53 struct list_head mode_set_list;
57 var_to_refresh(const struct fb_var_screeninfo *var)
59 int xtot = var->xres + var->left_margin + var->right_margin +
61 int ytot = var->yres + var->upper_margin + var->lower_margin +
64 return (1000000000 / var->pixclock * 1000 + 500) / xtot / ytot;
67 static int intelfb_setcolreg(unsigned regno, unsigned red, unsigned green,
68 unsigned blue, unsigned transp,
71 struct intelfb_par *par = info->par;
72 struct drm_mode_set *modeset;
74 list_for_each_entry(modeset, &par->mode_set_list, head) {
75 struct drm_crtc *crtc = modeset->crtc;
76 struct drm_framebuffer *fb = modeset->fb;
82 intel_crtc_fb_gamma_set(crtc, red, green, blue, regno);
89 fb->pseudo_palette[regno] = ((red & 0xf800) >> 1) |
90 ((green & 0xf800) >> 6) |
91 ((blue & 0xf800) >> 11);
94 fb->pseudo_palette[regno] = (red & 0xf800) |
95 ((green & 0xfc00) >> 5) |
96 ((blue & 0xf800) >> 11);
100 fb->pseudo_palette[regno] = ((red & 0xff00) << 8) |
102 ((blue & 0xff00) >> 8);
110 static int intelfb_check_var(struct fb_var_screeninfo *var,
111 struct fb_info *info)
113 struct intelfb_par *par = info->par;
114 struct intel_framebuffer *intel_fb = par->intel_fb;
115 struct drm_framebuffer *fb = &intel_fb->base;
118 if (var->pixclock == -1 || !var->pixclock)
121 /* Need to resize the fb object !!! */
122 if (var->xres > fb->width || var->yres > fb->height) {
123 DRM_ERROR("Requested width/height is greater than current fb object %dx%d > %dx%d\n",var->xres,var->yres,fb->width,fb->height);
124 DRM_ERROR("Need resizing code.\n");
128 switch (var->bits_per_pixel) {
130 depth = (var->green.length == 6) ? 16 : 15;
133 depth = (var->transp.length > 0) ? 32 : 24;
136 depth = var->bits_per_pixel;
143 var->green.offset = 0;
144 var->blue.offset = 0;
146 var->green.length = 8;
147 var->blue.length = 8;
148 var->transp.length = 0;
149 var->transp.offset = 0;
152 var->red.offset = 10;
153 var->green.offset = 5;
154 var->blue.offset = 0;
156 var->green.length = 5;
157 var->blue.length = 5;
158 var->transp.length = 1;
159 var->transp.offset = 15;
162 var->red.offset = 11;
163 var->green.offset = 5;
164 var->blue.offset = 0;
166 var->green.length = 6;
167 var->blue.length = 5;
168 var->transp.length = 0;
169 var->transp.offset = 0;
172 var->red.offset = 16;
173 var->green.offset = 8;
174 var->blue.offset = 0;
176 var->green.length = 8;
177 var->blue.length = 8;
178 var->transp.length = 0;
179 var->transp.offset = 0;
182 var->red.offset = 16;
183 var->green.offset = 8;
184 var->blue.offset = 0;
186 var->green.length = 8;
187 var->blue.length = 8;
188 var->transp.length = 8;
189 var->transp.offset = 24;
198 /* this will let fbcon do the mode init */
199 /* FIXME: take mode config lock? */
200 static int intelfb_set_par(struct fb_info *info)
202 struct intelfb_par *par = info->par;
203 struct drm_device *dev = par->dev;
204 struct fb_var_screeninfo *var = &info->var;
207 DRM_DEBUG("%d %d\n", var->xres, var->pixclock);
210 if (var->pixclock != -1) {
212 DRM_ERROR("PIXEL CLCOK SET\n");
214 struct intel_framebuffer *intel_fb = par->intel_fb;
215 struct drm_framebuffer *fb = &intel_fb->base;
216 struct drm_display_mode *drm_mode, *search_mode;
217 struct drm_connector *connector = NULL;
219 switch (var->bits_per_pixel) {
221 fb->depth = (var->green.length == 6) ? 16 : 15;
224 fb->depth = (var->transp.length > 0) ? 32 : 24;
227 fb->depth = var->bits_per_pixel;
231 fb->bits_per_pixel = var->bits_per_pixel;
233 info->fix.line_length = fb->pitch;
234 info->fix.smem_len = info->fix.line_length * fb->height;
235 info->fix.visual = (fb->depth == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
237 info->screen_size = info->fix.smem_len; /* ??? */
238 /* reuse desired mode if possible */
239 /* create a drm mode */
240 drm_mode = drm_mode_create(dev);
241 drm_mode->hdisplay = var->xres;
242 drm_mode->hsync_start = drm_mode->hdisplay + var->right_margin;
243 drm_mode->hsync_end = drm_mode->hsync_start + var->hsync_len;
244 drm_mode->htotal = drm_mode->hsync_end + var->left_margin;
245 drm_mode->vdisplay = var->yres;
246 drm_mode->vsync_start = drm_mode->vdisplay + var->lower_margin;
247 drm_mode->vsync_end = drm_mode->vsync_start + var->vsync_len;
248 drm_mode->vtotal = drm_mode->vsync_end + var->upper_margin;
249 drm_mode->clock = PICOS2KHZ(var->pixclock);
250 drm_mode->vrefresh = drm_mode_vrefresh(drm_mode);
252 drm_mode->flags |= var->sync & FB_SYNC_HOR_HIGH_ACT ? V_PHSYNC : V_NHSYNC;
253 drm_mode->flags |= var->sync & FB_SYNC_VERT_HIGH_ACT ? V_PVSYNC : V_NVSYNC;
255 drm_mode_set_name(drm_mode);
256 drm_mode_set_crtcinfo(drm_mode, CRTC_INTERLACE_HALVE_V);
259 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
260 if (connector->encoder &&
261 connector->encoder->crtc == par->set.crtc){
267 /* no connector bound, bail */
272 drm_mode_debug_printmodeline(drm_mode);
273 list_for_each_entry(search_mode, &connector->modes, head) {
274 drm_mode_debug_printmodeline(search_mode);
275 if (drm_mode_equal(drm_mode, search_mode)) {
276 drm_mode_destroy(dev, drm_mode);
277 drm_mode = search_mode;
283 /* If we didn't find a matching mode that exists on our connector,
284 * create a new attachment for the incoming user specified mode
288 /* this also destroys the mode */
289 drm_mode_detachmode_crtc(dev, par->our_mode);
292 par->set.mode = drm_mode;
293 par->our_mode = drm_mode;
294 drm_mode_debug_printmodeline(drm_mode);
296 drm_mode_attachmode_crtc(dev, par->set.crtc, par->set.mode);
298 par->set.mode = drm_mode;
300 drm_mode_detachmode_crtc(dev, par->our_mode);
301 par->our_mode = NULL;
303 return par->set.crtc->funcs->set_config(&par->set);
307 struct drm_mode_set *modeset;
310 list_for_each_entry(modeset, &par->mode_set_list, head) {
311 if (modeset->num_connectors) {
312 ret = modeset->crtc->funcs->set_config(modeset);
322 static void intelfb_copyarea(struct fb_info *info,
323 const struct fb_copyarea *region)
325 struct intelfb_par *par = info->par;
326 struct drm_device *dev = par->dev;
327 struct drm_i915_private *dev_priv = dev->dev_private;
328 u32 src_x1, src_y1, dst_x1, dst_y1, dst_x2, dst_y2, offset;
329 u32 cmd, rop_depth_pitch, src_pitch;
332 cmd = XY_SRC_COPY_BLT_CMD;
337 dst_x2 = region->dx + region->width;
338 dst_y2 = region->dy + region->height;
339 offset = par->fb->offset;
340 rop_depth_pitch = BLT_ROP_GXCOPY | par->fb->pitch;
341 src_pitch = par->fb->pitch;
343 switch (par->fb->bits_per_pixel) {
345 rop_depth_pitch |= BLT_DEPTH_16_565;
348 rop_depth_pitch |= BLT_DEPTH_32;
349 cmd |= XY_SRC_COPY_BLT_WRITE_ALPHA | XY_SRC_COPY_BLT_WRITE_RGB;
355 OUT_RING(rop_depth_pitch);
356 OUT_RING((dst_y1 << 16) | (dst_x1 & 0xffff));
357 OUT_RING((dst_y2 << 16) | (dst_x2 & 0xffff));
359 OUT_RING((src_y1 << 16) | (src_x1 & 0xffff));
365 #define ROUND_UP_TO(x, y) (((x) + (y) - 1) / (y) * (y))
366 #define ROUND_DOWN_TO(x, y) ((x) / (y) * (y))
368 void intelfb_imageblit(struct fb_info *info, const struct fb_image *image)
370 struct intelfb_par *par = info->par;
371 struct drm_device *dev = par->dev;
372 struct drm_i915_private *dev_priv = dev->dev_private;
373 u32 cmd, rop_pitch_depth, tmp;
374 int nbytes, ndwords, pad;
375 u32 dst_x1, dst_y1, dst_x2, dst_y2, offset, bg, fg;
380 /* size in bytes of a padded scanline */
381 nbytes = ROUND_UP_TO(image->width, 16) / 8;
383 /* Total bytes of padded scanline data to write out. */
384 nbytes *= image->height;
387 * Check if the glyph data exceeds the immediate mode limit.
388 * It would take a large font (1K pixels) to hit this limit.
390 if (nbytes > 128 || image->depth != 1)
391 return cfb_imageblit(info, image);
393 /* Src data is packaged a dword (32-bit) at a time. */
394 ndwords = ROUND_UP_TO(nbytes, 4) / 4;
397 * Ring has to be padded to a quad word. But because the command starts
398 with 7 bytes, pad only if there is an even number of ndwords
400 pad = !(ndwords % 2);
402 DRM_DEBUG("imageblit %dx%dx%d to (%d,%d)\n", image->width,
403 image->height, image->depth, image->dx, image->dy);
404 DRM_DEBUG("nbytes: %d, ndwords: %d, pad: %d\n", nbytes, ndwords, pad);
406 tmp = (XY_MONO_SRC_COPY_IMM_BLT & 0xff) + ndwords;
407 cmd = (XY_MONO_SRC_COPY_IMM_BLT & ~0xff) | tmp;
408 offset = par->fb->offset;
411 dst_x2 = image->dx + image->width;
412 dst_y2 = image->dy + image->height;
413 rop_pitch_depth = BLT_ROP_GXCOPY | par->fb->pitch;
415 switch (par->fb->bits_per_pixel) {
417 rop_pitch_depth |= BLT_DEPTH_8;
418 fg = image->fg_color;
419 bg = image->bg_color;
422 rop_pitch_depth |= BLT_DEPTH_16_565;
423 fg = par->fb->pseudo_palette[image->fg_color];
424 bg = par->fb->pseudo_palette[image->bg_color];
427 rop_pitch_depth |= BLT_DEPTH_32;
428 cmd |= XY_SRC_COPY_BLT_WRITE_ALPHA | XY_SRC_COPY_BLT_WRITE_RGB;
429 fg = par->fb->pseudo_palette[image->fg_color];
430 bg = par->fb->pseudo_palette[image->bg_color];
433 DRM_ERROR("unknown depth %d\n", par->fb->bits_per_pixel);
437 BEGIN_LP_RING(8 + ndwords);
439 OUT_RING(rop_pitch_depth);
440 OUT_RING((dst_y1 << 16) | (dst_x1 & 0xffff));
441 OUT_RING((dst_y2 << 16) | (dst_x2 & 0xffff));
446 iw = ROUND_UP_TO(image->width, 8) / 8;
449 for (j = 0; j < 2; ++j) {
450 for (i = 0; i < 2; ++i) {
451 if (ix != iw || i == 0)
452 dat |= image->data[iy*iw + ix++] << (i+j*2)*8;
454 if (ix == iw && iy != (image->height - 1)) {
466 static int intelfb_pan_display(struct fb_var_screeninfo *var,
467 struct fb_info *info)
469 struct intelfb_par *par = info->par;
470 struct drm_mode_set *modeset;
474 list_for_each_entry(modeset, &par->mode_set_list, head) {
475 modeset->x = var->xoffset;
476 modeset->y = var->yoffset;
478 if (modeset->num_connectors) {
479 ret = modeset->crtc->funcs->set_config(modeset);
482 info->var.xoffset = var->xoffset;
483 info->var.yoffset = var->yoffset;
491 static struct fb_ops intelfb_ops = {
492 .owner = THIS_MODULE,
493 //.fb_open = intelfb_open,
494 //.fb_read = intelfb_read,
495 //.fb_write = intelfb_write,
496 //.fb_release = intelfb_release,
497 //.fb_ioctl = intelfb_ioctl,
498 .fb_check_var = intelfb_check_var,
499 .fb_set_par = intelfb_set_par,
500 .fb_setcolreg = intelfb_setcolreg,
501 .fb_fillrect = cfb_fillrect,
502 .fb_copyarea = cfb_copyarea, //intelfb_copyarea,
503 .fb_imageblit = cfb_imageblit, //intelfb_imageblit,
504 .fb_pan_display = intelfb_pan_display,
508 * Curretly it is assumed that the old framebuffer is reused.
511 * caller should hold the mode config lock.
514 int intelfb_resize(struct drm_device *dev, struct drm_crtc *crtc)
516 struct fb_info *info;
517 struct drm_framebuffer *fb;
518 struct drm_display_mode *mode = crtc->desired_mode;
531 info->var.xres = mode->hdisplay;
532 info->var.right_margin = mode->hsync_start - mode->hdisplay;
533 info->var.hsync_len = mode->hsync_end - mode->hsync_start;
534 info->var.left_margin = mode->htotal - mode->hsync_end;
535 info->var.yres = mode->vdisplay;
536 info->var.lower_margin = mode->vsync_start - mode->vdisplay;
537 info->var.vsync_len = mode->vsync_end - mode->vsync_start;
538 info->var.upper_margin = mode->vtotal - mode->vsync_end;
539 info->var.pixclock = 10000000 / mode->htotal * 1000 / mode->vtotal * 100;
541 info->var.pixclock = info->var.pixclock * 1000 / mode->vrefresh;
545 EXPORT_SYMBOL(intelfb_resize);
547 int intelfb_create(struct drm_device *dev, uint32_t fb_width, uint32_t fb_height, struct intel_framebuffer **intel_fb_p)
549 struct fb_info *info;
550 struct intelfb_par *par;
551 struct drm_framebuffer *fb;
552 struct intel_framebuffer *intel_fb;
553 struct drm_mode_fb_cmd mode_cmd;
554 struct drm_buffer_object *fbo = NULL;
555 struct device *device = &dev->pdev->dev;
558 mode_cmd.width = fb_width;/* crtc->desired_mode->hdisplay; */
559 mode_cmd.height = fb_height;/* crtc->desired_mode->vdisplay; */
562 mode_cmd.pitch = mode_cmd.width * ((mode_cmd.bpp + 1) / 8);
565 ret = drm_buffer_object_create(dev, mode_cmd.pitch * mode_cmd.height,
570 DRM_BO_FLAG_MEM_VRAM |
571 DRM_BO_FLAG_NO_EVICT,
572 DRM_BO_HINT_DONT_FENCE, 0, 0,
575 printk(KERN_ERR "failed to allocate framebuffer\n");
580 fb = intel_user_framebuffer_create(dev, NULL, &mode_cmd);
582 drm_bo_usage_deref_unlocked(&fbo);
583 DRM_ERROR("failed to allocate fb.\n");
587 intel_fb = to_intel_framebuffer(fb);
588 *intel_fb_p = intel_fb;
592 info = framebuffer_alloc(sizeof(struct intelfb_par), device);
598 strcpy(info->fix.id, "inteldrmfb");
599 info->fix.type = FB_TYPE_PACKED_PIXELS;
600 info->fix.visual = FB_VISUAL_TRUECOLOR;
601 info->fix.type_aux = 0;
602 info->fix.xpanstep = 1; /* doing it in hw */
603 info->fix.ypanstep = 1; /* doing it in hw */
604 info->fix.ywrapstep = 0;
605 info->fix.accel = FB_ACCEL_I830;
606 info->fix.type_aux = 0;
608 info->flags = FBINFO_DEFAULT;
610 info->fbops = &intelfb_ops;
612 info->fix.line_length = fb->pitch;
613 info->fix.smem_start = intel_fb->bo->offset + dev->mode_config.fb_base;
614 info->fix.smem_len = info->fix.line_length * fb->height;
616 info->flags = FBINFO_DEFAULT;
618 ret = drm_bo_kmap(intel_fb->bo, 0, intel_fb->bo->num_pages, &intel_fb->kmap);
620 DRM_ERROR("error mapping fb: %d\n", ret);
622 info->screen_base = intel_fb->kmap.virtual;
623 info->screen_size = info->fix.smem_len; /* FIXME */
624 info->pseudo_palette = fb->pseudo_palette;
625 info->var.xres_virtual = fb->width;
626 info->var.yres_virtual = fb->height;
627 info->var.bits_per_pixel = fb->bits_per_pixel;
628 info->var.xoffset = 0;
629 info->var.yoffset = 0;
630 info->var.activate = FB_ACTIVATE_NOW;
631 info->var.height = -1;
632 info->var.width = -1;
634 info->var.xres = fb_width;
635 info->var.yres = fb_height;
638 info->fix.mmio_start = pci_resource_start(dev->pdev, 0);
639 info->fix.mmio_len = pci_resource_len(dev->pdev, 0);
641 info->fix.mmio_start = pci_resource_start(dev->pdev, 1);
642 info->fix.mmio_len = pci_resource_len(dev->pdev, 1);
645 info->pixmap.size = 64*1024;
646 info->pixmap.buf_align = 8;
647 info->pixmap.access_align = 32;
648 info->pixmap.flags = FB_PIXMAP_SYSTEM;
649 info->pixmap.scan_align = 1;
651 DRM_DEBUG("fb depth is %d\n", fb->depth);
652 DRM_DEBUG(" pitch is %d\n", fb->pitch);
655 info->var.red.offset = 0;
656 info->var.green.offset = 0;
657 info->var.blue.offset = 0;
658 info->var.red.length = 8; /* 8bit DAC */
659 info->var.green.length = 8;
660 info->var.blue.length = 8;
661 info->var.transp.offset = 0;
662 info->var.transp.length = 0;
665 info->var.red.offset = 10;
666 info->var.green.offset = 5;
667 info->var.blue.offset = 0;
668 info->var.red.length = 5;
669 info->var.green.length = 5;
670 info->var.blue.length = 5;
671 info->var.transp.offset = 15;
672 info->var.transp.length = 1;
675 info->var.red.offset = 11;
676 info->var.green.offset = 5;
677 info->var.blue.offset = 0;
678 info->var.red.length = 5;
679 info->var.green.length = 6;
680 info->var.blue.length = 5;
681 info->var.transp.offset = 0;
684 info->var.red.offset = 16;
685 info->var.green.offset = 8;
686 info->var.blue.offset = 0;
687 info->var.red.length = 8;
688 info->var.green.length = 8;
689 info->var.blue.length = 8;
690 info->var.transp.offset = 0;
691 info->var.transp.length = 0;
694 info->var.red.offset = 16;
695 info->var.green.offset = 8;
696 info->var.blue.offset = 0;
697 info->var.red.length = 8;
698 info->var.green.length = 8;
699 info->var.blue.length = 8;
700 info->var.transp.offset = 24;
701 info->var.transp.length = 8;
709 INIT_LIST_HEAD(&par->mode_set_list);
711 par->intel_fb = intel_fb;
713 /* To allow resizeing without swapping buffers */
714 printk("allocated %dx%d fb: 0x%08lx, bo %p\n", intel_fb->base.width,
715 intel_fb->base.height, intel_fb->bo->offset, fbo);
720 int intelfb_probe(struct drm_device *dev)
722 struct fb_info *info;
723 struct intelfb_par *par;
724 struct device *device = &dev->pdev->dev;
725 struct intel_framebuffer *intel_fb;
726 struct drm_mode_set *modeset;
727 struct drm_crtc *crtc;
728 struct drm_connector *connector;
730 int crtc_count = 0, i;
731 unsigned int fb_width = (unsigned)-1, fb_height = (unsigned)-1;
735 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
736 if (crtc->desired_mode) {
737 if (crtc->desired_mode->hdisplay < fb_width)
738 fb_width = crtc->desired_mode->hdisplay;
740 if (crtc->desired_mode->vdisplay < fb_height)
741 fb_height = crtc->desired_mode->vdisplay;
746 if (fb_width == -1 || fb_height == -1) {
750 DRM_DEBUG("here %d %d\n", fb_width, fb_height);
751 ret = intelfb_create(dev, fb_width, fb_height, &intel_fb);
755 DRM_DEBUG("here %p\n", intel_fb);
756 info = intel_fb->base.fbdev;
759 DRM_DEBUG("crtc count is %d\n", crtc_count);
760 /* make up a couple of config sets */
761 for (i = 0; i < crtc_count; i++) {
764 modeset = kzalloc(sizeof(struct drm_mode_set), GFP_KERNEL);
765 modeset->fb = &intel_fb->base;
767 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
768 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
769 if (intel_crtc->pipe == i)
770 modeset->crtc = crtc;
775 /* find out how many connectors are on this */
776 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
777 if (connector->encoder)
778 if (connector->encoder->crtc == modeset->crtc)
782 list_add_tail(&modeset->head, &par->mode_set_list);
787 DRM_DEBUG("cc %d\n", conn_count);
788 modeset->connectors = kcalloc(conn_count, sizeof(struct drm_connector *), GFP_KERNEL);
789 if (!modeset->connectors) {
794 modeset->num_connectors = conn_count;
797 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
798 if (connector->encoder)
799 if (connector->encoder->crtc == modeset->crtc)
800 modeset->connectors[conn_count++] = connector;
802 modeset->mode = modeset->crtc->desired_mode;
805 info->var.pixclock = -1;
807 info->var.right_margin = mode->hsync_start - mode->hdisplay;
808 info->var.hsync_len = mode->hsync_end - mode->hsync_start;
809 info->var.left_margin = mode->htotal - mode->hsync_end;
810 info->var.lower_margin = mode->vsync_start - mode->vdisplay;
811 info->var.vsync_len = mode->vsync_end - mode->vsync_start;
812 info->var.upper_margin = mode->vtotal - mode->vsync_end;
813 info->var.pixclock = KHZ2PICOS(mode->clock);
815 if (mode->flags & V_PHSYNC)
816 info->var.sync |= FB_SYNC_HOR_HIGH_ACT;
818 if (mode->flags & V_PVSYNC)
819 info->var.sync |= FB_SYNC_VERT_HIGH_ACT;
821 if (mode->flags & V_INTERLACE)
822 info->var.vmode = FB_VMODE_INTERLACED;
823 else if (mode->flags & V_DBLSCAN)
824 info->var.vmode = FB_VMODE_DOUBLE;
826 info->var.vmode = FB_VMODE_NONINTERLACED;
830 if (register_framebuffer(info) < 0)
833 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node,
840 EXPORT_SYMBOL(intelfb_probe);
842 int intelfb_remove(struct drm_device *dev, struct drm_framebuffer *fb)
844 struct fb_info *info;
845 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
853 unregister_framebuffer(info);
854 drm_bo_kunmap(&intel_fb->kmap);
855 drm_bo_usage_deref_unlocked(&intel_fb->bo);
856 framebuffer_release(info);
860 EXPORT_SYMBOL(intelfb_remove);
861 MODULE_LICENSE("GPL");