Commit Graph

43 Commits (fab5def5e9aea1bf6698baa942781dc47f0c9e6a)

Author SHA1 Message Date
Thomas Lübking 79c3fa55f2 merge buffer_age render into general render code
avoiding the blocking swapinterval detection causes
issues in the timing strategy and prevents protection
against CPU overload on the nvidia blob

BUG: 329821
FIXED-IN: 4.11.6
REVIEW: 115306
2014-01-29 19:56:14 +01:00
James Jones 6acef12932 Don't call into GL without a context
After losing current from the EGL or GLX
context, calls to the GL or GLES functions
have undefined behavior.  Perform all
cleanup that may touch OpenGL and check for
GL errors before losing current from the
context.

REVIEW: 115311
2014-01-28 07:54:32 +01:00
Fredrik Höglund eeb309c149 kwin: Add support for EXT_buffer_age
This patch adds support for GLX_EXT_buffer_age, and
EGL_EXT_buffer_age on X11.
2013-12-12 01:36:46 +01:00
Fredrik Höglund c25b2939b1 kwin: Prepare the backend interface for EXT_buffer_age
Allow prepareRenderingFrame() to return a region that will be
repainted in addition to the damaged region.

Pass both the damaged region and the repainted region, which
may be larger, as parameters to endRenderingFrame().
2013-12-12 01:36:45 +01:00
Fredrik Höglund 12446c9b4c kwin: Don't call glFlush() unnecessarily in endRenderingFrame()
We should only call glFlush() here if we're deferring the posting
of the back buffer to the next prepareRenderingFrame() call.
2013-12-12 01:36:44 +01:00
Thomas Lübking e63e5f5712 fix scheduling the repaints
repaints caused by effects so far polluted the timing calculations
since they started the timer on the old vsync offset
This (together with undercut timing) lead to multiple frames in
the buffer queue, and ultimately to a blocking swap

For unsynced painting, it simply caused wrong timings - leading to
"well, kinda around 60Hz - could be 75 as just well".

REVIEW: 112368
CCBUG: 322060
that part is fixed in 4.11.2
2013-09-25 23:09:18 +02:00
Antonio Larrosa f9109a3d4b Make kwin not crash under qemu due to failing glx call
This fixes a kwin crash that happened under qemu when running kwin for
the first time (subsequent runs had glx already disabled)
2013-09-17 19:06:40 +02:00
Fredrik Höglund 3363f4f9ed kwin: Don't set the forward-compatible bit
This flag seems to be ignored by several OpenGL implementations,
so don't set it for now.  Mesa may also stop accepting this flag
until forward-compatible contexts are fully supported.
2013-08-07 23:14:06 +02:00
Thomas Lübking ac32664dc1 keep buffer swap pref automatic until GPU detected
enforce to "e" (cheap) when driver is still unknown after
detection must be assumed to have run, so a sane value is available
when the context is up

BUG: 322355
FIXED-IN: 4.11
REVIEW: 111548
2013-08-02 22:03:54 +02:00
Thomas Lübking 50e3e909da prevent yield/swap cpu overhead on nvidia
CCBUG: 322060
REVIEW: 111663
2013-08-02 22:00:33 +02:00
Thomas Lübking 7f858da008 ignore unredirection configuration on intel
the only thing it does on these systems is cause users
trouble because usually when there's a client where
unredirection makes sense, that uses OpenGL - and then
things break in the driver.

CCBUG: 252817
REVIEW: 111476
2013-07-19 21:20:12 +02:00
Thomas Lübking 3ad47552d0 non-empty attrib_list for glXCreateContextAttribsARB
empty list is legal but causes bogus context on at least i915

BUG: 321843
REVIEW: 111355
FIXED-IN: 4.11
2013-07-08 18:53:37 +02:00
Fredrik Höglund 209e44cad2 kwin/glx: Relax the GLX_CONFIG_CAVEAT requirement
Allow drawable configs with caveats. The ARGB32 visual is marked as
non-conformant in the Catalyst driver.

