st/egl: Set dpms to on when showing screens
authorJakob Bornecrantz <wallbraker@gmail.com>
Wed, 25 Mar 2009 20:51:47 +0000 (20:51 +0000)
committerJakob Bornecrantz <jakob@vmware.com>
Wed, 25 Mar 2009 21:06:40 +0000 (21:06 +0000)
There is a wonderful bug in 2.6.29 that causes a hard lock on my
computer when this code is active for lvds that are turned off.

src/gallium/state_trackers/egl/egl_surface.c
src/gallium/state_trackers/egl/egl_tracker.c
src/gallium/state_trackers/egl/egl_tracker.h

index e6e80b985aa2cf5133ea319d83431ae9ca326a56..ca545b12e6858e658ce3f55158e9968b4f3131f7 100644 (file)
@@ -330,6 +330,13 @@ drm_show_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy,
        if (ret)
                goto err_crtc;
 
+
+       if (scrn->dpms)
+               drmModeConnectorSetProperty(dev->drmFD,
+                                           scrn->connectorID,
+                                           scrn->dpms->prop_id,
+                                           DRM_MODE_DPMS_ON);
+
        surf->screen = scrn;
 
        scrn->surf = surf;
index 9667c7ee3d46a88dabe6303b0801b2de8e2cc957..abdf84544f3f54f8b8238b920a5718b0705f273a 100644 (file)
@@ -107,6 +107,25 @@ drm_add_modes_from_connector(_EGLScreen *screen, drmModeConnectorPtr connector)
        }
 }
 
+static void
+drm_find_dpms(struct drm_device *dev, struct drm_screen *screen)
+{
+       drmModeConnectorPtr c = screen->connector;
+       drmModePropertyPtr p;
+       int i;
+
+       for (i = 0; i < c->count_props; i++) {
+               p = drmModeGetProperty(dev->drmFD, c->props[i]);
+               if (!strcmp(p->name, "DPMS"))
+                       break;
+
+               drmModeFreeProperty(p);
+               p = NULL;
+       }
+
+       screen->dpms = p;
+}
+
 EGLBoolean
 drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
 {
@@ -160,6 +179,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
                _eglInitScreen(&screen->base);
                _eglAddScreen(disp, &screen->base);
                drm_add_modes_from_connector(&screen->base, connector);
+               drm_find_dpms(dev, screen);
                dev->screens[num_screens++] = screen;
        }
        dev->count_screens = num_screens;
@@ -206,6 +226,7 @@ drm_terminate(_EGLDriver *drv, EGLDisplay dpy)
                if (screen->shown)
                        drm_takedown_shown_screen(drv, screen);
 
+               drmModeFreeProperty(screen->dpms);
                drmModeFreeConnector(screen->connector);
                _eglDestroyScreen(&screen->base);
                dev->screens[i] = NULL;
index 908bab5f9bf6d5ecd2df1a6f9b6045438ce78948..ce2717de639b396813df82a125fad16a6537c676 100644 (file)
@@ -114,6 +114,9 @@ struct drm_screen
        drmModeConnectorPtr connector;
        uint32_t connectorID;
 
+       /* dpms property */
+       drmModePropertyPtr dpms;
+
        /* Has this screen been shown */
        int shown;