summaryrefslogtreecommitdiff
path: root/kmscube/cube-gbm.cpp
diff options
context:
space:
mode:
authorKaido Kert <kaidokert@gmail.com>2024-11-29 04:47:25 +0000
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2024-12-09 12:35:38 +0200
commitaaab406251540429522c5ef7808ee049c65a06d2 (patch)
tree65b6681f3dab077e5341d9cb386f2e71220d12af /kmscube/cube-gbm.cpp
parent6cf6e88715ac034f568603bce9a1b8f4a30c12ce (diff)
Implement native visual matching
Implement matching GBM buffer format to EGL NATIVE_VISUAL_ID. eglChooseConfig cannot match on NATIVE_VISUAL_ID, but GBM/EGL requires matching formats. Similar logic is implemented in kmscube code in match_config_to_visual. X11, Wayland and Null cube demos remain unchanged. Tested on Raspi-4 and VirtualBox/Ubuntu
Diffstat (limited to 'kmscube/cube-gbm.cpp')
-rw-r--r--kmscube/cube-gbm.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/kmscube/cube-gbm.cpp b/kmscube/cube-gbm.cpp
index 034ae8a..69930ee 100644
--- a/kmscube/cube-gbm.cpp
+++ b/kmscube/cube-gbm.cpp
@@ -49,10 +49,10 @@ private:
class GbmSurface
{
public:
- GbmSurface(GbmDevice& gdev, int width, int height)
+ GbmSurface(GbmDevice& gdev, int width, int height, uint32_t format)
{
m_surface = gbm_surface_create(gdev.handle(), width, height,
- GBM_FORMAT_XRGB8888,
+ format,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
FAIL_IF(!m_surface, "failed to create gbm surface");
}
@@ -93,7 +93,7 @@ public:
: card(card), egl(egl), m_width(width), m_height(height),
bo_prev(0), bo_next(0)
{
- gsurface = unique_ptr<GbmSurface>(new GbmSurface(gdev, width, height));
+ gsurface = unique_ptr<GbmSurface>(new GbmSurface(gdev, width, height, egl.native_visual_id()));
esurface = eglCreateWindowSurface(egl.display(), egl.config(), gsurface->handle(), NULL);
FAIL_IF(esurface == EGL_NO_SURFACE, "failed to create egl surface");
}
@@ -319,7 +319,7 @@ void main_gbm()
FAIL_IF(!card.has_atomic(), "No atomic modesetting");
GbmDevice gdev(card);
- EglState egl(gdev.handle());
+ EglState egl(gdev.handle(), GBM_FORMAT_XRGB8888);
ResourceManager resman(card);