Commit Graph

420 Commits

Author SHA1 Message Date
Jesse Barnes c94cdfd6dd Fix palette save/restore
When restoring the palette, we weren't checking to make sure the
associated pipe was enabled before writing the registers.  In some
configurations, this led to a driver crash.  Add new routines to handle
palette save/restore and verify that the pipes are on before we touch
the registers (could easily be changed to enable/disable the pipes
around the save/restore as well).
2007-10-13 15:57:45 -07:00
Eric Anholt a1612b7728 Use mprotect on unbound AGP memory to attempt to catch use while unbound.
This doesn't help with the most common use-while-unbound cases, which are
from the hardware side.
2007-10-12 16:14:50 -07:00
Eric Anholt d47cf14877 Move tiling fence register setup to bind time instead of allocate time.
This allows us to allocate tiled buffers in buffer objects.  In the process
I removed the fence division that we had for tiled buffers on pre-965.  If we
resurrect that code, it should probably be managed by just dividing all the
objects in roughly half and fencing those halves (to reduce the alignment
requirement), instead of using giant fences until we run out of space and then
trying to deal with scarce space on the last (or not) buffer.  Halving
our tiled objects would use 6/8 of our fence registers on that hardware.
2007-10-11 12:17:15 -07:00
Eric Anholt a6dc81a086 Allow front/back/depth to move over the lifetime of the server. 2007-10-11 12:17:15 -07:00
Eric Anholt 132dce7565 Delay SAREA and mapping setup until EnterVT when using the memory manager.
Otherwise, we would use uninitialized offsets in the early setup.
2007-10-11 12:17:14 -07:00
Eric Anholt 4ca3550fb7 Rework DRI buffer mappings and sarea setup to allow for moving buffers.
While this has been a desired feature for some time, to allow for reallocation
of the front buffer, it was made more necessary by the desire to avoid
requiring a NO_MOVE buffer type in TTM because buffer objects may not be left
pinned over VT switch.  This is a step towards making those buffers
movable and resizable.
2007-10-11 12:17:14 -07:00
Eric Anholt f393a12d21 Move drmMMLock to after we have unbound our (pinned) buffers.
There are still issues due to the fact that we're allocating
NEED_LIFETIME_FIXED memory as buffer objects, which we refuse to unpin because
we have no way of pinning it back in the same location.
2007-10-11 12:17:14 -07:00
Zhenyu Wang 56ae767180 Revert "Fix G33 GTT stolen mem range"
This reverts commit 2a8592f2eb.

This causes compat issue between ddx and kernel apggart version.
Revert it as it shouldn't hurt normal people's default GTT size,
but if you change it to 1MB in bios, it's supposed to be broken now.
2007-10-11 10:09:29 +08:00
Eric Anholt 7db9d706a1 Warning cleanup. 2007-10-05 12:40:48 -07:00
Eric Anholt 126031655c Merge remote branch 'origin/master' into buffer-objects
Conflicts:

	src/i830.h
	src/i830_driver.c
2007-09-20 08:57:58 -07:00
Jesse Barnes 445a59d262 Remove unused plane->pipe mappings from SAREA private
Turns out we can get away without this, so remove it, fix a crash, and only
swap planes/pipes if the DRM can support it.
2007-09-12 09:32:41 -07:00
Jesse Barnes d02336290b Fix plane/pipe mapping compat code
Move plane->pipe mapping adjustment to ScreenInit so we can check
against the DRM driver version accurately.
2007-09-11 04:28:14 -07:00
Jesse Barnes d9f2b3c0d2 Fix crash in ScreenInit
Use pScreen directly when getting at the SAREA private, since
pScrn->pScreen may not be initialized yet.
2007-09-10 23:49:34 -07:00
Jesse Barnes 4c7542ef43 Only swap planes and pipes if DRM supports it
We want to associate plane A with pipe B on pre-965 mobile chips, since that's
the only way to get framebuffer compression on the builtin LVDS on those
platforms.  However, if we do this swapping and DRM isn't aware of it, we may
end up requesting vblank events for the wrong pipe, or setting up SAREA buffer
swap state incorrectly.

