blob: 71efcc73e511cbd541e5621c431109ed11cbc649 [file] [log] [blame]
Gurchetan Singh5521bde2016-09-30 14:53:32 -07001/*
2 * Copyright 2016 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
10static drv_format_t vgem_resolve_format(drv_format_t format)
11{
12 switch (format) {
13 case DRV_FORMAT_FLEX_IMPLEMENTATION_DEFINED:
14 /*HACK: See b/28671744 */
15 return DRV_FORMAT_XBGR8888;
16 case DRV_FORMAT_FLEX_YCbCr_420_888:
17 return DRV_FORMAT_YVU420;
18 default:
19 return format;
20 }
21}
22
23const struct backend backend_vgem =
24{
25 .name = "vgem",
26 .bo_create = drv_dumb_bo_create,
27 .bo_destroy = drv_dumb_bo_destroy,
28 .bo_map = drv_dumb_bo_map,
29 .resolve_format = vgem_resolve_format,
30 .format_list = {
31 {DRV_FORMAT_ABGR8888, DRV_BO_USE_SCANOUT | DRV_BO_USE_RENDERING | DRV_BO_USE_CURSOR
32 | DRV_BO_USE_SW_READ_OFTEN | DRV_BO_USE_SW_WRITE_OFTEN},
33 {DRV_FORMAT_YVU420, DRV_BO_USE_SCANOUT | DRV_BO_USE_RENDERING |
34 DRV_BO_USE_SW_READ_RARELY | DRV_BO_USE_SW_WRITE_RARELY},
35 }
36};
37