OSDN Git Service

minigbm: fix renderscipt allocation
[android-x86/external-minigbm.git] / gbm.c
diff --git a/gbm.c b/gbm.c
index 7389cd8..89726dd 100644 (file)
--- a/gbm.c
+++ b/gbm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The Chromium OS Authors. All rights reserved.
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
@@ -42,8 +42,7 @@ gbm_device_is_format_supported(struct gbm_device *gbm,
 
        drv_usage = gbm_convert_flags(usage);
 
-       return drv_is_combination_supported(gbm->drv, format, drv_usage,
-                                           DRM_FORMAT_MOD_NONE);
+       return (drv_get_combination(gbm->drv, format, drv_usage) != NULL);
 }
 
 PUBLIC struct gbm_device *gbm_create_device(int fd)
@@ -137,6 +136,32 @@ PUBLIC struct gbm_bo *gbm_bo_create(struct gbm_device *gbm, uint32_t width,
        return bo;
 }
 
+PUBLIC struct gbm_bo *gbm_bo_create_with_modifiers(struct gbm_device *gbm,
+                                                  uint32_t width,
+                                                  uint32_t height,
+                                                  uint32_t format,
+                                                  const uint64_t *modifiers,
+                                                  uint32_t count)
+{
+       struct gbm_bo *bo;
+
+       bo = gbm_bo_new(gbm, format);
+
+       if (!bo)
+               return NULL;
+
+       bo->bo = drv_bo_create_with_modifiers(gbm->drv,
+                                             width, height, format,
+                                             modifiers, count);
+
+       if (!bo->bo) {
+               free(bo);
+               return NULL;
+       }
+
+       return bo;
+}
+
 PUBLIC void gbm_bo_destroy(struct gbm_bo *bo)
 {
        if (bo->destroy_user_data) {