Commit Graph

157026 Commits (559ee21d261a54c42594ef9405d27e9008eedf44)

Author SHA1 Message Date
Zhao Yakui 559ee21d26 drm/kms: try to find the std mode in DMT table
When we need to add the standard timing mode, we will firstly check whether it
can be found in DMT table by comparing the hdisplay/vdisplay/vfresh_rate.
If it can't be found, then we will use the cvt/gtf to add the required mode.
If it can be found, it will be returned.

At the same time the function of drm_mode_vrefresh is also fixed. It will
return the result of actual refresh_rate plus 0.5.
For example:
When the calculated value is 84.9, then the fresh_rate is 85.
When the calculated value is 70.02, then the fresh_rate is 70.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 16:04:15 +10:00
Zhao Yakui aa9eaa1f09 drm/kms: Add the default mode table
When we add a standard timing mode in UMS, we will first check whether it can
be found in default mode table. If it can't be found, then we will use cvt/gtf
to add the standard timing mode.
Add the default mode table so that we can check whether the given mode
can be found in the default mode table as what we have done in UMS mode.

If the status of one output device is connected but there is no EDID, it will
have no correct mode. In such case we can add some default modes for it. Of
course we only add the modes in the default modes list that visible part is not
greater than 1024x768.

The default mode is autogenerated from the DMT spec. And it is copied from
xserver/hw/xfree86/modes/xf86EdidModes.c. But the mode with reduced blank
feature is removed.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 16:03:35 +10:00
Dave Airlie 13a8195b14 drm: split crtc/fb helpers into a separate module
I really don't want to have core drm module rely on CONFIG_FB,
so this is the easiest answer.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 15:45:33 +10:00
Dave Airlie adf551bb25 drm/radeon/kms: add updated registers from drm-fixes.
Fixes up the DISCARD + 2 sided stencil in the new generator scripts.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 13:49:07 +10:00
Dave Airlie a498b8210f drm/radeon/kms: block depthxy offset from use from userspace.
This could be used to bypass CS checks.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 13:48:11 +10:00
Maarten Maathuis ff6fdbed8f drm/crtc_helper: avoid NULL-pointer dereference when encoder is NULL
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-02 16:28:56 +10:00
Dave Airlie 9c552dd793 drm/crtc: fix mismerge of last patch.
We only want to NULL encoder->crtc when it is off.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-02 14:00:11 +10:00
Dave Airlie a3a0544b2c drm/kms: add explicit encoder disable function and detach harder.
For shared tv-out and VGA encoders, we really need to know if
the encoder is just being switched off temporarily in blanking
or if we are really disabling it hard.

Also we need to try harder to disconnect encoders from unused
connectors so we can share more efficently.

(shared encoders stuff is coming in radeon tv-out support)

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-02 09:42:59 +10:00
Dave Airlie ed017d9fb1 drm: fix drm_cache.c for arch with no support.
This produces a warn on for architectures where this gets called
but we don't have a cache flushing implementation suitable.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-02 09:41:13 +10:00
Dave Airlie fa8a123855 drm/mm: add ability to dump mm lists via debugfs
This adds code to the drm_mm to talk to debugfs, and adds
support to radeon to add the VRAM and GTT mm lists to debugfs.

I tested with spinlock debugging and it doesn't give out.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-02 09:39:43 +10:00
Dave Airlie 3420e74262 drm: fix two issues with fb consolidation.
Set accel to none, we really don't want anyone thinking
fb is an accel interface.
Pass pitch not depth to function for intel.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 10:33:29 +10:00
Alexey Dobriyan 3b51096f95 drm: use proc_create_data()
airlied: fixup race against drm info by filling out
tmp before adding it to proc.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:37:22 +10:00
Zhao Yakui 882f021951 drm/kms: Parse the detailed time info in CEA-EDID
Sometimes we can obtain the EDID with multiple blocks from the display device.
For example: HDMI monitor.
When the CEA-EDID block is detected, we should also parse the detailed timing
info from it. Otherwise we will lose some modes for the display device.

