This file is indexed.

/usr/include/mirclient/mir_toolkit/extensions/gbm_buffer.h is in libmirclient-dev 0.26.3+16.04.20170605-0ubuntu1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
 * Copyright © 2016 Canonical Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
 */

#ifndef MIR_CLIENT_EXTENSIONS_GBM_BUFFER_H_
#define MIR_CLIENT_EXTENSIONS_GBM_BUFFER_H_

#include "mir_toolkit/mir_connection.h"
#include "mir_toolkit/mir_extension_core.h"
#include "mir_toolkit/mir_buffer.h"

#ifdef __cplusplus
extern "C" {
#endif

/** Allocate a MirBuffer via gbm
 *
 *  available in V1 and V2.
 *
 *  The callback will be called when the buffer is available for use.
 *  It will be called once when created, and once per every
 *  mir_presentation_chain_submit_buffer.
 *
 *  The buffer can be destroyed via mir_buffer_release().
 *
 *   \note  Not all formats or flags are available, and allocations may fail.
 *          Be sure to check mir_buffer_is_valid() on the returned buffer.
 *   \param [in] connection            The connection
 *   \param [in] width                 Requested buffer width
 *   \param [in] height                Requested buffer height
 *   \param [in] gbm_pixel_format      The pixel format, one of the GBM_FORMATs
 *   \param [in] gbm_bo_flags          The gbm_bo_flags for the buffer.
 *   \param [in] available_callback    The callback called when the buffer
 *                                     is available
 *   \param [in] available_context     The context for the available_callback
 **/
typedef void (*mir_connection_allocate_buffer_gbm)(
    MirConnection* connection,
    int width, int height,
    unsigned int gbm_pixel_format,
    unsigned int gbm_bo_flags,
    MirBufferCallback available_callback, void* available_context);

/** v2 version of mir_connection_allocate_buffer_gbm, with more accurate types.
 */
typedef void (*MirConnectionAllocateBufferGbm)(
    MirConnection* connection,
    uint32_t width, uint32_t height,
    uint32_t gbm_pixel_format,
    uint32_t gbm_bo_flags,
    MirBufferCallback available_callback, void* available_context);

typedef struct MirExtensionGbmBufferV1
{
    mir_connection_allocate_buffer_gbm allocate_buffer_gbm;
} MirExtensionGbmBufferV1;

static inline MirExtensionGbmBufferV1 const* mir_extension_gbm_buffer_v1(
    MirConnection* connection)
{
    return (MirExtensionGbmBufferV1 const*) mir_connection_request_extension(
        connection, "mir_extension_gbm_buffer", 1);
}

/** Allocate a MirBuffer via gbm and wait for the allocation.
 *  available in V2.
 *  The buffer can be destroyed via mir_buffer_release().
 *
 *   \param [in] connection            The connection
 *   \param [in] width                 Requested buffer width
 *   \param [in] height                Requested buffer height
 *   \param [in] gbm_pixel_format      The pixel format, one of the GBM_FORMATs
 *   \param [in] gbm_bo_flags          The gbm_bo_flags for the buffer.
 *   \return                           The buffer
 **/
typedef MirBuffer* (*MirConnectionAllocateBufferGbmSync)(
    MirConnection* connection,
    uint32_t width, uint32_t height,
    uint32_t gbm_pixel_format,
    uint32_t gbm_bo_flags);

/** Check if a MirBuffer is suitable for import via GBM_BO_IMPORT_FD
 * 
 *   \param [in] buffer The buffer
 *   \return            True if suitable, false if unsuitable
 */
typedef bool (*MirBufferIsGbmImportable)(MirBuffer* buffer);

/** Access the fd a MirBuffer suitable for gbm import
 *   \pre               The buffer is suitable for GBM_BO_IMPORT_FD
 *   \warning           The fd is owned by the buffer. Do not close() it.
 *   \param [in] buffer The buffer
 *   \return            The fd
 */
typedef int (*MirBufferGbmFd)(MirBuffer* buffer);

/** Get the stride of a MirBuffer
 *   \pre               The buffer is suitable for GBM_BO_IMPORT_FD
 *   \param [in] buffer The buffer
 *   \return            The stride of the buffer
 */
typedef uint32_t (*MirBufferGbmStride)(MirBuffer* buffer);

/** Get the GBM_FORMAT of a MirBuffer
 *   \pre               The buffer is suitable for GBM_BO_IMPORT_FD
 *   \param [in] buffer The buffer
 *   \return            The GBM_FORMAT of the buffer
 */
typedef uint32_t (*MirBufferGbmFormat)(MirBuffer* buffer);

/** Get the gbm_bo_flags of a MirBuffer
 *   \pre               The buffer is suitable for GBM_BO_IMPORT_FD
 *   \param [in] buffer The buffer
 *   \return            The gbm_bo_flags of the buffer
 */
typedef uint32_t (*MirBufferGbmFlags)(MirBuffer* buffer);

/** Get the age of a MirBuffer
 *   \pre               The buffer is suitable for GBM_BO_IMPORT_FD
 *   \param [in] buffer The buffer
 *   \return            The age of the buffer
 */
typedef unsigned int (*MirBufferGbmAge)(MirBuffer* buffer);

typedef struct MirExtensionGbmBufferV2
{
    MirConnectionAllocateBufferGbm allocate_buffer_gbm;
    MirConnectionAllocateBufferGbmSync allocate_buffer_gbm_sync;
    MirBufferIsGbmImportable is_gbm_importable;
    MirBufferGbmFd fd;
    MirBufferGbmStride stride;
    MirBufferGbmFormat format;
    MirBufferGbmFlags flags;
    MirBufferGbmAge age;
} MirExtensionGbmBufferV2;

static inline MirExtensionGbmBufferV2 const* mir_extension_gbm_buffer_v2(
    MirConnection* connection)
{
    return (MirExtensionGbmBufferV2 const*) mir_connection_request_extension(
        connection, "mir_extension_gbm_buffer", 2);
}

#ifdef __cplusplus
}
#endif
#endif /* MIR_CLIENT_EXTENSIONS_GBM_BUFFER_H_ */