Fixes regression from
commit 1de1104064
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Fri Feb 21 22:43:04 2014 +0000
sna: Use a hint to do whole image uploads inplace
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75549
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
One of the failure modes for execbuf is running out of memory - often
this is reported as a false ENOSPC (thanks shmemfs!). Because of this,
we should try to resubmit after we purge our caches.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
To handle sigtrapping of the threads, we allow the threads to handle
their async signals and upon hitting the trap, we kill the thread. All
the rest of the threads are reaped by the main xserver thread
afterwards.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Along one of the sw blt paths we failed to apply the offset for
Composite redirection.
Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73811
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
By killing the threads and leaking their allocations - marginally
preferrable to losing the entire Xserver.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
For the moment, this still leaves open the vexing question of how to
protect the multi-threaded variants, but it should provide more shelter
for extreme OOM.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The fallback xf86InitialConfiguration() is another function that may
explode if called without any CRTCs attached.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The xserver may crash if we try to setup colormap handling without any
CRTCs, so don't.
Suggested-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Chris would like to humbly apologise for making these changes to the
OpenBSD code blind, and to thank Mark and Jonathan for their support
and understanding.
X always sends MappingNotify events (there is no way for the client
to ignore them). In particular, MappingNotify would be sent after a VT
switch, and this would knock out our ability to track the cursor..
Reported-by: Raul Dias <raul@dias.com.br>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75115
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Since the helper is a standalone app, the usual xserver rules of not using
stdio because of signal handling don't apply.
And since the helper does run with elevated rights, it is important to keep
the code KISS so that it can be audited easily.
This commit replaces the hard to read "raw" read loop with a much simpler
loop using fgets, improving readability of the code.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Event though we've failed to open the backlight normally, we may still be
running under a suid-root xserver, so drop any elevated rights before
executing what we hope will be pkxec.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Even though we've failed to open the backlight normally, we may still be
running under a suid-root xserver, so use the servers build in System instead
of system so as to properly drop root rights.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Update the comment about trying suid-root first with some explanations of
why pkexec may be preferable in some cases.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
We only handle the singular wscons OpenBSD interface for backlight, so
explicitly reject any user requests for something else.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Our fallback path for finding the backlight interface uses a hardcoded
table of known backlight controllers in proirity order. Rather than
maintain this table twice in the midst of the KMS logic, push it to the
new set of common backlight routines.
This incorporates bugfixes from SNA to handle unknown backlights, but
usable, gracefully.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Once the xserver stops running as root on kms capabable systems, we will need
some other way to access the backlight.
The approach taken in this patch moves most of the heavy lifting to a
helper that runs with root privileges and pipes our requested brightness
into the sysfs backlight interface. Where required, we use pkexec to
launch the helper with the elevated privilege.
v2: Amalgamate much more of the duplicate code.
Keep the daemon and pipe alive for the lifetime of the backlight interface.
Provide an alternative for systems without PolicyKit.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> [v1]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
O_NONBLOCK is a status flag not a descriptor flag, so F_GETFL / F_SETFL should
be used to modify it.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
It is not just the BSDs that lack these ioctls in their userspace
headers, but everything older than about a year...
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
These are not currently exported on OpenBSD and cause the build to fail.
Hide their use behind an ifdef guard for the time being.
"I noticed the following when trying to compile xf86-video-intel git on OpenBSD:
/usr/users/jsg/src/xf86-video-intel/src/sna/sna_display.c:2106: error: 'DRM_MODE_OBJECT_CRTC' undeclared (first use in this function)
/usr/users/jsg/src/xf86-video-intel/src/sna/sna_display.c:2106: error: (Each undeclared identifier is reported only once
/usr/users/jsg/src/xf86-video-intel/src/sna/sna_display.c:2106: error: for each function it appears in.)
/usr/users/jsg/src/xf86-video-intel/src/sna/sna_display.c:2107: error: 'DRM_MODE_OBJECT_PLANE' undeclared (first use in this function)"
Reported-by: Jonathan Gray
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Before we write values into the file, we want to be sure that it is our
sysfs backlight interface, and not some ordinary file we are about to
destroy.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Attempting to create a 0x0 frontbuffer results in erroneous pixmap
generation, and is liable to explode at a random point in future, so
just reject it outright.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
After altering the command bits to accommodate Broadwell, we needed to
fixup the comparison of previous BLT commands to detect overwritten
commands.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Before attaching properties to any connector, check that we can indeed
control the backlight through the sysfs interface by doing an access
check. If the xserver is started without root privileges, we cannot
write through /sys/class/backlight and so should take care not to
advertise that we can.
Reported-by: Hans de Geode <hdegeode@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Before attaching properties to any connector, check that we can indeed
control the backlight through the sysfs interface by doing an access
check. If the xserver is started without root privileges, we cannot
write through /sys/class/backlight and so should take care not to
advertise that we can.
Reported-by: Hans de Geode <hdegeode@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The sprite plane can be independently rotated to the CRTC primary plane.
To rotate the sprite plane, we just set a property on the plane similar
to how we rotate the CRTC, so we can refactor them together to use the
same routines.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Otherwise X tells Clients that the cursor is still in the unrotated
location when it appears rotated on the display.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This reverts commit 4497212307.
Unfortunately, this simple fix does not work for UXA as DPMS is used by
the xserver to turn off CRTCs and outputs. Since UXA does not implement
CRTC DPMS, this commit causes us to fail to turn off outputs.
The kernel has been fixed up in the meantime and that commit has been
recommended to be backported to all stable kernels:
commit c9976dcf55c8aaa7037427b239f15e5acfc01a3a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sun Sep 29 19:15:07 2013 +0100
drm/i915: Only apply DPMS to the encoder if enabled
so it should be safe for UXA to rely on its old behaviour.
Bugzilla: https://code.google.com/p/chromium/issues/detail?id=341135
References: https://bugs.freedesktop.org/show_bug.cgi?id=68030
Suggested-by: Dominik Behr <dbehr@google.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
In some cases, such as querying the mode from the CRTC, we may not have
a name associated with the mode. However, RandR always expects a valid
name. To satisfy this requirement, always generate the canonical mode
name if no other is specified.
References: https://bugs.freedesktop.org/show_bug.cgi?id=70132
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
When we change the blend mode between operations, it appears that we
must flush the render cache or else we risk render corruption. This is
usually noticeable in rendering of single glyphs.
This was originally fixed for bug 51422, but was reintroduced by
commit 37eb7343be
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sat Dec 1 09:40:11 2012 +0000
sna/gen5: Inspired by gen4, reorder the flushing
and the desire to reduce the impact of this w/a.
Reported-by: itumaykin@gmail.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74882
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>