summaryrefslogtreecommitdiff
path: root/egl.h
blob: 22074da86b9c167474b9d6a1f17a87905e605177 (plain)
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
/*
 * Derived from GStreamer 0.10 EGL Library in gst-omx
 * Copyright (C) 2014 Fluendo S.A.
 *   @author: Josep Torra <josep@fluendo.com>
 * *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __MY_EGL_H__
#define __MY_EGL_H__

#include <glib.h>
#include <glib-object.h>

#include <EGL/egl.h>
#include <EGL/eglext.h>

G_BEGIN_DECLS

typedef struct _EGLImageMemory EGLImageMemory;
typedef struct _EGLImageMemoryPool EGLImageMemoryPool;
typedef struct _EGLDisplayWrapper EGLDisplayWrapper;
typedef void (*DestroyNotifyEGLImageMemoryPool) (EGLImageMemoryPool *
    pool, gpointer user_data);

/* EGLImageMemory handling */
EGLImageMemory *egl_image_memory_ref (EGLImageMemory * mem);
EGLImageMemory *egl_image_memory_unref (EGLImageMemory * mem);
EGLImageKHR egl_image_memory_get_image (EGLImageMemory * mem);

/* EGLImageMemoryPool handling */
#define TYPE_EGL_IMAGE_MEMORY_POOL (egl_image_memory_pool_get_type())
GType egl_image_memory_pool_get_type (void);

EGLImageMemoryPool *egl_image_memory_pool_new (gint size,
    EGLDisplayWrapper * display, gpointer user_data,
    DestroyNotifyEGLImageMemoryPool destroy_data);
EGLImageMemoryPool *egl_image_memory_pool_ref (EGLImageMemoryPool *
    pool);
EGLImageMemoryPool *egl_image_memory_pool_unref (EGLImageMemoryPool *
    pool);
gint egl_image_memory_pool_get_size (EGLImageMemoryPool * pool);

gboolean egl_image_memory_pool_set_resources (EGLImageMemoryPool * pool,
    gint idx, EGLClientBuffer client_buffer, EGLImageKHR image);

gboolean egl_image_memory_pool_get_resources (EGLImageMemoryPool * pool,
    gint idx, EGLClientBuffer * client_buffer, EGLImageKHR * image);

EGLDisplayWrapper *egl_image_memory_pool_get_display (EGLImageMemoryPool *
    pool);
GList *egl_image_memory_pool_get_images (EGLImageMemoryPool * pool);
void egl_image_memory_pool_set_active (EGLImageMemoryPool * pool,
    gboolean active);
void egl_image_memory_pool_wait_released (EGLImageMemoryPool * pool);
EGLImageMemory *egl_image_memory_pool_acquire_memory (EGLImageMemoryPool *
    pool, gint idx, gpointer user_data, GDestroyNotify destroy_data);

/* EGLDisplay wrapper with refcount, connection is closed after last ref is gone */
EGLDisplayWrapper * egl_display_new (EGLDisplay display, gpointer user_data,
    GDestroyNotify destroy_data);
EGLDisplayWrapper *egl_display_ref (EGLDisplayWrapper * display);
void egl_display_unref (EGLDisplayWrapper * display);
EGLDisplay egl_display_get (EGLDisplayWrapper * display);

G_END_DECLS

#endif /* __MY_EGL_H__ */