summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@hobbes.virtuousgeek.org>2007-04-10 10:45:55 -0700
committerJesse Barnes <jbarnes@hobbes.virtuousgeek.org>2007-04-10 10:45:55 -0700
commit44a8761302888080f1cb6596d4573d88c1746da4 (patch)
tree851220ca0bdcd7677eda5ea796a4eb5a670bf406
parente114b981bc291049fa6996d487334a408acc1ce2 (diff)
parent50672adb3142abca743535a8e60c360ef47b2a08 (diff)
Merge branch 'modesetting-101' of git+ssh://git.freedesktop.org/git/mesa/drm into origin/modesetting-101
Conflicts: linux-core/drm_crtc.c - trivial merge linux-core/drm_crtc.h - trivial merge linux-core/intel_display.c - crtc_config -> mode_config shared-core/i915_dma.c - accommodate new init code in i915_init.c
-rw-r--r--libdrm/xf86drmMode.c36
-rw-r--r--libdrm/xf86drmMode.h16
-rw-r--r--linux-core/Makefile.kernel2
-rw-r--r--linux-core/drmP.h2
-rw-r--r--linux-core/drm_crtc.c293
-rw-r--r--linux-core/drm_crtc.h40
-rw-r--r--linux-core/drm_drv.c2
-rw-r--r--linux-core/drm_modes.c4
-rw-r--r--linux-core/intel_display.c277
-rw-r--r--linux-core/intel_lvds.c10
-rw-r--r--linux-core/intel_sdvo.c105
-rw-r--r--shared-core/drm.h13
-rw-r--r--shared-core/i915_dma.c4
-rw-r--r--shared-core/i915_drv.h1
-rw-r--r--shared-core/i915_init.c4
15 files changed, 498 insertions, 311 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index c4403b1c..c0444e65 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -40,6 +40,7 @@
#include "xf86drmMode.h"
#include "xf86drm.h"
#include <drm.h>
+#include <string.h>
/*
* Util functions
@@ -192,6 +193,30 @@ err_allocs:
return 0;
}
+int drmModeAddFB(int fd, uint32_t width, uint32_t height,
+ uint8_t bpp, uint32_t pitch, drmBO *bo, uint32_t *buf_id)
+{
+ struct drm_mode_fb_cmd f;
+ int ret;
+
+ f.width = width;
+ f.height = height;
+ f.pitch = pitch;
+ f.bpp = bpp;
+ f.handle = bo->handle;
+
+ if (ret = ioctl(fd, DRM_IOCTL_MODE_ADDFB, &f))
+ return ret;
+
+ *buf_id = f.buffer_id;
+ return 0;
+}
+
+int drmModeRmFB(int fd, uint32_t bufferId)
+{
+ return ioctl(fd, DRM_IOCTL_MODE_RMFB, bufferId);
+}
+
#if 0
int drmModeForceProbe(int fd, uint32_t outputId)
{
@@ -287,11 +312,9 @@ err_allocs:
}
-int drmModeSetCrtc(
- int fd, uint32_t crtcId, uint32_t bufferId,
- uint32_t x, uint32_t y, uint32_t modeId,
- uint32_t *outputs, int count
- )
+int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
+ uint32_t x, uint32_t y, uint32_t modeId,
+ uint32_t *outputs, int count)
{
struct drm_mode_crtc crtc;
@@ -363,7 +386,8 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id)
r->crtcs = out.crtcs;
r->clones = out.clones;
r->modes = drmAllocCpy(out.modes, out.count_modes, sizeof(uint32_t));
-
+ strncpy(r->name, out.name, DRM_OUTPUT_NAME_LEN);
+ r->name[DRM_OUTPUT_NAME_LEN-1] = 0;
return r;
err_allocs:
diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h
index c027a16d..594eb487 100644
--- a/libdrm/xf86drmMode.h
+++ b/libdrm/xf86drmMode.h
@@ -77,8 +77,10 @@ typedef struct _drmModeRes {
typedef struct _drmModeFrameBuffer {
- uint32_t minWidth, maxWidth;
- uint32_t minHeight, maxHeight;
+ uint32_t width;
+ uint32_t height;
+ uint32_t pitch;
+ uint8_t bpp;
} drmModeFrameBuffer, *drmModeFrameBufferPtr;
@@ -118,7 +120,7 @@ typedef enum {
typedef struct _drmModeOutput {
unsigned int crtc; /**< Crtc currently connected to */
-
+ unsigned char name[DRM_OUTPUT_NAME_LEN];
drmModeConnection connection;
uint32_t mmWidth, mmHeight; /**< HxW in millimeters */
drmModeSubPixel subpixel;
@@ -212,14 +214,12 @@ extern drmModeFrameBufferPtr drmModeGetFramebuffer(int fd,
/**
* Creates a new framebuffer with an buffer object as its scanout buffer.
*/
-extern uint32_t drmModeNewFrameBuffer(int fd,
- uint32_t width, uint32_t height,
- uint8_t bbp, uint32_t pitch, drmBO *bo);
-
+extern int drmModeAddFB(int fd, uint32_t width, uint32_t height,
+ uint8_t bpp, uint32_t pitch, drmBO *bo, uint32_t *buf_id);
/**
* Destroies the given framebuffer.
*/
-extern int drmModeDesFrameBuffer(int fd, uint32_t bufferId);
+extern int drmModeRmFB(int fd, uint32_t bufferId);
/**
* Changes the scanout buffer to the given buffer object.
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel
index ac403f64..c767116a 100644
--- a/linux-core/Makefile.kernel
+++ b/linux-core/Makefile.kernel
@@ -21,7 +21,7 @@ mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
i810-objs := i810_drv.o i810_dma.o
i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_fence.o \
i915_buffer.o intel_display.o intel_crt.o intel_lvds.o \
- intel_sdvo.o intel_modes.o intel_i2c.o
+ intel_sdvo.o intel_modes.o intel_i2c.o i915_init.o
nouveau-objs := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \
nouveau_object.o nouveau_irq.o \
nv04_timer.o \
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 74f52854..25fc8733 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -832,7 +832,7 @@ typedef struct drm_device {
/*@} */
/* DRM mode setting */
- struct drm_crtc_config crtc_config;
+ struct drm_mode_config mode_config;
} drm_device_t;
#if __OS_HAS_AGP
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index 6874265e..1899df2d 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -8,39 +8,39 @@ int drm_mode_idr_get(struct drm_device *dev, void *ptr)
int new_id = 0;
int ret;
again:
- if (idr_pre_get(&dev->crtc_config.crtc_idr, GFP_KERNEL) == 0) {
+ if (idr_pre_get(&dev->mode_config.crtc_idr, GFP_KERNEL) == 0) {
DRM_ERROR("Ran out memory getting a mode number\n");
return 0;
}
- spin_lock(&dev->crtc_config.config_lock);
+ spin_lock(&dev->mode_config.config_lock);
- ret = idr_get_new_above(&dev->crtc_config.crtc_idr, ptr, 1, &new_id);
+ ret = idr_get_new_above(&dev->mode_config.crtc_idr, ptr, 1, &new_id);
if (ret == -EAGAIN) {
- spin_unlock(&dev->crtc_config.config_lock);
+ spin_unlock(&dev->mode_config.config_lock);
goto again;
}
- spin_unlock(&dev->crtc_config.config_lock);
+ spin_unlock(&dev->mode_config.config_lock);
return new_id;
}
void drm_mode_idr_put(struct drm_device *dev, int id)
{
- idr_remove(&dev->crtc_config.crtc_idr, id);
+ idr_remove(&dev->mode_config.crtc_idr, id);
}
struct drm_framebuffer *drm_framebuffer_create(drm_device_t *dev)
{
struct drm_framebuffer *fb;
- spin_lock(&dev->crtc_config.config_lock);
+ spin_lock(&dev->mode_config.config_lock);
/* Limit to single framebuffer for now */
- if (dev->crtc_config.num_fb > 1) {
+ if (dev->mode_config.num_fb > 1) {
DRM_ERROR("Attempt to add multiple framebuffers failed\n");
return NULL;
}
- spin_unlock(&dev->crtc_config.config_lock);
+ spin_unlock(&dev->mode_config.config_lock);
fb = kzalloc(sizeof(struct drm_framebuffer), GFP_KERNEL);
if (!fb) {
@@ -50,10 +50,10 @@ struct drm_framebuffer *drm_framebuffer_create(drm_device_t *dev)
fb->id = drm_mode_idr_get(dev, fb);
fb->dev = dev;
- spin_lock(&dev->crtc_config.config_lock);
- dev->crtc_config.num_fb++;
- list_add(&fb->head, &dev->crtc_config.fb_list);
- spin_unlock(&dev->crtc_config.config_lock);
+ spin_lock(&dev->mode_config.config_lock);
+ dev->mode_config.num_fb++;
+ list_add(&fb->head, &dev->mode_config.fb_list);
+ spin_unlock(&dev->mode_config.config_lock);
return fb;
}
@@ -62,11 +62,11 @@ void drm_framebuffer_destroy(struct drm_framebuffer *fb)
{
drm_device_t *dev = fb->dev;
- spin_lock(&dev->crtc_config.config_lock);
+ spin_lock(&dev->mode_config.config_lock);
drm_mode_idr_put(dev, fb->id);
list_del(&fb->head);
- dev->crtc_config.num_fb--;
- spin_unlock(&dev->crtc_config.config_lock);
+ dev->mode_config.num_fb--;
+ spin_unlock(&dev->mode_config.config_lock);
kfree(fb);
}
@@ -86,10 +86,10 @@ struct drm_crtc *drm_crtc_create(drm_device_t *dev,
crtc->id = drm_mode_idr_get(dev, crtc);
DRM_DEBUG("crtc %p got id %d\n", crtc, crtc->id);
- spin_lock(&dev->crtc_config.config_lock);
- list_add_tail(&crtc->head, &dev->crtc_config.crtc_list);
- dev->crtc_config.num_crtc++;
- spin_unlock(&dev->crtc_config.config_lock);
+ spin_lock(&dev->mode_config.config_lock);
+ list_add_tail(&crtc->head, &dev->mode_config.crtc_list);
+ dev->mode_config.num_crtc++;
+ spin_unlock(&dev->mode_config.config_lock);
return crtc;
}
@@ -103,11 +103,11 @@ void drm_crtc_destroy(struct drm_crtc *crtc)
(*crtc->funcs->cleanup)(crtc);
- spin_lock(&dev->crtc_config.config_lock);
+ spin_lock(&dev->mode_config.config_lock);
drm_mode_idr_put(dev, crtc->id);
list_del(&crtc->head);
- dev->crtc_config.num_crtc--;
- spin_unlock(&dev->crtc_config.config_lock);
+ dev->mode_config.num_crtc--;
+ spin_unlock(&dev->mode_config.config_lock);
kfree(crtc);
}
EXPORT_SYMBOL(drm_crtc_destroy);
@@ -117,7 +117,7 @@ bool drm_crtc_in_use(struct drm_crtc *crtc)
struct drm_output *output;
drm_device_t *dev = crtc->dev;
/* FIXME: Locking around list access? */
- list_for_each_entry(output, &dev->crtc_config.output_list, head)
+ list_for_each_entry(output, &dev->mode_config.output_list, head)
if (output->crtc == crtc)
return true;
return false;
@@ -132,7 +132,7 @@ void drm_crtc_probe_output_modes(struct drm_device *dev, int maxX, int maxY)
//if (maxX == 0 || maxY == 0)
// TODO
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
list_for_each_entry_safe(mode, t, &output->modes, head)
drm_mode_remove(output, mode);
@@ -215,7 +215,7 @@ bool drm_crtc_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
* adjust it according to limitations or output properties, and also
* a chance to reject the mode entirely.
*/
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
if (output->crtc != crtc)
continue;
@@ -230,7 +230,7 @@ bool drm_crtc_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
}
/* Prepare the outputs and CRTCs before setting the mode. */
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
if (output->crtc != crtc)
continue;
@@ -245,14 +245,14 @@ bool drm_crtc_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
* on the DPLL.
*/
crtc->funcs->mode_set(crtc, mode, adjusted_mode, x, y);
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
if (output->crtc == crtc)
output->funcs->mode_set(output, mode, adjusted_mode);
}
/* Now, enable the clocks, plane, pipe, and outputs that we set up. */
crtc->funcs->commit(crtc);
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
if (output->crtc == crtc)
{
output->funcs->commit(output);
@@ -288,11 +288,11 @@ bool drm_set_desired_modes(struct drm_device *dev)
struct drm_crtc *crtc;
struct drm_output *output, *list_output;
- list_for_each_entry(crtc, &dev->crtc_config.crtc_list, head) {
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
output = NULL;
DRM_DEBUG("crtc is %d\n", crtc->id);
- list_for_each_entry(list_output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(list_output, &dev->mode_config.output_list, head) {
if (list_output->crtc == crtc) {
output = list_output;
break;
@@ -321,12 +321,12 @@ void drm_disable_unused_functions(struct drm_device *dev)
struct drm_output *output;
struct drm_crtc *crtc;
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
if (!output->crtc)
(*output->funcs->dpms)(output, DPMSModeOff);
}
- list_for_each_entry(crtc, &dev->crtc_config.crtc_list, head) {
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
if (!crtc->enabled)
crtc->funcs->dpms(crtc, DPMSModeOff);
}
@@ -372,7 +372,7 @@ struct drm_output *drm_output_create(drm_device_t *dev,
{
struct drm_output *output = NULL;
- output = kmalloc(sizeof(struct drm_output), GFP_KERNEL);
+ output = kzalloc(sizeof(struct drm_output), GFP_KERNEL);
if (!output)
return NULL;
@@ -390,11 +390,11 @@ struct drm_output *drm_output_create(drm_device_t *dev,
/* output_set_monitor(output)? */
/* check for output_ignored(output)? */
- spin_lock(&dev->crtc_config.config_lock);
- list_add_tail(&output->head, &dev->crtc_config.output_list);
- dev->crtc_config.num_output++;
+ spin_lock(&dev->mode_config.config_lock);
+ list_add_tail(&output->head, &dev->mode_config.output_list);
+ dev->mode_config.num_output++;
- spin_unlock(&dev->crtc_config.config_lock);
+ spin_unlock(&dev->mode_config.config_lock);
return output;
@@ -415,10 +415,10 @@ void drm_output_destroy(struct drm_output *output)
list_for_each_entry_safe(mode, t, &output->modes, head)
drm_mode_remove(output, mode);
- spin_lock(&dev->crtc_config.config_lock);
+ spin_lock(&dev->mode_config.config_lock);
drm_mode_idr_put(dev, output->id);
list_del(&output->head);
- spin_unlock(&dev->crtc_config.config_lock);
+ spin_unlock(&dev->mode_config.config_lock);
kfree(output);
}
EXPORT_SYMBOL(drm_output_destroy);
@@ -456,28 +456,29 @@ void drm_crtc_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode
kfree(mode);
}
-void drm_crtc_config_init(drm_device_t *dev)
+void drm_mode_config_init(drm_device_t *dev)
{
- spin_lock_init(&dev->crtc_config.config_lock);
- INIT_LIST_HEAD(&dev->crtc_config.fb_list);
- INIT_LIST_HEAD(&dev->crtc_config.crtc_list);
- INIT_LIST_HEAD(&dev->crtc_config.output_list);
- idr_init(&dev->crtc_config.crtc_idr);
+ spin_lock_init(&dev->mode_config.config_lock);
+ INIT_LIST_HEAD(&dev->mode_config.fb_list);
+ INIT_LIST_HEAD(&dev->mode_config.crtc_list);
+ INIT_LIST_HEAD(&dev->mode_config.output_list);
+ idr_init(&dev->mode_config.crtc_idr);
}
-EXPORT_SYMBOL(drm_crtc_config_init);
+EXPORT_SYMBOL(drm_mode_config_init);
-void drm_framebuffer_set_object(drm_device_t *dev, unsigned long handle)
+static int drm_get_buffer_object(drm_device_t *dev, struct drm_buffer_object **bo, unsigned long handle)
{
- struct drm_framebuffer *fb;
drm_user_object_t *uo;
drm_hash_item_t *hash;
- drm_buffer_object_t *bo;
int ret;
+ *bo = NULL;
+
mutex_lock(&dev->struct_mutex);
ret = drm_ht_find_item(&dev->object_hash, handle, &hash);
if (ret) {
DRM_ERROR("Couldn't find handle.\n");
+ ret = -EINVAL;
goto out_err;
}
@@ -486,20 +487,13 @@ void drm_framebuffer_set_object(drm_device_t *dev, unsigned long handle)
ret = -EINVAL;
goto out_err;
}
-
- bo = drm_user_object_entry(uo, drm_buffer_object_t, base);
- /* get the first fb */
- list_for_each_entry(fb, &dev->crtc_config.fb_list, head) {
- fb->offset = bo->offset;
- break;
- }
+ *bo = drm_user_object_entry(uo, drm_buffer_object_t, base);
ret = 0;
out_err:
mutex_unlock(&dev->struct_mutex);
- return;
+ return ret;
}
-EXPORT_SYMBOL(drm_framebuffer_set_object);
bool drm_initial_config(drm_device_t *dev, bool can_grow)
{
@@ -509,6 +503,7 @@ bool drm_initial_config(drm_device_t *dev, bool can_grow)
struct drm_framebuffer *fb;
struct drm_output *output, *use_output = NULL;
+#if 0
fb = drm_framebuffer_create(dev);
if (!fb)
return false;
@@ -518,11 +513,12 @@ bool drm_initial_config(drm_device_t *dev, bool can_grow)
fb->height = 768;
fb->depth = 24;
fb->bits_per_pixel = 32;
+#endif
/* bind both CRTCs to this fb */
/* only initialise one crtc to enabled state */
- list_for_each_entry(crtc, &dev->crtc_config.crtc_list, head) {
- crtc->fb = fb;
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+ // crtc->fb = fb;
if (!vga_crtc) {
vga_crtc = crtc;
crtc->enabled = 1;
@@ -547,7 +543,7 @@ bool drm_initial_config(drm_device_t *dev, bool can_grow)
/* hard bind the CRTCS */
/* bind analog output to one crtc */
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
struct drm_display_mode *des_mode;
/* Get the first preferred moded */
@@ -583,20 +579,20 @@ bool drm_initial_config(drm_device_t *dev, bool can_grow)
}
EXPORT_SYMBOL(drm_initial_config);
-void drm_crtc_config_cleanup(drm_device_t *dev)
+void drm_mode_config_cleanup(drm_device_t *dev)
{
struct drm_output *output, *ot;
struct drm_crtc *crtc, *ct;
- list_for_each_entry_safe(output, ot, &dev->crtc_config.output_list, head) {
+ list_for_each_entry_safe(output, ot, &dev->mode_config.output_list, head) {
drm_output_destroy(output);
}
- list_for_each_entry_safe(crtc, ct, &dev->crtc_config.crtc_list, head) {
+ list_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) {
drm_crtc_destroy(crtc);
}
}
-EXPORT_SYMBOL(drm_crtc_config_cleanup);
+EXPORT_SYMBOL(drm_mode_config_cleanup);
int drm_crtc_set_config(struct drm_crtc *crtc, struct drm_mode_crtc *crtc_info, struct drm_display_mode *new_mode, struct drm_output **output_set)
{
@@ -607,7 +603,7 @@ int drm_crtc_set_config(struct drm_crtc *crtc, struct drm_mode_crtc *crtc_info,
struct drm_output *output;
int count = 0, ro;
- save_crtcs = kzalloc(dev->crtc_config.num_crtc * sizeof(struct drm_crtc *), GFP_KERNEL);
+ save_crtcs = kzalloc(dev->mode_config.num_crtc * sizeof(struct drm_crtc *), GFP_KERNEL);
if (!save_crtcs)
return -ENOMEM;
@@ -617,7 +613,7 @@ int drm_crtc_set_config(struct drm_crtc *crtc, struct drm_mode_crtc *crtc_info,
if (crtc->mode.mode_id != new_mode->mode_id)
changed = true;
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
save_crtcs[count++] = output->crtc;
if (output->crtc == crtc)
@@ -645,7 +641,7 @@ int drm_crtc_set_config(struct drm_crtc *crtc, struct drm_mode_crtc *crtc_info,
crtc_info->y)) {
crtc->enabled = save_enabled;
count = 0;
- list_for_each_entry(output, &dev->crtc_config.output_list, head)
+ list_for_each_entry(output, &dev->mode_config.output_list, head)
output->crtc = save_crtcs[count++];
kfree(save_crtcs);
return -EINVAL;
@@ -700,15 +696,14 @@ int drm_mode_getresources(struct inode *inode, struct file *filp,
int output_count = 0;
int crtc_count = 0;
int copied = 0;
-
+
memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
- list_for_each(lh, &dev->crtc_config.crtc_list)
+ list_for_each(lh, &dev->mode_config.crtc_list)
crtc_count++;
- list_for_each_entry(output, &dev->crtc_config.output_list,
- head)
- {
+ list_for_each_entry(output, &dev->mode_config.output_list,
+ head) {
output_count++;
list_for_each(lh, &output->modes)
mode_count++;
@@ -717,11 +712,21 @@ int drm_mode_getresources(struct inode *inode, struct file *filp,
if (copy_from_user(&card_res, argp, sizeof(card_res)))
return -EFAULT;
+ if (card_res.count_modes == 0) {
+ DRM_DEBUG("probing modes %dx%d\n", dev->mode_config.max_width, dev->mode_config.max_height);
+ drm_crtc_probe_output_modes(dev, dev->mode_config.max_width, dev->mode_config.max_height);
+ mode_count = 0;
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
+ list_for_each(lh, &output->modes)
+ mode_count++;
+ }
+ }
+
/* handle this in 3 parts */
/* CRTCs */
if (card_res.count_crtcs >= crtc_count) {
copied = 0;
- list_for_each_entry(crtc, &dev->crtc_config.crtc_list, head){
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head){
DRM_DEBUG("CRTC ID is %d\n", crtc->id);
if (put_user(crtc->id, &card_res.crtc_id[copied++])) {
retcode = -EFAULT;
@@ -735,7 +740,7 @@ int drm_mode_getresources(struct inode *inode, struct file *filp,
/* Outputs */
if (card_res.count_outputs >= output_count) {
copied = 0;
- list_for_each_entry(output, &dev->crtc_config.output_list,
+ list_for_each_entry(output, &dev->mode_config.output_list,
head) {
DRM_DEBUG("OUTPUT ID is %d\n", output->id);
if (put_user(output->id, &card_res.output_id[copied++])) {
@@ -749,7 +754,7 @@ int drm_mode_getresources(struct inode *inode, struct file *filp,
/* Modes */
if (card_res.count_modes >= mode_count) {
copied = 0;
- list_for_each_entry(output, &dev->crtc_config.output_list,
+ list_for_each_entry(output, &dev->mode_config.output_list,
head) {
list_for_each_entry(mode, &output->modes, head) {
drm_crtc_convert_to_umode(&u_mode, mode);
@@ -788,7 +793,7 @@ int drm_mode_getcrtc(struct inode *inode, struct file *filp,
if (copy_from_user(&crtc_resp, argp, sizeof(crtc_resp)))
return -EFAULT;
- crtc = idr_find(&dev->crtc_config.crtc_idr, crtc_resp.crtc_id);
+ crtc = idr_find(&dev->mode_config.crtc_idr, crtc_resp.crtc_id);
if (!crtc || (crtc->id != crtc_resp.crtc_id))
return -EINVAL;
crtc_resp.x = crtc->x;
@@ -800,7 +805,7 @@ int drm_mode_getcrtc(struct inode *inode, struct file *filp,
crtc_resp.mode = crtc->mode.mode_id;
ocount = 0;
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
if (output->crtc == crtc)
crtc_resp.outputs |= 1 << (ocount++);
}
@@ -830,13 +835,19 @@ int drm_mode_getoutput(struct inode *inode, struct file *filp,
if (copy_from_user(&out_resp, argp, sizeof(out_resp)))
return -EFAULT;
- output= idr_find(&dev->crtc_config.crtc_idr, out_resp.output);
+ DRM_DEBUG("output id %d:\n", out_resp.output);
+ output= idr_find(&dev->mode_config.crtc_idr, out_resp.output);
if (!output || (output->id != out_resp.output))
return -EINVAL;
+ DRM_DEBUG("about to count modes: %s\n", output->name);
list_for_each_entry(mode, &output->modes, head)
mode_count++;
+ DRM_DEBUG("about to count modes %d %d %p\n", mode_count, out_resp.count_modes, output->crtc);
+ strncpy(out_resp.name, output->name, DRM_OUTPUT_NAME_LEN);
+ out_resp.name[DRM_OUTPUT_NAME_LEN-1] = 0;
+
out_resp.mm_width = output->mm_width;
out_resp.mm_height = output->mm_height;
out_resp.subpixel = output->subpixel_order;
@@ -846,7 +857,7 @@ int drm_mode_getoutput(struct inode *inode, struct file *filp,
else
out_resp.crtc = 0;
- if (out_resp.count_modes >= mode_count) {
+ if ((out_resp.count_modes >= mode_count) && mode_count) {
copied = 0;
list_for_each_entry(mode, &output->modes, head) {
if (put_user(mode->mode_id, &out_resp.modes[copied++])) {
@@ -881,22 +892,42 @@ int drm_mode_setcrtc(struct inode *inode, struct file *filp,
if (copy_from_user(&crtc_req, argp, sizeof(crtc_req)))
return -EFAULT;
- crtc = idr_find(&dev->crtc_config.crtc_idr, crtc_req.crtc_id);
+ crtc = idr_find(&dev->mode_config.crtc_idr, crtc_req.crtc_id);
if (!crtc || (crtc->id != crtc_req.crtc_id))
+ {
+ DRM_DEBUG("Unknown CRTC ID %d\n", crtc_req.crtc_id);
return -EINVAL;
+ }
if (crtc_req.mode) {
- mode = idr_find(&dev->crtc_config.crtc_idr, crtc_req.mode);
+ mode = idr_find(&dev->mode_config.crtc_idr, crtc_req.mode);
if (!mode || (mode->mode_id != crtc_req.mode))
+ {
+ {
+ struct drm_output *output;
+
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
+ list_for_each_entry(mode, &output->modes, head) {
+ drm_mode_debug_printmodeline(dev, mode);
+ }
+ }
+ }
+
+ DRM_DEBUG("Unknown mode id %d, %p\n", crtc_req.mode, mode);
return -EINVAL;
+ }
} else
mode = NULL;
- if (crtc_req.count_outputs == 0 && mode)
+ if (crtc_req.count_outputs == 0 && mode) {
+ DRM_DEBUG("Count outputs is 0 but mode set\n");
return -EINVAL;
+ }
- if (crtc_req.count_outputs > 0 && !mode)
+ if (crtc_req.count_outputs > 0 && !mode) {
+ DRM_DEBUG("Count outputs is %d but no mode set\n", crtc_req.count_outputs);
return -EINVAL;
+ }
if (crtc_req.count_outputs > 0) {
u32 out_id;
@@ -904,14 +935,15 @@ int drm_mode_setcrtc(struct inode *inode, struct file *filp,
if (!output_set)
return -ENOMEM;
- for (i = 0; i < crtc_req.count_outputs; i++)
- {
+ for (i = 0; i < crtc_req.count_outputs; i++) {
if (get_user(out_id, &crtc_req.set_outputs[i]))
return -EFAULT;
- output = idr_find(&dev->crtc_config.crtc_idr, out_id);
- if (!output || (out_id != output->id))
+ output = idr_find(&dev->mode_config.crtc_idr, out_id);
+ if (!output || (out_id != output->id)) {
+ DRM_DEBUG("Output id %d unknown\n", out_id);
return -EINVAL;
+ }
output_set[i] = output;
}
@@ -920,3 +952,86 @@ int drm_mode_setcrtc(struct inode *inode, struct file *filp,
retcode = drm_crtc_set_config(crtc, &crtc_req, mode, output_set);
return retcode;
}
+
+/* Add framebuffer ioctl */
+int drm_mode_addfb(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ struct drm_file *priv = filp->private_data;
+ struct drm_device *dev = priv->head->dev;
+ struct drm_mode_fb_cmd __user *argp = (void __user *)arg;
+ struct drm_mode_fb_cmd r;
+ struct drm_mode_config *config = &dev->mode_config;
+ struct drm_framebuffer *fb;
+ struct drm_buffer_object *bo;
+ int ret;
+
+ if (copy_from_user(&r, argp, sizeof(r)))
+ return -EFAULT;
+
+ if ((config->min_width > r.width) || (r.width > config->max_width)) {
+ DRM_ERROR("mode new framebuffer width not within limits\n");
+ return -EINVAL;
+ }
+ if ((config->min_height > r.height) || (r.height > config->max_height)) {
+ DRM_ERROR("mode new framebuffer height not within limits\n");
+ return -EINVAL;
+ }
+
+ /* TODO check limits are okay */
+ ret = drm_get_buffer_object(dev, &bo, r.handle);
+ if (ret || !bo)
+ return -EINVAL;
+
+ /* TODO check buffer is sufficently large */
+ /* TODO setup destructor callback */
+
+ fb = drm_framebuffer_create(dev);
+ if(!fb)
+ return -EINVAL;;
+
+ fb->width = r.width;
+ fb->height = r.height;
+ fb->pitch = r.pitch;
+ fb->bits_per_pixel = r.bpp;
+ fb->offset = bo->offset;
+ fb->bo = bo;
+
+ r.buffer_id = fb->id;
+
+ /* bind the fb to the crtc for now */
+ {
+ struct drm_crtc *crtc;
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+ crtc->fb = fb;
+ }
+ }
+ if (copy_to_user(argp, &r, sizeof(r)))
+ return -EFAULT;
+
+ return 0;
+}
+
+int drm_mode_rmfb(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->head->dev;
+ struct drm_framebuffer *fb = 0;
+ uint32_t id = arg;
+
+ fb = idr_find(&dev->mode_config.crtc_idr, id);
+ /* TODO check that we realy get a framebuffer back. */
+ if (!fb || (id != fb->id)) {
+ DRM_ERROR("mode invalid framebuffer id\n");
+ return -EINVAL;
+ }
+
+ /* TODO check if we own the buffer */
+ /* TODO release all crtc connected to the framebuffer */
+ /* TODO unhock the destructor from the buffer object */
+
+ drm_framebuffer_destroy(fb);
+
+ return 0;
+}
diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h
index 775d21e7..57bfb10b 100644
--- a/linux-core/drm_crtc.h
+++ b/linux-core/drm_crtc.h
@@ -178,6 +178,7 @@ struct drm_framebuffer {
unsigned int depth;
int bits_per_pixel;
int flags;
+ struct drm_buffer_object *bo;
};
struct drm_crtc;
struct drm_output;
@@ -377,7 +378,7 @@ struct drm_output {
};
/**
- * struct drm_crtc_config_funcs - configure CRTCs for a given screen layout
+ * struct drm_mode_config_funcs - configure CRTCs for a given screen layout
* @resize: adjust CRTCs as necessary for the proposed layout
*
* Currently only a resize hook is available. DRM will call back into the
@@ -385,15 +386,15 @@ struct drm_output {
* the proposed size, it can return false. Otherwise it should adjust
* the CRTC<->output mappings as needed and update its view of the screen.
*/
-struct drm_crtc_config_funcs {
+struct drm_mode_config_funcs {
bool (*resize)(struct drm_device *dev, int width, int height);
};
/**
- * drm_crtc_config - CRTC configuration control structure
+ * drm_mode_config - Mode configuration control structure
*
*/
-struct drm_crtc_config {
+struct drm_mode_config {
spinlock_t config_lock;
struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, output, modes - just makes life easier */
/* this is limited to one for now */
@@ -410,7 +411,7 @@ struct drm_crtc_config {
int max_width, max_height;
/* DamagePtr rotationDamage? */
/* DGA stuff? */
- struct drm_crtc_config_funcs *funcs;
+ struct drm_mode_config_funcs *funcs;
};
struct drm_output *drm_output_create(struct drm_device *dev,
@@ -427,23 +428,12 @@ extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
struct drm_display_mode *mode);
extern void drm_mode_debug_printmodeline(struct drm_device *dev,
struct drm_display_mode *mode);
-extern void drm_crtc_config_init(struct drm_device *dev);
-extern void drm_crtc_config_cleanup(struct drm_device *dev);
+extern void drm_mode_config_init(struct drm_device *dev);
+extern void drm_mode_config_cleanup(struct drm_device *dev);
extern void drm_disable_unused_functions(struct drm_device *dev);
extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev);
extern void drm_crtc_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
-
-/* IOCTLs */
-extern int drm_mode_getresources(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-
-extern int drm_mode_getcrtc(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_mode_getoutput(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_mode_setcrtc(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
extern void drm_mode_list_concat(struct list_head *head,
struct list_head *new);
extern void drm_mode_validate_size(struct drm_device *dev,
@@ -461,5 +451,19 @@ extern void drm_framebuffer_set_object(struct drm_device *dev,
unsigned long handle);
extern bool drm_set_desired_modes(struct drm_device *dev);
+/* IOCTLs */
+extern int drm_mode_getresources(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+
+extern int drm_mode_getcrtc(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_getoutput(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_setcrtc(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_addfb(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_rmfb(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
#endif /* __DRM_CRTC_H__ */
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index c8ee054f..80007170 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -127,6 +127,8 @@ static drm_ioctl_desc_t drm_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_MODE_GETCRTC)] = {drm_mode_getcrtc, DRM_MASTER|DRM_ROOT_ONLY},
[DRM_IOCTL_NR(DRM_IOCTL_MODE_GETOUTPUT)] = {drm_mode_getoutput, DRM_MASTER|DRM_ROOT_ONLY},
[DRM_IOCTL_NR(DRM_IOCTL_MODE_SETCRTC)] = {drm_mode_setcrtc, DRM_MASTER|DRM_ROOT_ONLY},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB)] = {drm_mode_addfb, DRM_MASTER|DRM_ROOT_ONLY},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_RMFB)] = {drm_mode_rmfb, DRM_MASTER|DRM_ROOT_ONLY},
};
#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
diff --git a/linux-core/drm_modes.c b/linux-core/drm_modes.c
index bedef163..0f2a612a 100644
--- a/linux-core/drm_modes.c
+++ b/linux-core/drm_modes.c
@@ -36,8 +36,8 @@
void drm_mode_debug_printmodeline(struct drm_device *dev,
struct drm_display_mode *mode)
{
- DRM_DEBUG("Modeline \"%s\" %d %d %d %d %d %d %d %d %d %d\n",
- mode->name, mode->vrefresh / 1000, mode->clock,
+ DRM_DEBUG("Modeline %d:\"%s\" %d %d %d %d %d %d %d %d %d %d\n",
+ mode->mode_id, mode->name, mode->vrefresh / 1000, mode->clock,
mode->hdisplay, mode->hsync_start,
mode->hsync_end, mode->htotal,
mode->vdisplay, mode->vsync_start,
diff --git a/linux-core/intel_display.c b/linux-core/intel_display.c
index 90c894ee..1eed71f0 100644
--- a/linux-core/intel_display.c
+++ b/linux-core/intel_display.c
@@ -222,10 +222,10 @@ static void intel_clock(struct drm_device *dev, int refclk,
bool intel_pipe_has_type (struct drm_crtc *crtc, int type)
{
struct drm_device *dev = crtc->dev;
- struct drm_crtc_config *crtc_config = &dev->crtc_config;
+ struct drm_mode_config *mode_config = &dev->mode_config;
struct drm_output *l_entry;
- list_for_each_entry(l_entry, &crtc_config->output_list, head) {
+ list_for_each_entry(l_entry, &mode_config->output_list, head) {
if (l_entry->crtc == crtc) {
struct intel_output *intel_output = l_entry->driver_private;
if (intel_output->type == type)
@@ -349,9 +349,10 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y)
int dspbase = (pipe == 0 ? DSPABASE : DSPBBASE);
int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF);
- Start = crtc->fb->offset;
+ Start = crtc->fb->offset + dev_priv->baseaddr;
Offset = ((y * crtc->fb->width + x) * (crtc->fb->bits_per_pixel / 8));
+ DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y);
if (IS_I965G(dev)) {
I915_WRITE(dspbase, Offset);
I915_READ(dspbase);
@@ -363,27 +364,22 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y)
}
-#if 0
- drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen);
-
- if (!sPriv)
+ if (!dev_priv->sarea_priv)
return;
switch (pipe) {
- case 0:
- sPriv->pipeA_x = x;
- sPriv->pipeA_y = y;
- break;
+ case 0:
+ dev_priv->sarea_priv->pipeA_x = x;
+ dev_priv->sarea_priv->pipeA_y = y;
+ break;
case 1:
- sPriv->pipeB_x = x;
- sPriv->pipeB_y = y;
+ dev_priv->sarea_priv->pipeB_x = x;
+ dev_priv->sarea_priv->pipeB_y = y;
break;
default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Can't update pipe %d in SAREA\n", pipe);
+ DRM_ERROR("Can't update pipe %d in SAREA\n", pipe);
break;
}
-#endif
}
/**
@@ -403,6 +399,7 @@ static void intel_crtc_dpms(struct drm_crtc *crtc, int mode)
int dspbase_reg = (pipe == 0) ? DSPABASE : DSPBBASE;
int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
u32 temp;
+ bool enabled;
/* XXX: When our outputs are all unaware of DPMS modes other than off
* and on, we should map those modes to DPMSModeOff in the CRTC.
@@ -491,30 +488,25 @@ static void intel_crtc_dpms(struct drm_crtc *crtc, int mode)
break;
}
-#if 0 //TODO
- if (pI830->directRenderingEnabled) {
- drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen);
- Bool enabled = crtc->enabled && mode != DPMSModeOff;
-
- if (!sPriv)
- return;
-
- switch (pipe) {
- case 0:
- sPriv->pipeA_w = enabled ? crtc->mode.HDisplay : 0;
- sPriv->pipeA_h = enabled ? crtc->mode.VDisplay : 0;
- break;
- case 1:
- sPriv->pipeB_w = enabled ? crtc->mode.HDisplay : 0;
- sPriv->pipeB_h = enabled ? crtc->mode.VDisplay : 0;
- break;
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Can't update pipe %d in SAREA\n", pipe);
- break;
- }
+
+ if (!dev_priv->sarea_priv)
+ return;
+
+ enabled = crtc->enabled && mode != DPMSModeOff;
+
+ switch (pipe) {
+ case 0:
+ dev_priv->sarea_priv->pipeA_w = enabled ? crtc->mode.hdisplay : 0;
+ dev_priv->sarea_priv->pipeA_h = enabled ? crtc->mode.vdisplay : 0;
+ break;
+ case 1:
+ dev_priv->sarea_priv->pipeB_w = enabled ? crtc->mode.hdisplay : 0;
+ dev_priv->sarea_priv->pipeB_h = enabled ? crtc->mode.vdisplay : 0;
+ break;
+ default:
+ DRM_ERROR("Can't update pipe %d in SAREA\n", pipe);
+ break;
}
-#endif
}
static bool intel_crtc_lock(struct drm_crtc *crtc)
@@ -580,8 +572,9 @@ static int intel_get_core_clock_speed(drm_device_t *dev)
else if (IS_I945GM(dev) || IS_845G(dev))
return 200000;
else if (IS_I915GM(dev)) {
-#if 0
- u16 gcfgc = pciReadWord(dev->PciTag, I915_GCFGC);
+ u16 gcfgc = 0;
+
+ pci_read_config_word(dev->pdev, I915_GCFGC, &gcfgc);
if (gcfgc & I915_LOW_FREQUENCY_ENABLE)
return 133000;
@@ -594,7 +587,6 @@ static int intel_get_core_clock_speed(drm_device_t *dev)
return 190000;
}
}
-#endif
} else if (IS_I865G(dev))
return 266000;
else if (IS_I855(dev)) {
@@ -679,10 +671,10 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
u32 dpll = 0, fp = 0, dspcntr, pipeconf;
bool ok, is_sdvo = false, is_dvo = false;
bool is_crt = false, is_lvds = false, is_tv = false;
- struct drm_crtc_config *crtc_config = &dev->crtc_config;
+ struct drm_mode_config *mode_config = &dev->mode_config;
struct drm_output *output;
- list_for_each_entry(output, &crtc_config->output_list, head) {
+ list_for_each_entry(output, &mode_config->output_list, head) {
struct intel_output *intel_output = output->driver_private;
if (output->crtc != crtc)
@@ -832,106 +824,102 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
if (intel_panel_fitter_pipe(dev) == pipe)
I915_WRITE(PFIT_CONTROL, 0);
+ DRM_DEBUG("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
+ drm_mode_debug_printmodeline(dev, mode);
+
#if 0
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
- xf86PrintModeline(pScrn->scrnIndex, mode);
- if (!xf86ModesEqual(mode, adjusted_mode)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Adjusted mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
- xf86PrintModeline(pScrn->scrnIndex, mode);
- }
- i830PrintPll("chosen", &clock);
+ if (!xf86ModesEqual(mode, adjusted_mode)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Adjusted mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
+ xf86PrintModeline(pScrn->scrnIndex, mode);
+ }
+ i830PrintPll("chosen", &clock);
#endif
- if (dpll & DPLL_VCO_ENABLE)
- {
+ if (dpll & DPLL_VCO_ENABLE) {
+ I915_WRITE(fp_reg, fp);
+ I915_WRITE(dpll_reg, dpll & ~DPLL_VCO_ENABLE);
+ I915_READ(dpll_reg);
+ udelay(150);
+ }
+
+ /* The LVDS pin pair needs to be on before the DPLLs are enabled.
+ * This is an exception to the general rule that mode_set doesn't turn
+ * things on.
+ */
+ if (is_lvds) {
+ u32 lvds = I915_READ(LVDS);
+
+ lvds |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP | LVDS_PIPEB_SELECT;
+ /* Set the B0-B3 data pairs corresponding to whether we're going to
+ * set the DPLLs for dual-channel mode or not.
+ */
+ if (clock.p2 == 7)
+ lvds |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP;
+ else
+ lvds &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP);
+
+ /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP)
+ * appropriately here, but we need to look more thoroughly into how
+ * panels behave in the two modes.
+ */
+
+ I915_WRITE(LVDS, lvds);
+ I915_READ(LVDS);
+ }
+
I915_WRITE(fp_reg, fp);
- I915_WRITE(dpll_reg, dpll & ~DPLL_VCO_ENABLE);
+ I915_WRITE(dpll_reg, dpll);
I915_READ(dpll_reg);
+ /* Wait for the clocks to stabilize. */
udelay(150);
- }
-
- /* The LVDS pin pair needs to be on before the DPLLs are enabled.
- * This is an exception to the general rule that mode_set doesn't turn
- * things on.
- */
- if (is_lvds)
- {
- u32 lvds = I915_READ(LVDS);
-
- lvds |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP | LVDS_PIPEB_SELECT;
- /* Set the B0-B3 data pairs corresponding to whether we're going to
- * set the DPLLs for dual-channel mode or not.
- */
- if (clock.p2 == 7)
- lvds |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP;
- else
- lvds &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP);
-
- /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP)
- * appropriately here, but we need to look more thoroughly into how
- * panels behave in the two modes.
- */
-
- I915_WRITE(LVDS, lvds);
- I915_READ(LVDS);
- }
-
- I915_WRITE(fp_reg, fp);
- I915_WRITE(dpll_reg, dpll);
- I915_READ(dpll_reg);
- /* Wait for the clocks to stabilize. */
- udelay(150);
-
- if (IS_I965G(dev)) {
- int sdvo_pixel_multiply = adjusted_mode->clock / mode->clock;
- I915_WRITE(dpll_md_reg, (0 << DPLL_MD_UDI_DIVIDER_SHIFT) |
- ((sdvo_pixel_multiply - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT));
- } else {
- /* write it again -- the BIOS does, after all */
- I915_WRITE(dpll_reg, dpll);
- }
- I915_READ(dpll_reg);
- /* Wait for the clocks to stabilize. */
- udelay(150);
-
- I915_WRITE(htot_reg, (adjusted_mode->crtc_hdisplay - 1) |
- ((adjusted_mode->crtc_htotal - 1) << 16));
- I915_WRITE(hblank_reg, (adjusted_mode->crtc_hblank_start - 1) |
- ((adjusted_mode->crtc_hblank_end - 1) << 16));
- I915_WRITE(hsync_reg, (adjusted_mode->crtc_hsync_start - 1) |
- ((adjusted_mode->crtc_hsync_end - 1) << 16));
- I915_WRITE(vtot_reg, (adjusted_mode->crtc_vdisplay - 1) |
- ((adjusted_mode->crtc_vtotal - 1) << 16));
- I915_WRITE(vblank_reg, (adjusted_mode->crtc_vblank_start - 1) |
- ((adjusted_mode->crtc_vblank_end - 1) << 16));
- I915_WRITE(vsync_reg, (adjusted_mode->crtc_vsync_start - 1) |
- ((adjusted_mode->crtc_vsync_end - 1) << 16));
- I915_WRITE(dspstride_reg, crtc->fb->pitch * (crtc->fb->bits_per_pixel / 8));
- /* pipesrc and dspsize control the size that is scaled from, which should
- * always be the user's requested size.
- */
- I915_WRITE(dspsize_reg, ((mode->vdisplay - 1) << 16) | (mode->hdisplay - 1));
- I915_WRITE(dsppos_reg, 0);
- I915_WRITE(pipesrc_reg, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1));
- I915_WRITE(pipeconf_reg, pipeconf);
- I915_READ(pipeconf_reg);
-
- intel_wait_for_vblank(dev);
-
- I915_WRITE(dspcntr_reg, dspcntr);
-
- /* Flush the plane changes */
- intel_pipe_set_base(crtc, x, y);
-
+
+ if (IS_I965G(dev)) {
+ int sdvo_pixel_multiply = adjusted_mode->clock / mode->clock;
+ I915_WRITE(dpll_md_reg, (0 << DPLL_MD_UDI_DIVIDER_SHIFT) |
+ ((sdvo_pixel_multiply - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT));
+ } else {
+ /* write it again -- the BIOS does, after all */
+ I915_WRITE(dpll_reg, dpll);
+ }
+ I915_READ(dpll_reg);
+ /* Wait for the clocks to stabilize. */
+ udelay(150);
+
+ I915_WRITE(htot_reg, (adjusted_mode->crtc_hdisplay - 1) |
+ ((adjusted_mode->crtc_htotal - 1) << 16));
+ I915_WRITE(hblank_reg, (adjusted_mode->crtc_hblank_start - 1) |
+ ((adjusted_mode->crtc_hblank_end - 1) << 16));
+ I915_WRITE(hsync_reg, (adjusted_mode->crtc_hsync_start - 1) |
+ ((adjusted_mode->crtc_hsync_end - 1) << 16));
+ I915_WRITE(vtot_reg, (adjusted_mode->crtc_vdisplay - 1) |
+ ((adjusted_mode->crtc_vtotal - 1) << 16));
+ I915_WRITE(vblank_reg, (adjusted_mode->crtc_vblank_start - 1) |
+ ((adjusted_mode->crtc_vblank_end - 1) << 16));
+ I915_WRITE(vsync_reg, (adjusted_mode->crtc_vsync_start - 1) |
+ ((adjusted_mode->crtc_vsync_end - 1) << 16));
+ I915_WRITE(dspstride_reg, crtc->fb->pitch * (crtc->fb->bits_per_pixel / 8));
+ /* pipesrc and dspsize control the size that is scaled from, which should
+ * always be the user's requested size.
+ */
+ I915_WRITE(dspsize_reg, ((mode->vdisplay - 1) << 16) | (mode->hdisplay - 1));
+ I915_WRITE(dsppos_reg, 0);
+ I915_WRITE(pipesrc_reg, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1));
+ I915_WRITE(pipeconf_reg, pipeconf);
+ I915_READ(pipeconf_reg);
+
+ intel_wait_for_vblank(dev);
+
+ I915_WRITE(dspcntr_reg, dspcntr);
+
+ /* Flush the plane changes */
+ intel_pipe_set_base(crtc, x, y);
+
#ifdef XF86DRI // TODO
// I830DRISetVBlankInterrupt (pScrn, TRUE);
#endif
-
- intel_wait_for_vblank(dev);
-
-
+
+ intel_wait_for_vblank(dev);
}
/** Loads the palette/gamma unit for the CRTC with the prepared values */
@@ -1104,7 +1092,7 @@ void intel_crtc_init(drm_device_t *dev, int pipe)
if (crtc == NULL)
return;
- intel_crtc = kmalloc(sizeof(struct intel_crtc), GFP_KERNEL);
+ intel_crtc = kzalloc(sizeof(struct intel_crtc), GFP_KERNEL);
if (intel_crtc == NULL) {
kfree(crtc);
return;
@@ -1126,7 +1114,7 @@ int intel_output_clones(drm_device_t *dev, int type_mask)
struct drm_output *output;
int entry = 0;
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
struct intel_output *intel_output = output->driver_private;
if (type_mask & (1 << intel_output->type))
index_mask |= (1 << entry);
@@ -1153,7 +1141,7 @@ static void intel_setup_outputs(drm_device_t *dev)
intel_sdvo_init(dev, SDVOC);
}
- list_for_each_entry(output, &dev->crtc_config.output_list, head) {
+ list_for_each_entry(output, &dev->mode_config.output_list, head) {
struct intel_output *intel_output = output->driver_private;
int crtc_mask = 0, clone_mask = 0;
@@ -1193,8 +1181,13 @@ void intel_modeset_init(drm_device_t *dev)
int num_pipe;
int i;
- drm_crtc_config_init(dev);
+ drm_mode_config_init(dev);
+
+ dev->mode_config.min_width = 0;
+ dev->mode_config.min_height = 0;
+ dev->mode_config.max_width = 4096;
+ dev->mode_config.max_height = 4096;
if (IS_MOBILE(dev) || IS_I9XX(dev))
num_pipe = 2;
@@ -1209,11 +1202,11 @@ void intel_modeset_init(drm_device_t *dev)
intel_setup_outputs(dev);
- drm_initial_config(dev, false);
- drm_set_desired_modes(dev);
+ //drm_initial_config(dev, false);
+ //drm_set_desired_modes(dev);
}
void intel_modeset_cleanup(drm_device_t *dev)
{
- drm_crtc_config_cleanup(dev);
+ drm_mode_config_cleanup(dev);
}
diff --git a/linux-core/intel_lvds.c b/linux-core/intel_lvds.c
index 4638fb30..90a26109 100644
--- a/linux-core/intel_lvds.c
+++ b/linux-core/intel_lvds.c
@@ -164,15 +164,15 @@ static bool intel_lvds_mode_fixup(struct drm_output *output,
struct intel_crtc *intel_crtc = output->crtc->driver_private;
struct drm_output *tmp_output;
- spin_lock(&dev->crtc_config.config_lock);
- list_for_each_entry(tmp_output, &dev->crtc_config.output_list, head) {
+ spin_lock(&dev->mode_config.config_lock);
+ list_for_each_entry(tmp_output, &dev->mode_config.output_list, head) {
if (tmp_output != output && tmp_output->crtc == output->crtc) {
printk(KERN_ERR "Can't enable LVDS and another "
"output on the same pipe\n");
return false;
}
}
- spin_lock(&dev->crtc_config.config_lock);
+ spin_lock(&dev->mode_config.config_lock);
if (intel_crtc->pipe == 0) {
printk(KERN_ERR "Can't support LVDS on pipe A\n");
@@ -380,10 +380,10 @@ void intel_lvds_init(struct drm_device *dev)
if (!dev_priv->panel_fixed_mode) {
u32 lvds = I915_READ(LVDS);
int pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0;
- struct drm_crtc_config *crtc_config = &dev->crtc_config;
+ struct drm_mode_config *mode_config = &dev->mode_config;
struct drm_crtc *crtc;
/* FIXME: need drm_crtc_from_pipe */
- //crtc = drm_crtc_from_pipe(crtc_config, pipe);
+ //crtc = drm_crtc_from_pipe(mode_config, pipe);
if (lvds & LVDS_PORT_EN && 0) {
dev_priv->panel_fixed_mode =
diff --git a/linux-core/intel_sdvo.c b/linux-core/intel_sdvo.c
index 0e870d15..1b45afdb 100644
--- a/linux-core/intel_sdvo.c
+++ b/linux-core/intel_sdvo.c
@@ -209,11 +209,30 @@ static void intel_sdvo_write_cmd(struct drm_output *output, u8 cmd,
void *args, int args_len)
{
struct intel_output *intel_output = output->driver_private;
+ struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
int i;
+ if (1) {
+ printk("%s: W: %02X ", SDVO_NAME(sdvo_priv), cmd);
+ for (i = 0; i < args_len; i++)
+ printk("%02X ", ((u8 *)args)[i]);
+ for (; i < 8; i++)
+ printk(" ");
+ for (i = 0; i < sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0]); i++) {
+ if (cmd == sdvo_cmd_names[i].cmd) {
+ printk("(%s)", sdvo_cmd_names[i].name);
+ break;
+ }
+ }
+ if (i == sizeof(sdvo_cmd_names)/ sizeof(sdvo_cmd_names[0]))
+ printk("(%02X)",cmd);
+ printk("\n");
+ }
+
for (i = 0; i < args_len; i++) {
intel_sdvo_write_byte(output, SDVO_I2C_ARG_0 - i, ((u8*)args)[i]);
}
+
intel_sdvo_write_byte(output, SDVO_I2C_OPCODE, cmd);
}
@@ -230,6 +249,8 @@ static const char *cmd_status_names[] = {
static u8 intel_sdvo_read_response(struct drm_output *output, void *response,
int response_len)
{
+ struct intel_output *intel_output = output->driver_private;
+ struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
int i;
u8 status;
@@ -242,6 +263,18 @@ static u8 intel_sdvo_read_response(struct drm_output *output, void *response,
/* read the return status */
intel_sdvo_read_byte(output, SDVO_I2C_CMD_STATUS, &status);
+ if (1) {
+ printk("%s: R: ", SDVO_NAME(sdvo_priv));
+ for (i = 0; i < response_len; i++)
+ printk("%02X ", ((u8 *)response)[i]);
+ for (; i < 8; i++)
+ printk(" ");
+ if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP)
+ printk("(%s)", cmd_status_names[status]);
+ else
+ printk("(??? %d)", status);
+ printk("\n");
+ }
return status;
}
@@ -298,7 +331,7 @@ static bool intel_sdvo_get_trained_inputs(struct drm_output *output, bool *input
*input_1 = response.input0_trained;
*input_2 = response.input1_trained;
- return TRUE;
+ return true;
}
static bool intel_sdvo_get_active_outputs(struct drm_output *output,
@@ -363,13 +396,13 @@ static bool intel_sdvo_get_input_pixel_clock_range(struct drm_output *output,
status = intel_sdvo_read_response(output, &clocks, sizeof(clocks));
if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
+ return false;
/* Convert the values from units of 10 kHz to kHz. */
*clock_min = clocks.min * 10;
*clock_max = clocks.max * 10;
- return TRUE;
+ return true;
}
static bool intel_sdvo_set_target_output(struct drm_output *output,
@@ -393,15 +426,15 @@ static bool intel_sdvo_get_timing(struct drm_output *output, u8 cmd,
status = intel_sdvo_read_response(output, &dtd->part1,
sizeof(dtd->part1));
if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
+ return false;
intel_sdvo_write_cmd(output, cmd + 1, NULL, 0);
status = intel_sdvo_read_response(output, &dtd->part2,
sizeof(dtd->part2));
if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
static bool intel_sdvo_get_input_timing(struct drm_output *output,
@@ -426,14 +459,14 @@ static bool intel_sdvo_set_timing(struct drm_output *output, u8 cmd,
intel_sdvo_write_cmd(output, cmd, &dtd->part1, sizeof(dtd->part1));
status = intel_sdvo_read_response(output, NULL, 0);
if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
+ return false;
intel_sdvo_write_cmd(output, cmd + 1, &dtd->part2, sizeof(dtd->part2));
status = intel_sdvo_read_response(output, NULL, 0);
if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
static bool intel_sdvo_set_input_timing(struct drm_output *output,
@@ -464,16 +497,16 @@ static bool intel_sdvo_get_preferred_input_timing(struct drm_output *output,
status = intel_sdvo_read_response(output, &dtd->part1,
sizeof(dtd->part1));
if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
+ return false;
intel_sdvo_write_cmd(output, SDVO_CMD_GET_PREFERRED_INPUT_TIMING_PART2,
NULL, 0);
status = intel_sdvo_read_response(output, &dtd->part2,
sizeof(dtd->part2));
if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
#endif
@@ -502,9 +535,9 @@ static bool intel_sdvo_set_clock_rate_mult(struct drm_output *output, u8 val)
intel_sdvo_write_cmd(output, SDVO_CMD_SET_CLOCK_RATE_MULT, &val, 1);
status = intel_sdvo_read_response(output, NULL, 0);
if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
static bool intel_sdvo_mode_fixup(struct drm_output *output,
@@ -515,7 +548,7 @@ static bool intel_sdvo_mode_fixup(struct drm_output *output,
* device will be told of the multiplier during mode_set.
*/
adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode);
- return TRUE;
+ return true;
}
static void intel_sdvo_mode_set(struct drm_output *output,
@@ -584,7 +617,7 @@ static void intel_sdvo_mode_set(struct drm_output *output,
intel_sdvo_set_output_timing(output, &output_dtd);
/* Set the input timing to the screen. Assume always input 0. */
- intel_sdvo_set_target_input(output, TRUE, FALSE);
+ intel_sdvo_set_target_input(output, true, false);
/* We would like to use i830_sdvo_create_preferred_input_timing() to
* provide the device with a timing it can support, if it supports that
@@ -620,16 +653,20 @@ static void intel_sdvo_mode_set(struct drm_output *output,
}
/* Set the SDVO control regs. */
- sdvox = I915_READ(sdvo_priv->output_device);
- switch (sdvo_priv->output_device) {
- case SDVOB:
- sdvox &= SDVOB_PRESERVE_MASK;
- break;
- case SDVOC:
- sdvox &= SDVOC_PRESERVE_MASK;
- break;
- }
- sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
+ if (0/*IS_I965GM(dev)*/) {
+ sdvox = SDVO_BORDER_ENABLE;
+ } else {
+ sdvox = I915_READ(sdvo_priv->output_device);
+ switch (sdvo_priv->output_device) {
+ case SDVOB:
+ sdvox &= SDVOB_PRESERVE_MASK;
+ break;
+ case SDVOC:
+ sdvox &= SDVOC_PRESERVE_MASK;
+ break;
+ }
+ sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
+ }
if (intel_crtc->pipe == 1)
sdvox |= SDVO_PIPE_B_SELECT;
@@ -706,13 +743,13 @@ static void intel_sdvo_save(struct drm_output *output)
intel_sdvo_get_active_outputs(output, &sdvo_priv->save_active_outputs);
if (sdvo_priv->caps.sdvo_inputs_mask & 0x1) {
- intel_sdvo_set_target_input(output, TRUE, FALSE);
+ intel_sdvo_set_target_input(output, true, false);
intel_sdvo_get_input_timing(output,
&sdvo_priv->save_input_dtd_1);
}
if (sdvo_priv->caps.sdvo_inputs_mask & 0x2) {
- intel_sdvo_set_target_input(output, FALSE, TRUE);
+ intel_sdvo_set_target_input(output, false, true);
intel_sdvo_get_input_timing(output,
&sdvo_priv->save_input_dtd_2);
}
@@ -754,12 +791,12 @@ static void intel_sdvo_restore(struct drm_output *output)
}
if (sdvo_priv->caps.sdvo_inputs_mask & 0x1) {
- intel_sdvo_set_target_input(output, TRUE, FALSE);
+ intel_sdvo_set_target_input(output, true, false);
intel_sdvo_set_input_timing(output, &sdvo_priv->save_input_dtd_1);
}
if (sdvo_priv->caps.sdvo_inputs_mask & 0x2) {
- intel_sdvo_set_target_input(output, FALSE, TRUE);
+ intel_sdvo_set_target_input(output, false, true);
intel_sdvo_set_input_timing(output, &sdvo_priv->save_input_dtd_2);
}
@@ -805,9 +842,9 @@ static bool intel_sdvo_get_capabilities(struct drm_output *output, struct intel_
intel_sdvo_write_cmd(output, SDVO_CMD_GET_DEVICE_CAPS, NULL, 0);
status = intel_sdvo_read_response(output, caps, sizeof(*caps));
if (status != SDVO_CMD_STATUS_SUCCESS)
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
@@ -980,7 +1017,7 @@ void intel_sdvo_init(drm_device_t *dev, int output_device)
}
else
{
- unsigned char bytes[2];
+ unsigned char bytes[2];
memcpy (bytes, &sdvo_priv->caps.output_flags, 2);
DRM_DEBUG("%s: No active TMDS outputs (0x%02x%02x)\n",
@@ -997,7 +1034,7 @@ void intel_sdvo_init(drm_device_t *dev, int output_device)
/* Set the input timing to the screen. Assume always input 0. */
- intel_sdvo_set_target_input(output, TRUE, FALSE);
+ intel_sdvo_set_target_input(output, true, false);
intel_sdvo_get_input_pixel_clock_range(output,
&sdvo_priv->pixel_clock_min,
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 49bc41bc..f1afc049 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -891,7 +891,7 @@ typedef union drm_mm_init_arg{
/*
* Drm mode setting
*/
-
+#define DRM_OUTPUT_NAME_LEN 32
#define DRM_DISPLAY_MODE_LEN 32
struct drm_mode_modeinfo {
@@ -946,6 +946,7 @@ struct drm_mode_get_output {
unsigned int output; /**< Id */
unsigned int crtc; /**< Id of crtc */
+ unsigned char name[DRM_OUTPUT_NAME_LEN];
unsigned int connection;
unsigned int mm_width, mm_height; /**< HxW in millimeters */
@@ -962,6 +963,14 @@ struct drm_mode_get_output {
};
+struct drm_mode_fb_cmd {
+ unsigned int buffer_id;
+ unsigned int width, height;
+ unsigned int pitch;
+ unsigned int bpp;
+ unsigned int handle;
+};
+
/**
* \name Ioctls Definitions
*/
@@ -1037,6 +1046,8 @@ struct drm_mode_get_output {
#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc)
#define DRM_IOCTL_MODE_GETOUTPUT DRM_IOWR(0xA2, struct drm_mode_get_output)
#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA3, struct drm_mode_crtc)
+#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xA4, struct drm_mode_fb_cmd)
+#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xA5, unsigned int)
/*@}*/
/**
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c
index 0ba3048a..1c8a0d45 100644
--- a/shared-core/i915_dma.c
+++ b/shared-core/i915_dma.c
@@ -171,9 +171,7 @@ static int i915_initialize(drm_device_t * dev,
I915_WRITE(0x02080, dev_priv->dma_status_page);
DRM_DEBUG("Enabled hardware status page\n");
- /* this probably doesn't belong here - TODO */
- drm_framebuffer_set_object(dev, dev_priv->sarea_priv->front_handle);
- drm_set_desired_modes(dev);
+//drm_set_desired_modes(dev);
return 0;
}
diff --git a/shared-core/i915_drv.h b/shared-core/i915_drv.h
index 6e81f6f8..b1bf0469 100644
--- a/shared-core/i915_drv.h
+++ b/shared-core/i915_drv.h
@@ -92,6 +92,7 @@ typedef struct drm_i915_private {
drm_local_map_t *sarea;
drm_local_map_t *mmio_map;
+ unsigned long baseaddr;
unsigned long mmiobase;
unsigned long mmiolen;
diff --git a/shared-core/i915_init.c b/shared-core/i915_init.c
index e03ed429..e454c9fc 100644
--- a/shared-core/i915_init.c
+++ b/shared-core/i915_init.c
@@ -28,9 +28,11 @@ int i915_driver_load(drm_device_t *dev, unsigned long flags)
if (IS_I9XX(dev)) {
dev_priv->mmiobase = drm_get_resource_start(dev, 0);
dev_priv->mmiolen = drm_get_resource_len(dev, 0);
+ dev_priv->baseaddr = drm_get_resource_start(dev, 2) & 0xff000000;
} else if (drm_get_resource_start(dev, 1)) {
dev_priv->mmiobase = drm_get_resource_start(dev, 1);
dev_priv->mmiolen = drm_get_resource_len(dev, 1);
+ dev_priv->baseaddr = drm_get_resource_start(dev, 0) & 0xff000000;
} else {
DRM_ERROR("Unable to find MMIO registers\n");
return -ENODEV;
@@ -66,7 +68,7 @@ int i915_driver_load(drm_device_t *dev, unsigned long flags)
drm_bo_driver_init(dev);
/* this probably doesn't belong here - TODO */
- drm_framebuffer_set_object(dev, dev_priv->sarea_priv->front_handle);
+ //drm_framebuffer_set_object(dev, dev_priv->sarea_priv->front_handle);
intel_modeset_init(dev);
drm_set_desired_modes(dev);