1 /*
2  * Copyright (C) 2018 Canonical Ltd.
3  * Copyright (C) 2019-2020 Red Hat Inc.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18  * 02111-1307, USA.
19  */
20 
21 #ifndef META_DRM_BUFFER_PRIVATE_H
22 #define META_DRM_BUFFER_PRIVATE_H
23 
24 #include "backends/native/meta-backend-native-types.h"
25 #include "backends/native/meta-drm-buffer.h"
26 
27 typedef struct _MetaDrmFbArgs
28 {
29   uint32_t width;
30   uint32_t height;
31   uint32_t format;
32   uint32_t handles[4];
33   uint32_t offsets[4];
34   uint32_t strides[4];
35   uint64_t modifiers[4];
36 } MetaDrmFbArgs;
37 
38 struct _MetaDrmBufferClass
39 {
40   GObjectClass parent_class;
41 
42   int (* get_width) (MetaDrmBuffer *buffer);
43   int (* get_height) (MetaDrmBuffer *buffer);
44   int (* get_stride) (MetaDrmBuffer *buffer);
45   uint32_t (* get_format) (MetaDrmBuffer *buffer);
46 
47   gboolean (* fill_timings) (MetaDrmBuffer  *buffer,
48                              CoglFrameInfo  *info,
49                              GError        **error);
50 };
51 
52 MetaDeviceFile * meta_drm_buffer_get_device_file (MetaDrmBuffer *buffer);
53 
54 gboolean meta_drm_buffer_ensure_fb_id (MetaDrmBuffer        *buffer,
55                                        gboolean              use_modifiers,
56                                        const MetaDrmFbArgs  *fb_args,
57                                        GError              **error);
58 
59 gboolean meta_drm_buffer_ensure_fb_in_impl (MetaDrmBuffer        *buffer,
60                                             gboolean              use_modifiers,
61                                             const MetaDrmFbArgs  *fb_args,
62                                             GError              **error);
63 
64 #endif /* META_DRM_BUFFER_PRIVATE_H */
65