Changeset View
Changeset View
Standalone View
Standalone View
platformsupport/scenes/opengl/abstract_egl_backend.cpp
Show All 12 Lines | |||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "abstract_egl_backend.h" | 20 | #include "abstract_egl_backend.h" | ||
21 | #include "linux_dmabuf.h" | 21 | #include "egl_dmabuf.h" | ||
22 | #include "texture.h" | 22 | #include "texture.h" | ||
23 | #include "composite.h" | 23 | #include "composite.h" | ||
24 | #include "egl_context_attribute_builder.h" | 24 | #include "egl_context_attribute_builder.h" | ||
25 | #include "options.h" | 25 | #include "options.h" | ||
26 | #include "platform.h" | 26 | #include "platform.h" | ||
27 | #include "scene.h" | 27 | #include "scene.h" | ||
28 | #include "wayland_server.h" | 28 | #include "wayland_server.h" | ||
29 | #include <KWayland/Server/buffer_interface.h> | 29 | #include <KWayland/Server/buffer_interface.h> | ||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Line(s) | 165 | if (!eglBindWaylandDisplayWL(eglDisplay(), *(WaylandServer::self()->display()))) { | |||
166 | eglUnbindWaylandDisplayWL = nullptr; | 166 | eglUnbindWaylandDisplayWL = nullptr; | ||
167 | eglQueryWaylandBufferWL = nullptr; | 167 | eglQueryWaylandBufferWL = nullptr; | ||
168 | } else { | 168 | } else { | ||
169 | waylandServer()->display()->setEglDisplay(eglDisplay()); | 169 | waylandServer()->display()->setEglDisplay(eglDisplay()); | ||
170 | } | 170 | } | ||
171 | } | 171 | } | ||
172 | } | 172 | } | ||
173 | 173 | | |||
174 | LinuxDmabuf::factory(this); | 174 | EglDmabuf::factory(this); | ||
175 | } | 175 | } | ||
176 | 176 | | |||
177 | void AbstractEglBackend::initClientExtensions() | 177 | void AbstractEglBackend::initClientExtensions() | ||
178 | { | 178 | { | ||
179 | // Get the list of client extensions | 179 | // Get the list of client extensions | ||
180 | const char* clientExtensionsCString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); | 180 | const char* clientExtensionsCString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); | ||
181 | const QByteArray clientExtensionsString = QByteArray::fromRawData(clientExtensionsCString, qstrlen(clientExtensionsCString)); | 181 | const QByteArray clientExtensionsString = QByteArray::fromRawData(clientExtensionsCString, qstrlen(clientExtensionsCString)); | ||
182 | if (clientExtensionsString.isEmpty()) { | 182 | if (clientExtensionsString.isEmpty()) { | ||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Line(s) | 377 | if (updateFromFBO(pixmap->fbo())) { | |||
378 | return; | 378 | return; | ||
379 | } | 379 | } | ||
380 | if (updateFromInternalImageObject(pixmap)) { | 380 | if (updateFromInternalImageObject(pixmap)) { | ||
381 | return; | 381 | return; | ||
382 | } | 382 | } | ||
383 | return; | 383 | return; | ||
384 | } | 384 | } | ||
385 | auto s = pixmap->surface(); | 385 | auto s = pixmap->surface(); | ||
386 | if (DmabufBuffer *dmabuf = static_cast<DmabufBuffer *>(buffer->linuxDmabufBuffer())) { | 386 | if (EglDmabufBuffer *dmabuf = static_cast<EglDmabufBuffer *>(buffer->linuxDmabufBuffer())) { | ||
387 | q->bind(); | 387 | q->bind(); | ||
388 | glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES) dmabuf->images()[0]); //TODO | 388 | glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES) dmabuf->images()[0]); //TODO | ||
389 | q->unbind(); | 389 | q->unbind(); | ||
390 | if (m_image != EGL_NO_IMAGE_KHR) { | 390 | if (m_image != EGL_NO_IMAGE_KHR) { | ||
391 | eglDestroyImageKHR(m_backend->eglDisplay(), m_image); | 391 | eglDestroyImageKHR(m_backend->eglDisplay(), m_image); | ||
392 | } | 392 | } | ||
393 | m_image = EGL_NO_IMAGE_KHR; // The wl_buffer has ownership of the image | 393 | m_image = EGL_NO_IMAGE_KHR; // The wl_buffer has ownership of the image | ||
394 | // The origin in a dmabuf-buffer is at the upper-left corner, so the meaning | 394 | // The origin in a dmabuf-buffer is at the upper-left corner, so the meaning | ||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | 530 | if (EGL_NO_IMAGE_KHR == m_image) { | |||
533 | return false; | 533 | return false; | ||
534 | } | 534 | } | ||
535 | 535 | | |||
536 | return true; | 536 | return true; | ||
537 | } | 537 | } | ||
538 | 538 | | |||
539 | bool AbstractEglTexture::loadDmabufTexture(const QPointer< KWayland::Server::BufferInterface > &buffer) | 539 | bool AbstractEglTexture::loadDmabufTexture(const QPointer< KWayland::Server::BufferInterface > &buffer) | ||
540 | { | 540 | { | ||
541 | DmabufBuffer *dmabuf = static_cast<DmabufBuffer *>(buffer->linuxDmabufBuffer()); | 541 | auto *dmabuf = static_cast<EglDmabufBuffer *>(buffer->linuxDmabufBuffer()); | ||
542 | if (!dmabuf || dmabuf->images()[0] == EGL_NO_IMAGE_KHR) { | 542 | if (!dmabuf || dmabuf->images()[0] == EGL_NO_IMAGE_KHR) { | ||
543 | qCritical(KWIN_OPENGL) << "Invalid dmabuf-based wl_buffer"; | 543 | qCritical(KWIN_OPENGL) << "Invalid dmabuf-based wl_buffer"; | ||
544 | q->discard(); | 544 | q->discard(); | ||
545 | return false; | 545 | return false; | ||
546 | } | 546 | } | ||
547 | 547 | | |||
548 | Q_ASSERT(m_image == EGL_NO_IMAGE_KHR); | 548 | Q_ASSERT(m_image == EGL_NO_IMAGE_KHR); | ||
549 | 549 | | |||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |