diff --git a/util/display-x11.c b/util/display-x11.c
index 2f9cb2a75ce56d18829e8d43d02981c673aabcef..d63f5e8c179b1d7594631a26c01f86579b5b1bac 100644 (file)
--- a/util/display-x11.c
+++ b/util/display-x11.c
#include <sys/stat.h>
#include <fcntl.h>
+static int global_fd = 0;
#define to_display_x11(x) container_of(x, struct display_x11, base)
struct display_x11 {
for (j = 0; dri2bufs[i].names[j]; j++) {
buf->bo[j] = omap_bo_from_name(disp->dev, dri2bufs[i].names[j]);
+ buf->pitches[j] = dri2bufs[i].pitch[j];
}
+
buf->nbo = j;
bufs[i] = buf;
disp = &disp_x11->base;
- disp->fd = open(device, O_RDWR);
- if (disp->fd < 0) {
- ERROR("could not open drm device: %s (%d)", strerror(errno), errno);
- goto no_x11_free;
- }
+ if (!global_fd) {
+ MSG("opening device: %s", device);
+ global_fd = open(device, O_RDWR);
+ if (global_fd < 0) {
+ ERROR("could not open drm device: %s (%d)",
+ strerror(errno), errno);
+ goto no_x11_free;
+ }
- if (drmGetMagic(disp->fd, &magic)) {
- ERROR("drmGetMagic failed");
- goto no_x11_free;
- }
+ if (drmGetMagic(global_fd, &magic)) {
+ ERROR("drmGetMagic failed");
+ goto no_x11_free;
+ }
- if (!DRI2Authenticate(dpy, root, magic)) {
- ERROR("DRI2Authenticate failed");
- goto no_x11_free;
+ if (!DRI2Authenticate(dpy, root, magic)) {
+ ERROR("DRI2Authenticate failed");
+ goto no_x11_free;
+ }
}
+ disp->fd = global_fd;
+
disp->dev = omap_device_new(disp->fd);
if (!disp->dev) {
ERROR("couldn't create device");