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 / 0003-kmssink-add-YUYV-support.patch
1 From 11a3ff4b9451f12374006f853ef5736f5d098932 Mon Sep 17 00:00:00 2001
2 From: Eric Ruei <e-ruei1@ti.com>
3 Date: Tue, 14 Mar 2017 17:24:07 -0400
4 Subject: [PATCH 3/3] kmssink: add YUYV support
5
6 Signed-off-by: Eric Ruei <e-ruei1@ti.com>
7 ---
8  sys/kms/gstkmsbufferpriv.c | 32 +++++++++++++++++++++++++++-----
9  sys/kms/gstkmssink.c       |  2 +-
10  2 files changed, 28 insertions(+), 6 deletions(-)
11
12 diff --git a/sys/kms/gstkmsbufferpriv.c b/sys/kms/gstkmsbufferpriv.c
13 index 172a4c3..57c01f8 100644
14 --- a/sys/kms/gstkmsbufferpriv.c
15 +++ b/sys/kms/gstkmsbufferpriv.c
16 @@ -41,22 +41,44 @@
17  static int
18  create_fb (GstKMSBufferPriv * priv, GstKMSSink * sink)
19  {
20 +
21    /* TODO get format, etc from caps.. and query device for
22     * supported formats, and make this all more flexible to
23     * cope with various formats:
24     */
25 -  uint32_t fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
26 -
27 +  GstVideoFormat format = sink->format;
28 +  uint32_t fourcc;
29    uint32_t handles[4] = {
30 -    omap_bo_handle (priv->bo), omap_bo_handle (priv->bo),
31 +    omap_bo_handle (priv->bo),
32    };
33    uint32_t pitches[4] = {
34 -    GST_ROUND_UP_4 (sink->input_width), GST_ROUND_UP_4 (sink->input_width),
35 +    GST_ROUND_UP_4 (sink->input_width),
36    };
37    uint32_t offsets[4] = {
38 -    0, pitches[0] * sink->input_height
39 +    0,
40    };
41  
42 +  /**
43 +   * Only two formats are supported:
44 +   * AM3/4: YUYV
45 +   * AM5: NV12, YUYV
46 +   */
47 +  if(format == GST_VIDEO_FORMAT_YUY2)
48 +  {
49 +    /* YUYV */
50 +    fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V');
51 +    pitches[0] = GST_ROUND_UP_4 (sink->input_width*2);
52 +  }
53 +  else
54 +  {
55 +    /* NV12 */
56 +    fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
57 +    handles[1] = omap_bo_handle (priv->bo);
58 +    pitches[1] = GST_ROUND_UP_4 (sink->input_width);
59 +    offsets[1] = pitches[0] * sink->input_height;
60 +  }
61 +
62 +
63    return drmModeAddFB2 (priv->fd, sink->input_width, sink->input_height,
64        fourcc, handles, pitches, offsets, &priv->fb_id, 0);
65  }
66 diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c
67 index 9795bdf..b36d88f 100644
68 --- a/sys/kms/gstkmssink.c
69 +++ b/sys/kms/gstkmssink.c
70 @@ -50,7 +50,7 @@ static GstStaticPadTemplate gst_kms_sink_template_factory =
71  GST_STATIC_PAD_TEMPLATE ("sink",
72      GST_PAD_SINK,
73      GST_PAD_ALWAYS,
74 -    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE("NV12"))
75 +    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE("{NV12,YUY2}"))
76      );
77  
78  enum
79 -- 
80 1.9.1
81