Commit graph

521 commits

Author SHA1 Message Date
Martin Gräßlin
0c448f2ed2 Merge branch 'Plasma/5.4' 2015-09-14 16:52:06 +02:00
Marco Martin
5a55727056 support the slide protocol
take and apply thhe informations from the wayland slide
protocol in the sliding popups effect

REVIEW:125120
2015-09-14 16:39:39 +02:00
Martin Gräßlin
5fb67414d2 [libkwineffects] Proper no-size check in WindowQuadList::splitAt(X|Y)
A quad might have a null size in case it has a null width or null height.
Not just one dimension.

BUG: 236353
BUG: 210467
FIXED-IN: 5.4.2
REVIEW: 125131
2015-09-10 10:43:06 +02:00
Marco Martin
3f5bf65a9e Use the kwayland blur protocol in the blur effect
use the new blur protocol to fetch information about the
region of blur behind to apply to windows like Plasma::Dialog
REVIEW:125017
2015-09-02 14:43:44 +02:00
Martin Gräßlin
c24e315a9b Drop build option KWIN_BUILD_EGL
It doesn't make much sense any more as we do no longer link EGL since the
switch to epoxy. And epoxy pulls it in at runtime if needed.
Even more on Wayland it's just plain stupid to have EGL disabled. So
removing the option just simplifies our code base without any
disadvantages.

REVIEW: 124695
2015-08-11 11:15:25 +02:00
Martin Gräßlin
57c521c214 [libkwineffects] Introduce logging categories for libkwineffects 2015-07-31 12:16:15 +02:00
Aleix Pol
6f345f4915 Clean debug output
Removes endl in the end of qDebug.
Removes the \n in the end of opengl output.

REVIEW: 124320
2015-07-20 13:36:27 +02:00
Martin Gräßlin
c31bb6d46f Drop KF5::Service dependency where it's no longer needed 2015-07-07 09:53:48 +02:00
Nerdopolis Turfwalker
924b66c4d5 Check whether it's platform xcb before calling QX11Info::display()
Internally QX11Info::display() calls into QPA native interface and
tries to resolve the nativeResourceForIntegration for "display".
Unfortunately this key also exists in other QPA plugins, e.g. in
QtWayland.

Calling without a check on platform results on wayland qpa in
wl_display* being casted into Display*.

REVIEW: 124203
2015-06-29 13:56:56 +02:00
Martin Gräßlin
59a6c9ddf9 [libkwineffects] OpenGL ES 3.0 supports glBlitFramebuffer 2015-06-24 09:39:02 +02:00
David Edmundson
42768d515a Add missing include
Reviewed-by: Martin G
2015-05-12 14:26:48 +01:00
Martin Gräßlin
4bf479aca2 [libkwineffects] GL_NONE instead of None in GLTexture
It's about GL not about Xlib, so use GL_NONE instead of None.
Additional bonus: it compiles if the file does not include Xlib.
2015-05-11 16:25:00 +02:00
Martin Gräßlin
713c6b25dc [kwinglutils] Init glVersion on gles
The glVersion was not set at all for gles causing any code doing a
hasGLVersion check to fail which means that the compositor doesn't
start at all, because it has a hasGLVersion(2, 0) check.

The complete ifdef is no longer needed. The used additional glGetStringi
is also available in gles 3.0, thus epoxy can handle it quite well
without a need for ifdef.

Unfortunately the version string can be "strange" on GLES. On desktop
it looks like: "3.0 some driver foo", on GLES it could also be:
"OpenGL ES 3.0 some driver bar". Thus to make the logic work we are
first removing any leading "OpenGL ES " and hope that then the version
is encoded just like on GL.
2015-05-08 08:53:34 +02:00
Thomas Lübking
c5bb84469d make window elevation scriptable 2015-04-07 23:59:17 +02:00
Thomas Lübking
4a9b56d950 forward showingDesktop signal to effects 2015-04-07 23:59:17 +02:00
Martin Gräßlin
f1f87c7a7d Guard access to Display in GLPlatform::getXServerVersion
On wayland OpenGL might get initialized before we have a connection
to the XServer and we might only have an xcb connection. So let's
guard the access.
2015-03-17 10:20:19 +01:00
Martin Gräßlin
8c15da99ae Use property for x11AppScreen in KWin::Application
Already provided by KWin::Application so let's use it instead of
QX11Info::appScreen.

REVIEW: 122683
2015-03-17 09:44:53 +01:00
Martin Gräßlin
0d51952d78 Provide x11Connection as a property on the KWin::Application
KWin::connection() uses the property to resolve the value instead of
using QX11Info. In practice this doesn't change anything at the moment,
but allows kwin_wayland to provide an xcb connection without depending
on QX11Info.

