8e174b96ce3783094ac92ab711dd1374ef6ec4b3
[platform/upstream/gstreamer.git] / sys / kms / gstkmssink.h
1 /* GStreamer
2  *
3  * Copyright (C) 2016 Igalia
4  *
5  * Authors:
6  *  Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
7  *  Javier Martin <javiermartin@by.com.es>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the
21  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  *
24  */
25
26 #ifndef __GST_KMS_SINK_H__
27 #define __GST_KMS_SINK_H__
28
29 #include <gst/video/gstvideosink.h>
30
31 G_BEGIN_DECLS
32
33 #define GST_TYPE_KMS_SINK \
34   (gst_kms_sink_get_type())
35 #define GST_KMS_SINK(obj) \
36   (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_KMS_SINK, GstKMSSink))
37 #define GST_KMS_SINK_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_KMS_SINK, GstKMSSinkClass))
39 #define GST_IS_KMS_SINK(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_KMS_SINK))
41 #define GST_IS_KMS_SINK_CLASS(klass) \
42   (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_KMS_SINK))
43
44 typedef struct _GstKMSSink GstKMSSink;
45 typedef struct _GstKMSSinkClass GstKMSSinkClass;
46
47 struct _GstKMSSink {
48   GstVideoSink videosink;
49
50   /*< private >*/
51   gint fd;
52   gint conn_id;
53   gint crtc_id;
54   gint plane_id;
55   guint pipe;
56
57   /* crtc data */
58   guint16 hdisplay, vdisplay;
59   guint32 buffer_id;
60
61   /* capabilities */
62   gboolean has_prime_import;
63   gboolean has_async_page_flip;
64   gboolean can_scale;
65
66   gboolean modesetting_enabled;
67
68   GstVideoInfo vinfo;
69   GstCaps *allowed_caps;
70   GstBufferPool *pool;
71   GstAllocator *allocator;
72   GstBuffer *last_buffer;
73   GstMemory *tmp_kmsmem;
74   GList *mem_cache;
75
76   gchar *devname;
77
78   guint32 mm_width, mm_height;
79
80   GstPoll *poll;
81   GstPollFD pollfd;
82 };
83
84 struct _GstKMSSinkClass {
85   GstVideoSinkClass parent_class;
86 };
87
88 GType gst_kms_sink_get_type (void) G_GNUC_CONST;
89
90 G_END_DECLS
91
92 #endif /* __GST_KMS_SINK_H__ */