Commit Graph

76 Commits

Author SHA1 Message Date
Chris Wilson 0a9b136ec4 Remove the GeneralSocket upon CloseScreen
Be neat and tidy in case we are shutdown but the server is not
regenerated (e.g. a hot-unplug).

Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-25 15:38:58 +00:00
Mark Kettenis 364e02c799 uxa: Add OpenBSD backlight control implementation
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2013-03-22 11:27:43 +00:00
Mickaël THOMAS 8881a14200 Set initial value for backlight_active_level
If the "Backlight" option is set, backlight_active_level is not set which
results in a default value of 0, causing a black screen upon starting Xorg.
2013-01-07 20:26:03 +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 695b2ce2d3 uxa: Fixup drm_intel_bo_disable_reuse() typo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-10-20 16:19:21 +01:00
Chris Wilson fc0ba65f5e uxa: Disable bo reuse after binding to a scanout
On gen6+, bo are expected to be LLC by default. However, as using the bo
for the scanout causes it to be moved into the uncached domain, this
assumption is then false and we should release the bo back to the system
rather than spread the uncached buffers around. The most common
allocator of scanouts is for pageflipping which are already non-reusable
due to the DRI2 export, so there should actually be little impact.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-10-20 15:37:19 +01:00
Paulo Zanoni 1ec41590c9 Fix possible_clones computation for shared encoders between outputs
Libdrm's possible_clones is a mask of encoders. Xorg's possible_clones
is a mask of outputs, so we just can't do the following:

  output->possible_clones = kencoder->possible_clones;

This is a problem on Haswell because, at least with the current
patches floating on the mailing list, there is more than one connector
per encoder.

This patch writes the code to properly translate libdrm's encoder mask
into Xorg's output mask.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-10-12 09:45:37 +01:00
Chris Wilson 88cfd23379 uxa: Update mode->fb_id after completing pageflips
As intel_crtc_on() depends upon the current value for determining if the
pipe is active, we can only change the value afterwards.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-27 16:16:39 +01:00
Chris Wilson 5a45cbacb7 uxa: Confirm the pipe is alive before flipping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-27 13:31:27 +01:00
Chris Wilson addfa653cf uxa: Prevent attempting to call intel_mode_fini() before PreInit runs
In the Ubuntu xserver it is apparently possible for the Screen to be
deleted prior to being fully initialised. Make sure we don't crash in
that situation!

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55346
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-26 08:59:18 +01:00
Chris Wilson a858afc66c Silence a couple of potential compiler warnings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-23 13:49:40 +01:00
Chris Wilson 0fc3d020f3 Skip adding unknown special modes
In light of the discussion on how to add stereo modes it was revealed
that we would happily add modes with unknown and unhandled strange
flags. Adam Jackson mentioned that he has plans to fix that with some
upcoming work, but as a first step we can simply eradicate them whilst
pondering how to support the stereoscopic vision of the future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-14 10:00:45 +01:00
Chris Wilson 886f3cef41 uxa: Fix cut'n'paste error in Option "Backlight"
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-05 15:27:21 +01:00
Сковорода Никита Андреевич 3dc644b2a9 uxa: Fix Backlight option support.
Signed-off-by: Сковорода Никита Андреевич <chalkerx@gmail.com>
2012-09-03 23:09:08 +01: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
Chris Wilson 414e87255c Add Option "Backlight" to override the probed backlight control interface
The automatic selection may not correspond with the correct backlight
(such as in a multi-gpu, multi-panel device) or the user may simply
prefer another control interface. This allows them to override the
chosen interface using

  Option "Backlight" "my-backlight"

to specify '/sys/class/backlight/my-backlight' as the interface to use
instead.

Suggested-by: Alon Levy <alevy@redhat.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=29273
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 19:47:31 +01:00
Chris Wilson de707b7dc8 uxa: Add Apple's gmux to the list of known preferred backlights
Reported-by: Austin Lund <austin.lund@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=52423
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-25 09:07:06 +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 5026b6a147 uxa: Install the drm_wakeup_handler for vblank events in !use_page_flipping
Even if page-flipping itself is disabled, we still want to allow the
client to schedule wakeups for some future vblank which requires
listening to the kernel vblank notifications.