BUG: 317972
2013-06-11 20:47:59 +02:00
Thomas Lübking 175f117af3 drop malicious waitSync
REVIEW: 110558
2013-06-05 14:11:00 +02:00
Thomas Lübking 6c998fc668 manage triple buffering
REVIEW: 110556
2013-06-05 14:10:59 +02:00
Fredrik Höglund 7a99b8c0ef kwin: Add GLTexture::matrix()
This method returns a matrix that transforms normalized or un-normalized
texture coordinates, taking the texture target and y-inversion flag into
account.
2013-05-28 16:35:36 +02:00
Fredrik Höglund 7f0d0436e9 kwin/glx: Add support for GLX_ARB_create_context_robustness
Request a context with robust buffer access behavior, and set the reset
notification strategy to GLX_LOSE_CONTEXT_ON_RESET_ARB.
2013-05-22 23:37:15 +02:00
Thomas Lübking 69ef2f9c16 tidy up
REVIEW: 109785
2013-05-20 16:09:27 +02:00
Thomas Lübking 9446abc696 hasWaitSync -> blocksForRetrace and syncsToVBlank
since that's not the same.
also autodetect triple buffering

REVIEW: 109783
2013-05-20 16:09:27 +02:00
Fredrik Höglund 26f23b656b kwin/glx: Try to create an OpenGL 3.1 core context 2013-05-08 18:33:01 +02:00
Fredrik Höglund 84ad2585e1 kwin: Use glXCreateContextAttribsARB() when it's supported 2013-05-08 18:32:58 +02:00
Ralf Jung 72db0e5e71 remove GlVSync option (it has no UI anymore)
Based on (revision 2 of) https://git.reviewboard.kde.org/r/109086/ by Thomas Lübking

