summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-04-10 17:16:08 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-04-10 17:16:08 -0400
commit04f335fd16c2a13b9425797acf5c3989cb6def7f (patch)
tree9e92cecb0b2ac512fac1fc4ef911878849eaeb42 /src/gallium/state_trackers/egl
parentc0419f190c836130932164ac47cfb53de668d423 (diff)
parent5e361c47abf2ee20140628d327eda9b39351d415 (diff)
Merge branch 'radeon-rewrite' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa into r6xx-rewrite
Diffstat (limited to 'src/gallium/state_trackers/egl')
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c9
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.c29
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.h3
3 files changed, 38 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index e6e80b985a..489aa8d9af 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -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;
@@ -399,8 +406,6 @@ drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
/* TODO stuff here */
}
-
- st_notify_swapbuffers_complete(surf->stfb);
}
return EGL_TRUE;
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c
index a22ef381b9..abdf84544f 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.c
+++ b/src/gallium/state_trackers/egl/egl_tracker.c
@@ -66,10 +66,13 @@ drm_get_device_id(struct drm_device *device)
{
char path[512];
FILE *file;
+ char *ret;
/* TODO get the real minor */
int minor = 0;
+ device->deviceID = 0;
+
snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", minor);
file = fopen(path, "r");
if (!file) {
@@ -77,7 +80,10 @@ drm_get_device_id(struct drm_device *device)
return;
}
- fgets(path, sizeof( path ), file);
+ ret = fgets(path, sizeof( path ), file);
+ if (!ret)
+ return;
+
sscanf(path, "%x", &device->deviceID);
fclose(file);
}
@@ -101,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)
{
@@ -154,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;
@@ -200,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;
diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h
index 908bab5f9b..ce2717de63 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.h
+++ b/src/gallium/state_trackers/egl/egl_tracker.h
@@ -114,6 +114,9 @@ struct drm_screen
drmModeConnectorPtr connector;
uint32_t connectorID;
+ /* dpms property */
+ drmModePropertyPtr dpms;
+
/* Has this screen been shown */
int shown;