From e03b5cdf3fb4dafe565c06179124644e218e9cde Mon Sep 17 00:00:00 2001 From: Jon Smirl Date: Tue, 17 May 2005 02:12:29 +0000 Subject: [PATCH] Make EGL_NO_MODE_MESA work. --- src/egl/main/eglscreen.c | 2 +- src/mesa/drivers/dri/fb/fb_egl.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c index 9669a22c07e..230fc4a7a4b 100644 --- a/src/egl/main/eglscreen.c +++ b/src/egl/main/eglscreen.c @@ -187,7 +187,7 @@ _eglShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, _eglError(EGL_BAD_SCREEN_MESA, "eglShowSurfaceMESA"); return EGL_FALSE; } - if (!mode) { + if (!mode && (m != EGL_NO_MODE_MESA )) { _eglError(EGL_BAD_MODE_MESA, "eglShowSurfaceMESA"); return EGL_FALSE; } diff --git a/src/mesa/drivers/dri/fb/fb_egl.c b/src/mesa/drivers/dri/fb/fb_egl.c index 8af14d1d160..d83d264a970 100644 --- a/src/mesa/drivers/dri/fb/fb_egl.c +++ b/src/mesa/drivers/dri/fb/fb_egl.c @@ -731,7 +731,7 @@ fbShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, if (!_eglShowSurfaceMESA(drv, dpy, screen, surface, m)) return EGL_FALSE; - snprintf(buffer, sizeof(buffer), "%s/%s/mode", sysfs, scrn->fb); + snprintf(buffer, sizeof(buffer), "%s/%s/blank", sysfs, scrn->fb); file = fopen(buffer, "r+"); if (!file) { @@ -739,6 +739,18 @@ err: printf("chown all fb sysfs attrib to allow write - %s\n", buffer); return EGL_FALSE; } + snprintf(buffer, sizeof(buffer), "%d", (m == EGL_NO_MODE_MESA ? VESA_POWERDOWN : VESA_HSYNC_SUSPEND)); + fputs(buffer, file); + fclose(file); + + if (m == EGL_NO_MODE_MESA) + return EGL_TRUE; + + snprintf(buffer, sizeof(buffer), "%s/%s/mode", sysfs, scrn->fb); + + file = fopen(buffer, "r+"); + if (!file) + goto err; fputs(mode->Name, file); fclose(file); @@ -751,6 +763,14 @@ err: fputs(buffer, file); fclose(file); + file = fopen(buffer, "r+"); + if (!file) + goto err; + + snprintf(buffer, sizeof(buffer), "%d", VESA_NO_BLANKING); + fputs(buffer, file); + fclose(file); + return EGL_TRUE; } -- 2.30.2