meta-agl-profile-telematics: recipes-core: systemd: change canbus systemd match regex
[AGL/meta-agl.git] / meta-agl-bsp / meta-ti / recipes-arago / gstreamer / gstreamer1.0-plugins-bad / 0001-gstwaylandsink-add-input-format-I420-support.patch
1 From 1364ee6e60eb09a3fe3b072fe4671c5d645e523a Mon Sep 17 00:00:00 2001
2 From: Eric Ruei <e-ruei1@ti.com>
3 Date: Wed, 22 Feb 2017 10:49:01 -0500
4 Subject: [PATCH 1/3] gstwaylandsink: add input format I420 support
5
6 The software-based video decoder produces the output in I420 format. To display
7 the output without additional ARM MHz consumed in video format conversion,
8 the function gst_wl_memory_construct_wl_buffer is enhanced to support I420 format.
9
10 Signed-off-by: Eric Ruei <e-ruei1@ti.com>
11 ---
12  ext/wayland/wldrm.c | 41 ++++++++++++++++++++++++++++++++++-------
13  1 file changed, 34 insertions(+), 7 deletions(-)
14
15 diff --git a/ext/wayland/wldrm.c b/ext/wayland/wldrm.c
16 index 3dc9c21..ecbdc88 100644
17 --- a/ext/wayland/wldrm.c
18 +++ b/ext/wayland/wldrm.c
19 @@ -5,33 +5,60 @@
20  #include <omap_drmif.h>
21  #include <wayland-client.h>
22  
23 +GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
24 +#define GST_CAT_DEFAULT gstwayland_debug
25 +
26 +
27  struct wl_buffer *
28  gst_wl_drm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display,
29      const GstVideoInfo * info)
30  {
31    gint video_width = GST_VIDEO_INFO_WIDTH (info);
32    gint video_height = GST_VIDEO_INFO_HEIGHT (info);
33 +  GstVideoFormat format = GST_VIDEO_INFO_FORMAT (info);
34    int fd = -1;
35    struct omap_bo *bo;
36    struct wl_buffer *buffer;
37 -
38 -  /* TODO get format, etc from caps.. and query device for
39 -   * supported formats, and make this all more flexible to
40 -   * cope with various formats:
41 -   */
42 -  uint32_t fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
43 +  uint32_t fourcc;
44    uint32_t name;
45    /* note: wayland and mesa use the terminology:
46     *    stride - rowstride in bytes
47     *    pitch  - rowstride in pixels
48     */
49    uint32_t strides[3] = {
50 -    GST_ROUND_UP_4 (video_width), GST_ROUND_UP_4 (video_width), 0,
51 +    GST_ROUND_UP_4 (video_width), 0, 0,
52    };
53    uint32_t offsets[3] = {
54      0, strides[0] * video_height, 0
55    };
56  
57 +  if (format == GST_VIDEO_FORMAT_NV12)
58 +  {
59 +    /* NV12 */
60 +    fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
61 +    strides[1] = GST_ROUND_UP_4 (video_width);
62 +  }
63 +  else if(format == GST_VIDEO_FORMAT_I420)
64 +  {
65 +    /* YUV420 */
66 +    fourcc = GST_MAKE_FOURCC ('Y', 'U', '1', '2');
67 +    strides[1] = strides[2] = GST_ROUND_UP_4 (video_width/2);
68 +    offsets[2] = offsets[1] + strides[1] * video_height/2;
69 +  }
70 +  else
71 +  {
72 +
73 +    GST_DEBUG ("Unsupported video format: %d", format);
74 +    /*
75 +     * There are two xRGB frames with width and height = 1 required in the begining of a video stream.
76 +     * If we consider them as errot, then it will case libwayland-clent.so crashes
77 +     * due to invalid error handling.
78 +     * Consider them as NV12 until we can figure out a better solution
79 +     */
80 +    fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
81 +    strides[1] = GST_ROUND_UP_4 (video_width);
82 +  }
83 +
84    fd = gst_fd_memory_get_fd (mem);
85  
86    if (fd < 0 ) {
87 -- 
88 1.9.1
89