The first step is check whether the CEA EDID block is found. If it exists,
it will skip the CEA-data block and parse the detailed timing info.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:22:43 +10:00
Dave Airlie 785b93ef8c drm/kms: move driver specific fb common code to helper functions (v2)
Initially I always meant this code to be shared, but things
ran away from me before I got to it.

This refactors the i915 and radeon kms fbdev interaction layers
out into generic helpers + driver specific pieces.

It moves all the panic/sysrq enhancements to the core file,
and stores a linked list of kernel fbs. This could possibly be
improved to only store the fb which has fbcon on it for panics
etc.

radeon retains some specific codes used for a big endian
workaround.

changes:
fix oops in v1
fix freeing path for crtc_info

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:31 +10:00
Ben Hutchings 7dc482dfee drm/r128: Add test for initialisation to all ioctls that require it
Almost all r128's private ioctls require that the CCE state has
already been initialised.  However, most do not test that this has
been done, and will proceed to dereference a null pointer.  This may
result in a security vulnerability, since some ioctls are
unprivileged.

This adds a macro for the common initialisation test and changes all
ioctl implementations that require prior initialisation to use that
macro.

Also, r128_do_init_cce() does not test that the CCE state has not
been initialised already.  Repeated initialisation may lead to a crash
or resource leak.  This adds that test.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:30 +10:00
Ben Hutchings 70967ab9c0 radeon: Use request_firmware()
Loosely based on a patch by
Jaswinder Singh Rajput <jaswinderlinux@gmail.com>.

KMS support by Dave Airlie <airlied@redhat.com>.

For Radeon 100- to 500-series, firmware blobs look like:
    struct {
        __be32 datah;
        __be32 datal;
    } cp_ucode[256];

For Radeon 600-series, there are two separate firmware blobs:
    __be32 me_ucode[PM4_UCODE_SIZE * 3];
    __be32 pfp_ucode[PFP_UCODE_SIZE];

For Radeon 700-series, likewise:
    __be32 me_ucode[R700_PM4_UCODE_SIZE];
    __be32 pfp_ucode[R700_PFP_UCODE_SIZE];

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:30 +10:00
Roel Kluin 1ae70072f0 drm: dereference of tmp in drm_proc_create_files()
tmp allocation may fail, prevent a dereference.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:29 +10:00
Maarten Maathuis ff846ab7f7 drm/crtc_helper: NULL encoder->crtc when switching encoders
- Previously the old encoder would be called during modeset and without a connector bad things happened.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:29 +10:00
Maarten Maathuis f380ef8691 drm/crtc_helper: place drm_helper_encoder_in_use() in the header file
- The symbol was already exported.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:29 +10:00
Maarten Maathuis e67aae79f9 drm/crtc_helper: replace modeset fail path with something simpler
- The previous system was not very transparent, nor flexible.
- This is needed to be able to fix a few bugs in the mechanism.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:29 +10:00
Dave Airlie 689d7c2a11 drm/radeon: cleanup mkregtable.c
This cleans up the code in mkregtable.c to be more kernel style.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:28 +10:00
Pekka Paalanen a1a2d1d322 drm: GEM handles are u32, not int
Several functions in the GEM kernel API used int as handle type, but
user API has it __u32 which is also the intended type.

Replace int with u32.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 11:21:08 +10:00
Dave Airlie 3f7dc91ade drm/rs600/690: use autogenerated safe register tables.
This ports rs690 to the safe reg tables and makes rs600 also
use the same table.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 11:11:56 +10:00
Ben Hutchings 52f97df5da drm/r128: Use request_firmware() to load CCE microcode
Firmware blob looks like this:
    __be32 datah
    __be32 datal

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 10:47:00 +10:00
Ben Hutchings ece2be7993 drm/mga: Use request_firmware() to load microcode
Image format is IHEX, one record for each pipe in order (record
addresses are ignored).

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 10:46:54 +10:00
Dave Airlie c9c97b8c75 drm/ttm: consolidate cache flushing code in one place.
This merges the TTM and drm cache flushing into one file in the
drm core.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 09:53:47 +10:00
Dave Airlie 50f153036c drm/radeon/kms: generate the safe register tables.
Previously we just made these offline and included them,
but no reason we can't generate them at build time.