Reported-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51699
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-04 09:55:10 +01:00
Tom Hughes 61e16dc567 Add asus-nb-wmi backlight control
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51593
2012-07-02 10:25:08 +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
Chris Wilson c4eb5528a4 uxa: Check for DPMS off before scheduling a WAIT_ON_EVENT
Regression from commit 3f3bde4f0c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu May 24 11:58:46 2012 +0100

    uxa: Only consider an output valid if the kernel reports it attached

When backporting from SNA, a key difference that UXA does not track DPMS
state in its enabled flag and that a DPMS off CRTC is still bound to the
fb. So we do need to rescan the outputs and check that we have a
connector enabled *and* the pipe is running prior to emitting a scanline
wait.

References: https://bugs.freedesktop.org/show_bug.cgi?id=50668
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-05 16:09:05 +01:00
Chris Wilson ff91fd4a27 uxa: Check for failure from drmModeGetConnector()
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-04 12:41:05 +01:00
Chris Wilson 782cd6eafa uxa: check for failure to allocate drmModeCrtc
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-04 12:20:17 +01:00
Chris Wilson 46fbb3d31b uxa: NameForAtom may return NULL
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-02 08:38:21 +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
Paulo Zanoni 89091dd8a3 Avoid duplicated code with intel_output_create_ranged_atom
Same change for intel_display.c and sna_display.c.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-26 14:12:56 +01: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
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
Simon Que bc081420a5 xf86-video-intel: change order of DPMS operations
The operations when setting dpms on should be in the order opposite
of what's done when setting dpms off.

This is because of potentially conflicting effects:
~ drmModeConnectoSetProperty() enables/disables the backlight driver.
Some backlight drivers such as intel_backlight set the backlight to 0
when disabled and to max when enabled.
~ intel_output_dpms_backlight() saves the backlight value when turning
DPMS off and restores it when turning DPMS on.

Here's the current order of operations:

xset dpms force off (backlight is nonzero)
   drmModeConnectoSetProperty(DPMSModeOff)
      kernel: disable backlight, backlight=0
   intel_output_dpms_backlight(DPMSModeOff)
      save backlight value (0) <-- it has been set to 0 by kernel
      set backlight to 0

xset dpms force on
   drmModeConnectoSetProperty(DPMSModeOn)
      kernel: enable backlight, backlight=max
   intel_output_dpms_backlight(DPMSModeOn)
      set backlight to saved value (0)

The correct way to do this would be to reverse the operations during
xset dpms force off:
   intel_output_dpms_backlight(DPMSModeOff)
      save backlight value (nonzero)
      set backlight to 0
   drmModeConnectoSetProperty(DPMSModeOff)
      kernel: enable backlight, backlight=0

This restores the saved nonzero backlight value during the force on.

Signed-off-by: Simon Que <sque@chromium.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-08 14:06:16 +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 ac7df2919b Revert "Disable adding normal RTF modes for an eDP"
This reverts commit 212fa98687.

The underlying register programming for eDP is now believed to be fixed
as of linux-3.1.

References: https://bugs.freedesktop.org/show_bug.cgi?id=38012
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41070
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-16 23:29: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
Chris Wilson 212fa98687 Disable adding normal RTF modes for an eDP
This is causing a hard hang with 2.6.39+, we don't know why so play safe
and disable for the time being.

References: https://bugs.freedesktop.org/show_bug.cgi?id=38012
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 21:11:14 +01: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
Chris Wilson 1d102cc6ed Use SwapbuffersWait config option to control waiting on fullscreen swaps
As fullscreen swaps were going via a different path to the swapping of
ordinary windows, we were no longer honouring the xorg.conf option to
disable swapbuffer waiting.

This changes the code to only use pageflipping if the Option
"SwapbuffersWait" is set to "TRUE" (default).

