Skip to content

Commit f7ea4a4

Browse files
committed
Merge branch 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (44 commits) drm/i915: fix ioremap of a user address for non-root (CVE-2008-3831) drm: make CONFIG_DRM depend on CONFIG_SHMEM. radeon: fix PCI bus mastering support enables. radeon: add RS400 family support. drm/radeon: add support for RS740 IGP chipsets. i915: GM45 has GM965-style MCH setup. i915: Don't run retire work handler while suspended i915: Map status page cached for chips with GTT-based HWS location. i915: Fix up ring initialization to cover G45 oddities i915: Use non-reserved status page index for breadcrumb drm: Increment dev_priv->irq_received so i915_gem_interrupts count works. drm: kill drm_device->irq drm: wbinvd is cache coherent. i915: add missing return in error path. i915: fixup permissions on gem ioctls. drm: Clean up many sparse warnings in i915. drm: Use ioremap_wc in i915_driver instead of ioremap, since we always want WC. drm: G33-class hardware has a newer 965-style MCH (no DCC register). drm: Avoid oops in GEM execbuffers with bad arguments. DRM: Return -EBADF on bad object in flink, and return curent name if it exists. ...
2 parents 5564da7 + 4b40893 commit f7ea4a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+8814
-1964
lines changed

arch/x86/mm/highmem_32.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
137137

138138
return (void*) vaddr;
139139
}
140+
EXPORT_SYMBOL_GPL(kmap_atomic_pfn); /* temporarily in use by i915 GEM until vmap */
140141

141142
struct page *kmap_atomic_to_page(void *ptr)
142143
{

drivers/gpu/drm/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
menuconfig DRM
88
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
9-
depends on (AGP || AGP=n) && PCI && !EMULATED_CMPXCHG
9+
depends on (AGP || AGP=n) && PCI && !EMULATED_CMPXCHG && SHMEM
1010
help
1111
Kernel-level support for the Direct Rendering Infrastructure (DRI)
1212
introduced in XFree86 4.0. If you say Y here, you need to select
@@ -87,6 +87,7 @@ config DRM_MGA
8787
config DRM_SIS
8888
tristate "SiS video cards"
8989
depends on DRM && AGP
90+
depends on FB_SIS || FB_SIS=n
9091
help
9192
Choose this option if you have a SiS 630 or compatible video
9293
chipset. If M is selected the module will be called sis. AGP

drivers/gpu/drm/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
ccflags-y := -Iinclude/drm
66

7-
drm-y := drm_auth.o drm_bufs.o drm_context.o drm_dma.o drm_drawable.o \
8-
drm_drv.o drm_fops.o drm_ioctl.o drm_irq.o \
7+
drm-y := drm_auth.o drm_bufs.o drm_cache.o \
8+
drm_context.o drm_dma.o drm_drawable.o \
9+
drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
910
drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
1011
drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
1112
drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o

drivers/gpu/drm/drm_agpsupport.c

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include "drmP.h"
3535
#include <linux/module.h>
36+
#include <asm/agp.h>
3637

3738
#if __OS_HAS_AGP
3839

@@ -452,4 +453,53 @@ int drm_agp_unbind_memory(DRM_AGP_MEM * handle)
452453
return agp_unbind_memory(handle);
453454
}
454455

455-
#endif /* __OS_HAS_AGP */
456+
/**
457+
* Binds a collection of pages into AGP memory at the given offset, returning
458+
* the AGP memory structure containing them.
459+
*
460+
* No reference is held on the pages during this time -- it is up to the
461+
* caller to handle that.
462+
*/
463+
DRM_AGP_MEM *
464+
drm_agp_bind_pages(struct drm_device *dev,
465+
struct page **pages,
466+
unsigned long num_pages,
467+
uint32_t gtt_offset,
468+
u32 type)
469+
{
470+
DRM_AGP_MEM *mem;
471+
int ret, i;
472+
473+
DRM_DEBUG("\n");
474+
475+
mem = drm_agp_allocate_memory(dev->agp->bridge, num_pages,
476+
type);
477+
if (mem == NULL) {
478+
DRM_ERROR("Failed to allocate memory for %ld pages\n",
479+
num_pages);
480+
return NULL;
481+
}
482+
483+
for (i = 0; i < num_pages; i++)
484+
mem->memory[i] = phys_to_gart(page_to_phys(pages[i]));
485+
mem->page_count = num_pages;
486+
487+
mem->is_flushed = true;
488+
ret = drm_agp_bind_memory(mem, gtt_offset / PAGE_SIZE);
489+
if (ret != 0) {
490+
DRM_ERROR("Failed to bind AGP memory: %d\n", ret);
491+
agp_free_memory(mem);
492+
return NULL;
493+
}
494+
495+
return mem;
496+
}
497+
EXPORT_SYMBOL(drm_agp_bind_pages);
498+
499+
void drm_agp_chipset_flush(struct drm_device *dev)
500+
{
501+
agp_flush_chipset(dev->agp->bridge);
502+
}
503+
EXPORT_SYMBOL(drm_agp_chipset_flush);
504+
505+
#endif /* __OS_HAS_AGP */

