OSDN Git Service

minigbm: Switch to <drm_fourcc.h>
[android-x86/external-minigbm.git] / vgem.c
1 /*
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
10 static uint32_t vgem_resolve_format(uint32_t format)
11 {
12         switch (format) {
13         case DRM_FORMAT_FLEX_IMPLEMENTATION_DEFINED:
14                 /*HACK: See b/28671744 */
15                 return DRM_FORMAT_XBGR8888;
16         case DRM_FORMAT_FLEX_YCbCr_420_888:
17                 return DRM_FORMAT_YVU420;
18         default:
19                 return format;
20         }
21 }
22
23 const 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                 {DRM_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                 {DRM_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