aboutsummaryrefslogtreecommitdiff
path: root/linux-core/intel_fb.c
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@hobbes.virtuousgeek.org>2007-05-18 09:42:51 -0700
committerJesse Barnes <jbarnes@hobbes.virtuousgeek.org>2007-05-18 09:42:51 -0700
commita4929b921e44dcd3cae8e384b9b7eabc51db28ff (patch)
tree876a2ba492fd2786ed44ff26c514a0f2951f9096 /linux-core/intel_fb.c
parentf89458722173b364b8c3c27788b6c61889da554c (diff)
parentd42c1de3fb05405820b03ec9bb12f0b9a7eb0a7b (diff)
Merge branch 'modesetting-101' of git+ssh://git.freedesktop.org/git/mesa/drm into origin/modesetting-101
Conflicts: linux-core/drm_crtc.c - reconcile with locking changes
Diffstat (limited to 'linux-core/intel_fb.c')
-rw-r--r--linux-core/intel_fb.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/linux-core/intel_fb.c b/linux-core/intel_fb.c
index 2ce66460..449ef543 100644
--- a/linux-core/intel_fb.c
+++ b/linux-core/intel_fb.c
@@ -211,7 +211,6 @@ static int intelfb_set_par(struct fb_info *info)
struct drm_device *dev = par->dev;
struct drm_display_mode *drm_mode;
struct fb_var_screeninfo *var = &info->var;
- struct drm_output *output;
switch (var->bits_per_pixel) {
case 16:
@@ -263,6 +262,7 @@ static int intelfb_set_par(struct fb_info *info)
drm_mode->clock = PICOS2KHZ(var->pixclock);
drm_mode->vrefresh = drm_mode_vrefresh(drm_mode);
drm_mode_set_name(drm_mode);
+ drm_mode_set_crtcinfo(drm_mode, CRTC_INTERLACE_HALVE_V);
#endif
if (!drm_crtc_set_mode(par->crtc, drm_mode, 0, 0))
@@ -444,8 +444,9 @@ int intelfb_probe(struct drm_device *dev, struct drm_crtc *crtc)
struct fb_info *info;
struct intelfb_par *par;
struct device *device = &dev->pdev->dev;
- struct drm_framebuffer *fb = crtc->fb;
+ struct drm_framebuffer *fb;
struct drm_display_mode *mode = crtc->desired_mode;
+ drm_buffer_object_t *fbo = NULL;
int ret;
info = framebuffer_alloc(sizeof(struct intelfb_par), device);
@@ -453,6 +454,41 @@ int intelfb_probe(struct drm_device *dev, struct drm_crtc *crtc)
return -EINVAL;
}
+ fb = drm_framebuffer_create(dev);
+ if (!fb) {
+ framebuffer_release(info);
+ DRM_ERROR("failed to allocate fb.\n");
+ return -EINVAL;
+ }
+ crtc->fb = fb;
+
+ fb->width = crtc->desired_mode->hdisplay;
+ fb->height = crtc->desired_mode->vdisplay;
+
+ fb->bits_per_pixel = 32;
+ fb->pitch = fb->width * ((fb->bits_per_pixel + 1) / 8);
+ fb->depth = 24;
+ ret = drm_buffer_object_create(dev,
+ fb->width * fb->height * 4,
+ drm_bo_type_kernel,
+ DRM_BO_FLAG_READ |
+ DRM_BO_FLAG_WRITE |
+ DRM_BO_FLAG_MEM_PRIV0 | /* FIXME! */
+ DRM_BO_FLAG_NO_MOVE,
+ 0, 0, 0,
+ &fbo);
+ if (ret || !fbo) {
+ printk(KERN_ERR "failed to allocate framebuffer\n");
+ drm_framebuffer_destroy(fb);
+ framebuffer_release(info);
+ return -EINVAL;
+ }
+ fb->offset = fbo->offset;
+ fb->bo = fbo;
+ printk("allocated %dx%d fb: 0x%08lx, bo %p\n", fb->width,
+ fb->height, fbo->offset, fbo);
+
+
fb->fbdev = info;
par = info->par;
@@ -505,7 +541,9 @@ int intelfb_probe(struct drm_device *dev, struct drm_crtc *crtc)
info->var.vsync_len = mode->vsync_end - mode->vsync_start;
info->var.upper_margin = mode->vtotal - mode->vsync_end;
info->var.pixclock = 10000000 / mode->htotal * 1000 /
- mode->vtotal * 100000 / mode->vrefresh;
+ mode->vtotal * 100;
+ /* avoid overflow */
+ info->var.pixclock = info->var.pixclock * 1000 / mode->vrefresh;
info->pixmap.size = 64*1024;
info->pixmap.buf_align = 8;