summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/drm/nouveau/common/nouveau_screen.c
diff options
context:
space:
mode:
authorYounes Manton <younes.m@gmail.com>2009-01-10 13:30:29 -0500
committerYounes Manton <younes.m@gmail.com>2009-01-10 13:52:07 -0500
commit8ee238be7587a232beeb56b1dc3b75e1b8fb903e (patch)
treea0b25eda15eb123ff7742f18faa735ea9e10b288 /src/gallium/winsys/drm/nouveau/common/nouveau_screen.c
parent734b3cb182b4b7d1075faf60c1a23ab0a55af356 (diff)
nouveau: Factor out common winsys bits into libnouveaudrm.a
Diffstat (limited to 'src/gallium/winsys/drm/nouveau/common/nouveau_screen.c')
-rw-r--r--src/gallium/winsys/drm/nouveau/common/nouveau_screen.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_screen.c b/src/gallium/winsys/drm/nouveau/common/nouveau_screen.c
new file mode 100644
index 0000000000..422fbf0207
--- /dev/null
+++ b/src/gallium/winsys/drm/nouveau/common/nouveau_screen.c
@@ -0,0 +1,31 @@
+#include <util/u_memory.h>
+#include "nouveau_dri.h"
+#include "nouveau_local.h"
+#include "nouveau_screen.h"
+
+int
+nouveau_screen_init(struct nouveau_dri *nv_dri, int dev_fd,
+ struct nouveau_screen *nv_screen)
+{
+ int ret;
+
+ ret = nouveau_device_open_existing(&nv_screen->device, 0,
+ dev_fd, 0);
+ if (ret) {
+ NOUVEAU_ERR("Failed opening nouveau device: %d\n", ret);
+ return 1;
+ }
+
+ nv_screen->front_offset = nv_dri->front_offset;
+ nv_screen->front_pitch = nv_dri->front_pitch * (nv_dri->bpp / 8);
+ nv_screen->front_cpp = nv_dri->bpp / 8;
+ nv_screen->front_height = nv_dri->height;
+
+ return 0;
+}
+
+void
+nouveau_screen_cleanup(struct nouveau_screen *nv_screen)
+{
+ nouveau_device_close(&nv_screen->device);
+}