REVIEW: 109086
2013-03-28 19:05:52 +01:00
Ralf Jung eff856e8ef Re-add code I accidentally removed 2013-03-26 21:49:59 +01:00
Ralf Jung 0598e6363b move the "copy pixels" code into its own function (it's used twice) 2013-03-26 21:08:38 +01:00
Martin Gräßlin d021bf35c1 Skip framebuffer configs for depth 32 with no alpha
Fixes another problem on NVIDIA that RGBA windows were rendered
incorrectly.
2013-03-21 15:52:43 +01:00
Martin Gräßlin 0c4c16e93f Fix typo
Makes KWin work with NVIDIA again.
2013-03-21 12:40:49 +01:00
Fredrik Höglund 9c658a752c kwin: Simplify GLXBackend::initDrawableConfigs()
Use glXChooseFBConfig() instead of glXGetFBConfigs(), and prefer
the first usable configuration instead of the last.
2013-03-17 18:28:46 +01:00
Fredrik Höglund 00c0ad05d3 kwin: Require Xcomposite 0.3 for OpenGL compositing
Remove support for OpenGL compositing without using a composite
overlay window. With this change kwin now also requires a
double-buffered framebuffer configuration.
2013-03-17 18:28:46 +01:00
Fredrik Höglund baeeb1b90b kwin: Simplify GLXBackend::initRenderingContext()
glXCreateNewContext() is supposed to return NULL on failure, so let's
assume that it does. Don't try to create an indirect context when
creating a direct context failed. glXCreateNewContext() should return
an indirect context when a direct context cannot be created.
2013-03-17 18:27:41 +01:00
Fredrik Höglund 96ed29497c kwin: Simplify GLXBackend::initBufferConfigs()
Use glXChooseFBConfig() instead of glXGetFBConfigs(), and prefer
the first usable configuration instead of the last.

Also rename initBufferConfigs() to initFbConfig().
2013-03-17 18:13:36 +01:00
Fredrik Höglund 8a14a0d610 kwin: Move some debug output to where it belongs 2013-03-17 18:08:54 +01:00
Fredrik Höglund 8446912502 kwin: Remove some left over support for GLX < 1.3
We require GLX_EXT_texture_from_pixmap which in turn requires GLX 1.3.
2013-03-17 18:01:52 +01:00
Fredrik Höglund e393cc9069 kwin: Rename some variables in GLXBackend
ctxbuffer       → ctx
glxbuffer       → glxDrawable
buffer          → drawable
fbcbuffer       → fbconfig
fbcbuffer_db    → fbconfig_db
fbcbuffer_nondb → fbconfig_nondb
2013-03-17 17:53:38 +01:00
Ralf Jung 3a6d55b16e Get rid of the unreliable lastMask in the GL backend
REVIEW: 109396
2013-03-12 11:55:28 +01:00
Thomas Lübking 9aef5b85a0 support a permanent glSwapBuffer
either by
- forcing fullrepaints unconditionally
- turning a repaint to a full one beyond a threshhold
- completing the the backbuffer from the frontbuffer after the paint

BUG: 307965
FIXED-IN: 4.10
REVIEW: 107198
2013-03-05 19:24:30 +01:00
Thomas Lübking 69b2804a12 Initialize some variables and check on destruction
BUG: 313911
REVIEW: 108604
2013-01-30 10:45:21 +01:00
Ralf Jung 96bc979ca8 Fix buffer swap prototypes
BUG: 309647
REVIEW: 107302
2012-11-18 12:50:31 +01:00
Fredrik Höglund 6e9901e5c3 Merge branch 'KDE/4.9'
Conflicts:
	kwin/eglonxbackend.cpp
	kwin/glxbackend.cpp
	kwin/libkwineffects/kwinglplatform.cpp
2012-10-30 23:26:06 +01:00
Fredrik Höglund e578676f42 kwin: Rename flushBuffer() to present()
This function doesn't flush any buffered commands, it presents or posts
the color buffer to the surface to which the GL context is bound.
2012-10-29 21:31:17 +01:00
Martin Gräßlin 388edab9e5 Add support for OpenGL in VirtualBox
OpenGL is properly working if there is a direct rendering context.
If LIBGL_ALWAYS_INDIRECT is set VirtualBox falls back to Mesa's software
rasterizer. So in order to get OpenGL the driver is now whitelisted in
the opengltest.

GLPlatform is extended to recognize the VirtualBox driver and has new
methods to report whether it is a virtual machine and VirtualBox. The
detection is rather limited as we don't get access to the underlying
hardware, so we do not know whether the features are really supported.
We need to trust the driver here in announcing the right extensions.

The driver does not provide glxQueryDrawable although it is part of
GLX 1.3. A hack is added in the glxbackend to set the function pointer to
NULL. This can unfortunately not be done in glxResolveFunctions() as
QueryDrawable seems not to be provided by an extension (at least not
listed in the OpenGL registry) and getProcAddress resolves a function but
it only prints an OpenGL Warning to stderr.

As a note: the driver reports that it is using XSHM for
GLX_EXT_texture_from_pixmap.

REVIEW: 106821
2012-10-25 11:27:28 +02:00
Martin Gräßlin 476adac337 Do not resolve glx functions specified in GLX 1.3
According to the OpenGL ABI for Linux GLX 1.3 is a minimum requirement.
Therefore we do not need to resolve the symbols which are present in that
version.

KWin did always require at least 1.3, for all the resolved functions
there were checks in the Scene, but they might have been incorrect.
Instead now the GLX version is checked and OpenGL compositing is blocked
if there is not at least GLX 1.3.

REVIEW: 106704
2012-10-04 17:17:51 +02:00
Martin Gräßlin a401558a43 Provide OpenGL over Egl
The Egl backend is decoupled from the OpenGL ES build option which makes
it possible to use it as a replacement for glx.

To make this possible a new build flag is added when egl is available at
compile time and any egl specific code is now ifdefed with this flag
instead of the gles flag. In addition at runtime a windowing system enum
value is passed to the various detect methods to have egl/glx specific
detection for e.g. function pointer resolving.

By default egl is used if compiled with OpenGL ES, otherwise glx is used.
But in the non-gles case the windowing system can be selected through the
new environment variable KWIN_OPENGL_INTERFACE. Setting this variable to
"egl" the EglOnXBackend is used.

REVIEW: 106632
2012-10-04 17:17:01 +02:00
Martin Gräßlin 6152cc4fa5 Split out the windowing system related part of SceneOpenGL
The handling for creating and managing the OpenGL context is
split out of the SceneOpenGL into the abstract OpenGLBackend
and it's two subclasses GlxBackend and EglOnXBackend.

The backends take care of creating the OpenGL context on the
windowing system, e.g. on glx an OpenGL context on the overlay
window is created and in the egl case an EGL context is created.
This means that the SceneOpenGL itself does not have to care
about the specific underlying infrastructure.

Furthermore the backend provides the Textures for the specific
texture from pixmap operations. For that in each of the backend
files an additional subclass of the TexturePrivate is defined.
These subclasses hold the EglImage and GLXPixmap respectively.

The backend is able to create such a private texture and for
that the ctor of the Texture is changed to take the backend as
a parameter and the Scene provides a factory method for
creating Textures. To make this work inside Window the Textures
are now hold as pointers which seems a better choice anyway as
to the member functions pointers are passed.
2012-09-16 21:28:05 +02:00