As we cannot make xcb_connection_t* available as a metatype, the
property's type is set to void*.
2015-03-17 09:44:53 +01:00
Martin Gräßlin
fe9873e4b1 Provide x11RootWindow as a property on the KWin::Application
KWin::rootWindow() uses the property to resolve the value instead of
using QX11Info. In practice this doesn't change anything at the moment,
but allows kwin_wayland to provide a root window without depending on
QX11Info.
2015-03-17 09:44:53 +01:00
Martin Gräßlin
d95ab94f0a Migrate away from QX11Info::appTime
The porting to Qt5 broke the timestamp handling in many areas. A deeper
look into Qt's xcb plugin shows that the appTime handling is not
sufficient for KWin's need. E.g. the time is only updated in response to
a property notify event if it's for a Qt created window, which is hardly
ever the case in KWin. Another example is that key press/release events
never updated the appTime.

As the functionality in Qt is rather trivial we can do the timestamp
handling ourselves. We filter all events anyway and it is slightly faster
as we don't have to go through the QPA interface any more.

REVIEW: 122636
2015-02-23 11:02:59 +01:00
Martin Gräßlin
caf99f83d5 Require Qt 5.4
REVIEW: 122617
2015-02-19 10:56:50 +01:00
Martin Gräßlin
230f8dea24 Merge branch 'Plasma/5.2' 2015-02-19 10:56:37 +01:00
Martin Gräßlin
7bbb68aad6 Check GL version and/or extension for using texture format GL_R8
BUG: 344301
FIXED-IN: 5.2.1
REVIEW: 122615
2015-02-18 09:09:50 +01:00
Martin Gräßlin
5c4f1dffa3 Merge branch 'Plasma/5.2' 2015-02-11 15:32:28 +01:00
Martin Gräßlin
d344b6cc3d Fix glPixelStore in GLTexture::update
Resetting glPixelStore is bound to the variable useUnpack, but setting
was only bound to a subset of the checks going into useUnpack variable.
This could cause an assert if one updated with a QImage not in format
ARGB32_Premultiplied.

REVIEW: 122521
2015-02-11 15:31:51 +01:00
Thomas Lübking
31cfd02756 forward cursorshape changes to effectshandler
CCBUG: 322088
REVIEW: 122468
2015-02-10 21:41:39 +01:00
Kai Uwe Broulik
e814a60045 Add isOnScreenDisplay to EffectWindow 2015-01-31 19:45:47 +01:00
Tobias C. Berner
ef3f0f753b Add <array> include where needed, to make it build on FreeBSD.
REVIEW: 122090
2015-01-17 15:22:11 +02:00
Martin Gräßlin
6b0ae95b80 Increase so-version for kwineffect libraries
Known ABI changes in at least GLTexture, probably more places.
2015-01-09 16:03:23 +01:00
Thomas Lübking
f61d3ade84 shortcut rendering textures for empty an rect
it makes no sense and there's a good chance
that in this case m_vbo is still nullptr and
it will not be created since d->m_cachedSize
will be an empty size as well
-> nullptr access -> crash

BUG: 337090
FIXED-IN: 5.2
2015-01-08 00:29:04 +01:00
Fredrik Höglund
35110d72c6 Avoid converting images in GLTexture when possible
Don't convert the QImage when the image format can be specified as
a format/type combination to glTex(Sub)Image().
2014-12-30 21:22:00 +01:00
Fredrik Höglund
7fd4cf0227 Add GLTexture::setSwizzle()
This method allows the caller to specify which component of a texel
is placed in each respective component of the vector returned to the
shader.
2014-12-30 21:19:49 +01:00
Fredrik Höglund
4d738b86ea Add an internalFormat parameter to the GLTexture ctor
This parameter is ignored on GLES.
2014-12-30 21:19:49 +01:00
Fredrik Höglund
74b65fcd00 Add support for GL_ARB_texture_storage
Use glTexStorage2D() to allocate storage for the texture. The structure
of the resulting texture becomes immutable and the texture is always
mipmap complete.  This allows the driver to skip the mipmap consistency
checks when validating the texture at draw time.
2014-12-14 18:33:52 +01:00
Fredrik Höglund
450be6a378 Add a levels parameter to the GLTexture ctor
Prior to this commit we didn't know if mipmaps were going to be used
when we created the GL texture, which meant that we couldn't tell the
driver whether to allocate storage for mipmaps or not.

This resulted in one of two things happening depending on the driver;
either it would allocate storage for mipmaps that in most cases would
never be used, or it wouldn't and would later be forced to reallocate
the texture when mipmaps were added.

By adding this parameter we can now explicitly tell the driver how
many mipmap levels will be used.

