OSDN Git Service

minigbm:amdgpu: align stride to 256
[android-x86/external-minigbm.git] / cros_gralloc / cros_gralloc_driver.cc
index 8096b7f..66087f5 100644 (file)
@@ -26,6 +26,10 @@ cros_gralloc_driver::~cros_gralloc_driver()
        }
 }
 
+int cros_gralloc_driver::get_fd() const {
+       return drv_get_fd(drv_);
+}
+
 int32_t cros_gralloc_driver::init()
 {
        /*
@@ -49,7 +53,7 @@ int32_t cros_gralloc_driver::init()
                        if (asprintf(&node, str, DRM_DIR_NAME, j) < 0)
                                continue;
 
-                       fd = open(node, O_RDWR, 0);
+                       fd = open(node, O_RDWR | O_CLOEXEC, 0);
                        free(node);
 
                        if (fd < 0)
@@ -74,6 +78,18 @@ int32_t cros_gralloc_driver::init()
        return -ENODEV;
 }
 
+int cros_gralloc_driver::init_master()
+{
+       int fd = open(DRM_DIR_NAME "/card0", O_RDWR, 0);
+       if (fd >= 0) {
+               drv_ = drv_create(fd);
+               if (drv_)
+                       return 0;
+       }
+
+       return -ENODEV;
+}
+
 bool cros_gralloc_driver::is_supported(const struct cros_gralloc_buffer_descriptor *descriptor)
 {
        struct combination *combo;