Jesse's comment was that this should be superseded by actually
supporting asynchronous page flips. As we are missing kernel and dix level
support for that, in the meantime honour the config option.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Kristian Høgsberg <krh@bitplanet.net>
2011-04-20 08:51:50 +01:00
Chris Wilson 6f104189bb Take advantage of the kernel flush for dirty bo in the busy ioctl
Rather than just creating and submitting a batch that simply contains a
flush in order to periodically ensure that rendering reaches the
scanout, we can simply ask the kernel whether the scanout is busy. The
kernel will then submit a flush on our behalf if it is dirty, which
takes advantage of the kernel's dirty state tracking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-04 19:24:30 +01:00
Keith Packard e1ff518230 Handle drawable/client destruction in pending swaps/flips
A pending swap or flip holds references to drawables and clients which
become invalid when destroyed. Add suitable resources to the database
to track those lifetimes and clean up the pending data structure then.

Later, when the pending swap or flip occurs, handle a missing drawable
by just discarding the flip or swap. Handle a missing client by not
sending an event or reply.

Signed-off-by: Keith Packard <keithp@keithp.com>
2011-03-23 17:14:12 -07:00
Keith Packard aa0328f342 dri2: Make DRI2FrameEvent public and use instead of void *
Instead of using void * for all of the flip_info and swap_info
pointers, just make the underlying structure a public data type and
use that.

Signed-off-by: Keith Packard <keithp@keithp.com>
2011-03-23 17:14:12 -07:00
Chris Wilson ce1e096905 Rename 'intel' backlight to match upstream name in 2.6.38
(Just waiting for libbacklight to bring sanity...)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-01-31 20:27:26 +00:00
Chris Wilson 03248a7984 Cache the fixed crtc<->pipe relationship
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-01-08 19:46:36 +00:00
Mario Kleiner 2177e60321 Fix reporting of pageflip completion events on multi-head.
When a drawable is page-flipped on multiple crtc's (fullscreen
drawable on mirror-mode or multi-head x-screen), only one pageflip
event is finally delivered, after the last participating crtc signals
flip completion, this to avoid visual corruption.

Old code returned vblank count and timestamps of flip completion
of this last crtc, instead of the values of the "master crtc", the
one that was used for initially scheduling/triggering the pagflip
via vblank events. (master = I830DRI2DrawablePipe(drawable))

This patch makes sure that the pageflip completion values of the
"master" crtc are returned, otherwise client applications will
get confused by the random (msc, ust) values returned by whichever
crtc was the last to complete its flip. Without this, the returned
values change randomly and jump forward and backward in time and
count.

Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-12-16 11:42:43 +00:00
Chris Wilson 8abade8a21 display: Flush any pending batches before changing modes.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-12-05 09:57:52 +00:00
Chris Wilson 55c5f1876e Wait on the current buffer to complete when running synchronously.
And remove the vestigal wait upon changing crtc as this is more properly
done in the kernel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-12-03 14:05:30 +00:00
Keith Packard 33c08882c0 Mark outputs as DPMSModeOn and restore backlight at mode set
The kernel always turns monitors on when doing mode setting, and so no
further DPMS action is required. Note this in the mode setting code by
marking the updated DPMS mode and restoring any saved backlight level.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2010-11-17 16:40:47 +08:00
Chris Wilson a44a63d2ff Wait for any pending rendering before switching modes.
A perennial problem we have is the accursed WAIT_FOR_EVENT hangs, which
occur when we switch the framebuffer before the WAIT_FOR_EVENT completes
and upsets the GPU.

We have tried more subtle approaches to detected these and fix them up in
the kernel, to no avail. What we need to do is to delay the framebuffer
flip until the WAIT completes, which is quite tricky in the kernel
without new ioctls and round-trips. Instead, apply the big hammer from
userspace and synchronise all rendering before changing the framebuffer.
I expect this not to cause noticeable latency on switching modes (far
less than the actual modeswitch) and should stop these hangs once and
for all.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31401 (...)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-11-05 10:07:46 +00:00