This mod checks whether DRM supports the new plane->pipe swapping behavior, and
only enables the swapping if so.  This should fix the bugs Lukas found and
debugged.  Reviewed by Michel Danzer.
2007-09-10 23:30:50 -07:00
Keith Packard 286f5df0b6 Switch to pci_device_map_range/pci_device_unmap_range APIs.
With the libpciaccess change that added these new APIs, use them
for all mapping.
2007-09-06 14:38:37 -07:00
Zhenyu Wang 2a8592f2eb Fix G33 GTT stolen mem range
G33 GTT table lives in seperate stolen mem with
graphics data stolen mem.
2007-09-05 14:52:56 +08:00
Keith Packard 3411eb0dba i830_driver.c changes for libpciaccess.
Change to use libpciaccess APIs, including computing and using BAR indices
for various mapping activities.
2007-08-26 23:09:01 -07:00
Eric Anholt bd874b11bb Replace AA allocator usage with i830_memory.c for RandR rotation.
This requires EXA 2.2 (server 1.3) for rotated performance with EXA, because
the i830_memory.c allocation may not fall within what EXA considers the
offscreen area, so the PixmapIsOffscreen hook is needed.
2007-08-17 17:49:21 -07:00
Jesse Barnes e5c336eaa3 Disambiguate plane and pipe mapping, use plane A on pipe B on pre-965 LVDS
Add a new 'plane' field to the intel_crtc private structure for tracking
planes separate from pipes.  This allows pre-965 chips to use plane A
on pipe B, enabling framebuffer compression for builtin LVDS displays.
2007-08-16 12:04:02 -07:00
Eric Anholt 0c9e4aeea8 Merge branch 'master' into buffer-objects
Conflicts:

	src/i830_dri.c
	src/i830_memory.c
2007-08-16 11:30:16 -07:00
Keith Packard d9f89a1af7 Save/restore tile-mode offset registers DSPATILEOFF and DSPBTILEOFF
Now that the driver sets these registers, they must be saved and restored.
2007-08-10 17:59:33 -07:00
Eric Anholt ba9a503ba2 Don't force tiling on if it is disabled in configuration but fbc is possible. 2007-08-10 17:42:21 -07:00
Jesse Barnes f71b9358b4 Cleanup tiling and FBC driver output.
Remove an extra "FBC enabled" message from i830_memory.c (only report errors
if they occur), and don't print the "forcing FBC on" message if tiling was
already enabled, as it's redundant and confusing.
2007-08-10 15:53:04 -04:00
Jesse Barnes e6746d0f28 Enable tiling by default on 965. 2007-08-10 15:48:15 -04:00
Eric Anholt 857b4a7bcb Pin some buffer objects at creation time, which can't be moved yet.
A number of other interfaces of ours don't allow buffer offsets to be updated
after screeninit.  This attempts to catalog why for each one, so that they
can be fixed one by one.

This happens to restore the EXA offscreen allocator for now, as a fixed-offset
object.
2007-07-27 18:50:07 -07:00
Eric Anholt d7b5b595ad Delay the first screen pixmap update to CreateScreenResources.
The return value of GetScreenPixmap before CreateScreenResources is not, in
fact, a pixmap.
2007-07-27 14:38:49 -07:00
Wang Zhenyu 34c82ad7ce Add quirk support
This one trys to use a flag for possible quirks. It adds a quirk
for my Lenovo T61 TV output, and ports some origin LVDS quirks to it.
2007-07-27 09:14:13 +08:00
Eric Anholt 1a585d0397 Use new drmBOSetPin interface instead of NO_EVICT/NO_MOVE buffers.
To do this, we have to deal with buffer offsets being set at EnterVT time
instead of screen init time. We've wanted to move this direction for a long
time, but there are repercussions.  The EXA offscreen memory manager has to
be disabled, because it can't be moved.  That will be replaced by BO-backed
pixmaps soon.  Also unresolved is whether our moving
front/back/depth/texture buffers will break the classic-mode DRI driver.

This code doesn't actually work yet.
2007-07-26 13:21:43 -07:00
Eric Anholt 18c707a8c1 When TTM is available, use it instead of manual AGP allocations when possible.
This is a step towards being able to expose buffer objects through the screen
private to DRI clients, instead of having them have to use the fake buffer
object type.

This fails in two ways.  First, the kernel memory manager is not currently
suitable for doing the physical allocations we need, so we still use AGP for
those.  Additionally, the DRI lock can't be initialized early enough for us, so
these buffer object allocations fail.  This will be fixed by improving the
DRM interface.
2007-07-25 10:11:16 -07:00
Dave Airlie c7920a0e81 strip out remainder of drmmm code in driver 2007-07-19 15:09:54 +10:00
Dave Airlie 1e169be25b intel: don't try and use TTM memory manager with old libdrm interface
I probably need to release a libdrm with this interface in it now..
2007-07-17 09:17:31 +10:00
Jesse Barnes bf831117b4 FBC fixes:
- allow FBC and Tiling to be forced off if configured to do so
  - only touch FBC registers if pI830->fb_compression is true
2007-07-07 10:15:32 -07:00
Jesse Barnes 4359df9419 Fix tiling and fb compression defaults for 965 (not yet fully supported). 2007-07-06 16:17:45 -07:00
Jesse Barnes ca593a5219 FBC and tiling changes
- change framebuffer option name to "FramebufferCompression"
  - add new "Tiling" option (controls all tiling, not just front buffer)
  - add debug message to fb compression enable/disable routines
  - update man page with new options
