1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright © 2011 Intel Corporation 3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a 5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the "Software"), 6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * to deal in the Software without restriction, including without limitation 7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * and/or sell copies of the Software, and to permit persons to whom the 9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Software is furnished to do so, subject to the following conditions: 10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the next 12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * paragraph) shall be included in all copies or substantial portions of the 13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Software. 14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * DEALINGS IN THE SOFTWARE. 23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Authors: 25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Benjamin Franzke <benjaminfranzke@googlemail.com> 26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef _GBM_H_ 29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define _GBM_H_ 30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifdef __cplusplus 32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern "C" { 33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif 34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define __GBM__ 1 37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <stdint.h> 39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \file gbm.h 42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \brief Generic Buffer Manager 43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct gbm_device; 46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct gbm_bo; 47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct gbm_surface; 48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \mainpage The Generic Buffer Manager 51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * This module provides an abstraction that the caller can use to request a 53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * buffer from the underlying memory management system for the platform. 54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * This allows the creation of portable code whilst still allowing access to 56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the underlying memory manager. 57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Abstraction representing the handle to a buffer allocated by the 61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * manager 62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgunion gbm_bo_handle { 64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void *ptr; 65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int32_t s32; 66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t u32; 67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int64_t s64; 68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint64_t u64; 69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** Format of the allocated buffer */ 72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgenum gbm_bo_format { 73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** RGB with 8 bits per channel in a 32 bit value */ 74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GBM_BO_FORMAT_XRGB8888, 75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** ARGB with 8 bits per channel in a 32 bit value */ 76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GBM_BO_FORMAT_ARGB8888 77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \ 80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) 81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ 83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* color index */ 85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_C8 __gbm_fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ 86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 8 bpp RGB */ 88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGB332 __gbm_fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ 89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGR233 __gbm_fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ 90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 16 bpp RGB */ 92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_XRGB4444 __gbm_fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ 93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_XBGR4444 __gbm_fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ 94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGBX4444 __gbm_fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ 95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGRX4444 __gbm_fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ 96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_ARGB4444 __gbm_fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ 98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_ABGR4444 __gbm_fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ 99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGBA4444 __gbm_fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ 100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGRA4444 __gbm_fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ 101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_XRGB1555 __gbm_fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ 103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_XBGR1555 __gbm_fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ 104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGBX5551 __gbm_fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ 105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGRX5551 __gbm_fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ 106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_ARGB1555 __gbm_fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ 108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_ABGR1555 __gbm_fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ 109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGBA5551 __gbm_fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ 110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGRA5551 __gbm_fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ 111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGB565 __gbm_fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ 113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGR565 __gbm_fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ 114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 24 bpp RGB */ 116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGB888 __gbm_fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ 117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGR888 __gbm_fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ 118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 32 bpp RGB */ 120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_XRGB8888 __gbm_fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ 121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_XBGR8888 __gbm_fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ 122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGBX8888 __gbm_fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ 123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGRX8888 __gbm_fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ 124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_ARGB8888 __gbm_fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ 126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_ABGR8888 __gbm_fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ 127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGBA8888 __gbm_fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ 128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGRA8888 __gbm_fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ 129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_XRGB2101010 __gbm_fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ 131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_XBGR2101010 __gbm_fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ 132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGBX1010102 __gbm_fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ 133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGRX1010102 __gbm_fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ 134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_ARGB2101010 __gbm_fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ 136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_ABGR2101010 __gbm_fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ 137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_RGBA1010102 __gbm_fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ 138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_BGRA1010102 __gbm_fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ 139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* packed YCbCr */ 141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YUYV __gbm_fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ 142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YVYU __gbm_fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ 143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_UYVY __gbm_fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ 144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_VYUY __gbm_fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ 145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_AYUV __gbm_fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ 147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 2 plane YCbCr 150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * index 0 = Y plane, [7:0] Y 151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian 152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * or 153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian 154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_NV12 __gbm_fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ 156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_NV21 __gbm_fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ 157f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_NV16 __gbm_fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ 158f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_NV61 __gbm_fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ 159f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 160f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 161f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 3 plane YCbCr 162f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * index 0: Y plane, [7:0] Y 163f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * index 1: Cb plane, [7:0] Cb 164f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * index 2: Cr plane, [7:0] Cr 165f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * or 166f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * index 1: Cr plane, [7:0] Cr 167f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * index 2: Cb plane, [7:0] Cb 168f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 169f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YUV410 __gbm_fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ 170f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YVU410 __gbm_fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ 171f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YUV411 __gbm_fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ 172f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YVU411 __gbm_fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ 173f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YUV420 __gbm_fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ 174f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YVU420 __gbm_fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ 175f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YUV422 __gbm_fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ 176f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YVU422 __gbm_fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ 177f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YUV444 __gbm_fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ 178f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_FORMAT_YVU444 __gbm_fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ 179f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 180f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 181f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 182f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Flags to indicate the intended use for the buffer - these are passed into 183f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * gbm_bo_create(). The caller must set the union of all the flags that are 184f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * appropriate 185f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 186f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \sa Use gbm_device_is_format_supported() to check if the combination of format 187f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * and use flags are supported 188f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 189f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgenum gbm_bo_flags { 190f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 191f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Buffer is going to be presented to the screen using an API such as KMS 192f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 193f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GBM_BO_USE_SCANOUT = (1 << 0), 194f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 195f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Buffer is going to be used as cursor - the dimensions for the buffer 196f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * must be 64x64 if this flag is passed. 197f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 198f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GBM_BO_USE_CURSOR_64X64 = (1 << 1), 199f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 200f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Buffer is to be used for rendering - for example it is going to be used 201f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * as the storage for a color buffer 202f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 203f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GBM_BO_USE_RENDERING = (1 << 2), 204f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 205f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Buffer can be used for gbm_bo_write. This is guaranteed to work 206f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * with GBM_BO_USE_CURSOR_64X64. but may not work for other 207f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * combinations. 208f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 209f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GBM_BO_USE_WRITE = (1 << 3), 210f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 211f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 212f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgint 213f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_device_get_fd(struct gbm_device *gbm); 214f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 215f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconst char * 216f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_device_get_backend_name(struct gbm_device *gbm); 217f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 218f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgint 219f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_device_is_format_supported(struct gbm_device *gbm, 220f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t format, uint32_t usage); 221f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 222f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 223f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_device_destroy(struct gbm_device *gbm); 224f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 225f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct gbm_device * 226f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_create_device(int fd); 227f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 228f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct gbm_bo * 229f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_create(struct gbm_device *gbm, 230f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t width, uint32_t height, 231f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t format, uint32_t flags); 232f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 233f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_BO_IMPORT_WL_BUFFER 0x5501 234f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GBM_BO_IMPORT_EGL_IMAGE 0x5502 235f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 236f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct gbm_bo * 237f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_import(struct gbm_device *gbm, uint32_t type, 238f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void *buffer, uint32_t usage); 239f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 240f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orguint32_t 241f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_get_width(struct gbm_bo *bo); 242f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 243f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orguint32_t 244f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_get_height(struct gbm_bo *bo); 245f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 246f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orguint32_t 247f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_get_stride(struct gbm_bo *bo); 248f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 249f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orguint32_t 250f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_get_format(struct gbm_bo *bo); 251f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 252f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct gbm_device * 253f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_get_device(struct gbm_bo *bo); 254f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 255f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgunion gbm_bo_handle 256f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_get_handle(struct gbm_bo *bo); 257f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 258f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgint 259f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count); 260f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 261f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 262f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_set_user_data(struct gbm_bo *bo, void *data, 263f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void (*destroy_user_data)(struct gbm_bo *, void *)); 264f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 265f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid * 266f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_get_user_data(struct gbm_bo *bo); 267f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 268f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 269f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_bo_destroy(struct gbm_bo *bo); 270f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 271f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct gbm_surface * 272f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_surface_create(struct gbm_device *gbm, 273f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t width, uint32_t height, 274f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t format, uint32_t flags); 275f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 276f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct gbm_bo * 277f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_surface_lock_front_buffer(struct gbm_surface *surface); 278f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 279f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 280f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_surface_release_buffer(struct gbm_surface *surface, struct gbm_bo *bo); 281f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 282f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgint 283f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_surface_has_free_buffers(struct gbm_surface *surface); 284f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 285f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 286f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggbm_surface_destroy(struct gbm_surface *surface); 287f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 288f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifdef __cplusplus 289f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 290f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif 291f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 292f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif 293