Commit Graph

88 Commits

Author SHA1 Message Date
Chris Wilson b7d2fcf47a Remove reliance on hard-coded DRI name
This provides for using the existing DDX with future DRI drivers which
may break from the traditional names - but only with the help of the
user/packager. This scheme needs to be replaced with a robust mechanism
for driver loading if AIGLX and co are to be kept.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-11-08 08:58:22 +00:00
Chris Wilson ef431b2d35 uxa: Drain the DRM event queue before server regeneration
Adam Jackson notes that what appeared to be my paranoid ramblings in SNA
actually served a purpose - it prevents a server crash following
server regen if an indirect client happened to be running at the time
(e.g. LIBGL_INDIRECT_ALWAYS=1 glxgears).

Reported-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-10-25 10:15:39 +01:00
Chris Wilson 16860d448f uxa: Only destroy the bufmgr if it exists
Be wary in case the Screen is destroy before we initialise bufmgr.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-29 10:40:51 +01:00
Chris Wilson 557ad78d02 Kill mibstore pretend backwards compatibility
Adam Jackson was kind enough to point out that mibstore had been a no-op
since xorg-1.4 and the earliest we claim to support is xorg-1.6.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-26 15:02:17 +01:00
Chris Wilson 8f5a6d107b Add miInitializeBackingStore() to compat-api.h
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-25 13:38:00 +01:00
Chris Wilson bc73acbd4d uxa: Error out after failing to become DRM master during PreInit
As we set the card fd to -1 upon failure, the error here is
non-recoverable, so make sure it gets propagated and we abort loading
the intel ddx.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/962892
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-10 18:55:04 +01:00
Imre Deak 46981d0170 uxa: fix leakage of FB when closing the screen
Calling drmModeRmFB is only allowed in DRM master mode. Since leaving
the VT also drops master mode we need to remove the FB before calling
I830LeaveVT.

This is only a real leak in case of a server reset, otherwise the server
process will exit anyway and the kernel will clean up the FB.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-05 11:11:06 +01:00
Dave Airlie 18d26076c7 intel: fix return value for no pEnt
Probably never gets hit but shuold return FALSE,

pointed out on irc by Lekensteyn

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-04 07:19:12 +10:00
Dave Airlie d14ff42f2a intel: query kernel for caps to setup scrn capabilities.
This queries the kernel for prime support before advertising
the capabilities.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-03 12:28:29 +10:00
Dave Airlie 6705d8237a intel: add pixmap tracking and scanout support. (v2)
This adds support for pixmap tracking and scanout of
alternate pixmaps.

v2: do dirty updates after uxa block handler, check if kernel
can flush vmap for us so we don't have to.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-03 12:28:29 +10:00
Dave Airlie 0768ac4d19 intel: add platform probing support.
This allows the driver to be loaded by the platform loading code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-03 12:25:07 +10:00
Chris Wilson 3c611087e8 Only open the matching BusID and not the first named
If you pass a name to drmOpen() it will attempt to open any device
corresponding to that name if it first fails to open the device
corresponding to the BusID. Obviously we want the failure from opening
the specified device in order to prevent wrongly opening the first found
device multiple times.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-20 16:09:25 +01:00
Chris Wilson 05dcc5f169 Pass the chipset info through driverPrivate rather than a global pointer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-03 21:42:28 +01:00
Chris Wilson 0fd680ff52 Don't disable acceleration on 830/845g by default
Run the risk of a GPU hang (it shouldn't endanger the entire machine
normally) and let the user elect to disable it through

  Option "NoAccel" "true"

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-29 22:51:26 +01:00
Chris Wilson 8c5077e4ed Assume all unknown chipsets are future gen
I think the likelihood of a new product being launched based on a 8xx
design is remote enough not to worry about.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-25 17:20:21 +01:00
Chris Wilson 554fce8a65 uxa: Pass the correct parameters to intel_detect_chipset()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-23 22:59:16 +01:00
Chris Wilson 40d90dfd86 intel: Refactor the common chipset detection/override
Reduce the duplicate messages for which type of chip we by
amalgamating the common code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-23 21:55:46 +01:00
Chris Wilson 536e7ab756 intel: Don't use stdbool without declaring it
Reported-by: Fabio Pedretti <fabio.ped@libero.it>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-16 12:17:40 +01:00
Chris Wilson 0c32be15b0 uxa: Remove Shadow hack
This was an incomplete hack so deprecate in favour of Shadow-on-Steriods,
SNA.

