Project
Loading...
Searching...
No Matches
GPUDisplayFrontendWayland.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef GPUDISPLAYFRONTENDWAYLAND_H
16#define GPUDISPLAYFRONTENDWAYLAND_H
17
18#include "GPUDisplayFrontend.h"
19#include <pthread.h>
20#include <wayland-client.h>
21
22struct xdg_wm_base;
23struct xdg_toplevel;
24struct xdg_surface;
25struct zxdg_decoration_manager_v1;
26struct zxdg_toplevel_decoration_v1;
27struct xkb_context;
28struct xkb_keymap;
29struct xkb_state;
30
31namespace o2::gpu
32{
34{
35 public:
37 ~GPUDisplayFrontendWayland() override = default;
38
39 int32_t StartDisplay() override;
40 void DisplayExit() override;
41 void SwitchFullscreen(bool set) override;
42 void ToggleMaximized(bool set) override;
43 void SetVSync(bool enable) override;
44 void OpenGLPrint(const char* s, float x, float y, float r, float g, float b, float a, bool fromBotton = true) override;
45 void getSize(int32_t& width, int32_t& height) override;
46 int32_t getVulkanSurface(void* instance, void* surface) override;
47 uint32_t getReqVulkanExtensions(const char**& p) override;
48
49 private:
50 int32_t FrontendMain() override;
51 int32_t GetKey(uint32_t key, uint32_t state);
52 void createBuffer(uint32_t width, uint32_t height);
53 void recreateBuffer(uint32_t width, uint32_t height);
54
55 pthread_mutex_t mSemLockExit = PTHREAD_MUTEX_INITIALIZER;
56 volatile bool mDisplayRunning = false;
57
58 wl_display* mWayland = nullptr;
59 wl_registry* mRegistry = nullptr;
60
61 wl_compositor* mCompositor = nullptr;
62 wl_seat* mSeat = nullptr;
63 wl_pointer* mPointer = nullptr;
64 wl_keyboard* mKeyboard = nullptr;
65 xdg_wm_base* mXdgBase = nullptr;
66 wl_shm* mShm = nullptr;
67
68 wl_surface* mSurface = nullptr;
69 xdg_surface* mXdgSurface = nullptr;
70 xdg_toplevel* mXdgToplevel = nullptr;
71
72 wl_output* mOutput = nullptr;
73
74 int32_t mFd = 0;
75 wl_shm_pool* mPool;
76 wl_buffer* mBuffer;
77
78 xkb_context* mXKBcontext = nullptr;
79 xkb_keymap* mXKBkeymap = nullptr;
80 xkb_state* mXKBstate = nullptr;
81
82 zxdg_decoration_manager_v1* mDecManager = nullptr;
83 // zxdg_toplevel_decoration_v1* mXdgDecoration = nullptr;
84
85 int32_t mWidthRequested = 0;
86 int32_t mHeightRequested = 0;
87};
88} // namespace o2::gpu
89
90#endif
benchmark::State & state
StringRef key
~GPUDisplayFrontendWayland() override=default
int32_t getVulkanSurface(void *instance, void *surface) override
void getSize(int32_t &width, int32_t &height) override
void OpenGLPrint(const char *s, float x, float y, float r, float g, float b, float a, bool fromBotton=true) override
uint32_t getReqVulkanExtensions(const char **&p) override
GLint GLenum GLint x
Definition glcorearb.h:403
GLint GLsizei GLsizei height
Definition glcorearb.h:270
GLint GLsizei width
Definition glcorearb.h:270
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLboolean GLboolean g
Definition glcorearb.h:1233
GLboolean enable
Definition glcorearb.h:3991
GLboolean r
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
HANDLE pthread_mutex_t