Eric Anholt [Mon, 15 Aug 2005 18:07:12 +0000 (18:07 +0000)]
Port the VIA DRM to FreeBSD. Original patch by Jake, with some cleanup by
me to match other drivers and avoid ifdeffing. The linux via_drv.c will
be moved from shared-core to linux-core soon by repocopy.
Submitted by: Jake Burkholder <jake@FreeBSD.org> Tested by: unichrome
Thomas Hellstrom [Sun, 14 Aug 2005 09:52:09 +0000 (09:52 +0000)]
VIA bugvixes by Joris van Rantwijk Initial commit.
Eric Anholt [Fri, 12 Aug 2005 17:18:08 +0000 (17:18 +0000)]
Fix build after linux-side checkin of master/root-only split. Still only
cares about root on the BSD side, but should be secure.
Thomas Hellstrom [Fri, 12 Aug 2005 14:19:33 +0000 (14:19 +0000)]
Reverting the previous via security-fix commit, since the assumption of
contexts registered with the callers filp was wrong.
Thomas Hellstrom [Thu, 11 Aug 2005 13:05:12 +0000 (13:05 +0000)]
Missing symbol export from previous via context check commit.
Thomas Hellstrom [Wed, 10 Aug 2005 19:46:46 +0000 (19:46 +0000)]
Security fix on via: Checking that the specified context belongs to the
caller on fb / agp memory alloc and free. Otherwise malicious clients
can register allocations on other clients or free memory used by other
clients which will lead to severe memory manager inconsistensies.
Jon Smirl [Tue, 9 Aug 2005 01:40:45 +0000 (01:40 +0000)]
Make sure savage has 3rd ioctl parameter
Dave Airlie [Sun, 7 Aug 2005 05:37:25 +0000 (05:37 +0000)]
make some functions static in the savage drm driver
Dave Airlie [Sun, 7 Aug 2005 05:32:06 +0000 (05:32 +0000)]
fix ioctl in r128 drm direction from Egbert Eich.
Dave Airlie [Sun, 7 Aug 2005 04:38:11 +0000 (04:38 +0000)]
remove bus address
Dave Airlie [Fri, 5 Aug 2005 13:04:21 +0000 (13:04 +0000)]
Fix bug in return to userspace resctx code
From: Egbert Eich <eich@suse.de>
Eric Anholt [Fri, 5 Aug 2005 03:50:23 +0000 (03:50 +0000)]
Rename the driver hooks in the DRM to something a little more
understandable: preinit -> load postinit -> (removed) presetup ->
firstopen postsetup -> (removed) open_helper -> open prerelease ->
preclose free_filp_priv -> postclose pretakedown -> lastclose
postcleanup -> unload release -> reclaim_buffers_locked version ->
(removed)
postinit and version were replaced with generic code in the Linux DRM
(drivers now set their version numbers and description in the driver
structure, like on BSD). postsetup wasn't used at all. Fixes the savage
hooks for initializing and tearing down mappings at the right times.
Testing involved at least starting X, running glxgears, killing
glxgears, exiting X, and repeating.
Tested on: FreeBSD (g200, g400, r200, r128) Linux (r200, savage4)
Jon Smirl [Thu, 4 Aug 2005 14:48:43 +0000 (14:48 +0000)]
Implement permanent sarea maps
Jon Smirl [Thu, 4 Aug 2005 14:39:25 +0000 (14:39 +0000)]
Tighten up AGP security. Verify that all uses of AGP are done inside
buffers that have been allocated from AGP. This includes some new
capable(CAP_SYS_ADMIN) checks, these functions are also protected by
the root requirement on the IOCTL macros.
Jon Smirl [Thu, 4 Aug 2005 13:59:48 +0000 (13:59 +0000)]
Mark some radeon init variables deprecated. These used to be passed in but
the driver already knew their correct value. For example the physical
address of the framebuffer and registers.
Jon Smirl [Thu, 4 Aug 2005 13:15:27 +0000 (13:15 +0000)]
Split the control of master vs root priv. Everything is still marked as
needing root.
Eric Anholt [Thu, 4 Aug 2005 07:46:11 +0000 (07:46 +0000)]
Whitespace fixups.
Eric Anholt [Thu, 4 Aug 2005 07:42:01 +0000 (07:42 +0000)]
Fix the MGA driver on BSD by passing in the proper chipset flags to the
driver's preinit routine, and by using DRM_COPY_TO_USER_IOCTL when
copying out to an ioctl's data pointer. Pulled from the latest version
of my drm-hook-rename.diff and only compile-tested after that.
Eric Anholt [Thu, 4 Aug 2005 07:31:21 +0000 (07:31 +0000)]
Add a debugging error message from testing new MGA code on BSD.
Adam Jackson [Mon, 1 Aug 2005 20:36:58 +0000 (20:36 +0000)]
version bump
Adam Jackson [Mon, 1 Aug 2005 20:31:35 +0000 (20:31 +0000)]
Fix the pkgconfig info. (Donnie Berkholz)
Eric Anholt [Thu, 28 Jul 2005 01:44:17 +0000 (01:44 +0000)]
Fix issues with buffer aging when more than one dma buffer is discarded in
a cmdbuf, which could lead to hangs.
Submitted by: Aapo Tahkola
Eric Anholt [Wed, 27 Jul 2005 20:20:30 +0000 (20:20 +0000)]
Correct a couple of descriptions of files in comments (were just
copy'n'pasted).
Submitted by: jkim
Eric Anholt [Wed, 27 Jul 2005 20:19:29 +0000 (20:19 +0000)]
Link in the savage files from shared-core.
Submitted by: jkim
Roland Scheidegger [Wed, 27 Jul 2005 18:19:11 +0000 (18:19 +0000)]
fix driver date and drm minor version for r300 support
Eric Anholt [Wed, 20 Jul 2005 21:17:47 +0000 (21:17 +0000)]
Add latest r300 support from r300.sf.net CVS. Patch submitted by volodya,
with BSD fix from jkim and the r300_reg.h license from Nicolai Haehnle.
Big thanks to everyone involved!
Eric Anholt [Tue, 19 Jul 2005 20:59:57 +0000 (20:59 +0000)]
Add .cvsignore file.
Dave Airlie [Sat, 16 Jul 2005 03:11:53 +0000 (03:11 +0000)]
revert last change due to me bring up too early
Dave Airlie [Sat, 16 Jul 2005 02:07:14 +0000 (02:07 +0000)]
up the version
Dave Airlie [Sat, 16 Jul 2005 02:03:03 +0000 (02:03 +0000)]
Egbert noticed this issue, but changing the IOW to IOWR mess up
compatiblity with userspace..
Thomas Hellstrom [Fri, 15 Jul 2005 21:22:51 +0000 (21:22 +0000)]
VIA: Fix sparse warnings (Alexey Dobriyan)
Adam Jackson [Wed, 13 Jul 2005 00:13:12 +0000 (00:13 +0000)]
distcheck fixes
Jon Smirl [Mon, 11 Jul 2005 18:27:39 +0000 (18:27 +0000)]
IRQ must be assigned and enabled or this will hang
Adam Jackson [Sun, 10 Jul 2005 22:42:42 +0000 (22:42 +0000)]
autoconfiscate libdrm
Jon Smirl [Sun, 3 Jul 2005 18:07:03 +0000 (18:07 +0000)]
Simplify the sysfs code
Jon Smirl [Sun, 3 Jul 2005 17:16:12 +0000 (17:16 +0000)]
Add sysfs attribute dri_library_name on Linux. code in share-core/via_drv.c
is ok to be shared, it will be passive on BSD.
Jon Smirl [Thu, 30 Jun 2005 16:00:35 +0000 (16:00 +0000)]
release can happen before dev->ctxlist is allocated
Ian Romanick [Wed, 29 Jun 2005 23:20:30 +0000 (23:20 +0000)]
Remove the AGP requirement from Makefile and Kconfig for MGA. Remove the
AGP requirement from Kconfig for SIS. There never was a requirement in
Makefile, and Eric Anholt confirms that the Makefile was correct.
Alan Hourihane [Wed, 29 Jun 2005 13:19:47 +0000 (13:19 +0000)]
add remaining calls
Alan Hourihane [Wed, 29 Jun 2005 13:13:22 +0000 (13:13 +0000)]
add i915_ioc32.c
Alan Hourihane [Wed, 29 Jun 2005 13:00:29 +0000 (13:00 +0000)]
silence warning
Dave Airlie [Wed, 29 Jun 2005 12:02:18 +0000 (12:02 +0000)]
fix some warnings from cross compiler
Dave Airlie [Wed, 29 Jun 2005 11:56:42 +0000 (11:56 +0000)]
make r128/mga compile properly on sparc cross-compiler
Alan Hourihane [Wed, 29 Jun 2005 11:36:37 +0000 (11:36 +0000)]
Move to linux specific directory
Dave Airlie [Wed, 29 Jun 2005 11:22:39 +0000 (11:22 +0000)]
add mga and r128 32/64 bits
This is Egberts code, ported to Pauls framework by me..
Dave Airlie [Wed, 29 Jun 2005 03:06:47 +0000 (03:06 +0000)]
these don't need reclaim buffers their release functions handle it
Dave Airlie [Wed, 29 Jun 2005 02:57:18 +0000 (02:57 +0000)]
Bug in conversion from old DRM to core DRM....
Eric Anholt [Wed, 29 Jun 2005 02:54:19 +0000 (02:54 +0000)]
Get the BSD DRM compiling again after MGA and mapping changes. Note that
i915 has been disabled for the moment, rather than working around
linux-specific code in the shared dir.
Eric Anholt [Tue, 28 Jun 2005 20:58:34 +0000 (20:58 +0000)]
- Remove drm_initmap and replace its usage with drm_addmap. This reduces
code duplication, and it also hands you the map pointer so you don't
need to re-find it.
- Remove the permanent maps flag. Instead, for register and framebuffer
maps, we always check whether there's already a map of that type and
offset around. Move the Radeon map initialization into presetup (first
open) so it happens again after every takedown.
- Remove the split cleanup of maps between driver takedown (last close) and
cleanup (module unload). Instead, always tear down maps on takedown,
and drivers can recreate them on first open.
- Make MGA always use addmap, instead of allocating consistent memory in
the PCI case and then faking up a map for it, which accomplished nearly
the same thing, in a different order. Note that the maps are exposed to
the user again: we may want to expose a flag to avoid this, but it's
not a security concern, and saves us a lot of code.
- Remove rmmaps in the MGA driver. Since the function is only called during
takedown anyway, we can let them die a natural death.
- Make removal of maps happen in one function, which is called by both
drm_takedown and drm_rmmap_ioctl.
Reviewed by: idr (previous revision) Tested on: mga (old/new/pci dma),
radeon, savage
Dave Airlie [Tue, 28 Jun 2005 13:02:20 +0000 (13:02 +0000)]
add compat code from Paul Mackerras
Dave Airlie [Tue, 28 Jun 2005 12:52:41 +0000 (12:52 +0000)]
Add compat to Makefile
Dave Airlie [Tue, 28 Jun 2005 12:50:15 +0000 (12:50 +0000)]
Add drm and radeon 32/64-bit compat code from Paul Mackerras
Alan Hourihane [Tue, 28 Jun 2005 08:03:33 +0000 (08:03 +0000)]
Given that BenH says using the sysdev approach for DRM is bogus, I'll yank
the code for it, rather than introducing something that isn't going to
work 100% of the time.
Alan Hourihane [Tue, 28 Jun 2005 07:34:49 +0000 (07:34 +0000)]
Comment out the .resume function as without programming their dependent
registers things tend to lock up in certain situations.
The BIOS repost will fix things up.
Alan Hourihane [Mon, 27 Jun 2005 15:17:12 +0000 (15:17 +0000)]
Reverse the pm_message_t patch for now, it appears that the 2.6.12 release
didn't have it.
Alan Hourihane [Mon, 27 Jun 2005 12:39:02 +0000 (12:39 +0000)]
Check for 2.6.12 suspend/resume changes (pm_message_t)
Alan Hourihane [Mon, 27 Jun 2005 11:41:40 +0000 (11:41 +0000)]
Check dev_priv
Alan Hourihane [Mon, 27 Jun 2005 11:39:44 +0000 (11:39 +0000)]
Save state of registers for suspend/resume.
Jon Smirl [Sun, 26 Jun 2005 13:31:15 +0000 (13:31 +0000)]
removed dev->sysdev_registered
Jon Smirl [Fri, 24 Jun 2005 22:48:16 +0000 (22:48 +0000)]
Ref count the sysdev class to support multiple DRM cards
Jon Smirl [Fri, 24 Jun 2005 21:50:40 +0000 (21:50 +0000)]
Make sysdev class only register when fbdev detected
Jon Smirl [Fri, 24 Jun 2005 19:31:06 +0000 (19:31 +0000)]
More err path clean up for drm_pm Add mandatory sysdev shutdown function
Alan Hourihane [Fri, 24 Jun 2005 09:28:50 +0000 (09:28 +0000)]
Fix the sysdev approach for power management.
We need to use the container_of() call to access our device private.
Alan Hourihane [Fri, 24 Jun 2005 08:56:12 +0000 (08:56 +0000)]
Fix suspend problem when i915 private hasn't been initialized yet.
Jon Smirl [Thu, 23 Jun 2005 05:29:16 +0000 (05:29 +0000)]
Fix drm_memory_debug.c to compile, doesn't seem to be working Clean up
error return path in drm_stub.c
Jon Smirl [Wed, 22 Jun 2005 05:49:56 +0000 (05:49 +0000)]
Get the power management hooks into the right place so that everything gets
freed correctly.
Jon Smirl [Tue, 21 Jun 2005 02:20:02 +0000 (02:20 +0000)]
Change initialization of savage register access to _DRM_READ_ONLY. Flags of
zero does not mean no privs, instead it grants write access
_DRM_READ_ONLY only applies to non-root users. Problem is only in CVS,
initmaps are not in the kernel yet.
Jon Smirl [Mon, 20 Jun 2005 15:40:48 +0000 (15:40 +0000)]
Change initialization of radeon register access to _DRM_READ_ONLY. Flags of
zero does not mean no privs, instead it grants write access
_DRM_READ_ONLY only applies to non-root users. Problem is only in CVS,
initmaps are not in the kernel yet.
Jon Smirl [Sun, 19 Jun 2005 04:15:58 +0000 (04:15 +0000)]
Remove I2C support from radeon driver. Same support is available from
radeonfb.
Dave Airlie [Fri, 17 Jun 2005 09:09:17 +0000 (09:09 +0000)]
fix up drm_alloc_agp to take a dev arg and not pass crappy agpgart around
Jon Smirl [Fri, 17 Jun 2005 04:47:30 +0000 (04:47 +0000)]
Fix 810/830 build
Alan Hourihane [Thu, 16 Jun 2005 19:58:00 +0000 (19:58 +0000)]
Force AGP always for Intel chipsets.
Fixes bug #3552
Ian Romanick [Wed, 15 Jun 2005 17:47:33 +0000 (17:47 +0000)]
Re-sync (and correct!) shared/mga_drm.h with shared-core/mga_drm.h.
Ian Romanick [Tue, 14 Jun 2005 22:34:11 +0000 (22:34 +0000)]
Adds support for PCI cards to MGA DRM
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this
change, the client-side driver no longer needs to map the primary DMA
region or the MMIO region. Previously, end-of-frame waiting was done by
busy waiting in the client-side driver until one of the MMIO registers
(the current DMA pointer) matched a pointer to the end of primary DMA
space. By using interrupts, the busy waiting and the extra mappings are
removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This
allows the kernel to do whatever needs to be done to setup DMA buffers.
The entire process and the locations of the buffers are hidden from
user-mode.
Additionally, a get_param query was added to differentiate between G4x0
cards and G550 cards. A gap was left in the numbering sequence so that,
if needed, G450 cards could be distinguished from G400 cards. According
to Ville Syrjälä, the G4x0 cards and the G550 cards handle
anisotropic filtering differently. This seems the most compatible way
to let the client-side driver know which card it's own. Doing this very
small change now eliminates the need to bump the DRM minor version
twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=
106625815319773&w=2
A number of ioctl handlers in linux-core were also modified so that they
could be called in-kernel. In these cases, the in-kernel callable
version kept the existing name (e.g., drm_agp_acquire) and the ioctl
handler added _ioctl to the name (e.g., drm_agp_acquire_ioctl).
This patch also replaces the drm_agp_do_release function with
drm_agp_release. drm_agp_release (drm_core_agp_release in the previous
patch) is very similar to drm_agp_do_release, and I saw no reason to
have both.
This commit *breaks the build* on BSD. Eric said that he would make the
required updates to the BSD side soon.
Xorg bug: 3259 Reviewed by: Eric Anholt
Dave Airlie [Sat, 11 Jun 2005 10:08:39 +0000 (10:08 +0000)]
fix up drm.h for C++ include as this can be included in user programs
Dave Airlie [Fri, 10 Jun 2005 01:21:23 +0000 (01:21 +0000)]
add dragonfly #define from Xorg CVS
Ian Romanick [Thu, 9 Jun 2005 21:24:34 +0000 (21:24 +0000)]
Synchronize with the shared-core version.
Ian Romanick [Thu, 9 Jun 2005 21:18:56 +0000 (21:18 +0000)]
Completely re-initialize DMA settings
There were two problems. First, the 'warp' and 'primary' pointers weren't
cleared, so mga_do_cleanup_dma, which gets called multiple times, would
try to ioremapfree them multiple times. This resulted in the new error
messages to syslog. The second problem was the, since the dev_private
structure isn't reallocated and cleaned out in mga_do_init_dma, when
the server is reloaded idle-waits would wait for impossible values.
I have given this patch some more riggorous testing. This includes:
- Load module, start server, run GL app, stop server, unload module.
- Load module, start server, run GL app, stop server, unload module, reload
module, restart server, run GL app.
- Load module, start server, run GL app, stop server, restart server, run
GL app, stop server, unload module.
In all three cases, everything worked as expected. Please let me know if
there are any further regressions with this patch.
Xorg bug: 3408 Reported by: Chris Rankin
Jon Smirl [Thu, 9 Jun 2005 13:22:12 +0000 (13:22 +0000)]
drm_mem_init should be done at core load, not driver init
Dave Airlie [Mon, 6 Jun 2005 11:35:43 +0000 (11:35 +0000)]
fix some issues with radeon interrupt handling
From: Dave Airlie + Benjamin Herrenschmidt
Alan Hourihane [Mon, 6 Jun 2005 09:18:44 +0000 (09:18 +0000)]
Fix copyrights
Eric Anholt [Mon, 6 Jun 2005 06:45:41 +0000 (06:45 +0000)]
Add a few more bits of Tonnerre's NetBSD port (Still need to deal with the
device attachment).
Dave Airlie [Sat, 4 Jun 2005 06:18:11 +0000 (06:18 +0000)]
misc cleanup patch from Adrian Bunk
Dave Airlie [Sat, 4 Jun 2005 06:14:58 +0000 (06:14 +0000)]
Remove warnings about code mixed with declerations..
Ian Romanick [Fri, 3 Jun 2005 22:53:32 +0000 (22:53 +0000)]
Minor clean-ups. The drm_mga_fullscreen_t stuff has been dead for a looong
time. Remove it and an out-dated comment.
Ian Romanick [Fri, 3 Jun 2005 22:45:21 +0000 (22:45 +0000)]
Move the deallocation of dev_private. Since dev_private is allocated when
the driver is loaded and is always expected to be around, it should
only be deallocated when the driver is unloaded.
Xorg bug: #3408 Reported by: Chris Rankin
Eric Anholt [Sat, 28 May 2005 20:36:22 +0000 (20:36 +0000)]
Bugzilla #3217: Create a new __drm_pci_free which is used internally in
linux-core to free pci memory without freeing the structure. Linux-core
internals often create pci dma handle structures on the stack due to
the lack of a drm_local_map_t to store them in properly. Fix the
original drm_pci_free to actually free the dma handle structure instead
of leaking it.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Eric Anholt [Sat, 28 May 2005 20:25:04 +0000 (20:25 +0000)]
Bugzilla #3217: The size field in the new dma handle structure was
uninitialized, and its use in drm_pci_free later resulted in panics.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Alan Hourihane [Sat, 28 May 2005 00:08:53 +0000 (00:08 +0000)]
Actually check for drm_fb_loaded before trying to initialize the sysdev
approach.
Alan Hourihane [Sat, 28 May 2005 00:00:08 +0000 (00:00 +0000)]
Re-implement the power management.
There's two choices when fb is or isn't loaded as we treat ourselves as a
PCI driver in the latter case.
If we are a PCI driver, then register the suspend/resume functions
directly. If not, then we register as a sysdev and pick up the
suspend/resume actions and pump them down into a generic *power
function.
It'll be nice when this little mess is sorted out with regard to being a
real PCI driver ;-/
Ian Romanick [Fri, 27 May 2005 23:42:11 +0000 (23:42 +0000)]
Modify drm_driver::device_is_agp to return a tri-state value to indicate
that a device absolutely is, absolutely is not, or may or may not be
AGP. Modify the i915 DRM to use this to force all i9x5 devices to be
"AGP" (even the PCI-e devices).
Reported by: Lukas Hejtmanek
Dave Airlie [Fri, 27 May 2005 07:23:44 +0000 (07:23 +0000)]
add radeon registers from VHA code these are the "unknown" registers
Thomas Hellstrom [Mon, 23 May 2005 20:56:54 +0000 (20:56 +0000)]
VIA:
64-bit fixes. Bumped driver date and patchlevel.
Ian Romanick [Sun, 22 May 2005 04:36:33 +0000 (04:36 +0000)]
Refactor the routines for "calculating" the size of the WARP microcode. The
two routines (one for G200 and one for G400) were replaced with static
const variables and a single function that returns the correct size.
The code to generate an error if the allocated WARP region is too small
was refactored from mga_warp_install_{g200,g400}_microcode to
mga_wrap_install_microcode.
mga_warp_microcode_size is global to the MGA DRM because it will soon be
used by code in another file.
Ian Romanick [Sat, 21 May 2005 02:31:08 +0000 (02:31 +0000)]
Forgot to bump the patchlevel and driver date on last commit.
Ian Romanick [Sat, 21 May 2005 02:27:51 +0000 (02:27 +0000)]
Change the MGA initialization and cleanup a bit. The dev_private structure
is now allocated (and partially filled in) by the new
mga_driver_preinit function.
This allows the driver to detect the type of card (i.e., G200 class vs.
G400 class) on its own. The chipset value passed to mga_dma_init is now
ignored. This same technique is used by the radeon DRM.
As a result of this, mga_driver_pretakedown was converted to
mga_driver_postcleanup. This routine gets called in some other places
than might be expected, and it sets the dev_private pointer to NULL.
That little gem took over an hour to track down. :(
Ian Romanick [Fri, 20 May 2005 00:17:40 +0000 (00:17 +0000)]
Refactor common, boilerplate ioctl code from drm_addbufs_* functions into
drm_addbufs. This makes the code more like the BSD code, and makes the
drm_addbufs_* functions callable in-kernel.
Reviewed by: Dave Airlie
Dave Airlie [Wed, 18 May 2005 06:35:16 +0000 (06:35 +0000)]
Add i945G pci ids to drm
From: Christopher Allen Wing <wingc@engin.umich.edu> Signed-off-by: Dave
Airlie <airlied@linux.ie>
Felix Kuehling [Tue, 17 May 2005 02:08:02 +0000 (02:08 +0000)]
Savage doesn't require AGP any more. Enable build even without CONFIG_AGP.
Ian Romanick [Mon, 16 May 2005 17:37:10 +0000 (17:37 +0000)]
Added device_is_agp callback to drm_driver. This function is called by the
platform-specific drm_device_is_agp function. Added implementation of
this function the the Linux-specific portion of the MGA driver to
detect PCI G450 cards. Added code to the Linux-specific portion of the
generic DRM layer to not initialize AGP infrastructure if the card is
not AGP (this matches what already existed in BSD).
Bumped the driver date and the driver patch-level for MGA.
This mostly fixes bugzilla #3248. The BSD side still needs an
implementation of mga_driver_device_is_agp.