OSDN Git Service

minigbm: Add dumb buffer 'nouveau' backend.
authorDaniele Castagna <dcastagna@chromium.org>
Fri, 16 Dec 2016 21:24:06 +0000 (16:24 -0500)
committerchrome-bot <chrome-bot@chromium.org>
Sat, 17 Dec 2016 22:43:49 +0000 (14:43 -0800)
Adding a nouveau backend to minigbm can be useful to test ozone code
on our workstations.

This CL adds a nouveau backend that uses dumb buffers.
This is enough to run ozone_gl_unittests and ozone_demo on our
workstations.

BUG=None
TEST='Ran ozone_demo on my workstation.'

Change-Id: I4e690192c9d9944b9907e64253205a94605a76eb
Reviewed-on: https://chromium-review.googlesource.com/421606
Commit-Ready: David Reveman <reveman@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
drv.c
nouveau.c [new file with mode: 0644]

diff --git a/drv.c b/drv.c
index 3a9ab4c..335e893 100644 (file)
--- a/drv.c
+++ b/drv.c
@@ -35,6 +35,7 @@ extern struct backend backend_marvell;
 #ifdef DRV_MEDIATEK
 extern struct backend backend_mediatek;
 #endif
+extern struct backend backend_nouveau;
 #ifdef DRV_ROCKCHIP
 extern struct backend backend_rockchip;
 #endif
@@ -74,6 +75,7 @@ static struct backend *drv_get_backend(int fd)
 #ifdef DRV_MEDIATEK
                &backend_mediatek,
 #endif
+               &backend_nouveau,
 #ifdef DRV_ROCKCHIP
                &backend_rockchip,
 #endif
diff --git a/nouveau.c b/nouveau.c
new file mode 100644 (file)
index 0000000..91a7c78
--- /dev/null
+++ b/nouveau.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016 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.
+ */
+
+#include "drv_priv.h"
+#include "helpers.h"
+#include "util.h"
+
+static struct supported_combination combos[2] = {
+       {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_RENDERING},
+       {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_RENDERING},
+};
+
+static int nouveau_init(struct driver *drv)
+{
+       drv_insert_combinations(drv, combos, ARRAY_SIZE(combos));
+       return drv_add_kms_flags(drv);
+}
+
+struct backend backend_nouveau =
+{
+       .name = "nouveau",
+       .init = nouveau_init,
+       .bo_create = drv_dumb_bo_create,
+       .bo_destroy = drv_dumb_bo_destroy,
+       .bo_map = drv_dumb_bo_map,
+};