1848b8605Smrg/* 2848b8605Smrg * Copyright © 2011 Intel Corporation 3848b8605Smrg * 4848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5848b8605Smrg * copy of this software and associated documentation files (the "Software"), 6848b8605Smrg * to deal in the Software without restriction, including without limitation 7848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 9848b8605Smrg * Software is furnished to do so, subject to the following conditions: 10848b8605Smrg * 11848b8605Smrg * The above copyright notice and this permission notice (including the next 12848b8605Smrg * paragraph) shall be included in all copies or substantial portions of the 13848b8605Smrg * Software. 14848b8605Smrg * 15848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16848b8605Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18848b8605Smrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19848b8605Smrg * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20848b8605Smrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21848b8605Smrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22848b8605Smrg * DEALINGS IN THE SOFTWARE. 23848b8605Smrg * 24848b8605Smrg * Authors: 25848b8605Smrg * Benjamin Franzke <benjaminfranzke@googlemail.com> 26848b8605Smrg */ 27848b8605Smrg 28848b8605Smrg#ifndef _GBM_H_ 29848b8605Smrg#define _GBM_H_ 30848b8605Smrg 31b8e80941Smrg#define __GBM__ 1 32b8e80941Smrg 33b8e80941Smrg#include <stddef.h> 34b8e80941Smrg#include <stdint.h> 35b8e80941Smrg 36848b8605Smrg#ifdef __cplusplus 37848b8605Smrgextern "C" { 38848b8605Smrg#endif 39848b8605Smrg 40848b8605Smrg 41848b8605Smrg/** 42848b8605Smrg * \file gbm.h 43848b8605Smrg * \brief Generic Buffer Manager 44848b8605Smrg */ 45848b8605Smrg 46848b8605Smrgstruct gbm_device; 47848b8605Smrgstruct gbm_bo; 48848b8605Smrgstruct gbm_surface; 49848b8605Smrg 50848b8605Smrg/** 51848b8605Smrg * \mainpage The Generic Buffer Manager 52848b8605Smrg * 53848b8605Smrg * This module provides an abstraction that the caller can use to request a 54848b8605Smrg * buffer from the underlying memory management system for the platform. 55848b8605Smrg * 56848b8605Smrg * This allows the creation of portable code whilst still allowing access to 57848b8605Smrg * the underlying memory manager. 58848b8605Smrg */ 59848b8605Smrg 60848b8605Smrg/** 61848b8605Smrg * Abstraction representing the handle to a buffer allocated by the 62848b8605Smrg * manager 63848b8605Smrg */ 64848b8605Smrgunion gbm_bo_handle { 65848b8605Smrg void *ptr; 66848b8605Smrg int32_t s32; 67848b8605Smrg uint32_t u32; 68848b8605Smrg int64_t s64; 69848b8605Smrg uint64_t u64; 70848b8605Smrg}; 71848b8605Smrg 72848b8605Smrg/** Format of the allocated buffer */ 73848b8605Smrgenum gbm_bo_format { 74848b8605Smrg /** RGB with 8 bits per channel in a 32 bit value */ 75848b8605Smrg GBM_BO_FORMAT_XRGB8888, 76848b8605Smrg /** ARGB with 8 bits per channel in a 32 bit value */ 77848b8605Smrg GBM_BO_FORMAT_ARGB8888 78848b8605Smrg}; 79848b8605Smrg 80b8e80941Smrg 81b8e80941Smrg/** 82b8e80941Smrg * The FourCC format codes are taken from the drm_fourcc.h definition, and 83b8e80941Smrg * re-namespaced. New GBM formats must not be added, unless they are 84b8e80941Smrg * identical ports from drm_fourcc. 85b8e80941Smrg */ 86848b8605Smrg#define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \ 87848b8605Smrg ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) 88848b8605Smrg 89848b8605Smrg#define GBM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ 90848b8605Smrg 91848b8605Smrg/* color index */ 92848b8605Smrg#define GBM_FORMAT_C8 __gbm_fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ 93848b8605Smrg 94b8e80941Smrg/* 8 bpp Red */ 95b8e80941Smrg#define GBM_FORMAT_R8 __gbm_fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ 96b8e80941Smrg 97b8e80941Smrg/* 16 bpp RG */ 98b8e80941Smrg#define GBM_FORMAT_GR88 __gbm_fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ 99b8e80941Smrg 100848b8605Smrg/* 8 bpp RGB */ 101848b8605Smrg#define GBM_FORMAT_RGB332 __gbm_fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ 102848b8605Smrg#define GBM_FORMAT_BGR233 __gbm_fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ 103848b8605Smrg 104848b8605Smrg/* 16 bpp RGB */ 105848b8605Smrg#define GBM_FORMAT_XRGB4444 __gbm_fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ 106848b8605Smrg#define GBM_FORMAT_XBGR4444 __gbm_fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ 107848b8605Smrg#define GBM_FORMAT_RGBX4444 __gbm_fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ 108848b8605Smrg#define GBM_FORMAT_BGRX4444 __gbm_fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ 109848b8605Smrg 110848b8605Smrg#define GBM_FORMAT_ARGB4444 __gbm_fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ 111848b8605Smrg#define GBM_FORMAT_ABGR4444 __gbm_fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ 112848b8605Smrg#define GBM_FORMAT_RGBA4444 __gbm_fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ 113848b8605Smrg#define GBM_FORMAT_BGRA4444 __gbm_fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ 114848b8605Smrg 115848b8605Smrg#define GBM_FORMAT_XRGB1555 __gbm_fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ 116848b8605Smrg#define GBM_FORMAT_XBGR1555 __gbm_fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ 117848b8605Smrg#define GBM_FORMAT_RGBX5551 __gbm_fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ 118848b8605Smrg#define GBM_FORMAT_BGRX5551 __gbm_fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ 119848b8605Smrg 120848b8605Smrg#define GBM_FORMAT_ARGB1555 __gbm_fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ 121848b8605Smrg#define GBM_FORMAT_ABGR1555 __gbm_fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ 122848b8605Smrg#define GBM_FORMAT_RGBA5551 __gbm_fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ 123848b8605Smrg#define GBM_FORMAT_BGRA5551 __gbm_fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ 124848b8605Smrg 125848b8605Smrg#define GBM_FORMAT_RGB565 __gbm_fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ 126848b8605Smrg#define GBM_FORMAT_BGR565 __gbm_fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ 127848b8605Smrg 128848b8605Smrg/* 24 bpp RGB */ 129848b8605Smrg#define GBM_FORMAT_RGB888 __gbm_fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ 130848b8605Smrg#define GBM_FORMAT_BGR888 __gbm_fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ 131848b8605Smrg 132848b8605Smrg/* 32 bpp RGB */ 133848b8605Smrg#define GBM_FORMAT_XRGB8888 __gbm_fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ 134848b8605Smrg#define GBM_FORMAT_XBGR8888 __gbm_fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ 135848b8605Smrg#define GBM_FORMAT_RGBX8888 __gbm_fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ 136848b8605Smrg#define GBM_FORMAT_BGRX8888 __gbm_fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ 137848b8605Smrg 138848b8605Smrg#define GBM_FORMAT_ARGB8888 __gbm_fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ 139848b8605Smrg#define GBM_FORMAT_ABGR8888 __gbm_fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ 140848b8605Smrg#define GBM_FORMAT_RGBA8888 __gbm_fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ 141848b8605Smrg#define GBM_FORMAT_BGRA8888 __gbm_fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ 142848b8605Smrg 143848b8605Smrg#define GBM_FORMAT_XRGB2101010 __gbm_fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ 144848b8605Smrg#define GBM_FORMAT_XBGR2101010 __gbm_fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ 145848b8605Smrg#define GBM_FORMAT_RGBX1010102 __gbm_fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ 146848b8605Smrg#define GBM_FORMAT_BGRX1010102 __gbm_fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ 147848b8605Smrg 148848b8605Smrg#define GBM_FORMAT_ARGB2101010 __gbm_fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ 149848b8605Smrg#define GBM_FORMAT_ABGR2101010 __gbm_fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ 150848b8605Smrg#define GBM_FORMAT_RGBA1010102 __gbm_fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ 151848b8605Smrg#define GBM_FORMAT_BGRA1010102 __gbm_fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ 152848b8605Smrg 153848b8605Smrg/* packed YCbCr */ 154848b8605Smrg#define GBM_FORMAT_YUYV __gbm_fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ 155848b8605Smrg#define GBM_FORMAT_YVYU __gbm_fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ 156848b8605Smrg#define GBM_FORMAT_UYVY __gbm_fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ 157848b8605Smrg#define GBM_FORMAT_VYUY __gbm_fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ 158848b8605Smrg 159848b8605Smrg#define GBM_FORMAT_AYUV __gbm_fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ 160848b8605Smrg 161848b8605Smrg/* 162848b8605Smrg * 2 plane YCbCr 163848b8605Smrg * index 0 = Y plane, [7:0] Y 164848b8605Smrg * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian 165848b8605Smrg * or 166848b8605Smrg * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian 167848b8605Smrg */ 168848b8605Smrg#define GBM_FORMAT_NV12 __gbm_fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ 169848b8605Smrg#define GBM_FORMAT_NV21 __gbm_fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ 170848b8605Smrg#define GBM_FORMAT_NV16 __gbm_fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ 171848b8605Smrg#define GBM_FORMAT_NV61 __gbm_fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ 172848b8605Smrg 173848b8605Smrg/* 174848b8605Smrg * 3 plane YCbCr 175848b8605Smrg * index 0: Y plane, [7:0] Y 176848b8605Smrg * index 1: Cb plane, [7:0] Cb 177848b8605Smrg * index 2: Cr plane, [7:0] Cr 178848b8605Smrg * or 179848b8605Smrg * index 1: Cr plane, [7:0] Cr 180848b8605Smrg * index 2: Cb plane, [7:0] Cb 181848b8605Smrg */ 182848b8605Smrg#define GBM_FORMAT_YUV410 __gbm_fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ 183848b8605Smrg#define GBM_FORMAT_YVU410 __gbm_fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ 184848b8605Smrg#define GBM_FORMAT_YUV411 __gbm_fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ 185848b8605Smrg#define GBM_FORMAT_YVU411 __gbm_fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ 186848b8605Smrg#define GBM_FORMAT_YUV420 __gbm_fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ 187848b8605Smrg#define GBM_FORMAT_YVU420 __gbm_fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ 188848b8605Smrg#define GBM_FORMAT_YUV422 __gbm_fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ 189848b8605Smrg#define GBM_FORMAT_YVU422 __gbm_fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ 190848b8605Smrg#define GBM_FORMAT_YUV444 __gbm_fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ 191848b8605Smrg#define GBM_FORMAT_YVU444 __gbm_fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ 192848b8605Smrg 193b8e80941Smrgstruct gbm_format_name_desc { 194b8e80941Smrg char name[5]; 195b8e80941Smrg}; 196848b8605Smrg 197848b8605Smrg/** 198848b8605Smrg * Flags to indicate the intended use for the buffer - these are passed into 199848b8605Smrg * gbm_bo_create(). The caller must set the union of all the flags that are 200848b8605Smrg * appropriate 201848b8605Smrg * 202848b8605Smrg * \sa Use gbm_device_is_format_supported() to check if the combination of format 203848b8605Smrg * and use flags are supported 204848b8605Smrg */ 205848b8605Smrgenum gbm_bo_flags { 206848b8605Smrg /** 207848b8605Smrg * Buffer is going to be presented to the screen using an API such as KMS 208848b8605Smrg */ 209848b8605Smrg GBM_BO_USE_SCANOUT = (1 << 0), 210848b8605Smrg /** 211848b8605Smrg * Buffer is going to be used as cursor 212848b8605Smrg */ 213848b8605Smrg GBM_BO_USE_CURSOR = (1 << 1), 214848b8605Smrg /** 215848b8605Smrg * Deprecated 216848b8605Smrg */ 217848b8605Smrg GBM_BO_USE_CURSOR_64X64 = GBM_BO_USE_CURSOR, 218848b8605Smrg /** 219848b8605Smrg * Buffer is to be used for rendering - for example it is going to be used 220848b8605Smrg * as the storage for a color buffer 221848b8605Smrg */ 222848b8605Smrg GBM_BO_USE_RENDERING = (1 << 2), 223848b8605Smrg /** 224848b8605Smrg * Buffer can be used for gbm_bo_write. This is guaranteed to work 225b8e80941Smrg * with GBM_BO_USE_CURSOR, but may not work for other combinations. 226848b8605Smrg */ 227848b8605Smrg GBM_BO_USE_WRITE = (1 << 3), 228b8e80941Smrg /** 229b8e80941Smrg * Buffer is linear, i.e. not tiled. 230b8e80941Smrg */ 231b8e80941Smrg GBM_BO_USE_LINEAR = (1 << 4), 232848b8605Smrg}; 233848b8605Smrg 234848b8605Smrgint 235848b8605Smrggbm_device_get_fd(struct gbm_device *gbm); 236848b8605Smrg 237848b8605Smrgconst char * 238848b8605Smrggbm_device_get_backend_name(struct gbm_device *gbm); 239848b8605Smrg 240848b8605Smrgint 241848b8605Smrggbm_device_is_format_supported(struct gbm_device *gbm, 242848b8605Smrg uint32_t format, uint32_t usage); 243848b8605Smrg 244b8e80941Smrgint 245b8e80941Smrggbm_device_get_format_modifier_plane_count(struct gbm_device *gbm, 246b8e80941Smrg uint32_t format, 247b8e80941Smrg uint64_t modifier); 248b8e80941Smrg 249848b8605Smrgvoid 250848b8605Smrggbm_device_destroy(struct gbm_device *gbm); 251848b8605Smrg 252848b8605Smrgstruct gbm_device * 253848b8605Smrggbm_create_device(int fd); 254848b8605Smrg 255848b8605Smrgstruct gbm_bo * 256848b8605Smrggbm_bo_create(struct gbm_device *gbm, 257848b8605Smrg uint32_t width, uint32_t height, 258848b8605Smrg uint32_t format, uint32_t flags); 259848b8605Smrg 260b8e80941Smrgstruct gbm_bo * 261b8e80941Smrggbm_bo_create_with_modifiers(struct gbm_device *gbm, 262b8e80941Smrg uint32_t width, uint32_t height, 263b8e80941Smrg uint32_t format, 264b8e80941Smrg const uint64_t *modifiers, 265b8e80941Smrg const unsigned int count); 266848b8605Smrg#define GBM_BO_IMPORT_WL_BUFFER 0x5501 267848b8605Smrg#define GBM_BO_IMPORT_EGL_IMAGE 0x5502 268848b8605Smrg#define GBM_BO_IMPORT_FD 0x5503 269b8e80941Smrg#define GBM_BO_IMPORT_FD_MODIFIER 0x5504 270848b8605Smrg 271848b8605Smrgstruct gbm_import_fd_data { 272848b8605Smrg int fd; 273848b8605Smrg uint32_t width; 274848b8605Smrg uint32_t height; 275848b8605Smrg uint32_t stride; 276848b8605Smrg uint32_t format; 277848b8605Smrg}; 278848b8605Smrg 279b8e80941Smrgstruct gbm_import_fd_modifier_data { 280b8e80941Smrg uint32_t width; 281b8e80941Smrg uint32_t height; 282b8e80941Smrg uint32_t format; 283b8e80941Smrg uint32_t num_fds; 284b8e80941Smrg int fds[4]; 285b8e80941Smrg int strides[4]; 286b8e80941Smrg int offsets[4]; 287b8e80941Smrg uint64_t modifier; 288b8e80941Smrg}; 289b8e80941Smrg 290848b8605Smrgstruct gbm_bo * 291848b8605Smrggbm_bo_import(struct gbm_device *gbm, uint32_t type, 292848b8605Smrg void *buffer, uint32_t usage); 293848b8605Smrg 294b8e80941Smrg/** 295b8e80941Smrg * Flags to indicate the type of mapping for the buffer - these are 296b8e80941Smrg * passed into gbm_bo_map(). The caller must set the union of all the 297b8e80941Smrg * flags that are appropriate. 298b8e80941Smrg * 299b8e80941Smrg * These flags are independent of the GBM_BO_USE_* creation flags. However, 300b8e80941Smrg * mapping the buffer may require copying to/from a staging buffer. 301b8e80941Smrg * 302b8e80941Smrg * See also: pipe_transfer_usage 303b8e80941Smrg */ 304b8e80941Smrgenum gbm_bo_transfer_flags { 305b8e80941Smrg /** 306b8e80941Smrg * Buffer contents read back (or accessed directly) at transfer 307b8e80941Smrg * create time. 308b8e80941Smrg */ 309b8e80941Smrg GBM_BO_TRANSFER_READ = (1 << 0), 310b8e80941Smrg /** 311b8e80941Smrg * Buffer contents will be written back at unmap time 312b8e80941Smrg * (or modified as a result of being accessed directly). 313b8e80941Smrg */ 314b8e80941Smrg GBM_BO_TRANSFER_WRITE = (1 << 1), 315b8e80941Smrg /** 316b8e80941Smrg * Read/modify/write 317b8e80941Smrg */ 318b8e80941Smrg GBM_BO_TRANSFER_READ_WRITE = (GBM_BO_TRANSFER_READ | GBM_BO_TRANSFER_WRITE), 319b8e80941Smrg}; 320b8e80941Smrg 321b8e80941Smrgvoid * 322b8e80941Smrggbm_bo_map(struct gbm_bo *bo, 323b8e80941Smrg uint32_t x, uint32_t y, uint32_t width, uint32_t height, 324b8e80941Smrg uint32_t flags, uint32_t *stride, void **map_data); 325b8e80941Smrg 326b8e80941Smrgvoid 327b8e80941Smrggbm_bo_unmap(struct gbm_bo *bo, void *map_data); 328b8e80941Smrg 329848b8605Smrguint32_t 330848b8605Smrggbm_bo_get_width(struct gbm_bo *bo); 331848b8605Smrg 332848b8605Smrguint32_t 333848b8605Smrggbm_bo_get_height(struct gbm_bo *bo); 334848b8605Smrg 335848b8605Smrguint32_t 336848b8605Smrggbm_bo_get_stride(struct gbm_bo *bo); 337848b8605Smrg 338b8e80941Smrguint32_t 339b8e80941Smrggbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane); 340b8e80941Smrg 341848b8605Smrguint32_t 342848b8605Smrggbm_bo_get_format(struct gbm_bo *bo); 343848b8605Smrg 344b8e80941Smrguint32_t 345b8e80941Smrggbm_bo_get_bpp(struct gbm_bo *bo); 346b8e80941Smrg 347b8e80941Smrguint32_t 348b8e80941Smrggbm_bo_get_offset(struct gbm_bo *bo, int plane); 349b8e80941Smrg 350848b8605Smrgstruct gbm_device * 351848b8605Smrggbm_bo_get_device(struct gbm_bo *bo); 352848b8605Smrg 353848b8605Smrgunion gbm_bo_handle 354848b8605Smrggbm_bo_get_handle(struct gbm_bo *bo); 355848b8605Smrg 356848b8605Smrgint 357848b8605Smrggbm_bo_get_fd(struct gbm_bo *bo); 358848b8605Smrg 359b8e80941Smrguint64_t 360b8e80941Smrggbm_bo_get_modifier(struct gbm_bo *bo); 361b8e80941Smrg 362b8e80941Smrgint 363b8e80941Smrggbm_bo_get_plane_count(struct gbm_bo *bo); 364b8e80941Smrg 365b8e80941Smrgunion gbm_bo_handle 366b8e80941Smrggbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane); 367b8e80941Smrg 368848b8605Smrgint 369848b8605Smrggbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count); 370848b8605Smrg 371848b8605Smrgvoid 372848b8605Smrggbm_bo_set_user_data(struct gbm_bo *bo, void *data, 373848b8605Smrg void (*destroy_user_data)(struct gbm_bo *, void *)); 374848b8605Smrg 375848b8605Smrgvoid * 376848b8605Smrggbm_bo_get_user_data(struct gbm_bo *bo); 377848b8605Smrg 378848b8605Smrgvoid 379848b8605Smrggbm_bo_destroy(struct gbm_bo *bo); 380848b8605Smrg 381848b8605Smrgstruct gbm_surface * 382848b8605Smrggbm_surface_create(struct gbm_device *gbm, 383848b8605Smrg uint32_t width, uint32_t height, 384848b8605Smrg uint32_t format, uint32_t flags); 385848b8605Smrg 386b8e80941Smrgstruct gbm_surface * 387b8e80941Smrggbm_surface_create_with_modifiers(struct gbm_device *gbm, 388b8e80941Smrg uint32_t width, uint32_t height, 389b8e80941Smrg uint32_t format, 390b8e80941Smrg const uint64_t *modifiers, 391b8e80941Smrg const unsigned int count); 392848b8605Smrg 393848b8605Smrgstruct gbm_bo * 394848b8605Smrggbm_surface_lock_front_buffer(struct gbm_surface *surface); 395848b8605Smrg 396848b8605Smrgvoid 397848b8605Smrggbm_surface_release_buffer(struct gbm_surface *surface, struct gbm_bo *bo); 398848b8605Smrg 399848b8605Smrgint 400848b8605Smrggbm_surface_has_free_buffers(struct gbm_surface *surface); 401848b8605Smrg 402848b8605Smrgvoid 403848b8605Smrggbm_surface_destroy(struct gbm_surface *surface); 404848b8605Smrg 405b8e80941Smrgchar * 406b8e80941Smrggbm_format_get_name(uint32_t gbm_format, struct gbm_format_name_desc *desc); 407b8e80941Smrg 408848b8605Smrg#ifdef __cplusplus 409848b8605Smrg} 410848b8605Smrg#endif 411848b8605Smrg 412848b8605Smrg#endif 413