summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* drm/radeon: introduce kernel modesetting for radeon hardwareJerome Glisse2009-06-1558-30/+35293
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add kernel modesetting support to radeon driver, use the ttm memory manager to manage memory and DRM/GEM to provide userspace API. In order to avoid backward compatibility issue and to allow clean design and code the radeon kernel modesetting use different code path than old radeon/drm driver. When kernel modesetting is enabled the IOCTL of radeon/drm driver are considered as invalid and an error message is printed in the log and they return failure. KMS enabled userspace will use new API to talk with the radeon/drm driver. The new API provide functions to create/destroy/share/mmap buffer object which are then managed by the kernel memory manager (here TTM). In order to submit command to the GPU the userspace provide a buffer holding the command stream, along this buffer userspace have to provide a list of buffer object used by the command stream. The kernel radeon driver will then place buffer in GPU accessible memory and will update command stream to reflect the position of the different buffers. The kernel will also perform security check on command stream provided by the user, we want to catch and forbid any illegal use of the GPU such as DMA into random system memory or into memory not owned by the process supplying the command stream. This part of the code is still incomplete and this why we propose that patch as a staging driver addition, future security might forbid current experimental userspace to run. This code support the following hardware : R1XX,R2XX,R3XX,R4XX,R5XX (radeon up to X1950). Works is underway to provide support for R6XX, R7XX and newer hardware (radeon from HD2XXX to HD4XXX). Authors: Jerome Glisse <jglisse@redhat.com> Dave Airlie <airlied@redhat.com> Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Add the TTM GPU memory manager subsystem.Thomas Hellstrom2009-06-1516-1/+5701
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TTM is a GPU memory manager subsystem designed for use with GPU devices with various memory types (On-card VRAM, AGP, PCI apertures etc.). It's essentially a helper library that assists the DRM driver in creating and managing persistent buffer objects. TTM manages placement of data and CPU map setup and teardown on data movement. It can also optionally manage synchronization of data on a per-buffer-object level. TTM takes care to provide an always valid virtual user-space address to a buffer object which makes user-space sub-allocation of big buffer objects feasible. TTM uses a fine-grained per buffer-object locking scheme, taking care to release all relevant locks when waiting for the GPU. Although this implies some locking overhead, it's probably a big win for devices with multiple command submission mechanisms, since the lock contention will be minimal. TTM can be used with whatever user-space interface the driver chooses, including GEM. It's used by the upcoming Radeon KMS DRM driver and is also the GPU memory management core of various new experimental DRM drivers. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Memory fragmentation from lost alignment blocksChris Wilson2009-06-151-11/+9
| | | | | | | | | If the block needs an alignment but otherwise fits exactly into the tail, then the split-off block from the start would remain marked as non-free. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/radeon: fix mobility flags on new PCI IDs.Dave Airlie2009-06-151-4/+4
| | | | | | | These aren't used that much on r600, but may be needed in the future, so get them correct now. Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: include kernel list header file in hashtab headerJerome Glisse2009-06-121-0/+2
| | | | Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Export hash table functionality.Jerome Glisse2009-06-121-0/+4
| | | | | | | add exports so TTM module can use these functions. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Split out the mm declarations in a separate header. Add atomic operations.Jerome Glisse2009-06-123-64/+228
| | | | | | | | this is a TTM preparation patch, it rearranges the mm and add operations needed to do mm operations in atomic context. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/radeon: add support for RV790.Alex Deucher2009-06-122-2/+4
| | | | | | This adds the PCI IDs for the rv790 which are equiv to the rv770. Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/radeon: add rv740 drm support.Alex Deucher2009-06-123-3/+41
| | | | | | This adds drm support for the RV740 family of chips to the r600 support code. Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm_calloc_large: check right size, check integer overflow, use GFP_ZEROKristian Høgsberg2009-06-121-8/+4
| | | | | | | | | Previously we would check size instead of size * nmemb, and so would never hit the vmalloc path. Also add integer overflow check as in kcalloc, and allocate GFP_ZERO pages instead of memset()ing them. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Eliminate magic I2C frobbing when reading EDIDKeith Packard2009-06-121-73/+1
| | | | | | | | | | This code depends on the underlying I2C adapter using the bit-banging algo, which may not be the case. If specific encoders require this mechanism, they should build a custom I2C algo that implements this workaround, rather than having it in the general path. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/i915: duplicate desired mode for use by fbcon.Dave Airlie2009-06-122-4/+14
| | | | | | | duplicate the mode into fbcon storage, so when we free modes later we don't just lose this. Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/via: vfree() no need checking before calling itFigo.zhang2009-06-121-4/+2
| | | | | | | | vfree() does it's own NULL checking, no need for explicit check before calling it. Signed-off-by: Figo.zhang <figo1802@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Replace DRM_DEBUG with DRM_DEBUG_DRIVER in i915 driveryakui_zhao2009-06-121-20/+29
| | | | | | | | Replace the DRM_DEBUG with the DRM_DEBUG_DRIVER to print the debug info in i915 driver. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Replace DRM_DEBUG with DRM_DEBUG_MODE in drm_modeyakui_zhao2009-06-121-7/+11
| | | | | | | | Replace the DRM_DEBUG with DRM_DEBUG_MODE macro to print the info in drm_mode. airlied:- fixed up to remove a conflicting #define Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/i915: Replace DRM_DEBUG with DRM_DEBUG_KMS in intel_sdvoyakui_zhao2009-06-111-32/+35
| | | | | | | | Use the DRM_DEBUG_KMS/DEBUG_LOG_KMS to print the debug info for SDVO device. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/i915: replace DRM_DEBUG with DRM_DEBUG_KMS in intel_lvdsyakui_zhao2009-06-111-2/+5
| | | | | | | | Use the DRM_DEBUG_KMS macro definition to print the debug info for the LVDS. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: add separate drm debugging levelsyakui_zhao2009-06-112-6/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now all the DRM debug info will be reported if the boot option of "drm.debug=1" is added. Sometimes it is inconvenient to get the debug info in KMS mode. We will get too much unrelated info. This will separate several DRM debug levels and the debug level can be used to print the different debug info. And the debug level is controlled by the module parameter of drm.debug In this patch it is divided into four debug levels; drm_core, drm_driver, drm_kms, drm_mode. At the same time we can get the different debug info by changing the debug level. This can be done by adding the module parameter. Of course it can be changed through the /sys/module/drm/parameters/debug after the system is booted. Four debug macro definitions are provided. DRM_DEBUG(fmt, args...) DRM_DEBUG_DRIVER(prefix, fmt, args...) DRM_DEBUG_KMS(prefix, fmt, args...) DRM_DEBUG_MODE(prefix, fmt, args...) When the boot option of "drm.debug=4" is added, it will print the debug info using DRM_DEBUG_KMS macro definition. When the boot option of "drm.debug=6" is added, it will print the debug info using DRM_DEBUG_KMS/DRM_DEBUG_DRIVER. Sometimes we expect to print the value of an array. For example: SDVO command, In such case the following four DRM debug macro definitions are added: DRM_LOG(fmt, args...) DRM_LOG_DRIVER(fmt, args...) DRM_LOG_KMS(fmt, args...) DRM_LOG_MODE(fmt, args...) Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* radeon: remove _DRM_DRIVER from the preadded sarea mapDave Airlie2009-06-111-1/+1
| | | | | | | This shouldn't be there and is what broke r600 late in the 2.6.30 release cycle with Ben's patch. Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: don't associate _DRM_DRIVER maps with a masterBen Skeggs2009-06-111-1/+2
| | | | | | | | | | | | A driver will use the _DRM_DRIVER map flag to indicate that it wants to be responsible for removing the map itself, bypassing the DRM's automagic cleanup code. Since the multi-master changes this has been broken, resulting in some drivers having their registers unmapped before it's finished with them. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: simplify kcalloc() call to kzalloc().Robert P. J. Day2009-06-111-1/+1
| | | | | | | | | | | Calls to kcalloc() for a single element can be simplified to calls to kzalloc(). Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Cc: Dave Airlie <airlied@linux.ie> Cc: Eric Anholt <eric@anholt.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
* intelfb: fix spelling of "CLOCK"Pavel Roskin2009-06-111-1/+1
| | | | | | | | Signed-off-by: Pavel Roskin <proski@gnu.org> Cc: Eric Anholt <eric@anholt.net> Cc: Dave Airlie <airlied@linux.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: fix LOCK_TEST_WITH_RETURN macroRoel Kluin2009-06-111-8/+8
| | | | | | | | | When this macro isn't called with 'file_priv' this will result in a build failure. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/i915: Hook connector to encoder during load detection (fixes tv/vga detect)Keith Packard2009-06-091-0/+2
| | | | | | | | | With the DRM-driven DPMS code, encoders are considered idle unless a connector is hooked to them, so mode setting is skipped. This makes load detection fail as none of the hardware is enabled. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: NOMEM->NOSPCChris Wilson2009-06-091-5/+5
| | | | | | | | To differentiate between encountering an out-of-memory error with running out of space in the aperture, use ENOSPC for the later. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: use I915_GEM_GPU_DOMAINSChris Wilson2009-06-091-13/+9
| | | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: no need to hold mutex for object lookupChris Wilson2009-06-091-2/+1
| | | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Call drm_vblank_post_modeset() on error paths.Chris Wilson2009-06-091-4/+2
| | | | | | | | Ensure that the drm_vblank_pre_modeset() is always balanced by drm_vblank_post_modeset() within intel_crtc_mode_set(). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: OR in the COMMAND read domain for the batch buffer.Chris Wilson2009-06-091-2/+6
| | | | | | | | | The batch buffer may be shared with another read buffer, so we should not ignore any previously set domains, but just or in the command domain (and check that the buffer is not writable). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Sanity check execbuffer arguments before touching state.Chris Wilson2009-06-091-11/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By sending a broken execbuffer (its length was not suitably aligned) I triggered an operation upon a freed object. The invalid alignment was discovered after updating the write_domain on the object but before the object was placed on the active queue. So during the unwind process following the error, the now freed object attempts to flush its non-existent, but outstanding, GPU writes causing this use-after-free. [drm:i915_dispatch_gem_execbuffer] *ERROR* alignment [drm:i915_gem_execbuffer] *ERROR* dispatch failed -22 WARNING: at lib/kref.c:43 warn_slowpath_null+0x10/0x15() Modules linked in: Pid: 4552, comm: lt-csi-drm Not tainted 2.6.30-rc6 #423 Call Trace: [<c0119ef3>] warn_slowpath_fmt+0x57/0x6d [<c014de24>] ? get_pageblock_migratetype+0x18/0x1e [<c014e8fd>] ? free_hot_page+0xa/0xc [<c014e915>] ? __free_pages+0x16/0x1f [<c0153ebf>] ? shmem_truncate_range+0x63e/0x656 [<c015fb2f>] ? slob_page_alloc+0x146/0x1c8 [<c0119f19>] warn_slowpath_null+0x10/0x15 [<c01f55f2>] kref_get+0x1b/0x21 [<c02605db>] i915_gem_object_move_to_active+0x1f/0x56 [<c0261302>] i915_add_request+0x156/0x19a [<c026136e>] i915_gem_object_flush_gpu_write_domain+0x28/0x3f [<c0261eca>] i915_gem_object_unbind+0x4a/0x124 [<c0261fd7>] i915_gem_free_object+0x33/0x9b [<c0250d6b>] drm_gem_object_free+0x28/0x4a [<c0250d43>] ? drm_gem_object_free+0x0/0x4a [<c01f55ce>] kref_put+0x38/0x41 [<c0250cbf>] drm_gem_object_unreference+0x11/0x13 [<c0250d06>] drm_gem_object_handle_unreference+0x1e/0x21 [<c0250d13>] drm_gem_object_release_handle+0xa/0xe [<c01f3e6b>] idr_for_each+0x5f/0x98 [<c0250d09>] ? drm_gem_object_release_handle+0x0/0xe [<c0250daf>] drm_gem_release+0x22/0x34 [<c025046f>] drm_release+0x1e8/0x3c4 [<c0162d25>] __fput+0xaf/0x146 [<c0162dce>] fput+0x12/0x14 [<c01605ef>] filp_close+0x48/0x52 [<c011b182>] put_files_struct+0x57/0x9b [<c011b1e4>] exit_files+0x1e/0x20 [<c011c6b6>] do_exit+0x16d/0x511 [<c03704ab>] ? __schedule+0x3d4/0x3e5 [<c0103f0d>] ? handle_irq+0xd/0x69 [<c011caa7>] do_group_exit+0x4d/0x73 [<c011cae0>] sys_exit_group+0x13/0x17 [<c010268c>] sysenter_do_call+0x12/0x2b Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Skip lvds with Aopen i945GTt-VFAMichael Cousin2009-06-091-0/+7
| | | | | Signed-off-by: Michael Cousin <mika.cousin@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Enable probe on new chipsetZhenyu Wang2009-06-091-0/+2
| | | | | Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: handle interrupt on new chipsetZhenyu Wang2009-06-094-8/+190
| | | | | | | | | | Update interrupt handling methods for IGDNG with new registers for display and graphics interrupt functions. As we won't use irq-based vblank sync in dri2, so display interrupt on new chip will be used for hotplug only in future. Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: enable MCHBAR if neededJesse Barnes2009-06-092-0/+147
| | | | | | | | | | | | | | | Using the new PNP resource checking code, this patch allows the i915 driver to allocate MCHBAR space if needed and use the BAR to determine current memory settings. [apw@canonical.com: moved to the new generic PNP resource interface] Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Eric Anholt <eric@anholt.net> failure to update-index after git-am --reject to hand-apply Signed-off-by: Eric Anholt <eric@anholt.net>
* pnp: add PNP resource range checking functionBjorn Helgaas2009-06-052-0/+20
| | | | | | | | | | Add a PNP resource range check function, indicating whether a resource has been assigned to any device. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> [apw@canonical.com: fixed up exports et al] Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: avoid non-atomic sysrq executionJesse Barnes2009-06-051-1/+7
| | | | | | | | | | | The sysrq functions are executed in hardirq context, so we shouldn't be calling sleeping functions from them, like mutex_locks or memory allocations. Fix up the i915 sysrq handler to avoid this. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: apply G45 vblank count code to all G4x chips and fix max_frame_countJesse Barnes2009-06-052-3/+4
| | | | | | | | All G4x and newer chips use the new style frame count register, with a full 32 bit frame count. Update the code to reflect this. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: add ignore lvds quirk info for AOpen Mini PCJarod Wilson2009-06-051-2/+8
| | | | | | | | | | Fix a FIXME in the intel LVDS bring-up code, adding the appropriate blacklist entry for the AOpen Mini PC, courtesy of a dmidecode dump from Florian Demmer. Signed-off-by: Jarod Wilson <jarod@redhat.com> CC: Florian Demmer <florian@demmer.org> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Initialize the SDVO device based on the sdvo info parsed from VBTyakui_zhao2009-06-051-3/+40
| | | | | | | | http://bugs.freedesktop.org/show_bug.cgi?id=20429 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> [anholt: Massive cleanup of the slave addr function] Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: parse VBT general definition block to get the SDVO device infoyakui_zhao2009-06-052-1/+93
| | | | | | | | | | | | | | | The general definition block contains the child device tables, which include the SDVO device info. For example: device slave address, device dvo port, device type. We will get the info of SDVO device by parsing the general definition blocks. Only when a valid slave address is found, it is regarded as the SDVO device. And the info of DVO port and slave address is recorded. http://bugs.freedesktop.org/show_bug.cgi?id=20429 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Add the structure of child_device_config in video BIOS tables.yakui_zhao2009-06-051-8/+93
| | | | | Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Add Display Port register definesKeith Packard2009-06-051-0/+163
| | | | | | | | | This adds the register definitions for the display port enable register along with those for the GMCH and Link M/N ratios required to drive display port outputs. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Don't trim cursor addresses to 11 bitsKeith Packard2009-06-051-4/+4
| | | | | | | | | We can safely assume that cursor addresses will not extend beyond the addressable screen dimensions; setting the additional bits is harmless in any case. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Set correct TV detection voltage level override valuesMa Ling2009-06-052-3/+6
| | | | | | | | | | | We detect TV connect status by setting DAC voltage level override values as 0.7 voltage for DAC_A/B/C. The corresponding 2-bits shold be 0x2, In order correctly to set last bit as 0, at first we must clean it. It fixed freedesktop.org bug #21204 Signed-off-by: Ma Ling <ling.ma@intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Add LVDS support for IGDNGZhenyu Wang2009-06-052-26/+114
| | | | | Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Add HDMI support on IGDNGZhenyu Wang2009-06-052-3/+47
| | | | | Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: enable kernel modesetting on IGDNGZhenyu Wang2009-06-053-38/+643
| | | | | | | | This adds kernel mode setting on IGDNG with VGA output support. Note that suspend/resume doesn't work yet. Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Disable tiling on IGDNG for nowZhenyu Wang2009-06-051-0/+7
| | | | | | | Swizzle bit detection not working right on it. Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Disable opregion on IGDNG for nowZhenyu Wang2009-06-052-3/+8
| | | | | | | Disable OpRegion support for now until verified on new chipsets. Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
* drm/i915: Add new chipset register definitionsZhenyu Wang2009-06-051-0/+447
| | | | | Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>