The parameter is only added to the non-image constructor for now. The
image constructor is changed to only allocate a single level, which
matches how textures created from images are used in kwin. This may
need to be revisited in the future.
2014-12-14 18:33:52 +01:00
Fredrik Höglund
ccf1bad426 Make mipmap filters other than GL_LINEAR_MIPMAP_LINEAR work
GLTexture would set both the minification and magnification filters
to GL_NEAREST if the texture filter was set to any mipmap filter other
than GL_LINEAR_MIPMAP_LINEAR.
2014-12-14 18:33:52 +01:00
Fredrik Höglund
aefadfaa6a Don't generate mipmaps in GLTexture::bind()
This code is broken in a number of different ways; firstly by assuming
that the mipmaps need to be regenerated when the texture filter has
changed. Secondly by preventing mipmaps from being specified by other
means.

This commit removes the code from bind() and adds a generateMipmaps()
method instead.
2014-12-14 18:33:52 +01:00
Fredrik Höglund
f8d1a0868a Test the generated shaders on startup
Compile and bind each shader in turn and render a textured quad.
2014-12-04 19:19:30 +01:00
Fredrik Höglund
d2cb9f9bf6 Add a model-view and a projection matrix in WindowPaintData
Effects currently modify the matrices by reading back the uniform
values from the shader they assume will be used to paint the window,
set new values for the uniforms, call paintWindow(), and then restore
the uniforms to their previous values.

This is both slow and unreliable, and will not work with dynamically
generated shaders.

This patch solves the problem by putting the matrices in
WindowPaintData and making it the responsibility of the paintWindow()
implementation to set the uniforms.
2014-12-04 19:19:30 +01:00
Fredrik Höglund
05c309da67 Add a ModelViewProjectionMatrix uniform 2014-12-04 19:19:29 +01:00
Fredrik Höglund
afcc8337de Add support for generating shaders at runtime
This adds new API in ShaderManager that makes it possible to request a
shader based on a set of traits. ShaderManager generates these shaders
on demand and caches them in a hash table.
2014-12-04 19:19:22 +01:00
Fredrik Höglund
90dfb3ca8b Grow the persistently mapped VBO as needed
Reallocate the buffer when the average frame size is greater than half
the size of the buffer.
2014-12-03 19:50:59 +01:00
Fredrik Höglund
4b3fabbfc9 Add support for GL_ARB_buffer_storage
Use a persistently mapped buffer object for the vertex streaming buffer
when GL_ARB_buffer_storage is supported.
2014-12-03 19:50:59 +01:00
Martin Gräßlin
bf4ba54647 Remove displayWidth and displayHeight from the compositor
Instead of getting size from displayWidth() and displayHeight() use
the information we have from Screens. This means there is only one
place to have the information and by that we can ensure that all
components use the same data to rely on. displayWidth/displayHeight
seem to provide the wrong information when unplugging an output
without disabling the output. This results in rendering artefacts.
But KWin::Screens has the correct information available.
2014-11-27 09:00:19 +01:00
Fredrik Höglund
9d01ed16be Remove GLTexturePrivate::bind()/unbind()
These virtual methods are not reimplemented anywhere.
2014-11-26 22:01:54 +01:00
Fredrik Höglund
4b9448db5e Inline GLTexture::load(QImage) in the constructor
This is the only place where it is called.

There was also no need for this function to be virtual since it's not
reimplemented anywhere.

This also fixes the GLTexturePrivate being created only to be
immediately deleted and replaced by a new GLTexturePrivate when the
GLTexture(QImage) constructor was used.

With this change the structure of the GLTexture effectively becomes
immutable to the outside world; the contents of the texture images can
change, but the texture images themselves cannot be reallocated.
2014-11-26 22:01:54 +01:00
Fredrik Höglund
9c7720abca Remove GLTexture::load(QPixmap) and load(QString)
These methods are only called from the GLTexture constructors,
so inline them there.
2014-11-26 22:01:54 +01:00
Fredrik Höglund
383a5ac319 Remove GLTexturePrivate::convertToGLFormat()
QImage::Format_RGBA8888_Premultiplied is the equivalent of
GL_RGBA/GL_UNSIGNED_BYTE, so use QImage::convertToFormat()
instead.

This commit also makes the texture upload code work correctly
on big-endian systems.
2014-11-26 22:01:23 +01:00
Fredrik Höglund
6ac7371113 Remove most calls to checkGLError()
...and rely on KHR_debug/GL_ARB_debug_output instead.
2014-11-25 21:57:57 +01:00
Fredrik Höglund
cb39eb0cc5 Use consistent names for the static members in GLTexturePrivate 2014-11-23 20:20:16 +01:00