blob: 7d0d8be8fa781d46fbd1c1479a9f2545b95e24ab [file] [log] [blame]
Anders Delliene5bef532020-06-10 10:30:44 +01001/*
2 * Copyright 2020 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7#include "drv_priv.h"
8#include "helpers.h"
9#include "util.h"
10
11#define INIT_DUMB_DRIVER(driver) \
12 const struct backend backend_##driver = { \
13 .name = #driver, \
14 .init = dumb_driver_init, \
15 .bo_create = drv_dumb_bo_create, \
16 .bo_destroy = drv_dumb_bo_destroy, \
17 .bo_import = drv_prime_bo_import, \
18 .bo_map = drv_dumb_bo_map, \
19 .bo_unmap = drv_bo_munmap, \
20 };
21
22static const uint32_t scanout_render_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888,
23 DRM_FORMAT_ABGR8888, DRM_FORMAT_XBGR8888,
24 DRM_FORMAT_BGR888, DRM_FORMAT_BGR565 };
25
26static const uint32_t texture_only_formats[] = { DRM_FORMAT_NV12, DRM_FORMAT_NV21,
27 DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID };
28
29static int dumb_driver_init(struct driver *drv)
30{
31 drv_add_combinations(drv, scanout_render_formats, ARRAY_SIZE(scanout_render_formats),
32 &LINEAR_METADATA, BO_USE_RENDER_MASK | BO_USE_SCANOUT);
33
34 drv_add_combinations(drv, texture_only_formats, ARRAY_SIZE(texture_only_formats),
35 &LINEAR_METADATA, BO_USE_TEXTURE_MASK);
36
37 drv_modify_combination(drv, DRM_FORMAT_NV12, &LINEAR_METADATA,
38 BO_USE_HW_VIDEO_ENCODER | BO_USE_HW_VIDEO_DECODER |
39 BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE);
40 drv_modify_combination(drv, DRM_FORMAT_NV21, &LINEAR_METADATA, BO_USE_HW_VIDEO_ENCODER);
41
42 return drv_modify_linear_combinations(drv);
43}
44
Gurchetan Singh238001f2020-10-28 15:00:10 -070045INIT_DUMB_DRIVER(evdi)
Anders Delliene5bef532020-06-10 10:30:44 +010046INIT_DUMB_DRIVER(komeda)
47INIT_DUMB_DRIVER(marvell)
48INIT_DUMB_DRIVER(meson)
49INIT_DUMB_DRIVER(nouveau)
50INIT_DUMB_DRIVER(radeon)
51INIT_DUMB_DRIVER(synaptics)
Gurchetan Singh238001f2020-10-28 15:00:10 -070052INIT_DUMB_DRIVER(udl)