summaryrefslogtreecommitdiff
path: root/linux-core/drm_crtc.c
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@fairlite.demon.co.uk>2007-05-18 14:16:10 +0100
committerAlan Hourihane <alanh@fairlite.demon.co.uk>2007-05-18 14:16:10 +0100
commit0c33a2cd2ec81478403d39b1b92aaa4431e7cf0a (patch)
treeb452501935a7e2247bfc01188edba04a4efa31f8 /linux-core/drm_crtc.c
parent3851600b3450697e20286b1937f3e51397f1965a (diff)
Move fbo creation to the specified fb driver which gives
it a chance to allocate the memory from whichever buffer it wants to.
Diffstat (limited to 'linux-core/drm_crtc.c')
-rw-r--r--linux-core/drm_crtc.c45
1 files changed, 1 insertions, 44 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index 7544eac4..1586eb1a 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -184,6 +184,7 @@ void drm_framebuffer_destroy(struct drm_framebuffer *fb)
kfree(fb);
}
+EXPORT_SYMBOL(drm_framebuffer_destroy);
/**
* drm_crtc_create - create a new CRTC object
@@ -820,10 +821,8 @@ static void drm_pick_crtcs (drm_device_t *dev)
break;
}
-
/* No preferred mode, let's select another which should pick
* the default 640x480 if nothing else is here.
- *
*/
if (!des_mode || !(des_mode->flags & DRM_MODE_TYPE_PREFERRED)) {
list_for_each_entry(des_mode, &output->modes, head) {
@@ -887,13 +886,7 @@ clone:
*/
bool drm_initial_config(drm_device_t *dev, bool can_grow)
{
- /* do a hardcoded initial configuration here */
- struct drm_display_mode *des_mode = NULL;
struct drm_output *output;
- struct drm_framebuffer *fb;
- drm_buffer_object_t *fbo;
- unsigned long size, bytes_per_pixel;
- int ret;
drm_crtc_probe_output_modes(dev, 2048, 2048);
@@ -905,42 +898,6 @@ bool drm_initial_config(drm_device_t *dev, bool can_grow)
if (!output->crtc || !output->crtc->desired_mode)
continue;
- fb = drm_framebuffer_create(dev);
- if (!fb) {
- DRM_ERROR("failed to allocate fb.\n");
- return true;
- }
- output->crtc->fb = fb;
- des_mode = output->crtc->desired_mode;
-
- if (des_mode->hdisplay > fb->width)
- fb->width = des_mode->hdisplay;
- if (des_mode->vdisplay > fb->height)
- fb->height = des_mode->vdisplay;
-
- /* FIXME: multiple depths */
- bytes_per_pixel = 4;
- fb->bits_per_pixel = 32;
- fb->pitch = fb->width * ((fb->bits_per_pixel + 1) / 8);
- fb->depth = 24;
- size = fb->width * fb->height * bytes_per_pixel;
- /* FIXME - what about resizeable objects ??? */
- ret = drm_buffer_object_create(dev, size, drm_bo_type_kernel,
- DRM_BO_FLAG_READ |
- DRM_BO_FLAG_WRITE |
- DRM_BO_FLAG_MEM_PRIV0 |
- DRM_BO_FLAG_NO_MOVE,
- 0, 0, 0,
- &fbo);
- if (ret) {
- printk(KERN_ERR "failed to allocate framebuffer\n");
- drm_framebuffer_destroy(fb);
- continue;
- }
- fb->offset = fbo->offset;
- fb->bo = fbo;
- printk("allocated %dx%d fb: 0x%08lx, bo %p\n", fb->width,
- fb->height, fbo->offset, fbo);
dev->driver->fb_probe(dev, output->crtc);
}
drm_disable_unused_functions(dev);