OSDN Git Service

minigbm: remove gma500
[android-x86/external-minigbm.git] / drv.c
diff --git a/drv.c b/drv.c
index a1be245..7e12873 100644 (file)
--- a/drv.c
+++ b/drv.c
 #ifdef DRV_AMDGPU
 extern const struct backend backend_amdgpu;
 #endif
+#ifdef DRV_AMLOGIC
+extern const struct backend backend_amlogic;
+#endif
 extern const struct backend backend_evdi;
 #ifdef DRV_EXYNOS
 extern const struct backend backend_exynos;
 #endif
-extern const struct backend backend_gma500;
 #ifdef DRV_I915
 extern const struct backend backend_i915;
 #endif
@@ -68,11 +70,13 @@ static const struct backend *drv_get_backend(int fd)
 #ifdef DRV_AMDGPU
                &backend_amdgpu,
 #endif
+#ifdef DRV_AMLOGIC
+               &backend_amlogic,
+#endif
                &backend_evdi,
 #ifdef DRV_EXYNOS
                &backend_exynos,
 #endif
-               &backend_gma500,
 #ifdef DRV_I915
                &backend_i915,
 #endif
@@ -136,18 +140,14 @@ struct driver *drv_create(int fd)
        if (!drv->mappings)
                goto free_buffer_table;
 
-       /* Start with a power of 2 number of allocations. */
-       drv->combos.allocations = 2;
-       drv->combos.size = 0;
-
-       drv->combos.data = calloc(drv->combos.allocations, sizeof(struct combination));
-       if (!drv->combos.data)
+       drv->combos = drv_array_init(sizeof(struct combination));
+       if (!drv->combos)
                goto free_mappings;
 
        if (drv->backend->init) {
                ret = drv->backend->init(drv);
                if (ret) {
-                       free(drv->combos.data);
+                       drv_array_destroy(drv->combos);
                        goto free_mappings;
                }
        }
@@ -174,8 +174,7 @@ void drv_destroy(struct driver *drv)
 
        drmHashDestroy(drv->buffer_table);
        drv_array_destroy(drv->mappings);
-
-       free(drv->combos.data);
+       drv_array_destroy(drv->combos);
 
        pthread_mutex_unlock(&drv->driver_lock);
        pthread_mutex_destroy(&drv->driver_lock);
@@ -202,8 +201,8 @@ struct combination *drv_get_combination(struct driver *drv, uint32_t format, uin
 
        best = NULL;
        uint32_t i;
-       for (i = 0; i < drv->combos.size; i++) {
-               curr = &drv->combos.data[i];
+       for (i = 0; i < drv_array_size(drv->combos); i++) {
+               curr = drv_array_at_idx(drv->combos, i);
                if ((format == curr->format) && use_flags == (curr->use_flags & use_flags))
                        if (!best || best->metadata.priority < curr->metadata.priority)
                                best = curr;