References: https://bugs.freedesktop.org/show_bug.cgi?id=47324
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-15 20:56:58 +01:00
Chris Wilson b260ca44b3 Drop some unused includes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-14 10:02:51 +01:00
Chris Wilson 5784e0f21d Allow matching against any device supported by drm/i915
However we cannot enable acceleration if we do not recognise its
hardware layout or instruction set.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-06 10:06:16 +01:00
Chris Wilson 1ee10cc3b2 Make the detection of broken pre-production hardware verbose
These SDV should have been returned to the manufacturer long ago and
replaced with real systems. So if they are still in use, add a gentle
reminder.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-06 09:22:39 +01:00
Chris Wilson 2dc93b2a6c sna: Check results from syscalls
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-19 15:34:09 +01:00
Chris Wilson 4e50467b4f uxa: Force the outputs to off for consistency with xf86DisableUnusedFunctions()
Upon a VT switch, we set the desired modes and turn off the DPMS on any
unused output. Make this explicit so that we always maintain consistency
between the kernel and X's list of enabled CRTCs.

References: https://bugs.freedesktop.org/show_bug.cgi?id=50772
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-14 19:44:22 +01:00
Dave Airlie 3b9b64c7c9 uxa: do copy fb at startup.
Copy the current framebuffer for smooth wayland->gdm handoff.

This has been hanging around in Fedora for too long now, and we've
dropped the feature a few times, and yes I know the Simpsons did it^W^W^W
SNA does it.

I've updated the code to have some of the better fixes from nouveau.

I've no idea who wrote this code either, krh or ajax. [ickle: The
earliest version I've found had krh's fingerprints on it, though it may
still have been a joint effort.]

Signed-off-by: Dave Airlie <airlied@redhat.com>
[ickle: improve error handling, only copy the fb during initial takeover]
2012-06-12 15:09:05 +01:00
Dave Airlie 8f5001493e intel: port legacy and uxa to new API.
This ports the legacy and uxa driver to the new server API.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 11:31:45 +01:00
Chris Wilson ed6004f7ad uxa: Be paranoid and guard against xf86GetPciInfoForEntity
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-04 12:23:02 +01:00
Chris Wilson 8a9a585341 Only create a single instance of the intel_options array
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-25 10:06:57 +01:00
Chris Wilson e456291350 Allow runtime switching of AccelMethod between uxa/sna and even glamor
Section "Device"
  Option "AccelMethod" "uxa/glamor/sna"
EndSection

The appropriate backend must also be enabled at compile time for the
runtime option to be available (i.e. --enable-uxa (default) --enable-sna
--enable-glamor)

Demanded-by: Adam Jackson <ajax@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50290
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-24 19:01:22 +01:00
Eugeni Dodonov df6ab02c36 Unify options handling between UXA and SNA
Unifies available options for both UXA and SNA drivers, and
moves them into a common header file, intel_opts.h.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2012-05-24 18:47:41 +01:00
Chris Wilson 3f3bde4f0c uxa: Only consider an output valid if the kernel reports it attached
Reported-by: Kyle Hill <kyle.hill@tacomafia.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50078
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-24 12:03:14 +01:00
Dave Airlie 43a34186d1 intel: convert to new screen conversion APIs
The compat header takes care of the old server vs new server.

this commit was autogenerated from util/modular/x-driver-screen-scrn-conv.sh

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-23 11:02:20 +01:00
Chris Wilson 1c2932e9cb uxa: Defer the call to EnterVT till after outputs are initialised
We need to do this apparently or else we never perform the VT switch.
However, we can not do it too early, especially not before we have
finished intialising the outputs.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47395
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-19 16:12:37 +00:00
Chris Wilson 219467ac8b uxa: Simplify flush tracking
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-15 12:43:12 +00:00
Chris Wilson bd8fafe0c4 uxa: Kill the complicated in-flight tracking
Reference leak hunting.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-15 12:43:11 +00:00
Chris Wilson 5b5cd6780e uxa: Add a option to disable the bo cache
If you are suffering from regular X crashes and rendering corruption
with a flood of ENOSPC or even EFILE reported in the Xorg.log, try
adding this snippet to your xorg.conf:

Section "Driver"
  Option "BufferCache" "False"
EndSection

References: https://bugs.freedesktop.org/show_bug.cgi?id=39552
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-24 11:19:58 +00:00
Chris Wilson 507f72d6d4 uxa: Remove DPRINTF stubs
It wasn't being used for anything non-trivial and was throwing compiler
warnings, so remove it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-21 11:29:41 +00:00
Zhigang Gong 1e0d702c3a uxa/glamor/dri: Enable the pageflip support on glamor.
To support easy buffer exchange at glamor layer, glamor
added a new API glamor_egl_exchange_buffers() to exchange
two pixmaps' EGL image and fbos and textures without
recreating any of them. But this simple method's requirement
is that there are two pixmaps. A exceptional case is:
If we are using triple buffer when do page flipping, we
will have an extra back_buffer which doesn't have a pixmap
attached to it. Then each time we set that buffer to a
pixmap, we will have to call the create_egl_textured_pixmap
to create the corresponding EGL image and fbo and texture
for it. This is not efficient.

To fix this issue, this commit introduces a new back_pixmap
to intel structure to hold the back buffer and corresponding
glamor resources. Then we will just need to do the light
weight buffer exchanging at both DDX and glamor layer.