drivers/gpu/drm/drm_cache.c

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**************************************************************************
2+
*
3+
* Copyright (c) 2006-2007 Tungsten Graphics, Inc., Cedar Park, TX., USA
4+
* All Rights Reserved.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a
7+
* copy of this software and associated documentation files (the
8+
* "Software"), to deal in the Software without restriction, including
9+
* without limitation the rights to use, copy, modify, merge, publish,
10+
* distribute, sub license, and/or sell copies of the Software, and to
11+
* permit persons to whom the Software is furnished to do so, subject to
12+
* the following conditions:
13+
*
14+
* The above copyright notice and this permission notice (including the
15+
* next paragraph) shall be included in all copies or substantial portions
16+
* of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21+
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24+
* USE OR OTHER DEALINGS IN THE SOFTWARE.
25+
*
26+
**************************************************************************/
27+
/*
28+
* Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
29+
*/
30+
31+
#include "drmP.h"
32+
33+
#if defined(CONFIG_X86)
34+
static void
35+
drm_clflush_page(struct page *page)
36+
{
37+
uint8_t *page_virtual;
38+
unsigned int i;
39+
40+
if (unlikely(page == NULL))
41+
return;
42+
43+
page_virtual = kmap_atomic(page, KM_USER0);
44+
for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size)
45+
clflush(page_virtual + i);
46+
kunmap_atomic(page_virtual, KM_USER0);
47+
}
48+
#endif
49+
50+
void
51+
drm_clflush_pages(struct page *pages[], unsigned long num_pages)
52+
{
53+
54+
#if defined(CONFIG_X86)
55+
if (cpu_has_clflush) {
56+
unsigned long i;
57+
58+
mb();
59+
for (i = 0; i < num_pages; ++i)
60+
drm_clflush_page(*pages++);
61+
mb();
62+
63+
return;
64+
}
65+
66+
wbinvd();
67+
#endif
68+
}
69+
EXPORT_SYMBOL(drm_clflush_pages);

drivers/gpu/drm/drm_drv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ static struct drm_ioctl_desc drm_ioctls[] = {
116116

117117
DRM_IOCTL_DEF(DRM_IOCTL_WAIT_VBLANK, drm_wait_vblank, 0),
118118

119+
DRM_IOCTL_DEF(DRM_IOCTL_MODESET_CTL, drm_modeset_ctl, 0),
120+
119121
DRM_IOCTL_DEF(DRM_IOCTL_UPDATE_DRAW, drm_update_drawable_info, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
122+
123+
DRM_IOCTL_DEF(DRM_IOCTL_GEM_CLOSE, drm_gem_close_ioctl, 0),
124+
DRM_IOCTL_DEF(DRM_IOCTL_GEM_FLINK, drm_gem_flink_ioctl, DRM_AUTH),
125+
DRM_IOCTL_DEF(DRM_IOCTL_GEM_OPEN, drm_gem_open_ioctl, DRM_AUTH),
120126
};
121127

122128
#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )

drivers/gpu/drm/drm_fops.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
246246
memset(priv, 0, sizeof(*priv));
247247
filp->private_data = priv;
248248
priv->filp = filp;
249-
priv->uid = current->euid;
249+
priv->uid = current_euid();
250250
priv->pid = task_pid_nr(current);
251251
priv->minor = idr_find(&drm_minors_idr, minor_id);
252252
priv->ioctl_count = 0;
@@ -256,6 +256,9 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
256256

257257
INIT_LIST_HEAD(&priv->lhead);
258258

259+
if (dev->driver->driver_features & DRIVER_GEM)
260+
drm_gem_open(dev, priv);
261+
259262
if (dev->driver->open) {
260263
ret = dev->driver->open(dev, priv);
261264
if (ret < 0)
@@ -400,6 +403,9 @@ int drm_release(struct inode *inode, struct file *filp)
400403
dev->driver->reclaim_buffers(dev, file_priv);
401404
}
402405

406+
if (dev->driver->driver_features & DRIVER_GEM)
407+
drm_gem_release(dev, file_priv);
408+
403409
drm_fasync(-1, filp, 0);
404410

405411
mutex_lock(&dev->ctxlist_mutex);

0 commit comments

Comments
 (0)