TODO: add rs690 + r100/r200 when done.
should we do rs480/rs690 no tcl version?

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-21 14:20:38 +10:00
Thomas Hellstrom 759e4f83f4 drm/ttm: Fixes for "Memory accounting rework."
ttm:
Fix error paths when kobject_add returns an error.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-20 18:58:15 +10:00
Thomas Hellstrom 7f5f4db2d5 drm/ttm: Fixes for "Make parts of a struct ttm_bo_device global"
ttm:
Remove a stray debug printout.
Remove a re-init of the lru spinlock at device init.

radeon:
Fix the size of the bo_global allocation.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-20 18:58:13 +10:00
Dave Airlie 51c8b4071d Merge Linus master to drm-next
linux-next conflict reported needed resolution.

Conflicts:
	drivers/gpu/drm/drm_crtc.c
	drivers/gpu/drm/drm_edid.c
	drivers/gpu/drm/i915/intel_sdvo.c
	drivers/gpu/drm/radeon/radeon_ttm.c
	drivers/gpu/drm/ttm/ttm_bo.c
2009-08-20 13:38:04 +10:00
Linus Torvalds 6c30c53fd5 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2:
  nilfs2: fix oopses with doubly mounted snapshots
  nilfs2: missing a read lock for segment writer in nilfs_attach_checkpoint()
2009-08-19 10:40:24 -07:00
Anton Blanchard 0dc9aa845c AFS: Documentation updates
Fix some issues with the AFS documentation, found when testing AFS on ppc64:

- Update AFS features: reading/writing, local caching
- Typo in kafs sysfs debug file
- Use modprobe instead of insmod in example
- Update IPs for grand.central.org

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-08-19 10:40:13 -07:00
Linus Torvalds cad2c8fd9b Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/kms: teardown crtc correctly when fb is destroyed.
  drm/kms/radeon: cleanup combios TV table like DDX.
  drm/radeon/kms: memset the allocated framebuffer before using it.
  drm/radeon/kms: although LVDS might be possible on crtc 1 don't do it.
  drm/radeon/kms: implement bo busy check + current domain
  drm/radeon/kms: cut down indirects in register accesses.
  drm/radeon/kms: Fix up vertical blank interrupt support.
  drm/radeon/kms: add rv530 R300_SU_REG_DEST + reloc for ZPASS_ADDR
  drm/edid: fixup detailed timings like the X server.
  drm/radeon/kms: Add specific rs690 authorized register table
2009-08-19 10:38:36 -07:00
Linus Torvalds 4aa2d56b21 Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze
* 'next' of git://git.monstr.eu/linux-2.6-microblaze:
  microblaze: Update Microblaze defconfigs
  microblaze: Use klimit instead of _end for memory init
  microblaze: Enable ppoll syscall
  microblaze: Sane handling of missing timer/intc in device tree
  microblaze: use the generic ack_bad_irq implementation
2009-08-19 09:44:51 -07:00
Linus Torvalds d46c7d9ab8 Merge branch 'perfcounters-fixes-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perfcounters-fixes-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  perf tools: Make 'make html' work
  perf annotate: Fix segmentation fault
  perf_counter: Fix the PARISC build
  perf_counter: Check task on counter read IPI
  perf: Rename perf-examples.txt to examples.txt
  perf record: Fix typo in pid_synthesize_comm_event
2009-08-19 09:43:19 -07:00
Thomas Hellstrom a987fcaa80 ttm: Make parts of a struct ttm_bo_device global.
Common resources, like memory accounting and swap lists should be
global and not per device. Introduce a struct ttm_bo_global to
accomodate this, and register it with sysfs. Add a small sysfs interface
to return the number of active buffer objects.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19 16:10:34 +10:00
Thomas Hellstrom 5fd9cbad3a drm/ttm: Memory accounting rework.
Use inclusive zones to simplify accounting and its sysfs representation.
Use DMA32 accounting where applicable.

