diff options
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/Makefile | 1 | ||||
-rw-r--r-- | linux-core/drmP.h | 4 | ||||
-rw-r--r-- | linux-core/drm_bo.c | 3 | ||||
-rw-r--r-- | linux-core/drm_crtc.c | 55 | ||||
-rw-r--r-- | linux-core/drm_crtc.h | 4 | ||||
-rw-r--r-- | linux-core/drm_drv.c | 42 | ||||
-rw-r--r-- | linux-core/drm_fb.c | 4 | ||||
-rw-r--r-- | linux-core/drm_fence.c | 26 | ||||
-rw-r--r-- | linux-core/drm_memory.c | 2 | ||||
-rw-r--r-- | linux-core/drm_objects.h | 9 | ||||
-rw-r--r-- | linux-core/drm_os_linux.h | 18 | ||||
-rw-r--r-- | linux-core/drm_vm.c | 5 | ||||
-rw-r--r-- | linux-core/intel_drv.h | 4 | ||||
-rw-r--r-- | linux-core/intel_fb.c | 44 | ||||
-rw-r--r-- | linux-core/intel_sdvo.c | 24 |
15 files changed, 136 insertions, 109 deletions
diff --git a/linux-core/Makefile b/linux-core/Makefile index af29bd6a..1758777c 100644 --- a/linux-core/Makefile +++ b/linux-core/Makefile @@ -283,6 +283,7 @@ CONFIG_DRM_SAVAGE := n CONFIG_DRM_VIA := n CONFIG_DRM_MACH64 := n CONFIG_DRM_NV := n +CONFIG_DRM_NOUVEAU := n # Enable module builds for the modules requested/supported. diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 380570bc..4e36dab1 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1139,6 +1139,10 @@ extern drm_head_t **drm_heads; extern struct drm_sysfs_class *drm_class; extern struct proc_dir_entry *drm_proc_root; +extern drm_local_map_t *drm_getsarea(struct drm_device *dev); +extern int drm_wait_on(drm_device_t *dev, wait_queue_head_t *queue, + int timeout, int (*fn)(drm_device_t *dev, void *priv), + void *priv); /* Proc support (drm_proc.h) */ extern int drm_proc_init(drm_device_t * dev, int minor, diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 27016d8c..50f62dce 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -2309,6 +2309,9 @@ void drm_bo_unmap_virtual(drm_buffer_object_t * bo) loff_t offset = ((loff_t) bo->map_list.hash.key) << PAGE_SHIFT; loff_t holelen = ((loff_t) bo->mem.num_pages) << PAGE_SHIFT; + if (!dev->dev_mapping) + return; + unmap_mapping_range(dev->dev_mapping, offset, holelen, 1); } diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index e5a4b32b..245fe5be 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -170,6 +170,7 @@ void drm_framebuffer_destroy(struct drm_framebuffer *fb) kfree(fb); } +EXPORT_SYMBOL(drm_framebuffer_destroy); /** * drm_crtc_create - create a new CRTC object @@ -790,10 +791,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) { @@ -857,12 +856,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 = false; spin_lock(&dev->mode_config.config_lock); @@ -877,48 +871,10 @@ 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"); - ret = true; - goto out; - } - 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); -out: spin_unlock(&dev->mode_config.config_lock); return ret; } @@ -946,10 +902,6 @@ void drm_mode_config_cleanup(drm_device_t *dev) drm_output_destroy(output); } - list_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) { - drm_crtc_destroy(crtc); - } - list_for_each_entry_safe(mode, mt, &dev->mode_config.usermode_list, head) { drm_mode_destroy(dev, mode); } @@ -964,6 +916,11 @@ void drm_mode_config_cleanup(drm_device_t *dev) } drm_framebuffer_destroy(fb); } + + list_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) { + drm_crtc_destroy(crtc); + } + } EXPORT_SYMBOL(drm_mode_config_cleanup); diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h index 7ca8311b..e8a527b0 100644 --- a/linux-core/drm_crtc.h +++ b/linux-core/drm_crtc.h @@ -520,8 +520,12 @@ extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev); extern bool drm_initial_config(struct drm_device *dev, bool cangrow); extern void drm_framebuffer_set_object(struct drm_device *dev, unsigned long handle); +extern struct drm_framebuffer *drm_framebuffer_create(struct drm_device *dev); +extern void drm_framebuffer_destroy(struct drm_framebuffer *fb); extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc); extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb); +extern bool drm_crtc_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode, + int x, int y); /* IOCTLs */ extern int drm_mode_getresources(struct inode *inode, struct file *filp, diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index dc52f302..76fb90c9 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -632,3 +632,45 @@ err_i1: return retcode; } EXPORT_SYMBOL(drm_ioctl); + +int drm_wait_on(drm_device_t *dev, wait_queue_head_t *queue, int timeout, + int (*fn)(drm_device_t *dev, void *priv), void *priv) +{ + DECLARE_WAITQUEUE(entry, current); + unsigned long end = jiffies + (timeout); + int ret = 0; + add_wait_queue(queue, &entry); + + for (;;) { + __set_current_state(TASK_INTERRUPTIBLE); + if ((*fn)(dev, priv)) + break; + if (time_after_eq(jiffies, end)) { + ret = -EBUSY; + break; + } + schedule_timeout((HZ/100 > 1) ? HZ/100 : 1); + if (signal_pending(current)) { + ret = -EINTR; + break; + } + } + __set_current_state(TASK_RUNNING); + remove_wait_queue(queue, &entry); + return ret; +} +EXPORT_SYMBOL(drm_wait_on); + +drm_local_map_t *drm_getsarea(struct drm_device *dev) +{ + drm_map_list_t *entry; + + list_for_each_entry(entry, &dev->maplist->head, head) { + if (entry->map && entry->map->type == _DRM_SHM && + (entry->map->flags & _DRM_CONTAINS_LOCK)) { + return entry->map; + } + } + return NULL; +} +EXPORT_SYMBOL(drm_getsarea); diff --git a/linux-core/drm_fb.c b/linux-core/drm_fb.c index 7a105d59..775fd180 100644 --- a/linux-core/drm_fb.c +++ b/linux-core/drm_fb.c @@ -259,6 +259,7 @@ static int drmfb_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)) @@ -418,9 +419,10 @@ int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc) } EXPORT_SYMBOL(drmfb_probe); -int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb) +int drmfb_remove(struct drm_device *dev, struct drm_crtc *crtc) { struct fb_info *info = fb->fbdev; + struct drm_framebuffer *fb = crtc->fb; if (info) { drm_mem_reg_iounmap(dev, &fb->bo->mem, fb->virtual_base); diff --git a/linux-core/drm_fence.c b/linux-core/drm_fence.c index 088c50d6..ce161dc3 100644 --- a/linux-core/drm_fence.c +++ b/linux-core/drm_fence.c @@ -1,8 +1,8 @@ /************************************************************************** - * + * * Copyright (c) 2006-2007 Tungsten Graphics, Inc., Cedar Park, TX., USA * All Rights Reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -10,17 +10,17 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ @@ -49,8 +49,6 @@ void drm_fence_handler(drm_device_t * dev, uint32_t class, int is_exe = (type & DRM_FENCE_TYPE_EXE); int ge_last_exe; - - diff = (sequence - fc->exe_flush_sequence) & driver->sequence_mask; if (fc->pending_exe_flush && is_exe && diff < driver->wrap_diff) @@ -59,13 +57,13 @@ void drm_fence_handler(drm_device_t * dev, uint32_t class, diff = (sequence - fc->last_exe_flush) & driver->sequence_mask; ge_last_exe = diff < driver->wrap_diff; - if (ge_last_exe) + if (ge_last_exe) fc->pending_flush &= ~type; if (is_exe && ge_last_exe) { fc->last_exe_flush = sequence; } - + if (list_empty(&fc->ring)) return; @@ -107,9 +105,8 @@ void drm_fence_handler(drm_device_t * dev, uint32_t class, fence->base.hash.key); list_del_init(&fence->ring); } - } - + if (wake) { DRM_WAKEUP(&fc->fence_queue); } @@ -266,7 +263,7 @@ void drm_fence_flush_old(drm_device_t * dev, uint32_t class, uint32_t sequence) fc->exe_flush_sequence = sequence - (driver->flush_diff / 2); } write_unlock_irqrestore(&fm->lock, flags); - + mutex_lock(&dev->struct_mutex); read_lock_irqsave(&fm->lock, flags); @@ -413,7 +410,7 @@ int drm_fence_object_emit(drm_device_t * dev, drm_fence_object_t * fence, fence->signaled = 0x00; fence->sequence = sequence; fence->native_type = native_type; - if (list_empty(&fc->ring)) + if (list_empty(&fc->ring)) fc->last_exe_flush = sequence - 1; list_add_tail(&fence->ring, &fc->ring); write_unlock_irqrestore(&fm->lock, flags); @@ -498,7 +495,6 @@ void drm_fence_manager_init(drm_device_t * dev) drm_fence_driver_t *fed = dev->driver->fence_driver; int i; - rwlock_init(&fm->lock); write_lock(&fm->lock); fm->initialized = 0; diff --git a/linux-core/drm_memory.c b/linux-core/drm_memory.c index 86c869f1..759e1f15 100644 --- a/linux-core/drm_memory.c +++ b/linux-core/drm_memory.c @@ -47,7 +47,7 @@ static struct { static inline size_t drm_size_align(size_t size) { - register size_t tmpSize = 4; + size_t tmpSize = 4; if (size > PAGE_SIZE) return PAGE_ALIGN(size); diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h index 0c7f2e32..b6754453 100644 --- a/linux-core/drm_objects.h +++ b/linux-core/drm_objects.h @@ -29,8 +29,7 @@ */ #ifndef _DRM_OBJECTS_H -#define _DRM_OJBECTS_H -#define DRM_HAS_TTM +#define _DRM_OBJECTS_H struct drm_device; @@ -248,9 +247,9 @@ typedef struct drm_ttm_backend_func { typedef struct drm_ttm_backend { - uint32_t flags; - int mem_type; - drm_ttm_backend_func_t *func; + uint32_t flags; + int mem_type; + drm_ttm_backend_func_t *func; } drm_ttm_backend_t; typedef struct drm_ttm { diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h index 816959e8..2ea105c5 100644 --- a/linux-core/drm_os_linux.h +++ b/linux-core/drm_os_linux.h @@ -119,24 +119,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size) #define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data -/** - * Get the pointer to the SAREA. - * - * Searches the SAREA on the mapping lists and points drm_device::sarea to it. - */ -#define DRM_GETSAREA() \ -do { \ - drm_map_list_t *entry; \ - list_for_each_entry( entry, &dev->maplist->head, head ) { \ - if ( entry->map && \ - entry->map->type == _DRM_SHM && \ - (entry->map->flags & _DRM_CONTAINS_LOCK) ) { \ - dev_priv->sarea = entry->map; \ - break; \ - } \ - } \ -} while (0) - #define DRM_HZ HZ #define DRM_WAIT_ON( ret, queue, timeout, condition ) \ diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index 1f905fba..b8871539 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -516,8 +516,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) return -EINVAL; } - if (!capable(CAP_SYS_ADMIN) && - (dma->flags & _DRM_DMA_USE_PCI_RO)) { + if (!capable(CAP_SYS_ADMIN) && (dma->flags & _DRM_DMA_USE_PCI_RO)) { vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE); #if defined(__i386__) || defined(__x86_64__) pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW; @@ -739,7 +738,7 @@ static unsigned long drm_bo_vm_nopfn(struct vm_area_struct *vma, unsigned long bus_base; unsigned long bus_offset; unsigned long bus_size; - int ret = NOPFN_REFAULT; + unsigned long ret = NOPFN_REFAULT; if (address > vma->vm_end) return NOPFN_SIGBUS; diff --git a/linux-core/intel_drv.h b/linux-core/intel_drv.h index 9205b99b..0a03e37b 100644 --- a/linux-core/intel_drv.h +++ b/linux-core/intel_drv.h @@ -76,7 +76,7 @@ extern struct drm_display_mode *intel_crtc_mode_get(drm_device_t *dev, extern void intel_wait_for_vblank(drm_device_t *dev); extern struct drm_crtc *intel_get_crtc_from_pipe(drm_device_t *dev, int pipe); -extern int intelfb_probe(struct drm_device *dev, struct drm_framebuffer *fb); -extern int intelfb_remove(struct drm_device *dev, struct drm_framebuffer *fb); +extern int intelfb_probe(struct drm_device *dev, struct drm_crtc *crtc); +extern int intelfb_remove(struct drm_device *dev, struct drm_crtc *crtc); #endif /* __INTEL_DRV_H__ */ 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; diff --git a/linux-core/intel_sdvo.c b/linux-core/intel_sdvo.c index c02fd958..196298ff 100644 --- a/linux-core/intel_sdvo.c +++ b/linux-core/intel_sdvo.c @@ -213,20 +213,20 @@ static void intel_sdvo_write_cmd(struct drm_output *output, u8 cmd, int i; if (1) { - printk("%s: W: %02X ", SDVO_NAME(sdvo_priv), cmd); + DRM_DEBUG("%s: W: %02X ", SDVO_NAME(sdvo_priv), cmd); for (i = 0; i < args_len; i++) - printk("%02X ", ((u8 *)args)[i]); + DRM_DEBUG("%02X ", ((u8 *)args)[i]); for (; i < 8; i++) - printk(" "); + DRM_DEBUG(" "); 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); + DRM_DEBUG("(%s)", sdvo_cmd_names[i].name); break; } } if (i == sizeof(sdvo_cmd_names)/ sizeof(sdvo_cmd_names[0])) - printk("(%02X)",cmd); - printk("\n"); + DRM_DEBUG("(%02X)",cmd); + DRM_DEBUG("\n"); } for (i = 0; i < args_len; i++) { @@ -266,16 +266,16 @@ static u8 intel_sdvo_read_response(struct drm_output *output, void *response, intel_sdvo_read_byte(output, SDVO_I2C_CMD_STATUS, &status); if (1) { - printk("%s: R: ", SDVO_NAME(sdvo_priv)); + DRM_DEBUG("%s: R: ", SDVO_NAME(sdvo_priv)); for (i = 0; i < response_len; i++) - printk("%02X ", ((u8 *)response)[i]); + DRM_DEBUG("%02X ", ((u8 *)response)[i]); for (; i < 8; i++) - printk(" "); + DRM_DEBUG(" "); if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP) - printk("(%s)", cmd_status_names[status]); + DRM_DEBUG("(%s)", cmd_status_names[status]); else - printk("(??? %d)", status); - printk("\n"); + DRM_DEBUG("(??? %d)", status); + DRM_DEBUG("\n"); } if (status != SDVO_CMD_STATUS_PENDING) |