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
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.
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.
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*.
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.
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
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
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
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.
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.
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.
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.
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.
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.
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.
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.
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.