OSDN Git Service

minigbm: cros_gralloc: fix rendernode query
[android-x86/external-minigbm.git] / exynos.c
index 3d58c02..d6dc7de 100644 (file)
--- a/exynos.c
+++ b/exynos.c
 #include "helpers.h"
 #include "util.h"
 
+static struct supported_combination combos[5] = {
+       {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR},
+       {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING},
+       {DRM_FORMAT_NV12, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING},
+       {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR},
+       {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING},
+};
+
+static int exynos_init(struct driver *drv)
+{
+       drv_insert_combinations(drv, combos, ARRAY_SIZE(combos));
+       return drv_add_kms_flags(drv);
+}
+
 static int exynos_bo_create(struct bo *bo, uint32_t width, uint32_t height,
                            uint32_t format, uint32_t flags)
 {
        size_t plane;
 
-       if (format == DRV_FORMAT_NV12) {
+       if (format == DRM_FORMAT_NV12) {
                uint32_t chroma_height;
                /* V4L2 s5p-mfc requires width to be 16 byte aligned and height 32. */
                width = ALIGN(width, 16);
@@ -33,9 +47,10 @@ static int exynos_bo_create(struct bo *bo, uint32_t width, uint32_t height,
                bo->sizes[0] = bo->strides[0] * height + 64;
                bo->sizes[1] = bo->strides[1] * chroma_height + 64;
                bo->offsets[0] = bo->offsets[1] = 0;
-       } else if (format == DRV_FORMAT_XRGB8888 || format == DRV_FORMAT_ARGB8888) {
-               bo->strides[0] = drv_stride_from_format(format, width);
-               bo->sizes[0] = height * bo->strides[0];
+               bo->total_size = bo->sizes[0] + bo->sizes[1];
+       } else if (format == DRM_FORMAT_XRGB8888 || format == DRM_FORMAT_ARGB8888) {
+               bo->strides[0] = drv_stride_from_format(format, width, 0);
+               bo->total_size = bo->sizes[0] = height * bo->strides[0];
                bo->offsets[0] = 0;
        } else {
                fprintf(stderr, "drv: unsupported format %X\n", format);
@@ -85,19 +100,13 @@ cleanup_planes:
  * Use dumb mapping with exynos even though a GEM buffer is created.
  * libdrm does the same thing in exynos_drm.c
  */
-const struct backend backend_exynos =
+struct backend backend_exynos =
 {
        .name = "exynos",
+       .init = exynos_init,
        .bo_create = exynos_bo_create,
        .bo_destroy = drv_gem_bo_destroy,
        .bo_map = drv_dumb_bo_map,
-       .format_list = {
-               {DRV_FORMAT_XRGB8888, DRV_BO_USE_SCANOUT | DRV_BO_USE_CURSOR | DRV_BO_USE_RENDERING},
-               {DRV_FORMAT_XRGB8888, DRV_BO_USE_SCANOUT | DRV_BO_USE_CURSOR | DRV_BO_USE_LINEAR},
-               {DRV_FORMAT_ARGB8888, DRV_BO_USE_SCANOUT | DRV_BO_USE_CURSOR | DRV_BO_USE_RENDERING},
-               {DRV_FORMAT_ARGB8888, DRV_BO_USE_SCANOUT | DRV_BO_USE_CURSOR | DRV_BO_USE_LINEAR},
-               {DRV_FORMAT_NV12, DRV_BO_USE_SCANOUT | DRV_BO_USE_RENDERING},
-       }
 };
 
 #endif