gbm.h revision 3464ebd5
13464ebd5Sriastradh/*
23464ebd5Sriastradh * Copyright © 2011 Intel Corporation
33464ebd5Sriastradh *
43464ebd5Sriastradh * Permission is hereby granted, free of charge, to any person obtaining a
53464ebd5Sriastradh * copy of this software and associated documentation files (the "Software"),
63464ebd5Sriastradh * to deal in the Software without restriction, including without limitation
73464ebd5Sriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense,
83464ebd5Sriastradh * and/or sell copies of the Software, and to permit persons to whom the
93464ebd5Sriastradh * Software is furnished to do so, subject to the following conditions:
103464ebd5Sriastradh *
113464ebd5Sriastradh * The above copyright notice and this permission notice (including the next
123464ebd5Sriastradh * paragraph) shall be included in all copies or substantial portions of the
133464ebd5Sriastradh * Software.
143464ebd5Sriastradh *
153464ebd5Sriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
163464ebd5Sriastradh * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
173464ebd5Sriastradh * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
183464ebd5Sriastradh * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
193464ebd5Sriastradh * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
203464ebd5Sriastradh * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
213464ebd5Sriastradh * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
223464ebd5Sriastradh * DEALINGS IN THE SOFTWARE.
233464ebd5Sriastradh *
243464ebd5Sriastradh * Authors:
253464ebd5Sriastradh *    Benjamin Franzke <benjaminfranzke@googlemail.com>
263464ebd5Sriastradh */
273464ebd5Sriastradh
283464ebd5Sriastradh#ifndef _GBM_H_
293464ebd5Sriastradh#define _GBM_H_
303464ebd5Sriastradh
313464ebd5Sriastradh#ifdef __cplusplus
323464ebd5Sriastradhextern "C" {
333464ebd5Sriastradh#endif
343464ebd5Sriastradh
353464ebd5Sriastradh
363464ebd5Sriastradh#define __GBM__ 1
373464ebd5Sriastradh
383464ebd5Sriastradh#include <stdint.h>
393464ebd5Sriastradh
403464ebd5Sriastradhstruct gbm_device;
413464ebd5Sriastradhstruct gbm_bo;
423464ebd5Sriastradh
433464ebd5Sriastradhunion gbm_bo_handle {
443464ebd5Sriastradh   void *ptr;
453464ebd5Sriastradh   int32_t s32;
463464ebd5Sriastradh   uint32_t u32;
473464ebd5Sriastradh   int64_t s64;
483464ebd5Sriastradh   uint64_t u64;
493464ebd5Sriastradh};
503464ebd5Sriastradh
513464ebd5Sriastradhenum gbm_bo_format {
523464ebd5Sriastradh   GBM_BO_FORMAT_XRGB8888,
533464ebd5Sriastradh   GBM_BO_FORMAT_ARGB8888,
543464ebd5Sriastradh};
553464ebd5Sriastradh
563464ebd5Sriastradhenum gbm_bo_flags {
573464ebd5Sriastradh   GBM_BO_USE_SCANOUT      = (1 << 0),
583464ebd5Sriastradh   GBM_BO_USE_CURSOR_64X64 = (1 << 1),
593464ebd5Sriastradh   GBM_BO_USE_RENDERING    = (1 << 2),
603464ebd5Sriastradh};
613464ebd5Sriastradh
623464ebd5Sriastradhint
633464ebd5Sriastradhgbm_device_get_fd(struct gbm_device *gbm);
643464ebd5Sriastradh
653464ebd5Sriastradhconst char *
663464ebd5Sriastradhgbm_device_get_backend_name(struct gbm_device *gbm);
673464ebd5Sriastradh
683464ebd5Sriastradhint
693464ebd5Sriastradhgbm_device_is_format_supported(struct gbm_device *gbm,
703464ebd5Sriastradh                               enum gbm_bo_format format,
713464ebd5Sriastradh                               uint32_t usage);
723464ebd5Sriastradh
733464ebd5Sriastradhvoid
743464ebd5Sriastradhgbm_device_destroy(struct gbm_device *gbm);
753464ebd5Sriastradh
763464ebd5Sriastradhstruct gbm_device *
773464ebd5Sriastradhgbm_create_device(int fd);
783464ebd5Sriastradh
793464ebd5Sriastradhstruct gbm_bo *
803464ebd5Sriastradhgbm_bo_create(struct gbm_device *gbm,
813464ebd5Sriastradh              uint32_t width, uint32_t height,
823464ebd5Sriastradh              enum gbm_bo_format format, uint32_t flags);
833464ebd5Sriastradh
843464ebd5Sriastradhstruct gbm_bo *
853464ebd5Sriastradhgbm_bo_create_from_egl_image(struct gbm_device *gbm,
863464ebd5Sriastradh                             void *egl_dpy, void *egl_img,
873464ebd5Sriastradh                             uint32_t width, uint32_t height,
883464ebd5Sriastradh                             uint32_t usage);
893464ebd5Sriastradh
903464ebd5Sriastradhuint32_t
913464ebd5Sriastradhgbm_bo_get_width(struct gbm_bo *bo);
923464ebd5Sriastradh
933464ebd5Sriastradhuint32_t
943464ebd5Sriastradhgbm_bo_get_height(struct gbm_bo *bo);
953464ebd5Sriastradh
963464ebd5Sriastradhuint32_t
973464ebd5Sriastradhgbm_bo_get_pitch(struct gbm_bo *bo);
983464ebd5Sriastradh
993464ebd5Sriastradhunion gbm_bo_handle
1003464ebd5Sriastradhgbm_bo_get_handle(struct gbm_bo *bo);
1013464ebd5Sriastradh
1023464ebd5Sriastradhvoid
1033464ebd5Sriastradhgbm_bo_destroy(struct gbm_bo *bo);
1043464ebd5Sriastradh
1053464ebd5Sriastradh#ifdef __cplusplus
1063464ebd5Sriastradh}
1073464ebd5Sriastradh#endif
1083464ebd5Sriastradh
1093464ebd5Sriastradh#endif
110