Add a sysfs interface to make the heuristically determined limits
readable and configurable.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19 16:09:53 +10:00
Thomas Hellstrom e9840be8c2 drm/ttm: Add a virtual ttm sysfs device.
The device directory will be the base directory of the
sysfs representation of other ttm subsystems.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19 16:09:04 +10:00
Thomas Hellstrom 327c225bd5 drm: Enable drm drivers to add drm sysfs devices.
Export utility functions for drivers to add specialized devices in the
sysfs drm class subdirectory.

Initially this will be needed form TTM to add a virtual device that
handles power management.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19 16:08:51 +10:00
Pekka Paalanen a0724fcf82 drm/ttm: optimize bo_kmap_type values
A micro-optimization on the function ttm_kmap_obj_virtual().

By defining the values of enum ttm_bo_kmap_obj::bo_kmap_type to have a
bit indicating iomem, size of the function ttm_kmap_obj_virtual() will be
reduced by 16 bytes on x86_64 (gcc 4.1.2).

ttm_kmap_obj_virtual() may be heavily used, when buffer objects are
accessed via wrappers, that work for both kinds of memory addresses:
iomem cookies and kernel virtual.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 16:07:00 +10:00
Pekka Paalanen 949ef70e2d drm/kms: no need to return void value (encoder)
Cc: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 16:06:49 +10:00
Jesse Barnes 53bd83899f drm: clarify scaling property names
Now that we're using the scaling property in the Intel driver I noticed
that the names were a bit confusing.  I've corrected them according to
our discussion on IRC and the mailing list, though I've left out
potential new additions for a new scaling property with an integer (or
two) for the scaling factor.  None of the drivers implement that today,
but if someone wants to do it, I think it could be done with the
addition of a single new type and a new property to describe the
scaling factor in the X and Y directions.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 16:06:40 +10:00
Dave Airlie 776f3360de drm: fixup includes in encoder slave header files.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 15:56:37 +10:00
Jesse Barnes 453a7d46dc drm: remove root requirement from DRM_IOCTL_SET_VERSION (+ DRM_IOCTL_AUTH_MAGIC)
Just a DRM_MASTER flag is sufficient here, though maybe this call is
totally deprecated anyway (xf86-video-intel still calls it though).

(airlied: drop ioctl auth_magic as discussed on mailing list also)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 15:51:55 +10:00
Dave Airlie 5ef5f72feb drm/kms: teardown crtc correctly when fb is destroyed.
If userspace destroys a framebuffer that is in use on a crtc,
don't just null it out, tear down the crtc properly so the
hw gets turned off.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 14:11:34 +10:00
Dave Airlie 6a719e0533 drm/kms/radeon: cleanup combios TV table like DDX.
The fallback case wasn't getting executed properly if there
was no TV table, which my T42 M7 hasn't got.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 14:11:32 +10:00
Dave Airlie bf8e828b00 drm/radeon/kms: memset the allocated framebuffer before using it.
This gets rid of some ugliness, we shuold probably find a way
for the GPU to zero this.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 14:11:32 +10:00
Dave Airlie 80e6914db1 drm/radeon/kms: although LVDS might be possible on crtc 1 don't do it.
LVDS always requests RMX_FULL, we need to fix it so that doesn't happen
before we can enable LVDS on crtc 1.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 14:11:26 +10:00
Linus Torvalds c124891f50 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
  security: Fix prompt for LSM_MMAP_MIN_ADDR
  security: Make LSM_MMAP_MIN_ADDR default match its help text.
2009-08-18 19:41:47 -07:00
Linus Torvalds 77f312a96d Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
  percpu: use the right flag for get_vm_area()
  percpu, sparc64: fix sparse possible cpu map handling
  init: set nr_cpu_ids before setup_per_cpu_areas()
2009-08-18 19:41:05 -07:00