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_prime_export;
64   gboolean has_async_page_flip;
65   gboolean can_scale;
66 
67   gboolean modesetting_enabled;
68   gboolean restore_crtc;
69   GstStructure *connector_props;
70   GstStructure *plane_props;
71 
72   GstVideoInfo vinfo;
73   GstCaps *allowed_caps;
74   GstBufferPool *pool;
75   GstAllocator *allocator;
76   GstBuffer *last_buffer;
77   GstMemory *tmp_kmsmem;
78 
79   gchar *devname;
80   gchar *bus_id;
81 
82   guint32 mm_width, mm_height;
83   gpointer saved_crtc;
84   GstPoll *poll;
85   GstPollFD pollfd;
86 
87   /* render video rectangle */
88   GstVideoRectangle render_rect;
89 
90   /* reconfigure info if driver doesn't scale */
91   GstVideoRectangle pending_rect;
92   gboolean reconfigure;
93 };
94 
95 struct _GstKMSSinkClass {
96   GstVideoSinkClass parent_class;
97 };
98 
99 GType gst_kms_sink_get_type (void) G_GNUC_CONST;
100 
101 G_END_DECLS
102 
103 #endif /* __GST_KMS_SINK_H__ */
104