As the new back pixmap is similar to the screen pixmap
and need to be handled carefully when close screen. As the
glamor data structure is a per screen data, and will be
released at its close screen method. The glamor's close
screen method must cleanup the screen pixmap and back
pixmap's glamor resources. screen pixmap is easy to get,
but there is no good way to store the back pixmap.

So the glamor add a new API glamor_egl_create_textured_screen_ext
function to pass the back pixmap's pointer to glamor layer.

This commit make us depend on glamor commit: 4e58c4f.
And we increased the required glamor version from 0.3.0 to 0.3.1

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-21 08:42:12 +00:00
Zhigang Gong 70092bfbc5 uxa/glamor: Refine CloseScreen and InitScreen process.
The previous version calls glamor_egl_close_screen and
glamor_egl_free_screen manually which is not align with
standard process. Now glamor change the way to follow
standard method:

glamor layer and glamor egl layer both have their internal
CloseScreens. The correct sequence is after the I830CloseScreen
is registered, then register glamor_egl_close_screen and
the last one is glamor_close_screen. So we move out the
intel_glamor_init from the intel_uxa_init to I830ScreenInit
and just after the registration of I830CloseScreen.

As the glamor interfaces changed, we need to check the
glamor version when load the glamor egl module to make
sure we are loading the right glamor module. If
failed, it will switch back to UXA path.

This depends upon glamor commit 1bc8bf tagged with version 0.3.0.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-08 09:07:42 +00:00
Chris Wilson a8fe50ab65 uxa: Explicitly check for libdrm_intel in configure
And remove the excess dependencies from the common files.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-17 21:26:34 +00:00
Chris Wilson 5d5b2b8ee2 uxa: Cap the maximum number of VMA cached
Since we can not keep an unlimited number of vma cached due to the hard
per-process limits on the number of mappings and recreating mappings is
slow due to excruciatingly slow GTT pagefaults, we need to compromise
and keep a small MRU cache of inactive mmaps.

This uses the new API in libdrm-2.4.29 to specify the limit upon the VMA
cache maintained by libdrm.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 11:30:05 +00:00
Chris Wilson 1128825efb uxa: Wakeup 3s after the last rendering to reap the bo-cache
libdrm expires its bo 2s after entry into the cache, but we need to free
a buffer to trigger the reaper. So schedule a timer event to trigger 3s
after the last rendering is submitted to free any resident bo during
long periods of idleness.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 11:27:17 +00:00
Chris Wilson f6c82c73b6 uxa: Fix runtime linking of previous commit
So much for relying on compiler warnings.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-02 10:34:10 +00:00
Zhigang Gong fbabe60f48 glamor: Initial commit to introduce glamor acceleration.
Added one configuration option --enable-glamor to control
whether use glamor. Added one new file intel_glamor.c to
wrap glamor egl API for intel driver's usage.
This commit doesn't really change the driver's control path.
It just adds necessary files for glamor and change some
configuration.

Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-17 01:10:21 +00:00
Chris Wilson 3771387ad1 Compile out UXA if so desired
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-16 22:15:39 +00:00
Chris Wilson edbeab8c4e sna: Reduce and clarify dependencies
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-16 22:15:39 +00:00
Daniel Vetter d0184b5909 snb: implement PIPE_CONTROL workaround
Sandybdrige requires an elaborate dance to flush caches without
hanging the gpu. See public docs Vol2Part1 1.7.4.1 PIPE_CONTROL
or the corrensponding code in mesa/kernel.

This (together with the corresponding patch for the kernel) seems to
fix the hangs in cairo-perf-traces I'm seeing on my snb machine.

v2: Incorporate review from Chris Wilson. For paranoia keep all three
PIPE_CONTROL cmds in the same batchbuffer to avoid upsetting the gpu.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-10-11 09:54:17 +02:00
Chris Wilson 7538be3315 dri: Enable triple-bufferred pageflips
By popular demand.

Triple-buffering trade-offs output latency versus jitter. By having a
pre-rendered frame ready to swap in following a pageflip, we avoid the
scenario where the latency between receiving the flip complete signal
from the kernel, waking up the vsynced application, it render the new
frame and then for the server to process the swap request is greater
than the frame interval, causing us to miss the vblank. The result is
that application can become frame-locked to 30fps. Instead, we report to
the application that the first frame swap is immediately completed,
supply a new back buffer (or else the rendering would be blocked on
waiting for the front-buffer to be swapped away from the scanout) and
let them proceed to render the second frame. The second frame is added
to the swap queue, and the client throttled to vrefresh. (If the client
missed the vblank, the swap queue is empty and the client is immediately
woken again, whilst the pageflip is pending.)

Note, for practical reasons this only applies to page-flipping, for
example, calls to glXSwapBuffer() on fullscreen applications.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-11 22:13:01 +01:00
Adam Jackson 356ded1308 Don't include xf86Priv.h
I'd like it to not be in the SDK anymore, and we're not using anything
from it.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-22 22:39:37 +01:00
Adam Jackson 9d6e02a135 Remove the memory of Option "AccelMethod"
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-11 09:20:09 +01:00