summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: af8242a)
raw | patch | inline | side by side (parent: af8242a)
author | Rob Clark <rob@ti.com> | |
Thu, 1 Mar 2012 17:01:15 +0000 (11:01 -0600) | ||
committer | Rob Clark <rob@ti.com> | |
Thu, 1 Mar 2012 17:04:56 +0000 (11:04 -0600) |
This is needed if you have multiple dri2video windows in a single
process, since GEM handles only have meaning within the context of
a single file-open.
process, since GEM handles only have meaning within the context of
a single file-open.
util/display-x11.c | patch | blob | history |
diff --git a/util/display-x11.c b/util/display-x11.c
index 2f9cb2a75ce56d18829e8d43d02981c673aabcef..758b08fb60ac50c270e4d3292f44d72c82162254 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 {
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");