external/gbm_gralloc
Revisão | 0afe1961cda99527fa8827cfaeece393b77b57fc (tree) |
---|---|
Hora | 2019-01-14 14:16:42 |
Autor | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
Open the DRM device of the primary framebuffer (fb0)
With the new added drmOpenByFB function in libdrm, it's easy to find
the correct DRM device of the primary framebuffer.
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
@@ -34,6 +34,7 @@ | ||
34 | 34 | #include <sys/stat.h> |
35 | 35 | #include <fcntl.h> |
36 | 36 | #include <assert.h> |
37 | +#include <xf86drm.h> | |
37 | 38 | |
38 | 39 | #include <hardware/gralloc.h> |
39 | 40 | #include <system/graphics.h> |
@@ -313,8 +314,11 @@ struct gbm_device *gbm_dev_create(bool master) | ||
313 | 314 | char path[PROPERTY_VALUE_MAX]; |
314 | 315 | int fd; |
315 | 316 | |
316 | - property_get("gralloc.gbm.device", path, master ? "/dev/dri/card0" : "/dev/dri/renderD128"); | |
317 | - fd = open(path, O_RDWR | O_CLOEXEC); | |
317 | + if (property_get("gralloc.gbm.device", path, NULL) > 0) | |
318 | + fd = open(path, O_RDWR | O_CLOEXEC); | |
319 | + else | |
320 | + fd = drmOpenByFB(0, master ? DRM_NODE_PRIMARY : DRM_NODE_RENDER); | |
321 | + | |
318 | 322 | if (fd < 0) { |
319 | 323 | ALOGE("failed to open %s", path); |
320 | 324 | return NULL; |