2007-07-06 16:10:52 -07:00
Jesse Barnes f02036aedc Framebuffer compression changes:
- move FBC register definitions to i830_reg.h
  - add fix from Arjan for 965 depth buffer tiling
  - add VT switch and clear-at-server-start code for FBC registers
2007-07-02 15:42:02 -07:00
Jesse Barnes b384c60897 Enable framebuffer compression (use Option "FrameBufferCompression"
"true" in your xorg.conf).  Should save ~0.5W during typical 2D usage.
2007-07-02 09:32:28 -07:00
Eric Anholt ceb6dd7244 Fix context switching between DRI and X.
Now, all 3D pipeline consumers in the driver just call
IntelEmitInvariantState(), which handles basic state setup, the caching of that
state setup, and notifying DRI clients.  This also removes a mistaken idle
wait in the Render code which was papering over the brokenness in the context
switching.
2007-06-12 10:04:39 -07:00
Wang Zhenyu f4c05973d3 Add support for the G33, Q33, and Q35 chipsets.
These chipsets require that the hardware status page be referenced by an offset
in the GTT rather than a physical memory address, so the X Server allocates it
rather than the DRM.
2007-06-05 11:34:22 -07:00
Wang Zhenyu 0984c1fc09 Add pci ids for 945GME 2007-05-31 10:19:31 +08:00
Wang Zhenyu 88ee25ebad Add pci ids for 965GME/GLE chip 2007-05-31 10:19:31 +08:00
Keith Packard ff0ac8ea63 Xv does not require directRendering 2007-05-25 17:26:15 -07:00
Keith Packard e89d5f2754 Make each output control clones/crtcs. Split DVO into LVDS, TMDS, TV.
Move clone/crtc config into each output where it's easier to understand (no
need for a switch statement in I830PrepareOutputs. Also, split DVO into
three sub-types (TMDS, LVDS, TVOUT) as those have different cloning
abilities.
2007-05-17 15:00:12 -07:00
Keith Packard b31bef1a8e Deal with i830 CRT load detection which cannot use FORCE_BORDER.
Chips newer than the i830 can force the border color for the active period
of the screen, allowing the load detection to easily see the right data. In
addition, newer chips appear to have more sensible load detection hardware
which either ignores inactive periods on the screen or performs some
longer-term averaging. The i830 appears to provide unfiltered samples of the
detected load.

For the i830, then, emit a border at the bottom of the screen and, for load
detection, simply turn it purple and wait for the current line to be within
the border. Sample an entire scanline, counting the number of times the load
detection sees a monitor. In my testing, the presence of a monitor will
cause the detection to succeed every time, while the absense will cause it
to fail about 75% of the time. The code here, checks for presence at least
75% of the time, which should be adequate.

Also, as the new mode configuration code has already taken care to enable
the CRT output, eliminate much of the load detection code which is simply
duplicating functionality from the general mode setting code. This should
result in faster load detection as this code will now run in no more than
one frame time. It does burn the CPU the whole time though, polling the
displayed scanline register.
2007-05-12 20:04:31 -07:00
Eric Anholt 34f362d099 Fix typo s/i/index/ in LoadPalette for depth 16.
Reported by:	Haihao Xiang <haihao.xiang@intel.com>
2007-05-02 15:43:17 -07:00
Eric Anholt f3168e3b0c Disable non-working GTT decoding on i830, and fix map/unmap of GTT. 2007-05-02 14:31:57 -07:00
Dave Airlie c7bb34e83d disable all outputs on EnterVT
This disables all outputs on EnterVT as the SDVO output can confuse
the VGA output if the BIOS has enabled it on the same pipe but X
isn't going to use the SDVO.

Worked out on irc with keithp
2007-05-02 14:25:39 +10:00
Eric Anholt 6748d620fb Ignore VideoRam now that its original purpose is obsolete.
It had been necessary to allow more than a small amount of memory to be
allocated, but now those old small allocations people had configured are
getting in the way.
2007-04-30 19:15:34 -07:00
Eric Anholt a4f1a7872f Allow physical-memory allocations within stolen memory.
Because stolen memory happens to be a contiguous block of high system memory,
we can just read the GTT entries for it to get physical addresses for our
allocations there if needed.  This reduces fragmentation of the aperture space,
and will often reclaim up to 7 MB of memory that had been left unused since the
simplified aperture manager was put in place, but without reintroducing the
complexities of the old aperture manager.
2007-04-30 19:15:24 -07:00
Eric Anholt 7d0d34cfdc Disable some clock gating functions documented to work incorrectly. 2007-04-30 18:40:03 -07:00
Keith Packard 60e891915a Eliminate LinearAlloc option and code.
With the fixes to the 2D frame buffer allocation that allows up to 65536
lines of 2D frame buffer in XAA mode, the old linear allocation hacks are no
longer necessary.
2007-04-19 14:02:23 -07:00