Skip to content

Commit bf79256

Browse files
committed
Detect Android driver to disable x11 direcft_copy of buffers (for #504)
1 parent e6112d0 commit bf79256

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/glx/glx.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,13 +2822,17 @@ void BlitEmulatedPixmap(int win) {
28222822
}
28232823
static int direct_copy = 1;
28242824
if(direct_copy) {
2825-
LOAD_EGL(eglCopyBuffers);
2826-
if(!egl_eglCopyBuffers(eglDisplay, buff->Surface, (EGLNativePixmapType)frame)) {
2827-
LOGE("Cannot use eglCopyBuffers, disabling it's use: ");
2828-
CheckEGLErrors();
2825+
if(hardext.android)
28292826
direct_copy = 0;
2830-
} else
2831-
return;
2827+
else {
2828+
LOAD_EGL(eglCopyBuffers);
2829+
if(!egl_eglCopyBuffers(eglDisplay, buff->Surface, (EGLNativePixmapType)frame)) {
2830+
LOGE("Cannot use eglCopyBuffers, disabling it's use: ");
2831+
CheckEGLErrors();
2832+
direct_copy = 0;
2833+
} else
2834+
return;
2835+
}
28322836
}
28332837
uintptr_t pix=(uintptr_t)frame->data;
28342838

src/glx/hardext.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,18 @@ void GetHardwareExtensions(int notest)
213213
}
214214

215215
egl_eglChooseConfig(eglDisplay, configAttribs, pbufConfigs, 1, &configsFound);
216+
const char* eglExts = egl_eglQueryString(eglDisplay, EGL_EXTENSIONS);
216217
#ifndef NO_GBM
217-
const char* eglExts = egl_eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
218218
if(eglExts && strstr(eglExts, "EGL_KHR_platform_gbm ")) {
219219
SHUT_LOGD("GBM Surfaces supported%s\n", globals4es.usegbm?" and used":"");
220220
hardext.gbm = 1;
221221
}
222222
#endif
223+
//SHUT_LOGD("EGL extension: %s\n", eglExts);
224+
if(eglExts && strstr(eglExts, "EGL_ANDROID_image_native_buffer ")) {
225+
hardext.android = 1;
226+
SHUT_LOGD("Android driver detected, disabling X11 direct_copy for PBuffer\n");
227+
}
223228
#ifndef PANDORA
224229
if(!configsFound) {
225230
// try without alpha channel

src/glx/hardext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ typedef struct _hardext {
4747
int srgb; // EGL_KHR_gl_colorspace
4848
int mapbuffer; // GL_OES_mapbuffer
4949
int drawbuffers; // GL_EXT_draw_buffers
50+
int android; // Android driver detected (so X11 CopyBuffer cannot be used)
5051
// es2 stuffs
5152
int esversion; // 1 is ES1.1 backend, 2 is ES2
5253
int maxvattrib; // GL_MAX_VERTEX_ATTRIBS (or 0 if not using es2)

0 commit comments

Comments
 (0)