Skip to content

Commit 62bfc59

Browse files
committed
kdrive/fbdev: Allow forcing glamor to create GL/GLES contexts
This brings fbdev's glamor code in line with glamor/glamor_egl.c Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
1 parent 162fda3 commit 62bfc59

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

hw/kdrive/fbdev/fb_glamor.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
const char *fbdev_glvnd_provider = "mesa";
2020

21+
Bool es_allowed = TRUE;
22+
Bool force_es = FALSE;
23+
2124
static void
2225
fbdev_glamor_egl_cleanup(FbdevScrPriv *scrpriv)
2326
{
@@ -310,11 +313,11 @@ fbdev_glamor_egl_try_gles_api(FbdevScrPriv *scrpriv)
310313
static Bool
311314
fbdev_glamor_bind_gl_api(FbdevScrPriv *scrpriv)
312315
{
313-
if (fbdev_glamor_egl_try_big_gl_api(scrpriv)) {
316+
if (!force_es && fbdev_glamor_egl_try_big_gl_api(scrpriv)) {
314317
return TRUE;
315318
}
316319

317-
return fbdev_glamor_egl_try_gles_api(scrpriv);
320+
return es_allowed && fbdev_glamor_egl_try_gles_api(scrpriv);
318321
}
319322

320323
static Bool

hw/kdrive/fbdev/fbdev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ extern Bool fbDisableShadow;
6464

6565
#if defined(GLAMOR) && defined(GLXEXT)
6666
extern const char *fbdev_glvnd_provider;
67+
extern Bool es_allowed;
68+
extern Bool force_es;
6769
#endif
6870

6971
Bool fbdevCardInit(KdCardInfo * card);

hw/kdrive/fbdev/fbinit.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ ddxUseMsg(void)
7373
ErrorF
7474
("-glvendor Suggest what glvnd vendor library should be used\n");
7575
ErrorF("\n");
76+
ErrorF
77+
("-force-gl Force glamor to only use GL contexts\n");
78+
ErrorF
79+
("-force-es Force glamor to only use GLES contexts\n");
7680
}
7781

7882
int
@@ -101,6 +105,16 @@ ddxProcessArgument(int argc, char **argv, int i)
101105
UseMsg();
102106
exit(1);
103107
}
108+
109+
if (!strcmp(argv[i], "-force-gl")) {
110+
es_allowed = FALSE;
111+
return 1;
112+
}
113+
114+
if (!strcmp(argv[i], "-force-es")) {
115+
force_es = TRUE;
116+
return 1;
117+
}
104118
#endif
105119

106120
return KdProcessArgument(argc, argv, i);

0 commit comments

Comments
 (0)