diff options
author | Scott Murray <scott.murray@konsulko.com> | 2019-02-08 10:53:08 -0500 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@iot.bzh> | 2019-04-04 18:02:11 +0200 |
commit | 7faccb97d69c7581e338f88ce3a2153cdd69fd16 (patch) | |
tree | 57dd664e04593af6eed43cb6ecffab438d93d860 /meta-agl-bsp | |
parent | e978a20f40916eac57a5e1af8f65b6ed9f719e50 (diff) |
Upgrade to thud
Changes include:
- Add LAYERSERIES_COMPAT definitions to layer.conf files
- Remove now unnecessary SECURITY_*FLAGS over-rides from distro
configuration
- Set intel-corei7-64 preferred kernel version to 4.19 to match
latest linux-intel kernel available in meta-intel
- Update qemuarm preferred kernel version to 4.18 to match latest
linux-yocto
- Update firmware package and devicetree file names for raspberrypi3
- Remove linux-firmware bbappend specific to raspberrypi, it seems no
longer required and breaks the cross SDK build
- Update linux-intel bbappend to 4.19, remove now unnecessary patch
- Remove now unnecessary lttng-modules backport
- Update linux-raspberrypi bbappend to 4.14 kernel
- Added kernel configuration fragment for raspberrypi to disable
Kprobes. This is required until linux-raspberrypi is updated to
greater than 4.14.104 to avoid a build failure in lttng-modules
related to a check for known breakage in the kernel CONFIG_OPTPROBES
code.
- Replace obsolete base_conditional usage with oe.utils.conditional
- Add gstreamer1.0-plugins-bad bbappend for raspberrypi3 to disable
faad PACKAGECONFIG to avoid commercial license issues
- Remove unused and unbuildable Vayu gstreamer recipes
- Update linux-ti-staging bbappend for new BSP kernel
- Regen dcan2_pinmux_enable.patch for linux-ti-staging to remove fuzz
warning, and remove upstreamed fix_dcan_addresses.patch
- Remove ipumm-fw from meta-agl-bsp/meta-ti, as newer version is
available in the upstream BSP
- Update meta-agl-bsp/meta-ti weston patch to apply against 5.0.0
- Update meta-agl-bsp/meta-ti wayland-ivi-extension patch to apply
against 2.2.0
- Add ti-sgx-ddk-km patch to add AGL toolchain configuration file
- Remove now unnecessary fdtoverlay recipe
- Update core.cfg and ivishell.cfg in weston-ini-conf recipe to handle
move of ivi-controller.so configuration in Weston 5.0.0
- Update connman-ncurses patch to remove fuzz warning
- Add installation of systemd over-ride file for run-postinsts.service
in run-postinsts bbappend to workaround race condition between
ldconfig.service and the /sbin/ldconfig invocations in the
post-install scripts run by run-postinsts.service. The observed
failure was cynara's post-install script failing and its database
not being created.
- Remove now unnecessary valgrind backport
- Add patches to fix most driver compilation against newer kernels
- Update libmicrohttpd bbappend
- Remove libssp-dev from agl-image-graphical-qt5-crosssdk and
agl-demo-platform-html5-crosssdk, upstream have removed it from
non-mingw32 platform SDKs
- Update wayland-ivi-extension recipe to build 2.2.0, and update
local patches
- Update weston patches for 5.0.0. Patches:
0016-ivi-shell_add_screen_remove_layer_api.patch
0017-ivi-shell-register-ivi_layout_interface.patch
have been removed as they have been applied upstream and are no longer
necessary. Patches:
0018-compositor-add-output-type-to-weston_output.patch
0019-compositor-drm-introduce-drm_get_dmafd_from_view.patch
(both related to Waltham) have been disabled for now as they need
significant rework.
- Remove weston-conf RRECOMMENDS in weston bbappend to avoid conflict
with weston-ini-conf
- Add OECMAKE_GENERATOR = "Unix Makefiles" to aglwgt.bbclass to work
around CMake+ninja issue in cmake-apps-module
- Update dbus cynara patches for 1.12.10
- Add do_install_append in cynara recipe to remove /var/cynara from
cynara package so the directory creation and labelling in the
post-install scriptlet will function as intended
- Remove now unnecessary e2fsprogs backport
- Remove now unnecessary libcap-ng backport
- Update pulseaudio patches to remove fuzz warnings
- Update neardal patch to remove fuzz warning
- Update freetype patch to remove fuzz warning
- Rename opencv bbappend to 3.% to handle 3.x backports in upstream
- Updated qtwayland patch to remove fuzz warning
Changes from Stephane Desneux <stephane.desneux@iot.bzh>:
- Remove wayland-ivi-extension PREFERRED_VERSION
- Remove now unnecessary nativesdk-cmake patch
- Remove now unnecessary ptest-runner patches
- Remove now unnecessary harfbuzz patches
- Disable waltham-transmitter as it does not build against weston 5.0.0
- Update af-main, cynara, and security-manager to use pkg_postinst_ontarget
- Bump connman-ncurses revision to avoid deprecated ncurses functions
- Update libva package usage with new intel-vaapi-driver name
- Add patches to security-manager to fix compilation with gcc8
- Updated systemd bbappend
Changes from Jan-Simon Möller <jsmoeller@linuxfoundation.org>:
- Remove meta-agl-bsp/ROCKO.FIXMEs
- Remove linux-yocto_4.12.bbappend and now unnecessary associated
patch
- Remove now unneeded kern-tools-native patch
- Bump gstreamer PREFERRED_VERSIONs to 1.14.x
- Remove latencytop from packagegroup-agl-core-devel, it has been
dropped by upstream
- Remove now unnecessary rpm patches
- Update pulseaudio bbappend to 12.2
- Update opencv bbappend to 3.4
- Update freetype bbappend to 2.9.1
- Update dbus bbappend to 1.12.10
- Update weston bbappend to 5.0.0
- Update cynara patches to remove fuzz warnings
- Add patch to cynara to fix compilation with gcc8
- Add xmlsec1 bbappend to clear EXTRA_OECONF to fix compilation on
sumo or newer
Changes from Ronan Le Martet <ronan.lemartet@iot.bzh>:
- Update meta-rcar-gen3-adas layer gstreamer1.0-plugin-vspfilter
bbappend to version 1.0.1
Known issues (marked with FIXME):
- CMake+ninja issue in cmake-apps-module has been worked around with
OECMAKE_GENERATOR
- waltham-transmitter and the patches to weston related to it have been
disabled
- Currently unclear if patch to libcap-native is actually required or
not
Bug-AGL: SPEC-1837
Change-Id: I7b8b9ef667aec2d229952eace6663dfc761654d0
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'meta-agl-bsp')
63 files changed, 70 insertions, 6422 deletions
diff --git a/meta-agl-bsp/ROCKO.FIXMEs b/meta-agl-bsp/ROCKO.FIXMEs deleted file mode 100644 index c21e2ec3d..000000000 --- a/meta-agl-bsp/ROCKO.FIXMEs +++ /dev/null @@ -1,18 +0,0 @@ -FIXME: - -- ti: - - gst and ducati: - modified: conf/include/agl_dra7xx-evm.inc - modified: meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend - -- i.mx: - Thus remove old bsp adaptations. - deleted: meta-boundary/recipes-kernel/linux/linux-boundary_4.1.15.bbappend - -- meta-oe: - - change is upstream - deleted: meta-openembedded-layer/recipes-devtools/lua/lua_%.bbappend - -- meta-intel: - - move libva patch to parent folder (generalize) - diff --git a/meta-agl-bsp/conf/include/agl_dra7xx-evm.inc b/meta-agl-bsp/conf/include/agl_dra7xx-evm.inc index 876d6e9a6..12c0a2797 100644 --- a/meta-agl-bsp/conf/include/agl_dra7xx-evm.inc +++ b/meta-agl-bsp/conf/include/agl_dra7xx-evm.inc @@ -24,22 +24,11 @@ PREFERRED_VERSION_libgbm = "10.0.0" ## Multimedia section ## #------------------------------------------------- -# FIXME -GSTREAMER_PLUGINS = "" -DISABLED_ROCKO_GSTREAMER_PLUGINS = " \ - gstreamer1.0-plugins-bad-meta \ - gstreamer1.0-plugins-ducati \ - gstreamer1.0-plugins-vpe \ -" - PACKAGES_MULTIMEDIA = " \ ipumm-fw \ pulseaudio-misc \ - ${GSTREAMER_PLUGINS} \ " -PREFERRED_VERSION_ipumm-fw = "3.00.13.00" - PREFERRED_PROVIDER_virtual/kernel = "linux-ti-staging" PREFERRED_VERSION_virtual/kernel = "4.9" diff --git a/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc b/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc index 534d36475..4fab6923e 100644 --- a/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc +++ b/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc @@ -2,7 +2,7 @@ # IMAGE_INSTALL_append = " \ libva \ - va-intel \ + intel-vaapi-driver \ gstreamer1.0-vaapi" AGL_EXTRA_IMAGE_FSTYPES = "wic.xz wic.bmap wic.xz.sha256sum" @@ -12,5 +12,5 @@ INITRD_LIVE = "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.ext4.gz" # kernel command line, including to change the screen resolution. WKS_FILE = "systemd-intel-corei7-64-bootdisk.wks" -PREFERRED_VERSION_linux-intel ?= "4.14%" -PREFERRED_VERSION_linux-intel-rt ?= "4.14%" +PREFERRED_VERSION_linux-intel ?= "4.19%" +PREFERRED_VERSION_linux-intel-rt ?= "4.19%" diff --git a/meta-agl-bsp/conf/include/agl_joule.inc b/meta-agl-bsp/conf/include/agl_joule.inc index a7773b2e9..642fe423c 100644 --- a/meta-agl-bsp/conf/include/agl_joule.inc +++ b/meta-agl-bsp/conf/include/agl_joule.inc @@ -3,7 +3,7 @@ INTEL_MACHINE_SUBTYPE = "broxton-m" IMAGE_INSTALL_append = " linux-firmware-iwlwifi-8000c linux-firmware-ibt" IMAGE_INSTALL_append = " \ libva \ - va-intel \ + intel-vaapi-driver \ gstreamer1.0-vaapi" OSTREE_BOOTLOADER ?= "u-boot" diff --git a/meta-agl-bsp/conf/include/agl_raspberrypi3.inc b/meta-agl-bsp/conf/include/agl_raspberrypi3.inc index 23a37c2da..298cacd56 100644 --- a/meta-agl-bsp/conf/include/agl_raspberrypi3.inc +++ b/meta-agl-bsp/conf/include/agl_raspberrypi3.inc @@ -17,7 +17,7 @@ MACHINE_FEATURES += "vc4graphics" # For libomxil #LICENSE_FLAGS_WHITELIST = "commercial" -IMAGE_INSTALL_append = " kernel-modules linux-firmware-raspbian-bcm43430 linux-firmware-raspbian-bcm43455 create-combined-dtb " +IMAGE_INSTALL_append = " kernel-modules linux-firmware-rpidistro-bcm43430 linux-firmware-rpidistro-bcm43455 create-combined-dtb " # Psplash causes crash on first boot on RPi IMAGE_FEATURES_remove = "splash" diff --git a/meta-agl-bsp/conf/layer.conf b/meta-agl-bsp/conf/layer.conf index 7c996cafe..35bf81123 100644 --- a/meta-agl-bsp/conf/layer.conf +++ b/meta-agl-bsp/conf/layer.conf @@ -22,3 +22,5 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend" BBFILE_COLLECTIONS += "aglbsp" BBFILE_PATTERN_aglbsp = "^${LAYERDIR}/" BBFILE_PRIORITY_aglbsp = "60" + +LAYERSERIES_COMPAT_aglbsp = "thud" diff --git a/meta-agl-bsp/conf/machine/qemuarm.conf b/meta-agl-bsp/conf/machine/qemuarm.conf index d47c05208..8d41d6927 100644 --- a/meta-agl-bsp/conf/machine/qemuarm.conf +++ b/meta-agl-bsp/conf/machine/qemuarm.conf @@ -15,4 +15,4 @@ QB_MACHINE = "-machine virt" # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy QB_OPT_APPEND = "-show-cursor -usb -device virtio-rng-pci" -PREFERRED_VERSION_linux-yocto ??= "4.12%" +PREFERRED_VERSION_linux-yocto ??= "4.18%" diff --git a/meta-agl-bsp/meta-aglprofilegraphical/recipes-graphics/harfbuzz/harfbuzz_1.4.8.bbappend b/meta-agl-bsp/meta-aglprofilegraphical/recipes-graphics/harfbuzz/harfbuzz_1.4.8.bbappend deleted file mode 100644 index db50df5d9..000000000 --- a/meta-agl-bsp/meta-aglprofilegraphical/recipes-graphics/harfbuzz/harfbuzz_1.4.8.bbappend +++ /dev/null @@ -1,4 +0,0 @@ -# 2017-09-13 hotfix for harfbuzz build -# Reference https://www.mail-archive.com/yocto@yoctoproject.org/msg36472.html - -acpaths = "-I ${STAGING_DATADIR_NATIVE}/aclocal/" diff --git a/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/0001-NFC-pn533-don-t-send-USB-data-off-of-the-stack.patch b/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/0001-NFC-pn533-don-t-send-USB-data-off-of-the-stack.patch deleted file mode 100644 index b64cc16cf..000000000 --- a/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/0001-NFC-pn533-don-t-send-USB-data-off-of-the-stack.patch +++ /dev/null @@ -1,145 +0,0 @@ -From dbafc28955fa6779dc23d1607a0fee5e509a278b Mon Sep 17 00:00:00 2001 -From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -Date: Sun, 20 May 2018 15:19:46 +0200 -Subject: [PATCH] NFC: pn533: don't send USB data off of the stack - -It's amazing that this driver ever worked, but now that x86 doesn't -allow USB data to be sent off of the stack, it really does not work at -all. Fix this up by properly allocating the data for the small -"commands" that get sent to the device off of the stack. - -We do this for one command by having a whole urb just for ack messages, -as they can be submitted in interrupt context, so we can not use -usb_bulk_msg(). But the poweron command can sleep (and does), so use -usb_bulk_msg() for that transfer. - -Reported-by: Carlos Manuel Santos <cmmpsantos@gmail.com> -Cc: Samuel Ortiz <sameo@linux.intel.com> -Cc: Stephen Hemminger <stephen@networkplumber.org> -Cc: stable <stable@vger.kernel.org> -Reviewed-by: Johan Hovold <johan@kernel.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - drivers/nfc/pn533/usb.c | 42 +++++++++++++++++++++++++++++------------ - 1 file changed, 30 insertions(+), 12 deletions(-) - -diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c -index e153e8b64bb8..d5553c47014f 100644 ---- a/drivers/nfc/pn533/usb.c -+++ b/drivers/nfc/pn533/usb.c -@@ -62,6 +62,9 @@ struct pn533_usb_phy { - struct urb *out_urb; - struct urb *in_urb; - -+ struct urb *ack_urb; -+ u8 *ack_buffer; -+ - struct pn533 *priv; - }; - -@@ -150,13 +153,16 @@ static int pn533_usb_send_ack(struct pn533 *dev, gfp_t flags) - struct pn533_usb_phy *phy = dev->phy; - static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; - /* spec 7.1.1.3: Preamble, SoPC (2), ACK Code (2), Postamble */ -- int rc; - -- phy->out_urb->transfer_buffer = (u8 *)ack; -- phy->out_urb->transfer_buffer_length = sizeof(ack); -- rc = usb_submit_urb(phy->out_urb, flags); -+ if (!phy->ack_buffer) { -+ phy->ack_buffer = kmemdup(ack, sizeof(ack), flags); -+ if (!phy->ack_buffer) -+ return -ENOMEM; -+ } - -- return rc; -+ phy->ack_urb->transfer_buffer = phy->ack_buffer; -+ phy->ack_urb->transfer_buffer_length = sizeof(ack); -+ return usb_submit_urb(phy->ack_urb, flags); - } - - static int pn533_usb_send_frame(struct pn533 *dev, -@@ -375,26 +381,31 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy) - /* Power on th reader (CCID cmd) */ - u8 cmd[10] = {PN533_ACR122_PC_TO_RDR_ICCPOWERON, - 0, 0, 0, 0, 0, 0, 3, 0, 0}; -+ char *buffer; -+ int transferred; - int rc; - void *cntx; - struct pn533_acr122_poweron_rdr_arg arg; - - dev_dbg(&phy->udev->dev, "%s\n", __func__); - -+ buffer = kmemdup(cmd, sizeof(cmd), GFP_KERNEL); -+ if (!buffer) -+ return -ENOMEM; -+ - init_completion(&arg.done); - cntx = phy->in_urb->context; /* backup context */ - - phy->in_urb->complete = pn533_acr122_poweron_rdr_resp; - phy->in_urb->context = &arg; - -- phy->out_urb->transfer_buffer = cmd; -- phy->out_urb->transfer_buffer_length = sizeof(cmd); -- - print_hex_dump_debug("ACR122 TX: ", DUMP_PREFIX_NONE, 16, 1, - cmd, sizeof(cmd), false); - -- rc = usb_submit_urb(phy->out_urb, GFP_KERNEL); -- if (rc) { -+ rc = usb_bulk_msg(phy->udev, phy->out_urb->pipe, buffer, sizeof(cmd), -+ &transferred, 0); -+ kfree(buffer); -+ if (rc || (transferred != sizeof(cmd))) { - nfc_err(&phy->udev->dev, - "Reader power on cmd error %d\n", rc); - return rc; -@@ -490,8 +501,9 @@ static int pn533_usb_probe(struct usb_interface *interface, - - phy->in_urb = usb_alloc_urb(0, GFP_KERNEL); - phy->out_urb = usb_alloc_urb(0, GFP_KERNEL); -+ phy->ack_urb = usb_alloc_urb(0, GFP_KERNEL); - -- if (!phy->in_urb || !phy->out_urb) -+ if (!phy->in_urb || !phy->out_urb || !phy->ack_urb) - goto error; - - usb_fill_bulk_urb(phy->in_urb, phy->udev, -@@ -501,7 +513,9 @@ static int pn533_usb_probe(struct usb_interface *interface, - usb_fill_bulk_urb(phy->out_urb, phy->udev, - usb_sndbulkpipe(phy->udev, out_endpoint), - NULL, 0, pn533_send_complete, phy); -- -+ usb_fill_bulk_urb(phy->ack_urb, phy->udev, -+ usb_sndbulkpipe(phy->udev, out_endpoint), -+ NULL, 0, pn533_send_complete, phy); - - switch (id->driver_info) { - case PN533_DEVICE_STD: -@@ -554,6 +568,7 @@ static int pn533_usb_probe(struct usb_interface *interface, - error: - usb_free_urb(phy->in_urb); - usb_free_urb(phy->out_urb); -+ usb_free_urb(phy->ack_urb); - usb_put_dev(phy->udev); - kfree(in_buf); - -@@ -573,10 +588,13 @@ static void pn533_usb_disconnect(struct usb_interface *interface) - - usb_kill_urb(phy->in_urb); - usb_kill_urb(phy->out_urb); -+ usb_kill_urb(phy->ack_urb); - - kfree(phy->in_urb->transfer_buffer); - usb_free_urb(phy->in_urb); - usb_free_urb(phy->out_urb); -+ usb_free_urb(phy->ack_urb); -+ kfree(phy->ack_buffer); - - nfc_info(&interface->dev, "NXP PN533 NFC device disconnected\n"); - } --- -2.17.1 - diff --git a/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto_4.12.bbappend b/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto_4.12.bbappend deleted file mode 100755 index 124a1f43b..000000000 --- a/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto_4.12.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" - -SRC_URI_append = " file://0001-NFC-pn533-don-t-send-USB-data-off-of-the-stack.patch" diff --git a/meta-agl-bsp/meta-intel/recipes-kernel/linux/files/0001-NFC-pn533-don-t-send-USB-data-off-of-the-stack.patch b/meta-agl-bsp/meta-intel/recipes-kernel/linux/files/0001-NFC-pn533-don-t-send-USB-data-off-of-the-stack.patch deleted file mode 100644 index b64cc16cf..000000000 --- a/meta-agl-bsp/meta-intel/recipes-kernel/linux/files/0001-NFC-pn533-don-t-send-USB-data-off-of-the-stack.patch +++ /dev/null @@ -1,145 +0,0 @@ -From dbafc28955fa6779dc23d1607a0fee5e509a278b Mon Sep 17 00:00:00 2001 -From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -Date: Sun, 20 May 2018 15:19:46 +0200 -Subject: [PATCH] NFC: pn533: don't send USB data off of the stack - -It's amazing that this driver ever worked, but now that x86 doesn't -allow USB data to be sent off of the stack, it really does not work at -all. Fix this up by properly allocating the data for the small -"commands" that get sent to the device off of the stack. - -We do this for one command by having a whole urb just for ack messages, -as they can be submitted in interrupt context, so we can not use -usb_bulk_msg(). But the poweron command can sleep (and does), so use -usb_bulk_msg() for that transfer. - -Reported-by: Carlos Manuel Santos <cmmpsantos@gmail.com> -Cc: Samuel Ortiz <sameo@linux.intel.com> -Cc: Stephen Hemminger <stephen@networkplumber.org> -Cc: stable <stable@vger.kernel.org> -Reviewed-by: Johan Hovold <johan@kernel.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - drivers/nfc/pn533/usb.c | 42 +++++++++++++++++++++++++++++------------ - 1 file changed, 30 insertions(+), 12 deletions(-) - -diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c -index e153e8b64bb8..d5553c47014f 100644 ---- a/drivers/nfc/pn533/usb.c -+++ b/drivers/nfc/pn533/usb.c -@@ -62,6 +62,9 @@ struct pn533_usb_phy { - struct urb *out_urb; - struct urb *in_urb; - -+ struct urb *ack_urb; -+ u8 *ack_buffer; -+ - struct pn533 *priv; - }; - -@@ -150,13 +153,16 @@ static int pn533_usb_send_ack(struct pn533 *dev, gfp_t flags) - struct pn533_usb_phy *phy = dev->phy; - static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; - /* spec 7.1.1.3: Preamble, SoPC (2), ACK Code (2), Postamble */ -- int rc; - -- phy->out_urb->transfer_buffer = (u8 *)ack; -- phy->out_urb->transfer_buffer_length = sizeof(ack); -- rc = usb_submit_urb(phy->out_urb, flags); -+ if (!phy->ack_buffer) { -+ phy->ack_buffer = kmemdup(ack, sizeof(ack), flags); -+ if (!phy->ack_buffer) -+ return -ENOMEM; -+ } - -- return rc; -+ phy->ack_urb->transfer_buffer = phy->ack_buffer; -+ phy->ack_urb->transfer_buffer_length = sizeof(ack); -+ return usb_submit_urb(phy->ack_urb, flags); - } - - static int pn533_usb_send_frame(struct pn533 *dev, -@@ -375,26 +381,31 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy) - /* Power on th reader (CCID cmd) */ - u8 cmd[10] = {PN533_ACR122_PC_TO_RDR_ICCPOWERON, - 0, 0, 0, 0, 0, 0, 3, 0, 0}; -+ char *buffer; -+ int transferred; - int rc; - void *cntx; - struct pn533_acr122_poweron_rdr_arg arg; - - dev_dbg(&phy->udev->dev, "%s\n", __func__); - -+ buffer = kmemdup(cmd, sizeof(cmd), GFP_KERNEL); -+ if (!buffer) -+ return -ENOMEM; -+ - init_completion(&arg.done); - cntx = phy->in_urb->context; /* backup context */ - - phy->in_urb->complete = pn533_acr122_poweron_rdr_resp; - phy->in_urb->context = &arg; - -- phy->out_urb->transfer_buffer = cmd; -- phy->out_urb->transfer_buffer_length = sizeof(cmd); -- - print_hex_dump_debug("ACR122 TX: ", DUMP_PREFIX_NONE, 16, 1, - cmd, sizeof(cmd), false); - -- rc = usb_submit_urb(phy->out_urb, GFP_KERNEL); -- if (rc) { -+ rc = usb_bulk_msg(phy->udev, phy->out_urb->pipe, buffer, sizeof(cmd), -+ &transferred, 0); -+ kfree(buffer); -+ if (rc || (transferred != sizeof(cmd))) { - nfc_err(&phy->udev->dev, - "Reader power on cmd error %d\n", rc); - return rc; -@@ -490,8 +501,9 @@ static int pn533_usb_probe(struct usb_interface *interface, - - phy->in_urb = usb_alloc_urb(0, GFP_KERNEL); - phy->out_urb = usb_alloc_urb(0, GFP_KERNEL); -+ phy->ack_urb = usb_alloc_urb(0, GFP_KERNEL); - -- if (!phy->in_urb || !phy->out_urb) -+ if (!phy->in_urb || !phy->out_urb || !phy->ack_urb) - goto error; - - usb_fill_bulk_urb(phy->in_urb, phy->udev, -@@ -501,7 +513,9 @@ static int pn533_usb_probe(struct usb_interface *interface, - usb_fill_bulk_urb(phy->out_urb, phy->udev, - usb_sndbulkpipe(phy->udev, out_endpoint), - NULL, 0, pn533_send_complete, phy); -- -+ usb_fill_bulk_urb(phy->ack_urb, phy->udev, -+ usb_sndbulkpipe(phy->udev, out_endpoint), -+ NULL, 0, pn533_send_complete, phy); - - switch (id->driver_info) { - case PN533_DEVICE_STD: -@@ -554,6 +568,7 @@ static int pn533_usb_probe(struct usb_interface *interface, - error: - usb_free_urb(phy->in_urb); - usb_free_urb(phy->out_urb); -+ usb_free_urb(phy->ack_urb); - usb_put_dev(phy->udev); - kfree(in_buf); - -@@ -573,10 +588,13 @@ static void pn533_usb_disconnect(struct usb_interface *interface) - - usb_kill_urb(phy->in_urb); - usb_kill_urb(phy->out_urb); -+ usb_kill_urb(phy->ack_urb); - - kfree(phy->in_urb->transfer_buffer); - usb_free_urb(phy->in_urb); - usb_free_urb(phy->out_urb); -+ usb_free_urb(phy->ack_urb); -+ kfree(phy->ack_buffer); - - nfc_info(&interface->dev, "NXP PN533 NFC device disconnected\n"); - } --- -2.17.1 - diff --git a/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-intel_4.14%.bbappend b/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-intel_4.19%.bbappend index 62c264d12..c49b8ecb0 100644 --- a/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-intel_4.14%.bbappend +++ b/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-intel_4.19%.bbappend @@ -15,9 +15,6 @@ KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/net-devices.cfg" # Ensure we have a startup.nsh file SRC_URI_append = " file://startup.nsh" -# SPEC-1553 fix for pn333_usb devices not being functional -SRC_URI_append = " file://0001-NFC-pn533-don-t-send-USB-data-off-of-the-stack.patch" - do_deploy_append() { install -m 0755 ${WORKDIR}/startup.nsh ${DEPLOYDIR}/ } diff --git a/meta-agl-bsp/meta-intel/recipes-kernel/lttng/lttng-modules/BUILD_RUNTIME_BUG_ON-vs-gcc7.patch b/meta-agl-bsp/meta-intel/recipes-kernel/lttng/lttng-modules/BUILD_RUNTIME_BUG_ON-vs-gcc7.patch deleted file mode 100644 index 76063607a..000000000 --- a/meta-agl-bsp/meta-intel/recipes-kernel/lttng/lttng-modules/BUILD_RUNTIME_BUG_ON-vs-gcc7.patch +++ /dev/null @@ -1,43 +0,0 @@ -From ab07574ef90fa510f293c37897d577066a88fe0d Mon Sep 17 00:00:00 2001 -From: Nathan Lynch <nathan_lynch@mentor.com> -Date: Tue, 25 Apr 2017 16:26:57 -0500 -Subject: [PATCH] BUILD_RUNTIME_BUG_ON vs gcc7 - -Avoid using LTTng's BUILD_RUNTIME_BUG_ON macro, as it appears to run -into a similar problem as Linux experienced with ilog2. - -See: -https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=474c90156c8dcc2fa815e6716cc9394d7930cb9c -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785 - -Upstream-Status: Pending -Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com> ---- - lib/align.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lib/align.h b/lib/align.h -index 5b91ae87410b..5e134cd485fe 100644 ---- a/lib/align.h -+++ b/lib/align.h -@@ -48,7 +48,7 @@ - */ - #define offset_align(align_drift, alignment) \ - ({ \ -- BUILD_RUNTIME_BUG_ON((alignment) == 0 \ -+ BUG_ON((alignment) == 0 \ - || ((alignment) & ((alignment) - 1))); \ - (((alignment) - (align_drift)) & ((alignment) - 1)); \ - }) -@@ -63,7 +63,7 @@ - */ - #define offset_align_floor(align_drift, alignment) \ - ({ \ -- BUILD_RUNTIME_BUG_ON((alignment) == 0 \ -+ BUG_ON((alignment) == 0 \ - || ((alignment) & ((alignment) - 1))); \ - (((align_drift) - (alignment)) & ((alignment) - 1)); \ - }) --- -2.9.3 - diff --git a/meta-agl-bsp/meta-intel/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch b/meta-agl-bsp/meta-intel/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch deleted file mode 100644 index aa165ba53..000000000 --- a/meta-agl-bsp/meta-intel/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch +++ /dev/null @@ -1,197 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> -<head> -<title>poky - Poky Build Tool and Metadata</title> -<meta name='generator' content='cgit v0.10.2'/> -<meta name='robots' content='index, nofollow'/> -<link rel='stylesheet' type='text/css' href='/cgit/cgit.css'/> -<link rel='shortcut icon' href='/favicon.ico'/> -<link rel='alternate' title='Atom feed' href='http://git.yoctoproject.org/cgit/cgit.cgi/poky/atom/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch?h=master' type='application/atom+xml'/> -<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> -<script type="text/javascript"> -$(document).ready(function() { -fragment = ''; -if (window.location.href.lastIndexOf('?') > -1) { - fragment = window.location.href.substring(window.location.href.lastIndexOf('?')); -} -$('.logo').append('<a href="http://git.yoctoproject.org/clean/cgit.cgi/' + window.location.pathname.substring(window.location.pathname.lastIndexOf("cgit.cgi")+9) + fragment + '">light theme</a>'); -}); -</script> -</head> -<body> -<div id='cgit'><table id='header'> -<tr> -<td class='logo' rowspan='2'><a href='/cgit/cgit.cgi/'><img src='/cgit/yocto-project-transp.png' alt='cgit logo'/></a></td> -<td class='main'><a href='/cgit/cgit.cgi/'>index</a> : <a title='poky' href='/cgit/cgit.cgi/poky/'>poky</a></td><td class='form'><form method='get' action=''> -<input type='hidden' name='id' value='1a97243bf86468a9dfd44f60c9f7563aff54b284'/><select name='h' onchange='this.form.submit();'> -<option value='1.1_M1'>1.1_M1</option> -<option value='1.1_M2'>1.1_M2</option> -<option value='1.1_M3'>1.1_M3</option> -<option value='1.1_M4'>1.1_M4</option> -<option value='1.2_M1'>1.2_M1</option> -<option value='1.2_M2'>1.2_M2</option> -<option value='1.2_M3'>1.2_M3</option> -<option value='1.2_M4'>1.2_M4</option> -<option value='1.3_M1'>1.3_M1</option> -<option value='1.3_M2'>1.3_M2</option> -<option value='1.3_M3'>1.3_M3</option> -<option value='1.3_M4'>1.3_M4</option> -<option value='1.3_M5'>1.3_M5</option> -<option value='1.3_beta'>1.3_beta</option> -<option value='1.4_M1'>1.4_M1</option> -<option value='1.4_M3'>1.4_M3</option> -<option value='1.4_M4'>1.4_M4</option> -<option value='1.4_M5'>1.4_M5</option> -<option value='1.6_M5'>1.6_M5</option> -<option value='bernard'>bernard</option> -<option value='blinky'>blinky</option> -<option value='clyde'>clyde</option> -<option value='daisy'>daisy</option> -<option value='danny'>danny</option> -<option value='danny-next'>danny-next</option> -<option value='denzil'>denzil</option> -<option value='dizzy'>dizzy</option> -<option value='dora'>dora</option> -<option value='dora-toaster'>dora-toaster</option> -<option value='dylan'>dylan</option> -<option value='edison'>edison</option> -<option value='elroy'>elroy</option> -<option value='fido'>fido</option> -<option value='green'>green</option> -<option value='jethro'>jethro</option> -<option value='krogoth'>krogoth</option> -<option value='krogoth-next'>krogoth-next</option> -<option value='laverne'>laverne</option> -<option value='master' selected='selected'>master</option> -<option value='master-next'>master-next</option> -<option value='master-next2'>master-next2</option> -<option value='morty'>morty</option> -<option value='morty-next'>morty-next</option> -<option value='pinky'>pinky</option> -<option value='purple'>purple</option> -<option value='pyro'>pyro</option> -<option value='pyro-next'>pyro-next</option> -<option value='rocko'>rocko</option> -<option value='rocko-next'>rocko-next</option> -</select> <input type='submit' name='' value='switch'/></form></td></tr> -<tr><td class='sub'>Poky Build Tool and Metadata</td><td class='sub right'>git repository hosting</td></tr></table> -<table class='tabs'><tr><td> -<a href='/cgit/cgit.cgi/poky/'>summary</a><a href='/cgit/cgit.cgi/poky/refs/?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>refs</a><a href='/cgit/cgit.cgi/poky/log/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch'>log</a><a class='active' href='/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>tree</a><a href='/cgit/cgit.cgi/poky/commit/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>commit</a><a href='/cgit/cgit.cgi/poky/diff/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>diff</a><a href='/cgit/cgit.cgi/poky/stats/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch'>stats</a></td><td class='form'><form class='right' method='get' action='/cgit/cgit.cgi/poky/log/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch'> -<input type='hidden' name='id' value='1a97243bf86468a9dfd44f60c9f7563aff54b284'/><select name='qt'> -<option value='grep'>log msg</option> -<option value='author'>author</option> -<option value='committer'>committer</option> -<option value='range'>range</option> -</select> -<input class='txt' type='text' size='10' name='q' value=''/> -<input type='submit' value='search'/> -</form> -</td></tr></table> -<div class='path'>path: <a href='/cgit/cgit.cgi/poky/tree/?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>root</a>/<a href='/cgit/cgit.cgi/poky/tree/meta?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>meta</a>/<a href='/cgit/cgit.cgi/poky/tree/meta/recipes-kernel?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>recipes-kernel</a>/<a href='/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/lttng?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>lttng</a>/<a href='/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/lttng/lttng-modules?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>lttng-modules</a>/<a href='/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch</a></div><div class='content'>blob: e41124227201a9d7bb53cd6a7a5ef6aa733328e2 (<a href='/cgit/cgit.cgi/poky/plain/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch?id=1a97243bf86468a9dfd44f60c9f7563aff54b284'>plain</a>) -<table summary='blob content' class='blob'> -<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a> -<a id='n2' href='#n2'>2</a> -<a id='n3' href='#n3'>3</a> -<a id='n4' href='#n4'>4</a> -<a id='n5' href='#n5'>5</a> -<a id='n6' href='#n6'>6</a> -<a id='n7' href='#n7'>7</a> -<a id='n8' href='#n8'>8</a> -<a id='n9' href='#n9'>9</a> -<a id='n10' href='#n10'>10</a> -<a id='n11' href='#n11'>11</a> -<a id='n12' href='#n12'>12</a> -<a id='n13' href='#n13'>13</a> -<a id='n14' href='#n14'>14</a> -<a id='n15' href='#n15'>15</a> -<a id='n16' href='#n16'>16</a> -<a id='n17' href='#n17'>17</a> -<a id='n18' href='#n18'>18</a> -<a id='n19' href='#n19'>19</a> -<a id='n20' href='#n20'>20</a> -<a id='n21' href='#n21'>21</a> -<a id='n22' href='#n22'>22</a> -<a id='n23' href='#n23'>23</a> -<a id='n24' href='#n24'>24</a> -<a id='n25' href='#n25'>25</a> -<a id='n26' href='#n26'>26</a> -<a id='n27' href='#n27'>27</a> -<a id='n28' href='#n28'>28</a> -<a id='n29' href='#n29'>29</a> -<a id='n30' href='#n30'>30</a> -<a id='n31' href='#n31'>31</a> -<a id='n32' href='#n32'>32</a> -<a id='n33' href='#n33'>33</a> -<a id='n34' href='#n34'>34</a> -<a id='n35' href='#n35'>35</a> -<a id='n36' href='#n36'>36</a> -<a id='n37' href='#n37'>37</a> -<a id='n38' href='#n38'>38</a> -<a id='n39' href='#n39'>39</a> -<a id='n40' href='#n40'>40</a> -<a id='n41' href='#n41'>41</a> -<a id='n42' href='#n42'>42</a> -<a id='n43' href='#n43'>43</a> -<a id='n44' href='#n44'>44</a> -<a id='n45' href='#n45'>45</a> -<a id='n46' href='#n46'>46</a> -<a id='n47' href='#n47'>47</a> -<a id='n48' href='#n48'>48</a> -<a id='n49' href='#n49'>49</a> -</pre></td> -<td class='lines'><pre><code>From 1b0e574d680101105a6c1e8931c78824f5a97a42 Mon Sep 17 00:00:00 2001 -From: Otavio Salvador <otavio@ossystems.com.br> -Date: Mon, 5 Sep 2016 17:08:56 +0000 -Subject: [PATCH] Makefile: Do not fail if CONFIG_TRACEPOINTS is not enabled -Organization: O.S. Systems Software LTDA. - -The lttng-modules are being pulled by the tools-profile image feature, -however, not every kernel has the CONFIG_TRACEPOINTS feature enabled. - -This change makes the build do not fail when CONFIG_TRACEPOINTS is not -available, allowing it to be kept being pulled by default. - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> ---- - Makefile | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/Makefile b/Makefile -index 8602649..75550cc 100644 ---- a/Makefile -+++ b/Makefile -@@ -8,10 +8,7 @@ ifneq ($(KERNELRELEASE),) - # and defines the modules to be built. - - ifdef CONFIG_LOCALVERSION # Check if dot-config is included. -- ifeq ($(CONFIG_TRACEPOINTS),) -- $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration) -- endif # CONFIG_TRACEPOINTS -- endif # ifdef CONFIG_LOCALVERSION -+ ifneq ($(CONFIG_TRACEPOINTS),) - - TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST))) - -@@ -94,6 +91,10 @@ ifneq ($(KERNELRELEASE),) - obj-$(CONFIG_LTTNG) += lib/ - obj-$(CONFIG_LTTNG) += tests/ - -+ else -+ $(warning The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration) -+ endif # CONFIG_TRACEPOINTS -+ endif # ifdef CONFIG_LOCALVERSION - else # KERNELRELEASE - - # This part of the Makefile is used when the 'make' command is runned in the --- -2.1.4 - -</code></pre></td></tr></table> -</div> <!-- class=content --> -<div class='footer'>generated by cgit v0.10.2 at 2018-02-19 12:16:57 (GMT)</div> -</div> <!-- id=cgit --> -</body> -</html> diff --git a/meta-agl-bsp/meta-intel/recipes-kernel/lttng/lttng-modules_2.10.5.bb b/meta-agl-bsp/meta-intel/recipes-kernel/lttng/lttng-modules_2.10.5.bb deleted file mode 100644 index 370b78aae..000000000 --- a/meta-agl-bsp/meta-intel/recipes-kernel/lttng/lttng-modules_2.10.5.bb +++ /dev/null @@ -1,35 +0,0 @@ -SECTION = "devel" -SUMMARY = "Linux Trace Toolkit KERNEL MODULE" -DESCRIPTION = "The lttng-modules 2.0 package contains the kernel tracer modules" -LICENSE = "LGPLv2.1 & GPLv2 & MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=c4613d1f8a9587bd7b366191830364b3 \ - file://gpl-2.0.txt;md5=751419260aa954499f7abaabaa882bbe \ - file://lgpl-2.1.txt;md5=243b725d71bb5df4a1e5920b344b86ad \ - " - -inherit module - -COMPATIBLE_HOST = '(x86_64|i.86|powerpc|aarch64|mips|nios2|arm).*-linux' - -SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \ - file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \ - file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \ -" - -SRC_URI[md5sum] = "4aaabaafd15d9455c83972e26ccfbca7" -SRC_URI[sha256sum] = "b8dbbbee45a673c381f51b99c555e36655c3c2c7a5477aab927591cc7f003a1f" - -export INSTALL_MOD_DIR="kernel/lttng-modules" - -EXTRA_OEMAKE += "KERNELDIR='${STAGING_KERNEL_DIR}'" - -do_install_append() { - # Delete empty directories to avoid QA failures if no modules were built - find ${D}/${nonarch_base_libdir} -depth -type d -empty -exec rmdir {} \; -} - -python do_package_prepend() { - if not os.path.exists(os.path.join(d.getVar('D'), d.getVar('nonarch_base_libdir')[1:], 'modules')): - bb.warn("%s: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel." % d.getVar('PN')) -} - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/userland/userland_%.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/userland/userland_%.bbappend new file mode 100644 index 000000000..d4c74ef48 --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/userland/userland_%.bbappend @@ -0,0 +1,4 @@ +# FIXME: Temporary fix that can be removed once commit 752db52 gets backported +# from master to thud branch of meta-raspberrypi +RDEPENDS_${PN}_remove = "libegl1" +RDEPENDS_${PN} += "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "libegl-mesa", "", d)}" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/create-combined-dtb/create-combined-dtb_1.0.0.bb b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/create-combined-dtb/create-combined-dtb_1.0.0.bb index 44f90272e..7cc76c06e 100644 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/create-combined-dtb/create-combined-dtb_1.0.0.bb +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/create-combined-dtb/create-combined-dtb_1.0.0.bb @@ -5,7 +5,7 @@ PR = "r1" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" -DEPENDS = "fdtoverlay-native" +DEPENDS = "dtc-native" ALLOW_EMPTY_${PN} = "1" FILES_${PN} = "" @@ -16,20 +16,20 @@ do_compile[depends] += "virtual/kernel:do_deploy" do_compile () { # Official touchscreen setup (rpi3b/rpi3b dtb, vc4-kms-v3d and ft5406) - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/uImage-bcm2710-rpi-3-b-plus.dtb -o uImage-bcm2710-rpi-3-b+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE}/rpi-ft5406.dtbo ${DEPLOY_DIR_IMAGE}/uImage-vc4-kms-v3d.dtbo - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/uImage-bcm2710-rpi-3-b.dtb -o uImage-bcm2710-rpi-3+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE}/rpi-ft5406.dtbo ${DEPLOY_DIR_IMAGE}/uImage-vc4-kms-v3d.dtbo + fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b-plus.dtb -o bcm2710-rpi-3-b+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE}/rpi-ft5406.dtbo ${DEPLOY_DIR_IMAGE}/vc4-kms-v3d.dtbo + fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b.dtb -o bcm2710-rpi-3+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE}/rpi-ft5406.dtbo ${DEPLOY_DIR_IMAGE}/vc4-kms-v3d.dtbo # HDMI screen setup (rpi3b/rpi3b dtb and vc4-kms-v3d) - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/uImage-bcm2710-rpi-3-b-plus.dtb -o uImage-bcm2710-rpi-3-b+vc4.dtb ${DEPLOY_DIR_IMAGE}/uImage-vc4-kms-v3d.dtbo - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/uImage-bcm2710-rpi-3-b.dtb -o uImage-bcm2710-rpi-3+vc4.dtb ${DEPLOY_DIR_IMAGE}/uImage-vc4-kms-v3d.dtbo + fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b-plus.dtb -o bcm2710-rpi-3-b+vc4.dtb ${DEPLOY_DIR_IMAGE}/vc4-kms-v3d.dtbo + fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b.dtb -o bcm2710-rpi-3+vc4.dtb ${DEPLOY_DIR_IMAGE}/vc4-kms-v3d.dtbo } do_deploy () { install -d ${DEPLOY_DIR_IMAGE} - install -m 0644 ${S}/uImage-bcm2710-rpi-3-b+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE} - install -m 0644 ${S}/uImage-bcm2710-rpi-3+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE} - install -m 0644 ${S}/uImage-bcm2710-rpi-3-b+vc4.dtb ${DEPLOY_DIR_IMAGE} - install -m 0644 ${S}/uImage-bcm2710-rpi-3+vc4.dtb ${DEPLOY_DIR_IMAGE} + install -m 0644 ${S}/bcm2710-rpi-3-b+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE} + install -m 0644 ${S}/bcm2710-rpi-3+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE} + install -m 0644 ${S}/bcm2710-rpi-3-b+vc4.dtb ${DEPLOY_DIR_IMAGE} + install -m 0644 ${S}/bcm2710-rpi-3+vc4.dtb ${DEPLOY_DIR_IMAGE} } addtask deploy after do_install diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/fdtoverlay/fdtoverlay.inc b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/fdtoverlay/fdtoverlay.inc deleted file mode 100644 index e769a1864..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/fdtoverlay/fdtoverlay.inc +++ /dev/null @@ -1,26 +0,0 @@ -SUMMARY = "fdtoverlay from the device tree compiler" -HOMEPAGE = "https://devicetree.org/" -DESCRIPTION = "fdtoverlay is a tool to apply a number of overlays to a base blob." -SECTION = "bootloader" -LICENSE = "GPLv2 | BSD" -DEPENDS = "flex-native bison-native" - -SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git \ - file://make_install.patch \ - " -UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" - -EXTRA_OEMAKE='NO_PYTHON=1 PREFIX="${prefix}" LIBDIR="${libdir}" DESTDIR="${D}"' - -S = "${WORKDIR}/git" - -do_compile () { - oe_runmake fdtoverlay -} - -do_install () { - install -d ${D}/${bindir} - install -m 0755 ${S}/fdtoverlay ${D}/${bindir}/fdtoverlay -} - -FILES_${PN} = "${bindir}/fdtoverlay" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/fdtoverlay/fdtoverlay/make_install.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/fdtoverlay/fdtoverlay/make_install.patch deleted file mode 100644 index ea9359e81..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/fdtoverlay/fdtoverlay/make_install.patch +++ /dev/null @@ -1,26 +0,0 @@ -From e9852b9d206df1e42aa4c8afec55a0f5e099b533 Mon Sep 17 00:00:00 2001 -From: Saul Wold <sgw@linux.intel.com> -Date: Thu, 3 Nov 2011 08:35:47 -0700 -Subject: [PATCH] dtc: Add patch to correctly install shared libraries and - -Upstream-Status: Inappropriate [configuration] - ---- - Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Makefile b/Makefile -index d8ebc4f..f5e01be 100644 ---- a/Makefile -+++ b/Makefile -@@ -205,8 +205,8 @@ install-bin: all $(SCRIPTS) - install-lib: all - @$(VECHO) INSTALL-LIB - $(INSTALL) -d $(DESTDIR)$(LIBDIR) -- $(INSTALL_LIB) $(LIBFDT_lib) $(DESTDIR)$(LIBDIR) -- ln -sf $(notdir $(LIBFDT_lib)) $(DESTDIR)$(LIBDIR)/$(LIBFDT_soname) -+ $(INSTALL) $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)/$(LIBFDT_soname) -+ ln -sf $(LIBFDT_soname) $(DESTDIR)$(LIBDIR)/$(notdir $(LIBFDT_lib)) - ln -sf $(LIBFDT_soname) $(DESTDIR)$(LIBDIR)/libfdt.$(SHAREDLIB_EXT) - $(INSTALL_DATA) $(LIBFDT_archive) $(DESTDIR)$(LIBDIR) - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/fdtoverlay/fdtoverlay_1.4.7.bb b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/fdtoverlay/fdtoverlay_1.4.7.bb deleted file mode 100644 index 91981987d..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/fdtoverlay/fdtoverlay_1.4.7.bb +++ /dev/null @@ -1,10 +0,0 @@ -require fdtoverlay.inc - -LIC_FILES_CHKSUM = "file://GPL;md5=94d55d512a9ba36caa9b7df079bae19f \ - file://libfdt/libfdt.h;beginline=3;endline=52;md5=fb360963151f8ec2d6c06b055bcbb68c" - -SRCREV = "88f18909db731a627456f26d779445f84e449536" - -S = "${WORKDIR}/git" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend deleted file mode 100644 index 9df797fab..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -# In releases based on Rocko firmware files for bcm43430 and -# bcm43455 are provided by linux-firmware-raspbian. The lines -# below fix eventual duplication of these files. -FILES_${PN}-bcm43455 = "" -FILES_${PN}-bcm43430 = "" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/disable_kprobes.cfg b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/disable_kprobes.cfg new file mode 100644 index 000000000..4a67a7e6b --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/disable_kprobes.cfg @@ -0,0 +1 @@ +CONFIG_KPROBES=n diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend index 855a86257..92dd6e7d2 100644 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend @@ -1,17 +1,20 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" require recipes-kernel/linux/linux-agl.inc -require recipes-kernel/linux/linux-agl-4.9.inc +require recipes-kernel/linux/linux-agl-4.14.inc +# NOTE: Kprobes need to be disabled until linux-raspberrypi gets updated +# to newer than 4.14.104 to avoid lttng-modules failing to build. SRC_URI_append = "\ - ${@base_conditional('USE_FAYTECH_MONITOR', '1', 'file://0002-faytech-fix-rpi.patch', '', d)} \ + ${@oe.utils.conditional('USE_FAYTECH_MONITOR', '1', 'file://0002-faytech-fix-rpi.patch', '', d)} \ + file://disable_kprobes.cfg \ " CMDLINE_DEBUG = "" CMDLINE_append = " usbhid.mousepoll=0" # Add options to allow CMA to operate -CMDLINE_append = ' ${@base_conditional("ENABLE_CMA", "1", "coherent_pool=6M smsc95xx.turbo_mode=N", "", d)}' +CMDLINE_append = ' ${@oe.utils.conditional("ENABLE_CMA", "1", "coherent_pool=6M smsc95xx.turbo_mode=N", "", d)}' KERNEL_MODULE_AUTOLOAD += "snd-bcm2835" KERNEL_MODULE_AUTOLOAD += "hid-multitouch" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend new file mode 100644 index 000000000..e48a380a3 --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend @@ -0,0 +1,2 @@ +# Disable faad by default to avoid licensing issues +PACKAGECONFIG_remove_rpi = "faad" diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf b/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf index 2b1ac5a7e..277186f29 100644 --- a/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf @@ -13,6 +13,8 @@ BBFILE_COLLECTIONS += "rcar-gen3-cogent" BBFILE_PATTERN_rcar-gen3-cogent := "^${LAYERDIR}/../../../meta-rcar/meta-rcar-gen3-adas/" BBFILE_PRIORITY_rcar-gen3-cogent = "7" +LAYERSERIES_COMPAT_rcar-gen3-cogent = "thud" + # Custom packages IMAGE_INSTALL_append_rcar-gen3 = " \ can-utils \ @@ -39,7 +41,6 @@ IMAGE_INSTALL_append_rcar-gen3 = " \ IMAGE_INSTALL_append_rcar-gen3 += " \ si-tools \ linux-firmware-wl18xx \ - wireless-tools \ ti-bt \ ti-bt-firmware \ bluez5 \ diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter_1.0.0.bbappend b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter_1.0.1.bbappend index e77b58e01..e77b58e01 100644 --- a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter_1.0.0.bbappend +++ b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter_1.0.1.bbappend diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-ducati_git.bb b/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-ducati_git.bb deleted file mode 100644 index 3f806eb8a..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-ducati_git.bb +++ /dev/null @@ -1,15 +0,0 @@ -DESCRIPTION = "GStreamer elements to use the multimedia accelerators available on some TI parts" -LICENSE = "LGPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" - -require gstreamer1.0-plugins-ti.inc - -PR = "${INC_PR}.24" -SRCREV = "e797c1d832cc8ee1dd66d1683991cb6d7316ed63" - -BRANCH ?= "master" - -SRC_URI = "git://git.ti.com/glsdk/gst-plugin-ducati.git;protocol=git;branch=${BRANCH} \ - " - -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-ti.inc b/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-ti.inc deleted file mode 100644 index 529306bf8..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-ti.inc +++ /dev/null @@ -1,23 +0,0 @@ -# Include file for common build settings for TI GStreamer plugins -DEPENDS += "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad libdrm libdce" - -inherit autotools-brokensep pkgconfig gettext - -INC_PR = "r2" - -S = "${WORKDIR}/git" - -PACKAGE_ARCH = "${MACHINE_ARCH}" - -do_configure() { - cd ${S} - chmod +x autogen.sh - ./autogen.sh --host=arm-linux --with-libtool-sysroot=${STAGING_DIR_TARGET} --prefix=/usr -} - -EXTRA_OECONF += "--enable-maintainer-mode" -EXTRA_OEMAKE += "'ERROR_CFLAGS=-Wno-deprecated-declarations'" - -FILES_${PN} += "${libdir}/gstreamer-1.0/*.so" -FILES_${PN}-dbg += "${libdir}/gstreamer-1.0/.debug" -FILES_${PN}-dev += "${libdir}/gstreamer-1.0/*.la" diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-vpe/ti-video.conf b/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-vpe/ti-video.conf deleted file mode 100644 index 339a0c196..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-vpe/ti-video.conf +++ /dev/null @@ -1 +0,0 @@ -install ti-vip /sbin/modprobe ti-vpe; /sbin/modprobe --ignore-install ti-vip diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-vpe_git.bb b/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-vpe_git.bb deleted file mode 100644 index e0fb640e3..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gst-plugins-ti/gstreamer1.0-plugins-vpe_git.bb +++ /dev/null @@ -1,18 +0,0 @@ -DESCRIPTION = "GStreamer elements to use the Video Processing Engine (VPE) found on some TI devices" - -LICENSE = "LGPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" - -require gstreamer1.0-plugins-ti.inc - -PR = "${INC_PR}.14" -SRCREV = "6ec1a9c9fc17e0cae781aed067a2a6f2c1f92d68" - -SRC_URI = "git://git.ti.com/glsdk/gst-plugin-vpe.git;protocol=git \ - file://ti-video.conf \ -" - -do_install_append() { - install -d ${D}/etc/modprobe.d - install -m 644 ${WORKDIR}/ti-video.conf ${D}/etc/modprobe.d -} diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-Enable-mouse-movement-for-videos-on-waylandsink.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-Enable-mouse-movement-for-videos-on-waylandsink.patch deleted file mode 100644 index 06d28bc82..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-Enable-mouse-movement-for-videos-on-waylandsink.patch +++ /dev/null @@ -1,404 +0,0 @@ -From 90fafb6ea39940161f3bf86ab7f557197ff389ff Mon Sep 17 00:00:00 2001 -From: Pooja Prajod <a0132412@ti.com> -Date: Fri, 26 Feb 2016 16:46:39 -0500 -Subject: [PATCH] Enable mouse movement for videos on waylandsink - -This patch enables grab, drag and ungrab of videos -that are being played on waylandsink. - -Signed-off-by: Pooja Prajod <a0132412@ti.com> ---- - ext/wayland/gstwaylandsink.c | 283 +++++++++++++++++++++++++++++++++++++++++++ - ext/wayland/gstwaylandsink.h | 26 ++++ - 2 files changed, 309 insertions(+) - -diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c -index cabf310..7394a2b 100644 ---- a/ext/wayland/gstwaylandsink.c -+++ b/ext/wayland/gstwaylandsink.c -@@ -41,6 +41,7 @@ - #endif - - #include "gstwaylandsink.h" -+#include <linux/input.h> - - /* signals */ - enum -@@ -100,6 +101,9 @@ static void create_window (GstWaylandSink * sink, struct display *display, - int width, int height); - static void shm_pool_destroy (struct shm_pool *pool); - -+static void input_grab (struct input *input, struct window *window); -+static void input_ungrab (struct input *input); -+ - typedef struct - { - uint32_t wl_format; -@@ -225,6 +229,54 @@ gst_wayland_sink_set_property (GObject * object, - } - - static void -+input_grab (struct input *input, struct window *window) -+{ -+ input->grab = window; -+} -+ -+static void -+input_ungrab (struct input *input) -+{ -+ input->grab = NULL; -+} -+ -+static void -+input_remove_pointer_focus (struct input *input) -+{ -+ struct window *window = input->pointer_focus; -+ -+ if (!window) -+ return; -+ -+ input->pointer_focus = NULL; -+} -+ -+static void -+input_destroy (struct input *input) -+{ -+ input_remove_pointer_focus (input); -+ -+ if (input->display->seat_version >= 3) { -+ if (input->pointer) -+ wl_pointer_release (input->pointer); -+ } -+ -+ wl_list_remove (&input->link); -+ wl_seat_destroy (input->seat); -+ free (input); -+} -+ -+static void -+display_destroy_inputs (struct display *display) -+{ -+ struct input *tmp; -+ struct input *input; -+ -+ wl_list_for_each_safe (input, tmp, &display->input_list, link) -+ input_destroy (input); -+} -+ -+static void - destroy_display (struct display *display) - { - if (display->shm) -@@ -236,6 +288,7 @@ destroy_display (struct display *display) - if (display->compositor) - wl_compositor_destroy (display->compositor); - -+ display_destroy_inputs (display); - wl_display_flush (display->display); - wl_display_disconnect (display->display); - free (display); -@@ -318,6 +371,229 @@ struct wl_shm_listener shm_listenter = { - shm_format - }; - -+ -+static void -+pointer_handle_enter (void *data, struct wl_pointer *pointer, -+ uint32_t serial, struct wl_surface *surface, -+ wl_fixed_t sx_w, wl_fixed_t sy_w) -+{ -+ struct input *input = data; -+ -+ if (!surface) { -+ /* enter event for a window we've just destroyed */ -+ return; -+ } -+ -+ input->display->serial = serial; -+ input->pointer_focus = wl_surface_get_user_data (surface); -+} -+ -+static void -+pointer_handle_leave (void *data, struct wl_pointer *pointer, -+ uint32_t serial, struct wl_surface *surface) -+{ -+ struct input *input = data; -+ -+ input_remove_pointer_focus (input); -+} -+ -+static void -+pointer_handle_motion (void *data, struct wl_pointer *pointer, -+ uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) -+{ -+ struct input *input = data; -+ struct window *window = input->pointer_focus; -+ -+ if (!window) -+ return; -+ -+ if (input->grab) -+ wl_shell_surface_move (input->grab->shell_surface, input->seat, -+ input->display->serial); -+ -+} -+ -+static void -+pointer_handle_button (void *data, struct wl_pointer *pointer, uint32_t serial, -+ uint32_t time, uint32_t button, uint32_t state_w) -+{ -+ struct input *input = data; -+ enum wl_pointer_button_state state = state_w; -+ input->display->serial = serial; -+ -+ if (button == BTN_LEFT) { -+ if (state == WL_POINTER_BUTTON_STATE_PRESSED) -+ input_grab (input, input->pointer_focus); -+ -+ if (input->grab && state == WL_POINTER_BUTTON_STATE_RELEASED) -+ input_ungrab (input); -+ } -+ -+ if (input->grab) -+ wl_shell_surface_move (input->grab->shell_surface, input->seat, -+ input->display->serial); -+} -+ -+static void -+pointer_handle_axis (void *data, struct wl_pointer *pointer, -+ uint32_t time, uint32_t axis, wl_fixed_t value) -+{ -+} -+ -+static const struct wl_pointer_listener pointer_listener = { -+ pointer_handle_enter, -+ pointer_handle_leave, -+ pointer_handle_motion, -+ pointer_handle_button, -+ pointer_handle_axis, -+}; -+ -+static void -+touch_handle_down (void *data, struct wl_touch *wl_touch, -+ uint32_t serial, uint32_t time, struct wl_surface *surface, -+ int32_t id, wl_fixed_t x_w, wl_fixed_t y_w) -+{ -+ struct input *input = data; -+ struct touch_point *tp; -+ -+ input->display->serial = serial; -+ input->touch_focus = wl_surface_get_user_data (surface); -+ if (!input->touch_focus) { -+ return; -+ } -+ -+ tp = malloc (sizeof *tp); -+ if (tp) { -+ tp->id = id; -+ wl_list_insert (&input->touch_point_list, &tp->link); -+ wl_shell_surface_move (input->touch_focus->shell_surface, input->seat, -+ serial); -+ } -+} -+ -+static void -+touch_handle_motion (void *data, struct wl_touch *wl_touch, -+ uint32_t time, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w) -+{ -+ struct input *input = data; -+ struct touch_point *tp; -+ -+ -+ if (!input->touch_focus) { -+ return; -+ } -+ wl_list_for_each (tp, &input->touch_point_list, link) { -+ if (tp->id != id) -+ continue; -+ -+ wl_shell_surface_move (input->touch_focus->shell_surface, input->seat, -+ input->display->serial); -+ -+ return; -+ } -+} -+ -+static void -+touch_handle_frame (void *data, struct wl_touch *wl_touch) -+{ -+} -+ -+static void -+touch_handle_cancel (void *data, struct wl_touch *wl_touch) -+{ -+} -+ -+static void -+touch_handle_up (void *data, struct wl_touch *wl_touch, -+ uint32_t serial, uint32_t time, int32_t id) -+{ -+ struct input *input = data; -+ struct touch_point *tp, *tmp; -+ -+ if (!input->touch_focus) { -+ return; -+ } -+ -+ wl_list_for_each_safe (tp, tmp, &input->touch_point_list, link) { -+ if (tp->id != id) -+ continue; -+ -+ wl_list_remove (&tp->link); -+ free (tp); -+ -+ return; -+ } -+} -+ -+static const struct wl_touch_listener touch_listener = { -+ touch_handle_down, -+ touch_handle_up, -+ touch_handle_motion, -+ touch_handle_frame, -+ touch_handle_cancel, -+}; -+ -+ -+ -+static void -+seat_handle_capabilities (void *data, struct wl_seat *seat, -+ enum wl_seat_capability caps) -+{ -+ struct input *input = data; -+ -+ if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) { -+ input->pointer = wl_seat_get_pointer (seat); -+ wl_pointer_set_user_data (input->pointer, input); -+ wl_pointer_add_listener (input->pointer, &pointer_listener, input); -+ } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { -+ wl_pointer_destroy (input->pointer); -+ input->pointer = NULL; -+ } -+ -+ if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) { -+ input->touch = wl_seat_get_touch (seat); -+ wl_touch_set_user_data (input->touch, input); -+ wl_touch_add_listener (input->touch, &touch_listener, input); -+ } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { -+ wl_touch_destroy (input->touch); -+ input->touch = NULL; -+ } -+} -+ -+static void -+seat_handle_name (void *data, struct wl_seat *seat, const char *name) -+{ -+ -+} -+ -+static const struct wl_seat_listener seat_listener = { -+ seat_handle_capabilities, -+ seat_handle_name -+}; -+ -+static void -+display_add_input (struct display *d, uint32_t id) -+{ -+ struct input *input; -+ -+ input = calloc (1, sizeof (*input)); -+ if (input == NULL) { -+ fprintf (stderr, "%s: out of memory\n", "gst-wayland-sink"); -+ exit (EXIT_FAILURE); -+ } -+ input->display = d; -+ input->seat = wl_registry_bind (d->registry, id, &wl_seat_interface, -+ MAX (d->seat_version, 3)); -+ input->touch_focus = NULL; -+ input->pointer_focus = NULL; -+ wl_list_init (&input->touch_point_list); -+ wl_list_insert (d->input_list.prev, &input->link); -+ -+ wl_seat_add_listener (input->seat, &seat_listener, input); -+ wl_seat_set_user_data (input->seat, input); -+ -+} -+ - static void - registry_handle_global (void *data, struct wl_registry *registry, - uint32_t id, const char *interface, uint32_t version) -@@ -332,6 +608,9 @@ registry_handle_global (void *data, struct wl_registry *registry, - } else if (strcmp (interface, "wl_shm") == 0) { - d->shm = wl_registry_bind (registry, id, &wl_shm_interface, 1); - wl_shm_add_listener (d->shm, &shm_listenter, d); -+ } else if (strcmp (interface, "wl_seat") == 0) { -+ d->seat_version = version; -+ display_add_input (d, id); - } - } - -@@ -352,6 +631,8 @@ create_display (void) - return NULL; - } - -+ wl_list_init (&display->input_list); -+ - display->registry = wl_display_get_registry (display->display); - wl_registry_add_listener (display->registry, ®istry_listener, display); - -@@ -491,6 +772,8 @@ create_window (GstWaylandSink * sink, struct display *display, int width, - - window->surface = wl_compositor_create_surface (display->compositor); - -+ wl_surface_set_user_data (window->surface, window); -+ - window->shell_surface = wl_shell_get_shell_surface (display->shell, - window->surface); - -diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h -index cb3383e..f7d30dc 100644 ---- a/ext/wayland/gstwaylandsink.h -+++ b/ext/wayland/gstwaylandsink.h -@@ -55,6 +55,27 @@ - #define GST_WAYLAND_SINK_GET_CLASS(inst) \ - (G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_WAYLAND_SINK, GstWaylandSinkClass)) - -+struct touch_point -+{ -+ int32_t id; -+ struct wl_list link; -+}; -+ -+struct input -+{ -+ struct display *display; -+ struct wl_seat *seat; -+ struct wl_pointer *pointer; -+ struct wl_touch *touch; -+ struct wl_list touch_point_list; -+ struct window *pointer_focus; -+ struct window *touch_focus; -+ struct wl_list link; -+ struct window *grab; -+ -+}; -+ -+ - struct display - { - struct wl_display *display; -@@ -63,6 +84,11 @@ struct display - struct wl_shell *shell; - struct wl_shm *shm; - uint32_t formats; -+ -+ struct wl_list input_list; -+ int seat_version; -+ uint32_t serial; -+ - }; - - struct window --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-gstdrmallocator-Add-DRM-allocator-support.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-gstdrmallocator-Add-DRM-allocator-support.patch deleted file mode 100644 index 38eb5a124..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-gstdrmallocator-Add-DRM-allocator-support.patch +++ /dev/null @@ -1,482 +0,0 @@ -From c5d115bf88f0d2fb64f58b21b72a3195eae98d0a Mon Sep 17 00:00:00 2001 -From: Pooja Prajod <a0132412@ti.com> -Date: Fri, 20 Jan 2017 14:41:45 +0530 -Subject: [PATCH 1/5] gstdrmallocator: Add DRM allocator support - -Add DRM based allocator support. - -The following changes are included : -1. Use DRM dumb buffers and associated APIs for -dmabuf allocation. -2. Have DRM device fd a member of allocator object -3. Allocate GstMemory objects with mem_type as 'dmabuf' - -Signed-off-by: Pooja Prajod <a0132412@ti.com> ---- - configure.ac | 5 + - gst-libs/gst/Makefile.am | 4 +- - gst-libs/gst/drm/Makefile.am | 33 +++++ - gst-libs/gst/drm/gstdrmallocator.c | 206 ++++++++++++++++++++++++++++++ - gst-libs/gst/drm/gstdrmallocator.h | 77 +++++++++++ - pkgconfig/Makefile.am | 3 + - pkgconfig/gstreamer-drm-uninstalled.pc.in | 11 ++ - pkgconfig/gstreamer-drm.pc.in | 12 ++ - 8 files changed, 349 insertions(+), 2 deletions(-) - create mode 100644 gst-libs/gst/drm/Makefile.am - create mode 100644 gst-libs/gst/drm/gstdrmallocator.c - create mode 100644 gst-libs/gst/drm/gstdrmallocator.h - create mode 100644 pkgconfig/gstreamer-drm-uninstalled.pc.in - create mode 100644 pkgconfig/gstreamer-drm.pc.in - -diff --git a/configure.ac b/configure.ac -index 5e85e56..e254605 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -621,6 +621,8 @@ if test x$with_egl_module_name != x; then - AC_DEFINE_UNQUOTED(GST_GL_LIBEGL_MODULE_NAME, "$with_egl_module_name", [EGL module name]) - fi - -+PKG_CHECK_MODULES([DRM], [libdrm libdrm_omap], HAVE_KMS=yes, HAVE_KMS=no) -+ - AC_ARG_ENABLE([wgl], - [ --enable-wgl Enable WGL support @<:@default=auto@:>@], - [case "${enableval}" in -@@ -3590,6 +3592,7 @@ gst-libs/Makefile - gst-libs/gst/Makefile - gst-libs/gst/adaptivedemux/Makefile - gst-libs/gst/basecamerabinsrc/Makefile -+gst-libs/gst/drm/Makefile - gst-libs/gst/gl/Makefile - gst-libs/gst/gl/android/Makefile - gst-libs/gst/gl/cocoa/Makefile -@@ -3749,6 +3752,8 @@ pkgconfig/gstreamer-plugins-bad.pc - pkgconfig/gstreamer-plugins-bad-uninstalled.pc - pkgconfig/gstreamer-codecparsers.pc - pkgconfig/gstreamer-codecparsers-uninstalled.pc -+pkgconfig/gstreamer-drm.pc -+pkgconfig/gstreamer-drm-uninstalled.pc - pkgconfig/gstreamer-insertbin.pc - pkgconfig/gstreamer-insertbin-uninstalled.pc - pkgconfig/gstreamer-gl.pc -diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am -index 7d0b309..5ec3967 100644 ---- a/gst-libs/gst/Makefile.am -+++ b/gst-libs/gst/Makefile.am -@@ -11,7 +11,7 @@ WAYLAND_DIR=wayland - endif - - SUBDIRS = uridownloader adaptivedemux interfaces basecamerabinsrc codecparsers \ -- insertbin mpegts base video audio player $(GL_DIR) $(WAYLAND_DIR) -+ insertbin mpegts base video audio player drm $(GL_DIR) $(WAYLAND_DIR) - - noinst_HEADERS = gst-i18n-plugin.h gettext.h glib-compat-private.h - DIST_SUBDIRS = uridownloader adaptivedemux interfaces gl basecamerabinsrc \ -@@ -24,7 +24,7 @@ adaptivedemux: uridownloader - - INDEPENDENT_SUBDIRS = \ - interfaces basecamerabinsrc codecparsers insertbin uridownloader \ -- mpegts base player $(GL_DIR) $(WAYLAND_DIR) -+ mpegts base player drm $(GL_DIR) $(WAYLAND_DIR) - - .PHONY: independent-subdirs $(INDEPENDENT_SUBDIRS) - -diff --git a/gst-libs/gst/drm/Makefile.am b/gst-libs/gst/drm/Makefile.am -new file mode 100644 -index 0000000..9a45dfb ---- /dev/null -+++ b/gst-libs/gst/drm/Makefile.am -@@ -0,0 +1,33 @@ -+lib_LTLIBRARIES = libgstdrm-@GST_API_VERSION@.la -+ -+CLEANFILES = $(BUILT_SOURCES) -+ -+libgstdrm_@GST_API_VERSION@_la_SOURCES = \ -+ gstdrmallocator.c -+ -+libgstdrm_@GST_API_VERSION@includedir = \ -+ $(includedir)/gstreamer-@GST_API_VERSION@/gst/drm -+ -+libgstdrm_@GST_API_VERSION@include_HEADERS = \ -+ gstdrmallocator.h -+ -+libgstdrm_@GST_API_VERSION@_la_CFLAGS = \ -+ $(DRM_CFLAGS) \ -+ $(OMAPDRM_CFLAGS) \ -+ $(GST_PLUGINS_BAD_CFLAGS) \ -+ $(GST_PLUGINS_BASE_CFLAGS) \ -+ -DGST_USE_UNSTABLE_API \ -+ $(GST_CFLAGS) -+ -+libgstdrm_@GST_API_VERSION@_la_LIBADD = \ -+ $(DRM_LIBS) \ -+ $(GST_PLUGINS_BASE_LIBS) \ -+ $(GST_BASE_LIBS) \ -+ -lgstallocators-$(GST_API_VERSION) \ -+ $(GST_LIBS) -+ -+libgstdrm_@GST_API_VERSION@_la_LDFLAGS = \ -+ $(DRM_LDFLAGS) \ -+ $(GST_LIB_LDFLAGS) \ -+ $(GST_ALL_LDFLAGS) \ -+ $(GST_LT_LDFLAGS) -diff --git a/gst-libs/gst/drm/gstdrmallocator.c b/gst-libs/gst/drm/gstdrmallocator.c -new file mode 100644 -index 0000000..b557ad2 ---- /dev/null -+++ b/gst-libs/gst/drm/gstdrmallocator.c -@@ -0,0 +1,206 @@ -+/* -+ * GStreamer -+ * -+ * Copyright (C) 2012 Texas Instruments -+ * -+ * Authors: -+ * Pooja Prajod <poojaprajod@ti.com> -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation -+ * version 2.1 of the License. -+ * -+ * 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+/** -+ * SECTION:GstDRMAllocator -+ * @short_description: GStreamer DRM allocator support -+ * -+ * Since: 1.6.3 -+ */ -+ -+ -+#include "gstdrmallocator.h" -+#include <stdio.h> -+#include <stdlib.h> -+#include <string.h> -+#include <errno.h> -+#include <unistd.h> -+#include <sys/mman.h> -+#include <sys/types.h> -+ -+#define INVALID_DRM_FD (-1) -+ -+GST_DEBUG_CATEGORY (drmallocator_debug); -+#define GST_CAT_DEFAULT drmallocator_debug -+ -+#define gst_drm_allocator_parent_class parent_class -+G_DEFINE_TYPE (GstDRMAllocator, gst_drm_allocator, GST_TYPE_FD_ALLOCATOR); -+ -+static GstMemory * -+gst_drm_allocator_alloc (GstAllocator * allocator, gsize size, -+ GstAllocationParams * params) -+{ -+ GstDRMAllocator *self = GST_DRM_ALLOCATOR (allocator); -+ int fd = -1; -+ int DrmDeviceFD = self->DrmDeviceFD; -+ GstMemory *mem; -+ /* Variable for DRM Dumb Buffers */ -+ -+ struct drm_mode_create_dumb creq; -+ struct drm_mode_destroy_dumb dreq; -+ int ret ; -+ -+ GST_LOG_OBJECT (self, "DRM Memory alloc"); -+ -+ memset(&creq, 0, sizeof(struct drm_mode_create_dumb)); -+ /* -+ We have only total size as argument to _allocator_alloc. -+ Since the DDR storage is linear, it is as good as saying -+ the buffer is of width = size and height = 1 -+ */ -+ creq.width = size; -+ creq.height = 1; -+ creq.bpp = 8; -+ -+ /* Create a DRM dumb buffer */ -+ ret = drmIoctl (DrmDeviceFD, DRM_IOCTL_MODE_CREATE_DUMB, &creq); -+ if (ret < 0) { -+ GST_ERROR_OBJECT (self, "Create DRM dumb buffer failed"); -+ return NULL; -+ } -+ /* Get a dmabuf fd from the dumb buffer handle */ -+ drmPrimeHandleToFD (DrmDeviceFD, creq.handle, DRM_CLOEXEC | O_RDWR, &fd); -+ -+ if (fd < 0) { -+ GST_ERROR_OBJECT (self, "Invalid fd returned: %d", fd); -+ goto fail; -+ } -+ -+ /* Get a dmabuf gstmemory with the fd */ -+ mem = gst_fd_allocator_alloc (allocator, fd, size, 0); -+ -+ if (G_UNLIKELY (!mem)) { -+ GST_ERROR_OBJECT (self, "GstDmaBufMemory allocation failed"); -+ close (fd); -+ goto fail; -+ } -+ -+ return mem; -+ -+ fail: -+ memset(&dreq, 0, sizeof(struct drm_mode_destroy_dumb)); -+ dreq.handle = creq.handle; -+ drmIoctl (DrmDeviceFD, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq); -+ return NULL; -+} -+ -+static void -+gst_drm_allocator_free (GstAllocator * allocator, GstMemory * mem) -+{ -+ GstDRMAllocator *self = GST_DRM_ALLOCATOR (allocator); -+ uint32_t handle = 0; -+ int DrmDeviceFD = self->DrmDeviceFD; -+ int fd = -1; -+ -+ GST_LOG_OBJECT (self, "DRM Memory free"); -+ -+ g_return_if_fail (GST_IS_ALLOCATOR (allocator)); -+ g_return_if_fail (mem != NULL); -+ g_return_if_fail (gst_is_drm_memory (mem)); -+ -+ fd = gst_fd_memory_get_fd (mem); -+ drmPrimeFDToHandle(DrmDeviceFD, fd, &handle); -+ -+ /* Incase there are some mapped memory, we unmap and ready it to be cleaned*/ -+ GST_ALLOCATOR_CLASS (parent_class)->free (allocator, mem); -+ -+ if (handle) { -+ struct drm_mode_destroy_dumb dreq; -+ memset(&dreq, 0, sizeof(struct drm_mode_destroy_dumb)); -+ dreq.handle = handle; -+ drmIoctl (DrmDeviceFD, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq); -+ } -+ -+ close (fd); -+} -+ -+static void -+gst_drm_allocator_finalize (GObject * obj) -+{ -+ GstDRMAllocator *self = GST_DRM_ALLOCATOR (obj); -+ GST_LOG_OBJECT (obj, "DRM Allocator finalize"); -+ -+ close (self->DrmDeviceFD); -+ self->DrmDeviceFD = INVALID_DRM_FD; -+ -+ G_OBJECT_CLASS (parent_class)->finalize (obj); -+} -+ -+static void -+gst_drm_allocator_class_init (GstDRMAllocatorClass * klass) -+{ -+ GstAllocatorClass *drm_alloc = (GstAllocatorClass *) klass; -+ -+ drm_alloc->alloc = GST_DEBUG_FUNCPTR (gst_drm_allocator_alloc); -+ drm_alloc->free = GST_DEBUG_FUNCPTR (gst_drm_allocator_free); -+ GST_DEBUG_CATEGORY_INIT (drmallocator_debug, "drmallocator", 0, -+ "GstDRMAllocator debug"); -+ -+} -+ -+static void -+gst_drm_allocator_init (GstDRMAllocator * self) -+{ -+ GstAllocator *alloc = GST_ALLOCATOR_CAST (self); -+ GObjectClass *object_class = G_OBJECT_CLASS (GST_DRM_ALLOCATOR_GET_CLASS(self)); -+ -+ if (self->DrmDeviceFD <= 0) { -+ self->DrmDeviceFD = open("/dev/dri/card0", O_RDWR | O_CLOEXEC); -+ if (self->DrmDeviceFD < 0) { -+ GST_ERROR_OBJECT (self, "Failed to open DRM device"); -+ } else { -+ drmDropMaster (self->DrmDeviceFD); -+ } -+ } -+ -+ alloc->mem_type = GST_ALLOCATOR_DMABUF; -+ -+ object_class->finalize = gst_drm_allocator_finalize; -+ -+ GST_OBJECT_FLAG_UNSET (self, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC); -+} -+ -+void -+gst_drm_allocator_register (void) -+{ -+ gst_allocator_register (GST_ALLOCATOR_DRM, -+ g_object_new (GST_TYPE_DRM_ALLOCATOR, NULL)); -+} -+ -+GstAllocator * -+gst_drm_allocator_get (void) -+{ -+ GstAllocator *alloc; -+ alloc = gst_allocator_find (GST_ALLOCATOR_DRM); -+ if (!alloc) { -+ gst_drm_allocator_register(); -+ alloc = gst_allocator_find (GST_ALLOCATOR_DRM); -+ } -+ return alloc; -+} -+ -+gboolean -+gst_is_drm_memory (GstMemory * mem) -+{ -+ return gst_memory_is_type (mem, GST_ALLOCATOR_DMABUF); -+} -diff --git a/gst-libs/gst/drm/gstdrmallocator.h b/gst-libs/gst/drm/gstdrmallocator.h -new file mode 100644 -index 0000000..1ca93ba ---- /dev/null -+++ b/gst-libs/gst/drm/gstdrmallocator.h -@@ -0,0 +1,77 @@ -+/* -+ * GStreamer -+ * -+ * Copyright (C) 2012 Texas Instruments -+ * -+ * Authors: -+ * Pooja Prajod <poojaprajod@ti.com> -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation -+ * version 2.1 of the License. -+ * -+ * 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+/** -+ * SECTION:GstDRMAllocator -+ * @short_description: GStreamer DRM allocator support -+ * -+ * Since: 1.6.3 -+ */ -+ -+#ifndef __GSTDRMALLOCATOR_H__ -+#define __GSTDRMALLOCATOR_H__ -+ -+#include <gst/gst.h> -+#include <gst/video/video.h> -+#include <gst/allocators/allocators.h> -+#include <stdint.h> -+ -+#include <xf86drm.h> -+#include <xf86drmMode.h> -+#include <fcntl.h> -+ -+G_BEGIN_DECLS -+ -+#define GST_TYPE_DRM_ALLOCATOR (gst_drm_allocator_get_type ()) -+#define GST_DRM_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DRM_ALLOCATOR, GstDRMAllocator)) -+#define GST_IS_DRM_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DRM_ALLOCATOR)) -+#define GST_DRM_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DRM_ALLOCATOR, GstDRMAllocatorClass)) -+#define GST_IS_DRM_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DRM_ALLOCATOR)) -+#define GST_DRM_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DRM_ALLOCATOR, GstDRMAllocatorClass)) -+ -+#define GST_ALLOCATOR_DRM "DRM" -+ -+typedef struct _GstDRMAllocator GstDRMAllocator; -+typedef struct _GstDRMAllocatorClass GstDRMAllocatorClass; -+ -+struct _GstDRMAllocator -+{ -+ GstFdAllocator parent; -+ int DrmDeviceFD; -+}; -+ -+struct _GstDRMAllocatorClass -+{ -+ GstFdAllocatorClass parent_class; -+}; -+ -+void gst_drm_allocator_register (void); -+GstAllocator * gst_drm_allocator_get (void); -+ -+gboolean gst_is_drm_memory (GstMemory * mem); -+ -+GType gst_drm_allocator_get_type (void); -+ -+G_END_DECLS -+ -+#endif /* __GSTDRMALLOCATOR_H__ */ -diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am -index 88c7e52..5fdccbf 100644 ---- a/pkgconfig/Makefile.am -+++ b/pkgconfig/Makefile.am -@@ -2,6 +2,7 @@ - ### all of the standard pc files we need to generate - pcverfiles = \ - gstreamer-plugins-bad-@GST_API_VERSION@.pc \ -+ gstreamer-drm-@GST_API_VERSION@.pc \ - gstreamer-codecparsers-@GST_API_VERSION@.pc \ - gstreamer-insertbin-@GST_API_VERSION@.pc \ - gstreamer-mpegts-@GST_API_VERSION@.pc \ -@@ -12,6 +13,7 @@ pcverfiles = \ - - pcverfiles_uninstalled = \ - gstreamer-plugins-bad-@GST_API_VERSION@-uninstalled.pc \ -+ gstreamer-drm-@GST_API_VERSION@-uninstalled.pc \ - gstreamer-codecparsers-@GST_API_VERSION@-uninstalled.pc \ - gstreamer-insertbin-@GST_API_VERSION@-uninstalled.pc \ - gstreamer-mpegts-@GST_API_VERSION@-uninstalled.pc \ -@@ -43,6 +45,7 @@ pkgconfig_DATA = $(pcverfiles) - CLEANFILES = $(pcverfiles) $(pcverfiles_uninstalled) - pcinfiles = \ - gstreamer-plugins-bad.pc.in gstreamer-plugins-bad-uninstalled.pc.in \ -+ gstreamer-drm.pc.in gstreamer-drm-uninstalled.pc.in \ - gstreamer-codecparsers.pc.in gstreamer-codecparsers-uninstalled.pc.in \ - gstreamer-gl.pc.in gstreamer-gl-uninstalled.pc.in \ - gstreamer-insertbin.pc.in gstreamer-insertbin-uninstalled.pc.in \ -diff --git a/pkgconfig/gstreamer-drm-uninstalled.pc.in b/pkgconfig/gstreamer-drm-uninstalled.pc.in -new file mode 100644 -index 0000000..9dcf978 ---- /dev/null -+++ b/pkgconfig/gstreamer-drm-uninstalled.pc.in -@@ -0,0 +1,11 @@ -+prefix= -+exec_prefix= -+libdir=${pcfiledir}/../gst-libs/gst/drm -+includedir=${pcfiledir}/../gst-libs -+ -+Name: GStreamer DRM Allocator, Uninstalled -+Description: DRM Allocator for GStreamer elements, uninstalled -+Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@ -+Version: @VERSION@ -+Libs: -L${libdir} ${libdir}/libgstdrm-@GST_MAJORMINOR@.la -+Cflags: -I${includedir} -diff --git a/pkgconfig/gstreamer-drm.pc.in b/pkgconfig/gstreamer-drm.pc.in -new file mode 100644 -index 0000000..d155e80 ---- /dev/null -+++ b/pkgconfig/gstreamer-drm.pc.in -@@ -0,0 +1,12 @@ -+prefix=@prefix@ -+exec_prefix=@exec_prefix@ -+libdir=@libdir@ -+includedir=@includedir@/gstreamer-@GST_MAJORMINOR@ -+ -+Name: GStreamer DRM Allocator -+Description: DRM Allocator for GStreamer elements -+Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@ -+Version: @VERSION@ -+Libs: -L${libdir} -lgstdrm-@GST_MAJORMINOR@ -+Cflags: -I${includedir} -+ --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-gstwaylandsink-Add-mouse-drag-and-drop-support.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-gstwaylandsink-Add-mouse-drag-and-drop-support.patch deleted file mode 100644 index 696202637..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-gstwaylandsink-Add-mouse-drag-and-drop-support.patch +++ /dev/null @@ -1,408 +0,0 @@ -From 79db7e4cab226515f0e4d40afdb5a5b478755396 Mon Sep 17 00:00:00 2001 -From: Pooja Prajod <a0132412@ti.com> -Date: Wed, 14 Sep 2016 16:03:17 -0400 -Subject: [PATCH] gstwaylandsink: Add mouse drag and drop support - -This patch adds mouse input listeners to WlDisplay instance. - -Signed-off-by: Pooja Prajod <a0132412@ti.com> -Signed-off-by: Eric Ruei <e-ruei1@ti.com> ---- - ext/wayland/wldisplay.c | 305 +++++++++++++++++++++++++++++++++++++++++++++++- - ext/wayland/wldisplay.h | 4 + - ext/wayland/wlwindow.c | 2 + - 3 files changed, 310 insertions(+), 1 deletion(-) - -diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c -index 8c5eeaf..c647f34 100644 ---- a/ext/wayland/wldisplay.c -+++ b/ext/wayland/wldisplay.c -@@ -21,18 +21,45 @@ - #ifdef HAVE_CONFIG_H - #include <config.h> - #endif -- -+#include <stdlib.h> -+#include <stdio.h> - #include "wldisplay.h" - #include "wlbuffer.h" -+#include "wlwindow.h" -+ -+#include <wayland-client-protocol.h> - -+#include <unistd.h> - #include <errno.h> -+#include <linux/input.h> - - GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug); - #define GST_CAT_DEFAULT gstwayland_debug - - G_DEFINE_TYPE (GstWlDisplay, gst_wl_display, G_TYPE_OBJECT); - -+struct touch_point -+{ -+ int32_t id; -+ struct wl_list link; -+}; -+ -+struct input -+{ -+ GstWlDisplay *display; -+ struct wl_seat *seat; -+ struct wl_pointer *pointer; -+ struct wl_touch *touch; -+ struct wl_list touch_point_list; -+ GstWlWindow *pointer_focus; -+ GstWlWindow *touch_focus; -+ struct wl_list link; -+ GstWlWindow *grab; -+}; -+ - static void gst_wl_display_finalize (GObject * gobject); -+static void input_grab (struct input *input, GstWlWindow *window); -+static void input_ungrab (struct input *input); - - static void - gst_wl_display_class_init (GstWlDisplayClass * klass) -@@ -51,6 +78,54 @@ gst_wl_display_init (GstWlDisplay * self) - } - - static void -+input_grab (struct input *input, GstWlWindow *window) -+{ -+ input->grab = window; -+} -+ -+static void -+input_ungrab (struct input *input) -+{ -+ input->grab = NULL; -+} -+ -+static void -+input_remove_pointer_focus (struct input *input) -+{ -+ GstWlWindow *window = input->pointer_focus; -+ -+ if (!window) -+ return; -+ -+ input->pointer_focus = NULL; -+} -+ -+static void -+input_destroy (struct input *input) -+{ -+ input_remove_pointer_focus (input); -+ -+ if (input->display->seat_version >= 3) { -+ if (input->pointer) -+ wl_pointer_release (input->pointer); -+ } -+ -+ wl_list_remove (&input->link); -+ wl_seat_destroy (input->seat); -+ free (input); -+} -+ -+static void -+display_destroy_inputs (GstWlDisplay *display) -+{ -+ struct input *tmp; -+ struct input *input; -+ -+ wl_list_for_each_safe (input, tmp, &display->input_list, link) -+ input_destroy (input); -+} -+ -+static void - gst_wl_display_finalize (GObject * gobject) - { - GstWlDisplay *self = GST_WL_DISPLAY (gobject); -@@ -74,6 +149,8 @@ gst_wl_display_finalize (GObject * gobject) - g_hash_table_unref (self->buffers); - g_mutex_clear (&self->buffers_mutex); - -+ display_destroy_inputs (self); -+ - if (self->shm) - wl_shm_destroy (self->shm); - -@@ -143,6 +220,228 @@ static const struct wl_shm_listener shm_listener = { - shm_format - }; - -+ -+static void -+pointer_handle_enter (void *data, struct wl_pointer *pointer, -+ uint32_t serial, struct wl_surface *surface, -+ wl_fixed_t sx_w, wl_fixed_t sy_w) -+{ -+ struct input *input = data; -+ -+ if (!surface) { -+ /* enter event for a window we've just destroyed */ -+ return; -+ } -+ -+ input->display->serial = serial; -+ input->pointer_focus = wl_surface_get_user_data (surface); -+} -+ -+static void -+pointer_handle_leave (void *data, struct wl_pointer *pointer, -+ uint32_t serial, struct wl_surface *surface) -+{ -+ struct input *input = data; -+ -+ input_remove_pointer_focus (input); -+} -+ -+static void -+pointer_handle_motion (void *data, struct wl_pointer *pointer, -+ uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) -+{ -+ struct input *input = data; -+ GstWlWindow *window = input->pointer_focus; -+ -+ if (!window) -+ return; -+ -+ if (input->grab) -+ wl_shell_surface_move (input->grab->shell_surface, input->seat, -+ input->display->serial); -+ -+} -+ -+static void -+pointer_handle_button (void *data, struct wl_pointer *pointer, uint32_t serial, -+ uint32_t time, uint32_t button, uint32_t state_w) -+{ -+ struct input *input = data; -+ enum wl_pointer_button_state state = state_w; -+ input->display->serial = serial; -+ -+ if (button == BTN_LEFT) { -+ if (state == WL_POINTER_BUTTON_STATE_PRESSED) -+ input_grab (input, input->pointer_focus); -+ -+ if (input->grab && state == WL_POINTER_BUTTON_STATE_RELEASED) -+ input_ungrab (input); -+ } -+ -+ if (input->grab) -+ wl_shell_surface_move (input->grab->shell_surface, input->seat, -+ input->display->serial); -+} -+ -+static void -+pointer_handle_axis (void *data, struct wl_pointer *pointer, -+ uint32_t time, uint32_t axis, wl_fixed_t value) -+{ -+} -+ -+static const struct wl_pointer_listener pointer_listener = { -+ pointer_handle_enter, -+ pointer_handle_leave, -+ pointer_handle_motion, -+ pointer_handle_button, -+ pointer_handle_axis, -+}; -+ -+static void -+touch_handle_down (void *data, struct wl_touch *wl_touch, -+ uint32_t serial, uint32_t time, struct wl_surface *surface, -+ int32_t id, wl_fixed_t x_w, wl_fixed_t y_w) -+{ -+ struct input *input = data; -+ struct touch_point *tp; -+ -+ input->display->serial = serial; -+ input->touch_focus = wl_surface_get_user_data (surface); -+ if (!input->touch_focus) { -+ return; -+ } -+ -+ tp = malloc (sizeof *tp); -+ if (tp) { -+ tp->id = id; -+ wl_list_insert (&input->touch_point_list, &tp->link); -+ wl_shell_surface_move (input->touch_focus->shell_surface, input->seat, -+ serial); -+ } -+} -+ -+static void -+touch_handle_motion (void *data, struct wl_touch *wl_touch, -+ uint32_t time, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w) -+{ -+ struct input *input = data; -+ struct touch_point *tp; -+ -+ -+ if (!input->touch_focus) { -+ return; -+ } -+ wl_list_for_each (tp, &input->touch_point_list, link) { -+ if (tp->id != id) -+ continue; -+ -+ wl_shell_surface_move (input->touch_focus->shell_surface, input->seat, -+ input->display->serial); -+ -+ return; -+ } -+} -+ -+static void -+touch_handle_frame (void *data, struct wl_touch *wl_touch) -+{ -+} -+ -+static void -+touch_handle_cancel (void *data, struct wl_touch *wl_touch) -+{ -+} -+ -+static void -+touch_handle_up (void *data, struct wl_touch *wl_touch, -+ uint32_t serial, uint32_t time, int32_t id) -+{ -+ struct input *input = data; -+ struct touch_point *tp, *tmp; -+ -+ if (!input->touch_focus) { -+ return; -+ } -+ -+ wl_list_for_each_safe (tp, tmp, &input->touch_point_list, link) { -+ if (tp->id != id) -+ continue; -+ -+ wl_list_remove (&tp->link); -+ free (tp); -+ -+ return; -+ } -+} -+ -+static const struct wl_touch_listener touch_listener = { -+ touch_handle_down, -+ touch_handle_up, -+ touch_handle_motion, -+ touch_handle_frame, -+ touch_handle_cancel, -+}; -+ -+ -+static void -+seat_handle_capabilities (void *data, struct wl_seat *seat, -+ enum wl_seat_capability caps) -+{ -+ struct input *input = data; -+ -+ if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) { -+ input->pointer = wl_seat_get_pointer (seat); -+ wl_pointer_set_user_data (input->pointer, input); -+ wl_pointer_add_listener (input->pointer, &pointer_listener, input); -+ } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { -+ wl_pointer_destroy (input->pointer); -+ input->pointer = NULL; -+ } -+ -+ if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) { -+ input->touch = wl_seat_get_touch (seat); -+ wl_touch_set_user_data (input->touch, input); -+ wl_touch_add_listener (input->touch, &touch_listener, input); -+ } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { -+ wl_touch_destroy (input->touch); -+ input->touch = NULL; -+ } -+} -+ -+static void -+seat_handle_name (void *data, struct wl_seat *seat, const char *name) -+{ -+ -+} -+ -+static const struct wl_seat_listener seat_listener = { -+ seat_handle_capabilities, -+ seat_handle_name -+}; -+ -+static void -+display_add_input (GstWlDisplay *d, uint32_t id) -+{ -+ struct input *input; -+ -+ input = calloc (1, sizeof (*input)); -+ if (input == NULL) { -+ fprintf (stderr, "%s: out of memory\n", "gst-wayland-sink"); -+ exit (EXIT_FAILURE); -+ } -+ input->display = d; -+ input->seat = wl_registry_bind (d->registry, id, &wl_seat_interface, -+ MAX (d->seat_version, 3)); -+ input->touch_focus = NULL; -+ input->pointer_focus = NULL; -+ wl_list_init (&input->touch_point_list); -+ wl_list_insert (d->input_list.prev, &input->link); -+ -+ wl_seat_add_listener (input->seat, &seat_listener, input); -+ wl_seat_set_user_data (input->seat, input); -+ -+} -+ - static void - registry_handle_global (void *data, struct wl_registry *registry, - uint32_t id, const char *interface, uint32_t version) -@@ -160,6 +459,9 @@ registry_handle_global (void *data, struct wl_registry *registry, - } else if (g_strcmp0 (interface, "wl_shm") == 0) { - self->shm = wl_registry_bind (registry, id, &wl_shm_interface, 1); - wl_shm_add_listener (self->shm, &shm_listener, self); -+ } else if (g_strcmp0 (interface, "wl_seat") == 0) { -+ self->seat_version = version; -+ display_add_input (self, id); - } else if (g_strcmp0 (interface, "wl_scaler") == 0) { - self->scaler = wl_registry_bind (registry, id, &wl_scaler_interface, 2); - } -@@ -237,6 +539,7 @@ gst_wl_display_new_existing (struct wl_display * display, - self->own_display = take_ownership; - - self->queue = wl_display_create_queue (self->display); -+ wl_list_init (&self->input_list); - self->registry = wl_display_get_registry (self->display); - wl_proxy_set_queue ((struct wl_proxy *) self->registry, self->queue); - wl_registry_add_listener (self->registry, ®istry_listener, self); -diff --git a/ext/wayland/wldisplay.h b/ext/wayland/wldisplay.h -index 5505d60..d8c2cef 100644 ---- a/ext/wayland/wldisplay.h -+++ b/ext/wayland/wldisplay.h -@@ -62,6 +62,10 @@ struct _GstWlDisplay - GMutex buffers_mutex; - GHashTable *buffers; - gboolean shutting_down; -+ -+ struct wl_list input_list; -+ int seat_version; -+ uint32_t serial; - }; - - struct _GstWlDisplayClass -diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c -index a964335..34ae385 100644 ---- a/ext/wayland/wlwindow.c -+++ b/ext/wayland/wlwindow.c -@@ -111,6 +111,8 @@ gst_wl_window_new_internal (GstWlDisplay * display) - - window->area_surface = wl_compositor_create_surface (display->compositor); - window->video_surface = wl_compositor_create_surface (display->compositor); -+ wl_surface_set_user_data (window->area_surface, window); -+ wl_surface_set_user_data (window->video_surface, window); - - wl_proxy_set_queue ((struct wl_proxy *) window->area_surface, display->queue); - wl_proxy_set_queue ((struct wl_proxy *) window->video_surface, --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-gstwaylandsink-add-input-format-I420-support.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-gstwaylandsink-add-input-format-I420-support.patch deleted file mode 100644 index 507f57b92..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0001-gstwaylandsink-add-input-format-I420-support.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 1364ee6e60eb09a3fe3b072fe4671c5d645e523a Mon Sep 17 00:00:00 2001 -From: Eric Ruei <e-ruei1@ti.com> -Date: Wed, 22 Feb 2017 10:49:01 -0500 -Subject: [PATCH 1/3] gstwaylandsink: add input format I420 support - -The software-based video decoder produces the output in I420 format. To display -the output without additional ARM MHz consumed in video format conversion, -the function gst_wl_memory_construct_wl_buffer is enhanced to support I420 format. - -Signed-off-by: Eric Ruei <e-ruei1@ti.com> ---- - ext/wayland/wldrm.c | 41 ++++++++++++++++++++++++++++++++++------- - 1 file changed, 34 insertions(+), 7 deletions(-) - -diff --git a/ext/wayland/wldrm.c b/ext/wayland/wldrm.c -index 3dc9c21..ecbdc88 100644 ---- a/ext/wayland/wldrm.c -+++ b/ext/wayland/wldrm.c -@@ -5,33 +5,60 @@ - #include <omap_drmif.h> - #include <wayland-client.h> - -+GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug); -+#define GST_CAT_DEFAULT gstwayland_debug -+ -+ - struct wl_buffer * - gst_wl_drm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display, - const GstVideoInfo * info) - { - gint video_width = GST_VIDEO_INFO_WIDTH (info); - gint video_height = GST_VIDEO_INFO_HEIGHT (info); -+ GstVideoFormat format = GST_VIDEO_INFO_FORMAT (info); - int fd = -1; - struct omap_bo *bo; - struct wl_buffer *buffer; -- -- /* TODO get format, etc from caps.. and query device for -- * supported formats, and make this all more flexible to -- * cope with various formats: -- */ -- uint32_t fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2'); -+ uint32_t fourcc; - uint32_t name; - /* note: wayland and mesa use the terminology: - * stride - rowstride in bytes - * pitch - rowstride in pixels - */ - uint32_t strides[3] = { -- GST_ROUND_UP_4 (video_width), GST_ROUND_UP_4 (video_width), 0, -+ GST_ROUND_UP_4 (video_width), 0, 0, - }; - uint32_t offsets[3] = { - 0, strides[0] * video_height, 0 - }; - -+ if (format == GST_VIDEO_FORMAT_NV12) -+ { -+ /* NV12 */ -+ fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2'); -+ strides[1] = GST_ROUND_UP_4 (video_width); -+ } -+ else if(format == GST_VIDEO_FORMAT_I420) -+ { -+ /* YUV420 */ -+ fourcc = GST_MAKE_FOURCC ('Y', 'U', '1', '2'); -+ strides[1] = strides[2] = GST_ROUND_UP_4 (video_width/2); -+ offsets[2] = offsets[1] + strides[1] * video_height/2; -+ } -+ else -+ { -+ -+ GST_DEBUG ("Unsupported video format: %d", format); -+ /* -+ * There are two xRGB frames with width and height = 1 required in the begining of a video stream. -+ * If we consider them as errot, then it will case libwayland-clent.so crashes -+ * due to invalid error handling. -+ * Consider them as NV12 until we can figure out a better solution -+ */ -+ fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2'); -+ strides[1] = GST_ROUND_UP_4 (video_width); -+ } -+ - fd = gst_fd_memory_get_fd (mem); - - if (fd < 0 ) { --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0002-kmssink-remove-DCE-dependencies.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0002-kmssink-remove-DCE-dependencies.patch deleted file mode 100644 index 308a84959..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0002-kmssink-remove-DCE-dependencies.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 68936c7fb864440bb4d2ab737a651888ac7c253a Mon Sep 17 00:00:00 2001 -From: Eric Ruei <e-ruei1@ti.com> -Date: Fri, 17 Mar 2017 10:42:32 -0400 -Subject: [PATCH 2/3] kmssink: remove DCE dependencies - -Replace DCE related API calls to libdrm and omapdrm API calls -to decouple DCE from kmssink - -Signed-off-by: Eric Ruei <e-ruei1@ti.com> ---- - configure.ac | 1 - - sys/kms/Makefile.am | 2 -- - sys/kms/gstkmssink.c | 17 +++++++++++++---- - 3 files changed, 13 insertions(+), 7 deletions(-) - -diff --git a/configure.ac b/configure.ac -index f93d52d..a6f93a5 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -2321,7 +2321,6 @@ dnl *** kms *** - translit(dnm, m, l) AM_CONDITIONAL(USE_KMS, true) - AG_GST_CHECK_FEATURE(KMS, [kmssink], kms, [ - PKG_CHECK_MODULES([DRM], [libdrm libdrm_omap], HAVE_KMS=yes, HAVE_KMS=no) --PKG_CHECK_MODULES(LIBDCE, [libdce >= 1.0.0], HAVE_KMS=yes, HAVE_KMS=no) - AC_SUBST(DRM_CFLAGS) - AC_SUBST(DRM_LIBS) - ]) -diff --git a/sys/kms/Makefile.am b/sys/kms/Makefile.am -index 6d56073..cc7353e 100644 ---- a/sys/kms/Makefile.am -+++ b/sys/kms/Makefile.am -@@ -9,7 +9,6 @@ libgstkmssink_la_CFLAGS = \ - $(GST_PLUGINS_BAD_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) \ - $(GST_BASE_CFLAGS) \ -- $(LIBDCE_CFLAGS) \ - $(GST_CFLAGS) \ - $(DRM_CFLAGS) - -@@ -17,7 +16,6 @@ libgstkmssink_la_LIBADD = \ - $(GST_PLUGINS_BASE_LIBS) \ - $(GST_BASE_LIBS) \ - $(GST_LIBS) \ -- $(LIBDCE_LIBS) \ - $(DRM_LIBS) \ - -lgstvideo-$(GST_API_VERSION) \ - $(top_builddir)/gst-libs/gst/drm/libgstdrm-$(GST_API_VERSION).la -diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c -index 17e6407..9795bdf 100644 ---- a/sys/kms/gstkmssink.c -+++ b/sys/kms/gstkmssink.c -@@ -31,7 +31,6 @@ - #include "gstkmssink.h" - #include "gstkmsbufferpriv.h" - --#include <libdce.h> - #include <omap_drm.h> - #include <omap_drmif.h> - #include <xf86drmMode.h> -@@ -516,13 +515,18 @@ gst_kms_sink_start (GstBaseSink * bsink) - - sink = GST_KMS_SINK (bsink); - -- drm_dev = dce_init (); -+ drm_fd = open("/dev/dri/card0", O_RDWR | O_CLOEXEC); -+ if(drm_fd == NULL) -+ goto drm_failed; -+ else { -+ drm_dev = omap_device_new(drm_fd); -+ } -+ - if (drm_dev == NULL) - goto device_failed; - else { -+ sink->fd = drm_fd; - sink->dev = drm_dev; -- sink->fd = dce_get_fd (); -- drm_fd = dce_get_fd (); - } - - sink->resources = drmModeGetResources (sink->fd); -@@ -539,6 +543,11 @@ fail: - gst_kms_sink_reset (sink); - return FALSE; - -+drm_failed: -+ GST_ELEMENT_ERROR (sink, RESOURCE, FAILED, -+ (NULL), ("drmOpen failed")); -+ goto fail; -+ - device_failed: - GST_ELEMENT_ERROR (sink, RESOURCE, FAILED, - (NULL), ("omap_device_new failed")); --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0002-parsers-Pick-previos-bug-fixes-on-different-parsers.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0002-parsers-Pick-previos-bug-fixes-on-different-parsers.patch deleted file mode 100644 index 707cfc2b7..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0002-parsers-Pick-previos-bug-fixes-on-different-parsers.patch +++ /dev/null @@ -1,146 +0,0 @@ -From c748e947ff35c4137178aef9bf229e0c67952982 Mon Sep 17 00:00:00 2001 -From: Pooja Prajod <a0132412@ti.com> -Date: Fri, 20 Jan 2017 14:57:29 +0530 -Subject: [PATCH 2/5] parsers: Pick previos bug fixes on different parsers - -The following bug fixes which were previously identified are picked : -1. Increase rank for vc1parse and jpegparse -2. Modify h264 and mpeg4 parsers to interpolate pts -3. Fix create() width and height calculation on h264parse - -Signed-off-by: Pooja Prajod <a0132412@ti.com> ---- - gst/jpegformat/gstjpegformat.c | 2 +- - gst/jpegformat/gstjpegparse.c | 2 +- - gst/videoparsers/gsth264parse.c | 22 +++++++--------------- - gst/videoparsers/gstmpeg4videoparse.c | 2 +- - gst/videoparsers/gstmpegvideoparse.c | 2 +- - gst/videoparsers/plugin.c | 2 +- - 6 files changed, 12 insertions(+), 20 deletions(-) - -diff --git a/gst/jpegformat/gstjpegformat.c b/gst/jpegformat/gstjpegformat.c -index b410466..ecb9311 100644 ---- a/gst/jpegformat/gstjpegformat.c -+++ b/gst/jpegformat/gstjpegformat.c -@@ -30,7 +30,7 @@ - static gboolean - plugin_init (GstPlugin * plugin) - { -- if (!gst_element_register (plugin, "jpegparse", GST_RANK_NONE, -+ if (!gst_element_register (plugin, "jpegparse", GST_RANK_PRIMARY + 2, - GST_TYPE_JPEG_PARSE)) - return FALSE; - if (!gst_element_register (plugin, "jifmux", GST_RANK_SECONDARY, -diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c -index 77e53a6..5bfba7b 100644 ---- a/gst/jpegformat/gstjpegparse.c -+++ b/gst/jpegformat/gstjpegparse.c -@@ -151,7 +151,7 @@ gst_jpeg_parse_class_init (GstJpegParseClass * klass) - - gst_element_class_set_static_metadata (gstelement_class, - "JPEG stream parser", -- "Video/Parser", -+ "Codec/Parser/Video", - "Parse JPEG images into single-frame buffers", - "Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>"); - -diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c -index 05b6b75..6fe2914 100644 ---- a/gst/videoparsers/gsth264parse.c -+++ b/gst/videoparsers/gsth264parse.c -@@ -162,7 +162,7 @@ static void - gst_h264_parse_init (GstH264Parse * h264parse) - { - h264parse->frame_out = gst_adapter_new (); -- gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (h264parse), FALSE); -+ gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (h264parse), TRUE); - GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (h264parse)); - GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (h264parse)); - } -@@ -1722,13 +1722,8 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps) - gint fps_num, fps_den; - gint par_n, par_d; - -- if (sps->frame_cropping_flag) { -- crop_width = sps->crop_rect_width; -- crop_height = sps->crop_rect_height; -- } else { -- crop_width = sps->width; -- crop_height = sps->height; -- } -+ crop_width = (sps->crop_rect_width > sps->width)? sps->crop_rect_width: sps->width; -+ crop_height = (sps->crop_rect_height > sps->height)? sps->crop_rect_height: sps->height; - - if (G_UNLIKELY (h264parse->width != crop_width || - h264parse->height != crop_height)) { -@@ -1762,7 +1757,7 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps) - } - - if (G_UNLIKELY (modified || h264parse->update_caps)) { -- gint width, height; -+ gint width=0, height=0; - GstClockTime latency; - - const gchar *caps_mview_mode = NULL; -@@ -1774,16 +1769,13 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps) - - caps = gst_caps_copy (sink_caps); - -- /* sps should give this but upstream overrides */ - if (s && gst_structure_has_field (s, "width")) - gst_structure_get_int (s, "width", &width); -- else -- width = h264parse->width; -- -+ width = (width > h264parse->width)? width: h264parse->width; -+ - if (s && gst_structure_has_field (s, "height")) - gst_structure_get_int (s, "height", &height); -- else -- height = h264parse->height; -+ height = (height > h264parse->height)? height: h264parse->height; - - if (s == NULL || - !gst_structure_get_fraction (s, "pixel-aspect-ratio", &par_n, -diff --git a/gst/videoparsers/gstmpeg4videoparse.c b/gst/videoparsers/gstmpeg4videoparse.c -index a1fd3b2..7912254 100644 ---- a/gst/videoparsers/gstmpeg4videoparse.c -+++ b/gst/videoparsers/gstmpeg4videoparse.c -@@ -185,7 +185,7 @@ gst_mpeg4vparse_init (GstMpeg4VParse * parse) - parse->interval = DEFAULT_CONFIG_INTERVAL; - parse->last_report = GST_CLOCK_TIME_NONE; - -- gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), FALSE); -+ gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), TRUE); - GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (parse)); - GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (parse)); - } -diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c -index bf71a3e..f203cca 100644 ---- a/gst/videoparsers/gstmpegvideoparse.c -+++ b/gst/videoparsers/gstmpegvideoparse.c -@@ -175,7 +175,7 @@ gst_mpegv_parse_init (GstMpegvParse * parse) - { - parse->config_flags = FLAG_NONE; - -- gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), FALSE); -+ gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), TRUE); - GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (parse)); - GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (parse)); - } -diff --git a/gst/videoparsers/plugin.c b/gst/videoparsers/plugin.c -index 79d1df6..fb866b5 100644 ---- a/gst/videoparsers/plugin.c -+++ b/gst/videoparsers/plugin.c -@@ -51,7 +51,7 @@ plugin_init (GstPlugin * plugin) - ret |= gst_element_register (plugin, "h265parse", - GST_RANK_SECONDARY, GST_TYPE_H265_PARSE); - ret |= gst_element_register (plugin, "vc1parse", -- GST_RANK_NONE, GST_TYPE_VC1_PARSE); -+ GST_RANK_PRIMARY + 2, GST_TYPE_VC1_PARSE); - - return ret; - } --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0003-gstkmssink-Add-support-for-KMS-based-sink.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0003-gstkmssink-Add-support-for-KMS-based-sink.patch deleted file mode 100644 index 1068fda2c..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0003-gstkmssink-Add-support-for-KMS-based-sink.patch +++ /dev/null @@ -1,1592 +0,0 @@ -From 44ba6f9839a410e981c9c941f099316ebfac2659 Mon Sep 17 00:00:00 2001 -From: Pooja Prajod <a0132412@ti.com> -Date: Fri, 20 Jan 2017 16:18:22 +0530 -Subject: [PATCH 3/5] gstkmssink: Add support for KMS based sink - -The following features are enabled: -1. Add support for kmssink -2. Fix memory leak by using API's that do not hold - reference to GstMemory -3. Restrict the number of buffers that will be allocated - by kmssink bufferpool -4. Use Atomic mode setting instead of SetPlane -5. Store encoder and plane data as static data to enable - same process looping usecase -6. Handle usecase where display is disabled by default - -Signed-off-by: Pooja Prajod <a0132412@ti.com> ---- - configure.ac | 14 + - sys/Makefile.am | 10 +- - sys/kms/Makefile.am | 28 ++ - sys/kms/gstdrmutils.c | 347 +++++++++++++++++++++ - sys/kms/gstdrmutils.h | 50 +++ - sys/kms/gstkmsbufferpriv.c | 121 ++++++++ - sys/kms/gstkmsbufferpriv.h | 64 ++++ - sys/kms/gstkmssink.c | 740 +++++++++++++++++++++++++++++++++++++++++++++ - sys/kms/gstkmssink.h | 92 ++++++ - 9 files changed, 1464 insertions(+), 2 deletions(-) - create mode 100644 sys/kms/Makefile.am - create mode 100644 sys/kms/gstdrmutils.c - create mode 100644 sys/kms/gstdrmutils.h - create mode 100644 sys/kms/gstkmsbufferpriv.c - create mode 100644 sys/kms/gstkmsbufferpriv.h - create mode 100644 sys/kms/gstkmssink.c - create mode 100644 sys/kms/gstkmssink.h - -diff --git a/configure.ac b/configure.ac -index e254605..9fdfbc7 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -2324,6 +2324,18 @@ AG_GST_CHECK_FEATURE(KATE, [Kate], kate, [ - AC_SUBST(TIGER_LIBS) - ],,,[AM_CONDITIONAL(USE_TIGER, false)]) - -+ -+ -+dnl *** kms *** -+translit(dnm, m, l) AM_CONDITIONAL(USE_KMS, true) -+AG_GST_CHECK_FEATURE(KMS, [kmssink], kms, [ -+PKG_CHECK_MODULES([DRM], [libdrm libdrm_omap], HAVE_KMS=yes, HAVE_KMS=no) -+PKG_CHECK_MODULES(LIBDCE, [libdce >= 1.0.0], HAVE_KMS=yes, HAVE_KMS=no) -+AC_SUBST(DRM_CFLAGS) -+AC_SUBST(DRM_LIBS) -+]) -+ -+ - dnl *** ladspa *** - translit(dnm, m, l) AM_CONDITIONAL(USE_LADSPA, true) - AG_GST_CHECK_FEATURE(LADSPA, [ladspa], ladspa, [ -@@ -3383,6 +3395,7 @@ AM_CONDITIONAL(USE_GTK3_GL, false) - AM_CONDITIONAL(USE_HLS, false) - AM_CONDITIONAL(USE_KATE, false) - AM_CONDITIONAL(USE_TIGER, false) -+AM_CONDITIONAL(USE_KMS, false) - AM_CONDITIONAL(USE_LADSPA, false) - AM_CONDITIONAL(USE_LV2, false) - AM_CONDITIONAL(USE_LIBDE265, false) -@@ -3632,6 +3645,7 @@ sys/fbdev/Makefile - sys/linsys/Makefile - sys/nvenc/Makefile - sys/opensles/Makefile -+sys/kms/Makefile - sys/shm/Makefile - sys/tinyalsa/Makefile - sys/uvch264/Makefile -diff --git a/sys/Makefile.am b/sys/Makefile.am -index 32f79fb..325b4af 100644 ---- a/sys/Makefile.am -+++ b/sys/Makefile.am -@@ -87,6 +87,12 @@ PVR_DIR=pvr2d - else - PVR_DIR= - endif -+ -+if USE_KMS -+KMS_DIR=kms -+else -+KMS_DIR= -+endif - - if USE_SHM - SHM_DIR=shm -@@ -148,10 +154,10 @@ else - TINYALSA_DIR= - endif - --SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OPENSLES_DIR) $(PVR_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR) $(NVENC_DIR) $(TINYALSA_DIR) -+SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OPENSLES_DIR) $(PVR_DIR) $(KMS_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR) $(NVENC_DIR) $(TINYALSA_DIR) - - DIST_SUBDIRS = acmenc acmmp3dec androidmedia applemedia applemedia-nonpublic avc bluez d3dvideosink decklink directsound dvb linsys fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \ -- opensles pvr2d shm uvch264 vcd vdpau wasapi wininet winks winscreencap \ -+ opensles pvr2d kms shm uvch264 vcd vdpau wasapi wininet winks winscreencap \ - nvenc tinyalsa - - include $(top_srcdir)/common/parallel-subdirs.mak -diff --git a/sys/kms/Makefile.am b/sys/kms/Makefile.am -new file mode 100644 -index 0000000..6d56073 ---- /dev/null -+++ b/sys/kms/Makefile.am -@@ -0,0 +1,28 @@ -+plugin_LTLIBRARIES = libgstkmssink.la -+ -+libgstkmssink_la_SOURCES = \ -+ gstkmssink.c \ -+ gstkmsbufferpriv.c \ -+ gstdrmutils.c -+ -+libgstkmssink_la_CFLAGS = \ -+ $(GST_PLUGINS_BAD_CFLAGS) \ -+ $(GST_PLUGINS_BASE_CFLAGS) \ -+ $(GST_BASE_CFLAGS) \ -+ $(LIBDCE_CFLAGS) \ -+ $(GST_CFLAGS) \ -+ $(DRM_CFLAGS) -+ -+libgstkmssink_la_LIBADD = \ -+ $(GST_PLUGINS_BASE_LIBS) \ -+ $(GST_BASE_LIBS) \ -+ $(GST_LIBS) \ -+ $(LIBDCE_LIBS) \ -+ $(DRM_LIBS) \ -+ -lgstvideo-$(GST_API_VERSION) \ -+ $(top_builddir)/gst-libs/gst/drm/libgstdrm-$(GST_API_VERSION).la -+ -+libgstkmssink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -+libgstkmssink_la_LIBTOOLFLAGS = --tag=disable-static -+ -+noinst_HEADERS = gstkmssink.h gstdrmutils.h gstkmsbufferpriv.h -diff --git a/sys/kms/gstdrmutils.c b/sys/kms/gstdrmutils.c -new file mode 100644 -index 0000000..0e67a48 ---- /dev/null -+++ b/sys/kms/gstdrmutils.c -@@ -0,0 +1,347 @@ -+/* GStreamer -+ * -+ * Copyright (C) 2012 Texas Instruments -+ * Copyright (C) 2012 Collabora Ltd -+ * -+ * Authors: -+ * Alessandro Decina <alessandro.decina@collabora.co.uk> -+ * -+ * 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., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+ -+#include <gst/gst.h> -+#include "gstdrmutils.h" -+ -+static int stored_enc = 0; -+static drmModeEncoder *enc; -+static struct plane_data *stored_plane; -+ -+GST_DEBUG_CATEGORY_EXTERN (gst_debug_kms_sink); -+#define GST_CAT_DEFAULT gst_debug_kms_sink -+ -+void -+gst_drm_connector_cleanup (int fd, struct connector *c) -+{ -+ if (c->connector) { -+ drmModeFreeConnector (c->connector); -+ c->connector = NULL; -+ } -+ -+ if (c->fb_id) { -+ drmModeRmFB (fd, c->fb_id); -+ c->fb_id = 0; -+ } -+ if (c->fb_bo) { -+ omap_bo_del (c->fb_bo); -+ c->fb_bo = NULL; -+ } -+} -+ -+ -+static gboolean -+gst_drm_connector_find_mode_and_plane_helper (int fd, -+ struct omap_device *dev, int width, int height, -+ drmModeRes * resources, drmModePlaneRes * plane_resources, -+ struct connector *c) -+{ -+ int i, best_area = 0, ret; -+ struct drm_set_client_cap req; -+ unsigned int j; -+ int32_t crtc; -+ -+ gst_drm_connector_cleanup (fd, c); -+ -+ req.capability = DRM_CLIENT_CAP_ATOMIC; -+ req.value = 1; -+ ret = ioctl(fd, DRM_IOCTL_SET_CLIENT_CAP, &req); -+ if(ret < 0) { -+ GST_DEBUG("drm set atomic cap failed"); -+ goto fail; -+ } -+ -+ /* First, find the connector & mode */ -+ c->connector = drmModeGetConnector (fd, c->id); -+ if (!c->connector) -+ goto error_no_connector; -+ -+ if (!c->connector->count_modes) -+ goto error_no_mode; -+ -+ /* just look for the highest resolution: */ -+ for (i = 0; i < c->connector->count_modes; i++) { -+ drmModeModeInfo *mode = &c->connector->modes[i]; -+ int area = mode->hdisplay * mode->vdisplay; -+ -+ if (area > best_area) { -+ c->mode = mode; -+ best_area = area; -+ } -+ } -+ -+ if (c->mode == NULL) { -+ /* XXX: just pick the first available mode. Not sure this is correct... */ -+ c->mode = &c->connector->modes[0]; -+#if 0 -+ goto error_no_mode; -+#endif -+ } -+ -+ /* Now get the encoder */ -+ -+ if (stored_enc) { -+ c->encoder = enc; -+ c->connector->encoder_id = stored_enc; -+ } else { -+ c->encoder = drmModeGetEncoder (fd, c->connector->encoder_id); -+ enc = c->encoder; -+ stored_enc = c->connector->encoder_id; -+ } -+ -+ if (!c->encoder) { -+ for (i = 0; i < c->connector->count_encoders; ++i) { -+ c->encoder = drmModeGetEncoder(fd, c->connector->encoders[i]); -+ if (!c->encoder) { -+ GST_DEBUG ("Cannot retrieve encoder %u:%u (%d): %m\n", -+ i, c->connector->encoders[i], errno); -+ continue; -+ } -+ /* iterate all global CRTCs */ -+ for (j = 0; j < resources->count_crtcs; ++j) { -+ /* check whether this CRTC works with the encoder */ -+ if (!(c->encoder->possible_crtcs & (1 << j))) -+ continue; -+ crtc = resources->crtcs[j]; -+ break; -+ } -+ if (crtc >= 0) { -+ enc = c->encoder; -+ stored_enc = c->connector->encoder_id; -+ c->crtc = crtc; -+ goto found_encoder; -+ } -+ } -+ } -+ -+found_encoder: -+ -+ if (!c->encoder) -+ goto error_no_encoder; -+ -+ if (c->crtc == -1) -+ c->crtc = c->encoder->crtc_id; -+ -+ /* and figure out which crtc index it is: */ -+ c->pipe = -1; -+ for (i = 0; i < resources->count_crtcs; i++) { -+ if (c->crtc == (int) resources->crtcs[i]) { -+ c->pipe = i; -+ break; -+ } -+ } -+ -+ if (c->pipe == -1) -+ goto error_no_crtc; -+ -+ if (stored_plane) { -+ c->pdata = stored_plane; -+ } else { -+ -+ c->pdata = calloc(sizeof(struct plane_data), 1); -+ for (i = 0; i < plane_resources->count_planes; i++) { -+ drmModePlane *plane = drmModeGetPlane (fd, plane_resources->planes[i]); -+ int propc; -+ if (plane->possible_crtcs & (1 << c->pipe)) { -+ drmModeObjectPropertiesPtr props = drmModeObjectGetProperties(fd, plane_resources->planes[i], DRM_MODE_OBJECT_PLANE); -+ for(propc = 0; propc < props->count_props; propc++) { -+ drmModePropertyPtr prop = drmModeGetProperty(fd, props->props[propc]); -+ if(strcmp(prop->name, "FB_ID") == 0) -+ c->pdata[0].fb_id_property = props->props[propc]; -+ } -+ c->pdata[0].plane = plane_resources->planes[i]; -+ stored_plane = c->pdata; -+ break; -+ } -+ } -+ if (stored_plane == NULL) -+ goto error_no_plane; -+ } -+ c->fb_bo = omap_bo_new (dev, best_area * 2, OMAP_BO_WC); -+ if (c->fb_bo) { -+ uint32_t fourcc = DRM_FORMAT_RGB565; -+ uint32_t handles[4] = { omap_bo_handle (c->fb_bo) }; -+ uint32_t pitches[4] = { c->mode->hdisplay * 2 }; -+ uint32_t offsets[4] = { 0 }; -+ ret = drmModeAddFB2 (fd, c->mode->hdisplay, c->mode->vdisplay, -+ fourcc, handles, pitches, offsets, &c->fb_id, 0); -+ if (ret) { -+ GST_DEBUG ("RGB565 AddFb2 failed"); -+ } -+ } -+ -+ /* now set the desired mode: */ -+ ret = drmModeSetCrtc (fd, c->crtc, c->fb_id, 0, 0, &c->id, 1, c->mode); -+ if (ret) { -+ GST_DEBUG ("SetCrtc failed"); -+ } -+ -+ return TRUE; -+ -+fail: -+ gst_drm_connector_cleanup (fd, c); -+ -+ return FALSE; -+ -+error_no_connector: -+ GST_DEBUG ("could not get connector %s", strerror (errno)); -+ goto fail; -+ -+error_no_mode: -+ GST_DEBUG ("could not find mode %dx%d (count_modes %d)", -+ width, height, c->connector->count_modes); -+ goto fail; -+ -+error_no_encoder: -+ GST_DEBUG ("could not get encoder: %s", strerror (errno)); -+ goto fail; -+ -+error_no_crtc: -+ GST_DEBUG ("couldn't find a crtc"); -+ goto fail; -+ -+error_no_plane: -+ GST_DEBUG ("couldn't find a plane"); -+ goto fail; -+} -+ -+gboolean -+gst_drm_connector_find_mode_and_plane (int fd, -+ struct omap_device *dev, int width, int height, -+ drmModeRes * resources, drmModePlaneRes * plane_resources, -+ struct connector *c) -+{ -+ int i; -+ gboolean found = FALSE; -+ -+ /* First, find the connector & mode */ -+ if (c->id == 0) { -+ /* Any connector */ -+ GST_DEBUG ("Any connector, %d available", resources->count_connectors); -+ for (i = 0; i < resources->count_connectors; i++) { -+ GST_DEBUG (" %d", resources->connectors[i]); -+ } -+ for (i = 0; i < resources->count_connectors; i++) { -+ GST_DEBUG ("Trying connector %d: %d", i, resources->connectors[i]); -+ c->id = resources->connectors[i]; -+ if (gst_drm_connector_find_mode_and_plane_helper (fd, dev, width, height, -+ resources, plane_resources, c)) { -+ GST_DEBUG ("Found suitable connector"); -+ found = TRUE; -+ break; -+ } -+ GST_DEBUG ("Connector not suitable"); -+ } -+ } else { -+ /* A specific connector */ -+ GST_DEBUG ("Connector %d", c->id); -+ found = -+ gst_drm_connector_find_mode_and_plane_helper (fd, dev, width, height, -+ resources, plane_resources, c); -+ } -+ -+ return found; -+} -+ -+/* table nicked off libdrm's modetest.c */ -+/* *INDENT-OFF* */ -+static const struct { -+ int type_id; -+ const char *type_name; -+} connector_type_names[] = { -+ { DRM_MODE_CONNECTOR_Unknown, "unknown" }, -+ { DRM_MODE_CONNECTOR_VGA, "VGA" }, -+ { DRM_MODE_CONNECTOR_DVII, "DVI-I" }, -+ { DRM_MODE_CONNECTOR_DVID, "DVI-D" }, -+ { DRM_MODE_CONNECTOR_DVIA, "DVI-A" }, -+ { DRM_MODE_CONNECTOR_Composite, "composite" }, -+ { DRM_MODE_CONNECTOR_SVIDEO, "s-video" }, -+ { DRM_MODE_CONNECTOR_LVDS, "LVDS" }, -+ { DRM_MODE_CONNECTOR_Component, "component" }, -+ { DRM_MODE_CONNECTOR_9PinDIN, "9-pin-DIN" }, -+ { DRM_MODE_CONNECTOR_DisplayPort, "displayport" }, -+ { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" }, -+ { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" }, -+ { DRM_MODE_CONNECTOR_TV, "TV" }, -+ { DRM_MODE_CONNECTOR_eDP, "embedded-displayport" }, -+}; -+/* *INDENT-ON* */ -+ -+gboolean -+gst_drm_connector_find_mode_and_plane_by_name (int fd, -+ struct omap_device * dev, int width, int height, -+ drmModeRes * resources, drmModePlaneRes * plane_resources, -+ struct connector * c, const char *name) -+{ -+ int i, n; -+ char tmp[64]; -+ const char *type_name; -+ int found[G_N_ELEMENTS (connector_type_names)] = { 0 }; -+ -+ /* Find connector from name */ -+ for (i = 0; i < resources->count_connectors; i++) { -+ GST_DEBUG ("Trying connector %d: %d", i, resources->connectors[i]); -+ c->id = resources->connectors[i]; -+ c->connector = drmModeGetConnector (fd, c->id); -+ if (!c->connector) -+ continue; -+ -+ /* Find type name from this connector */ -+ for (n = 0; n < G_N_ELEMENTS (connector_type_names); n++) -+ if (connector_type_names[n].type_id == c->connector->connector_type) -+ break; -+ if (n == G_N_ELEMENTS (connector_type_names)) -+ continue; -+ -+ type_name = connector_type_names[n].type_name; -+ GST_DEBUG ("Connector %d has type %s", i, type_name); -+ ++found[n]; -+ -+ drmModeFreeConnector (c->connector); -+ c->connector = NULL; -+ -+ /* Try a few different matches, such as modetest and xrandr -+ output, and also a indexless one matching first found */ -+ snprintf (tmp, sizeof (tmp), "%s-%u", type_name, found[n]); -+ if (!g_ascii_strcasecmp (tmp, name)) -+ goto found; -+ snprintf (tmp, sizeof (tmp), "%s%u", type_name, found[n]); -+ if (!g_ascii_strcasecmp (tmp, name)) -+ goto found; -+ if (!g_ascii_strcasecmp (name, type_name)) -+ goto found; -+ -+ continue; -+ -+ found: -+ if (gst_drm_connector_find_mode_and_plane_helper (fd, dev, width, height, -+ resources, plane_resources, c)) { -+ GST_DEBUG ("Found suitable connector"); -+ return TRUE; -+ } -+ GST_DEBUG ("Connector not suitable"); -+ } -+ -+ return FALSE; -+} -diff --git a/sys/kms/gstdrmutils.h b/sys/kms/gstdrmutils.h -new file mode 100644 -index 0000000..ebc5fc6 ---- /dev/null -+++ b/sys/kms/gstdrmutils.h -@@ -0,0 +1,50 @@ -+#ifndef __GST_DRMUTILS_H__ -+#define __GST_DRMUTILS_H__ -+ -+#include <fcntl.h> -+#include <xf86drm.h> -+#include <stdio.h> -+#include <stdint.h> -+#include <stdlib.h> -+#include <string.h> -+#include <errno.h> -+#include <unistd.h> -+#include <assert.h> -+#include <libdrm/drm.h> -+#include <libdrm/drm_mode.h> -+#include <xf86drmMode.h> -+#include <omap_drm.h> -+#include <omap_drmif.h> -+#include <drm_fourcc.h> -+#include <gst/gst.h> -+#include <sys/ioctl.h> -+ -+struct plane_data { -+ int plane; -+ int fb_id_property; -+}; -+ -+struct connector { -+ uint32_t id; -+ char mode_str[64]; -+ drmModeConnector *connector; -+ drmModeModeInfo *mode; -+ drmModeEncoder *encoder; -+ uint32_t fb_id; -+ struct omap_bo *fb_bo; -+ int crtc; -+ int pipe; -+ struct plane_data *pdata; -+}; -+ -+void gst_drm_connector_cleanup (int fd, struct connector * c); -+gboolean gst_drm_connector_find_mode_and_plane (int fd, -+ struct omap_device * dev, int width, int height, -+ drmModeRes * resources, drmModePlaneRes * plane_resources, -+ struct connector *c); -+gboolean gst_drm_connector_find_mode_and_plane_by_name (int fd, -+ struct omap_device *dev, int width, int height, -+ drmModeRes * resources, drmModePlaneRes * plane_resources, -+ struct connector *c, const char *name); -+ -+#endif /* __GST_DRMUTILS_H__ */ -diff --git a/sys/kms/gstkmsbufferpriv.c b/sys/kms/gstkmsbufferpriv.c -new file mode 100644 -index 0000000..172a4c3 ---- /dev/null -+++ b/sys/kms/gstkmsbufferpriv.c -@@ -0,0 +1,121 @@ -+/* -+ * GStreamer -+ * -+ * Copyright (C) 2012 Texas Instruments -+ * Copyright (C) 2012 Collabora Ltd -+ * -+ * Authors: -+ * Alessandro Decina <alessandro.decina@collabora.co.uk> -+ * Rob Clark <rob.clark@linaro.org> -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation -+ * version 2.1 of the License. -+ * -+ * 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include <stdint.h> -+#include <gst/gst.h> -+#include <gst/allocators/allocators.h> -+ -+#include <omap_drm.h> -+#include <omap_drmif.h> -+#include <xf86drmMode.h> -+ -+#include "gstkmssink.h" -+#include "gstkmsbufferpriv.h" -+ -+static int -+create_fb (GstKMSBufferPriv * priv, GstKMSSink * sink) -+{ -+ /* TODO get format, etc from caps.. and query device for -+ * supported formats, and make this all more flexible to -+ * cope with various formats: -+ */ -+ uint32_t fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2'); -+ -+ uint32_t handles[4] = { -+ omap_bo_handle (priv->bo), omap_bo_handle (priv->bo), -+ }; -+ uint32_t pitches[4] = { -+ GST_ROUND_UP_4 (sink->input_width), GST_ROUND_UP_4 (sink->input_width), -+ }; -+ uint32_t offsets[4] = { -+ 0, pitches[0] * sink->input_height -+ }; -+ -+ return drmModeAddFB2 (priv->fd, sink->input_width, sink->input_height, -+ fourcc, handles, pitches, offsets, &priv->fb_id, 0); -+} -+ -+/** -+ * gst_kms_buffer_priv: -+ * @sink: a #GstKMSSink -+ * @buf: a pointer to #GstBuffer -+ * -+ * Checks if the @buf has a GstMetaDmaBuf metadata set. If it doesn't we return a NULL -+ * indicating its not a dmabuf buffer. We maintain a hashtable with dmabuf fd as key and -+ * the GstKMSBufferPriv structure as value -+ * -+ * Returns: the #GstKMSBufferPriv -+ * -+ * Since: 1.2.? -+ */ -+GstKMSBufferPriv * -+gst_kms_buffer_priv (GstKMSSink * sink, GstBuffer * buf) -+{ -+ struct omap_bo *bo; -+ int fd; -+ int fd_copy; -+ GstKMSBufferPriv * priv; -+ GstMemory *mem; -+ -+ /* if it isn't a dmabuf buffer that we can import, then there -+ * is nothing we can do with it: -+ */ -+ mem = gst_buffer_peek_memory (buf, 0); -+ fd_copy = gst_fd_memory_get_fd (mem); -+ if (fd_copy < 0) { -+ GST_DEBUG_OBJECT (sink, "not importing non dmabuf buffer"); -+ return NULL; -+ } -+ -+ /* lookup the hashtable with fd as key. If present return bo & buffer structure */ -+ priv = g_hash_table_lookup (sink->kmsbufferpriv, (gpointer)fd_copy); -+ if(priv) { -+ return priv; -+ } -+ -+ priv = g_malloc0 (sizeof (GstKMSBufferPriv)); -+ bo = omap_bo_from_dmabuf (sink->dev, fd_copy); -+ fd = sink->fd; -+ -+ priv->bo = bo; -+ priv->fd = fd; -+ -+ if (create_fb (priv, sink)) { -+ GST_WARNING_OBJECT (sink, "could not create framebuffer: %s", -+ strerror (errno)); -+ g_free(priv); -+ return NULL; -+ } -+ -+ /* if fd not present, write to hash table fd and the corresponding priv. */ -+ g_hash_table_insert(sink->kmsbufferpriv, (gpointer)fd_copy, priv); -+ -+ -+ return priv; -+} -diff --git a/sys/kms/gstkmsbufferpriv.h b/sys/kms/gstkmsbufferpriv.h -new file mode 100644 -index 0000000..a1070da ---- /dev/null -+++ b/sys/kms/gstkmsbufferpriv.h -@@ -0,0 +1,64 @@ -+/* -+ * GStreamer -+ * -+ * Copyright (C) 2012 Texas Instruments -+ * Copyright (C) 2012 Collabora Ltd -+ * -+ * Authors: -+ * Alessandro Decina <alessandro.decina@collabora.co.uk> -+ * Rob Clark <rob.clark@linaro.org> -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation -+ * version 2.1 of the License. -+ * -+ * 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#ifndef __GSTKMSBUFFERPRIV_H__ -+#define __GSTKMSBUFFERPRIV_H__ -+ -+#include <stdint.h> -+#include <gst/gst.h> -+ -+G_BEGIN_DECLS -+ -+/* -+ * per-buffer private data so kmssink can attach a drm_framebuffer -+ * handle (fb_id) to a buffer, which gets deleted when the buffer -+ * is finalized -+ */ -+ -+#define GST_TYPE_KMS_BUFFER_PRIV \ -+ (gst_kms_buffer_priv_get_type ()) -+#define GST_KMS_BUFFER_PRIV(obj) \ -+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_KMS_BUFFER_PRIV, GstKMSBufferPriv)) -+#define GST_IS_KMS_BUFFER_PRIV(obj) \ -+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_KMS_BUFFER_PRIV)) -+ -+ -+typedef struct -+{ -+ struct omap_bo *bo; -+ int fd; -+ uint32_t fb_id; -+}GstKMSBufferPriv; -+ -+ -+GType gst_kms_buffer_priv_get_type (void); -+ -+/* Returns a GstKMSBufferPriv, if it has a dmabuf fd metadata */ -+GstKMSBufferPriv * gst_kms_buffer_priv (GstKMSSink *sink, GstBuffer * buf); -+ -+G_END_DECLS -+ -+ -+#endif /* __GSTKMSBUFFERPRIV_H__ */ -diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c -new file mode 100644 -index 0000000..17e6407 ---- /dev/null -+++ b/sys/kms/gstkmssink.c -@@ -0,0 +1,740 @@ -+/* GStreamer -+ * Copyright (C) 2012 Texas Instruments -+ * Copyright (C) 2012 Collabora Ltd -+ * -+ * Authors: -+ * Alessandro Decina <alessandro.decina@collabora.co.uk> -+ * -+ * 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., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ * -+ * Authors: -+ * Alessandro Decina <alessandro.decina@collabora.co.uk> -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include "gstkmssink.h" -+#include "gstkmsbufferpriv.h" -+ -+#include <libdce.h> -+#include <omap_drm.h> -+#include <omap_drmif.h> -+#include <xf86drmMode.h> -+ -+static int drm_fd = -1; -+static struct omap_device *drm_dev; -+static int once =1; -+ -+GST_DEBUG_CATEGORY (gst_debug_kms_sink); -+#define GST_CAT_DEFAULT gst_debug_kms_sink -+ -+G_DEFINE_TYPE (GstKMSSink, gst_kms_sink, GST_TYPE_VIDEO_SINK); -+ -+static void gst_kms_sink_reset (GstKMSSink * sink); -+ -+static GstStaticPadTemplate gst_kms_sink_template_factory = -+GST_STATIC_PAD_TEMPLATE ("sink", -+ GST_PAD_SINK, -+ GST_PAD_ALWAYS, -+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE("NV12")) -+ ); -+ -+enum -+{ -+ PROP_0, -+ PROP_PIXEL_ASPECT_RATIO, -+ PROP_FORCE_ASPECT_RATIO, -+ PROP_SCALE, -+ PROP_CONNECTOR, -+ PROP_CONNECTOR_NAME, -+}; -+ -+ -+static inline void -+display_bufs_queue (GstKMSSink * sink, GstBuffer * buf) -+{ -+ int i; -+ for (i = 0; i < (NUM_DISPLAY_BUFS - 1); i++) -+ gst_buffer_replace (&sink->display_bufs[i], sink->display_bufs[i + 1]); -+ gst_buffer_replace (&sink->display_bufs[i], buf); -+} -+ -+static inline void -+display_bufs_free (GstKMSSink * sink) -+{ -+ int i; -+ for (i = 0; i < NUM_DISPLAY_BUFS; i++) -+ gst_buffer_replace (&sink->display_bufs[i], NULL); -+} -+ -+static gboolean -+gst_kms_sink_calculate_aspect_ratio (GstKMSSink * sink, gint width, -+ gint height, gint video_par_n, gint video_par_d) -+{ -+ guint calculated_par_n; -+ guint calculated_par_d; -+ -+ if (!gst_video_calculate_display_ratio (&calculated_par_n, &calculated_par_d, -+ width, height, video_par_n, video_par_d, 1, 1)) { -+ GST_ELEMENT_ERROR (sink, CORE, NEGOTIATION, (NULL), -+ ("Error calculating the output display ratio of the video.")); -+ return FALSE; -+ } -+ GST_DEBUG_OBJECT (sink, -+ "video width/height: %dx%d, calculated display ratio: %d/%d", -+ width, height, calculated_par_n, calculated_par_d); -+ -+ /* now find a width x height that respects this display ratio. -+ * prefer those that have one of w/h the same as the incoming video -+ * using wd / hd = calculated_pad_n / calculated_par_d */ -+ -+ /* start with same height, because of interlaced video */ -+ /* check hd / calculated_par_d is an integer scale factor, and scale wd with the PAR */ -+ if (height % calculated_par_d == 0) { -+ GST_DEBUG_OBJECT (sink, "keeping video height"); -+ GST_VIDEO_SINK_WIDTH (sink) = (guint) -+ gst_util_uint64_scale_int (height, calculated_par_n, calculated_par_d); -+ GST_VIDEO_SINK_HEIGHT (sink) = height; -+ } else if (width % calculated_par_n == 0) { -+ GST_DEBUG_OBJECT (sink, "keeping video width"); -+ GST_VIDEO_SINK_WIDTH (sink) = width; -+ GST_VIDEO_SINK_HEIGHT (sink) = (guint) -+ gst_util_uint64_scale_int (width, calculated_par_d, calculated_par_n); -+ } else { -+ GST_DEBUG_OBJECT (sink, "approximating while keeping video height"); -+ GST_VIDEO_SINK_WIDTH (sink) = (guint) -+ gst_util_uint64_scale_int (height, calculated_par_n, calculated_par_d); -+ GST_VIDEO_SINK_HEIGHT (sink) = height; -+ } -+ GST_DEBUG_OBJECT (sink, "scaling to %dx%d", -+ GST_VIDEO_SINK_WIDTH (sink), GST_VIDEO_SINK_HEIGHT (sink)); -+ -+ return TRUE; -+} -+ -+static gboolean -+gst_kms_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) -+{ -+ GstKMSSink *sink; -+ gboolean ret = TRUE; -+ gint width, height; -+ gint fps_n, fps_d; -+ gint par_n, par_d; -+ GstVideoFormat format; -+ GstVideoInfo info; -+ GstStructure *conf; -+ GstStructure *s; -+ int size; -+ -+ sink = GST_KMS_SINK (bsink); -+ -+ ret = gst_video_info_from_caps (&info, caps); -+ format = GST_VIDEO_INFO_FORMAT(&info); -+ width = GST_VIDEO_INFO_WIDTH(&info); -+ height = GST_VIDEO_INFO_HEIGHT(&info); -+ fps_n = GST_VIDEO_INFO_FPS_N(&info); -+ fps_d = GST_VIDEO_INFO_FPS_D(&info); -+ par_n = GST_VIDEO_INFO_PAR_N(&info); -+ par_d = GST_VIDEO_INFO_PAR_D(&info); -+ -+ if (!ret) -+ return FALSE; -+ -+ if (width <= 0 || height <= 0) { -+ GST_ELEMENT_ERROR (sink, CORE, NEGOTIATION, (NULL), -+ ("Invalid image size.")); -+ return FALSE; -+ } -+ -+ sink->format = format; -+ sink->par_n = par_n; -+ sink->par_d = par_d; -+ sink->src_rect.x = sink->src_rect.y = 0; -+ sink->src_rect.w = width; -+ sink->src_rect.h = height; -+ sink->input_width = width; -+ sink->input_height = height; -+ size = info.size; -+ -+ if (!sink->pool) { -+ GstAllocator *allocator; -+ -+ allocator = gst_drm_allocator_get (); -+ sink->pool = gst_buffer_pool_new (); -+ conf = gst_buffer_pool_get_config (GST_BUFFER_POOL(sink->pool)); -+ gst_buffer_pool_config_set_params (conf, caps, size, 0, 0); -+ gst_buffer_pool_config_set_allocator (conf, allocator, NULL); -+ gst_buffer_pool_set_config (GST_BUFFER_POOL(sink->pool), conf); -+ if (allocator) -+ gst_object_unref (allocator); -+ } -+ -+ sink->conn.crtc = -1; -+ return TRUE; -+} -+ -+static void -+gst_kms_sink_get_times (GstBaseSink * bsink, GstBuffer * buf, -+ GstClockTime * start, GstClockTime * end) -+{ -+ GstKMSSink *sink; -+ -+ sink = GST_KMS_SINK (bsink); -+ -+ if (GST_BUFFER_PTS_IS_VALID (buf)) { -+ *start = GST_BUFFER_PTS (buf); -+ if (GST_BUFFER_DURATION_IS_VALID (buf)) { -+ *end = *start + GST_BUFFER_DURATION (buf); -+ } else { -+ if (sink->fps_n > 0) { -+ *end = *start + -+ gst_util_uint64_scale_int (GST_SECOND, sink->fps_d, sink->fps_n); -+ } -+ } -+ } -+} -+ -+ -+static void page_flip_handler(int fd, unsigned int frame, -+ unsigned int sec, unsigned int usec, void *data) -+{ -+ int *waiting_for_flip = data; -+ *waiting_for_flip = 0; -+} -+ -+ -+static GstFlowReturn -+gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * inbuf) -+{ -+ GstKMSSink *sink = GST_KMS_SINK (vsink); -+ GstBuffer *buf = NULL; -+ GstKMSBufferPriv *priv; -+ GstFlowReturn flow_ret = GST_FLOW_OK; -+ int ret = 0; -+ gint width, height; -+ GstVideoRectangle *c = &sink->src_rect; -+ int waiting_for_flip = 1; -+ -+ fd_set fds; -+ drmEventContext evctx = { -+ .version = DRM_EVENT_CONTEXT_VERSION, -+ .vblank_handler = 0, -+ .page_flip_handler = page_flip_handler, -+ }; -+ -+ g_mutex_lock (&sink->render_lock); -+ GstVideoCropMeta* crop = gst_buffer_get_video_crop_meta (inbuf); -+ if (crop){ -+ c->y = crop->y; -+ c->x = crop->x; -+ -+ if (crop->width >= 0) { -+ width = crop->width; -+ } else { -+ width = sink->input_width; -+ } -+ if (crop->height >= 0){ -+ height = crop->height; -+ } else { -+ height = sink->input_height; -+ } -+ } else { -+ width = sink->input_width; -+ height = sink->input_height; -+ } -+ -+ c->w = width; -+ c->h = height; -+ -+ -+ if (!gst_kms_sink_calculate_aspect_ratio (sink, width, height, -+ sink->par_n, sink->par_d)) -+ GST_DEBUG_OBJECT (sink, "calculate aspect ratio failed"); -+ -+ -+ GST_INFO_OBJECT (sink, "enter"); -+ -+ if (sink->conn.crtc == -1) { -+ if (sink->conn_name) { -+ if (!gst_drm_connector_find_mode_and_plane_by_name (sink->fd, -+ sink->dev, sink->src_rect.w, sink->src_rect.h, -+ sink->resources, sink->plane_resources, &sink->conn, -+ sink->conn_name)) -+ goto connector_not_found; -+ } else { -+ sink->conn.id = sink->conn_id; -+ if (!gst_drm_connector_find_mode_and_plane (sink->fd, -+ sink->dev, sink->src_rect.w, sink->src_rect.h, -+ sink->resources, sink->plane_resources, &sink->conn)) -+ goto connector_not_found; -+ } -+ once = 1; -+ } -+ -+ priv = gst_kms_buffer_priv (sink, inbuf); -+ -+ if (priv) { -+ buf = inbuf; -+ } else { -+ GST_LOG_OBJECT (sink, "not a KMS buffer, slow-path!"); -+ gst_buffer_pool_acquire_buffer (sink->pool, &buf, NULL); -+ if (buf) { -+ GST_BUFFER_PTS (buf) = GST_BUFFER_PTS (inbuf); -+ GST_BUFFER_DURATION (buf) = GST_BUFFER_DURATION (inbuf); -+ gst_buffer_copy_into (buf, inbuf, GST_BUFFER_COPY_DEEP, 0 ,-1); -+ priv = gst_kms_buffer_priv (sink, buf); -+ } -+ if (!priv) -+ goto add_fb2_failed; -+ } -+ -+ if (once) { -+ once = 0; -+ static GstVideoRectangle dest = { 0 }; -+ dest.w = sink->conn.mode->hdisplay; -+ dest.h = sink->conn.mode->vdisplay; -+ -+ gst_video_sink_center_rect (sink->src_rect, dest, &sink->dst_rect, -+ sink->scale); -+ ret = drmModeSetPlane (sink->fd, sink->conn.pdata[0].plane, -+ sink->conn.crtc, priv->fb_id, 0, -+ sink->dst_rect.x, sink->dst_rect.y, sink->dst_rect.w, sink->dst_rect.h, -+ sink->src_rect.x << 16, sink->src_rect.y << 16, -+ sink->src_rect.w << 16, sink->src_rect.h << 16); -+ if (ret) -+ goto set_plane_failed; -+ } -+ -+ drmModeAtomicReqPtr m_req = drmModeAtomicAlloc(); -+ -+ drmModeAtomicAddProperty(m_req, sink->conn.pdata[0].plane, -+ sink->conn.pdata[0].fb_id_property, -+ priv->fb_id); -+ -+ drmModeAtomicCommit(sink->fd, m_req, DRM_MODE_ATOMIC_TEST_ONLY, 0); -+ drmModeAtomicCommit(sink->fd, m_req, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, &waiting_for_flip); -+ drmModeAtomicFree(m_req); -+ -+ while (waiting_for_flip) { -+ FD_ZERO(&fds); -+ FD_SET(sink->fd, &fds); -+ int err; -+ err = select(sink->fd + 1, &fds, NULL, NULL, NULL); -+ if (err < 0) { -+ GST_ERROR_OBJECT (sink,"select err: %s\n", strerror(errno)); -+ flow_ret = GST_FLOW_ERROR; -+ goto out; -+ } -+ if (FD_ISSET(sink->fd, &fds)) { -+ drmHandleEvent(sink->fd, &evctx); -+ } -+ } -+ -+ display_bufs_queue (sink, buf); -+ -+out: -+ GST_INFO_OBJECT (sink, "exit"); -+ if (buf != inbuf) -+ gst_buffer_unref (buf); -+ g_mutex_unlock (&sink->render_lock); -+ return flow_ret; -+ -+add_fb2_failed: -+ GST_ELEMENT_ERROR (sink, RESOURCE, FAILED, -+ (NULL), ("drmModeAddFB2 failed: %s (%d)", strerror (errno), errno)); -+ flow_ret = GST_FLOW_ERROR; -+ goto out; -+ -+set_plane_failed: -+ GST_ELEMENT_ERROR (sink, RESOURCE, FAILED, -+ (NULL), ("drmModeSetPlane failed: %s (%d)", strerror (errno), errno)); -+ flow_ret = GST_FLOW_ERROR; -+ goto out; -+ -+connector_not_found: -+ GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND, -+ (NULL), ("connector not found", strerror (errno), errno)); -+ goto out; -+} -+ -+ -+static gboolean -+gst_kms_sink_event (GstBaseSink * bsink, GstEvent * event) -+{ -+ GstKMSSink *sink = GST_KMS_SINK (bsink); -+ -+ switch (GST_EVENT_TYPE (event)) { -+ default: -+ break; -+ } -+ if (GST_BASE_SINK_CLASS (gst_kms_sink_parent_class)->event) -+ return GST_BASE_SINK_CLASS (gst_kms_sink_parent_class)->event (bsink, -+ event); -+ else -+ return TRUE; -+} -+ -+static void -+gst_kms_sink_set_property (GObject * object, guint prop_id, -+ const GValue * value, GParamSpec * pspec) -+{ -+ GstKMSSink *sink; -+ -+ g_return_if_fail (GST_IS_KMS_SINK (object)); -+ -+ sink = GST_KMS_SINK (object); -+ -+ switch (prop_id) { -+ case PROP_FORCE_ASPECT_RATIO: -+ sink->keep_aspect = g_value_get_boolean (value); -+ break; -+ case PROP_SCALE: -+ sink->scale = g_value_get_boolean (value); -+ break; -+ case PROP_CONNECTOR: -+ sink->conn_id = g_value_get_uint (value); -+ break; -+ case PROP_CONNECTOR_NAME: -+ g_free (sink->conn_name); -+ sink->conn_name = g_strdup (g_value_get_string (value)); -+ break; -+ case PROP_PIXEL_ASPECT_RATIO: -+ { -+ GValue *tmp; -+ -+ tmp = g_new0 (GValue, 1); -+ g_value_init (tmp, GST_TYPE_FRACTION); -+ -+ if (!g_value_transform (value, tmp)) { -+ GST_WARNING_OBJECT (sink, "Could not transform string to aspect ratio"); -+ } else { -+ sink->par_n = gst_value_get_fraction_numerator (tmp); -+ sink->par_d = gst_value_get_fraction_denominator (tmp); -+ GST_DEBUG_OBJECT (sink, "set PAR to %d/%d", sink->par_n, sink->par_d); -+ } -+ g_free (tmp); -+ } -+ break; -+ default: -+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); -+ break; -+ } -+} -+ -+static void -+gst_kms_sink_get_property (GObject * object, guint prop_id, -+ GValue * value, GParamSpec * pspec) -+{ -+ GstKMSSink *sink; -+ -+ g_return_if_fail (GST_IS_KMS_SINK (object)); -+ -+ sink = GST_KMS_SINK (object); -+ -+ switch (prop_id) { -+ case PROP_FORCE_ASPECT_RATIO: -+ g_value_set_boolean (value, sink->keep_aspect); -+ break; -+ case PROP_SCALE: -+ g_value_set_boolean (value, sink->scale); -+ break; -+ case PROP_CONNECTOR: -+ g_value_set_uint (value, sink->conn.id); -+ break; -+ case PROP_PIXEL_ASPECT_RATIO: -+ { -+ char *v = g_strdup_printf ("%d/%d", sink->par_n, sink->par_d); -+ g_value_take_string (value, v); -+ break; -+ } -+ default: -+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); -+ break; -+ } -+} -+ -+static void -+gst_kms_sink_reset (GstKMSSink * sink) -+{ -+ GST_DEBUG_OBJECT (sink, "reset"); -+ -+ if (sink->fd != -1) { -+ gst_drm_connector_cleanup (sink->fd, &sink->conn); -+ } -+ memset (&sink->conn, 0, sizeof (struct connector)); -+ -+ display_bufs_free (sink); -+ -+ if (sink->pool) { -+ gst_buffer_pool_set_active (GST_BUFFER_POOL(sink->pool), FALSE); -+ gst_object_unref(sink->pool); -+ sink->pool = NULL; -+ } -+ -+ if (sink->plane_resources) { -+ drmModeFreePlaneResources (sink->plane_resources); -+ sink->plane_resources = NULL; -+ } -+ -+ if (sink->resources) { -+ drmModeFreeResources (sink->resources); -+ sink->resources = NULL; -+ } -+ -+ sink->par_n = sink->par_d = 1; -+ sink->src_rect.x = 0; -+ sink->src_rect.y = 0; -+ sink->src_rect.w = 0; -+ sink->src_rect.h = 0; -+ sink->input_width = 0; -+ sink->input_height = 0; -+ sink->format = GST_VIDEO_FORMAT_UNKNOWN; -+ -+ memset (&sink->src_rect, 0, sizeof (GstVideoRectangle)); -+ memset (&sink->dst_rect, 0, sizeof (GstVideoRectangle)); -+} -+ -+static gboolean -+gst_kms_sink_start (GstBaseSink * bsink) -+{ -+ GstKMSSink *sink; -+ -+ sink = GST_KMS_SINK (bsink); -+ -+ drm_dev = dce_init (); -+ if (drm_dev == NULL) -+ goto device_failed; -+ else { -+ sink->dev = drm_dev; -+ sink->fd = dce_get_fd (); -+ drm_fd = dce_get_fd (); -+ } -+ -+ sink->resources = drmModeGetResources (sink->fd); -+ if (sink->resources == NULL) -+ goto resources_failed; -+ -+ sink->plane_resources = drmModeGetPlaneResources (sink->fd); -+ if (sink->plane_resources == NULL) -+ goto plane_resources_failed; -+ -+ return TRUE; -+ -+fail: -+ gst_kms_sink_reset (sink); -+ return FALSE; -+ -+device_failed: -+ GST_ELEMENT_ERROR (sink, RESOURCE, FAILED, -+ (NULL), ("omap_device_new failed")); -+ goto fail; -+ -+resources_failed: -+ GST_ELEMENT_ERROR (sink, RESOURCE, FAILED, -+ (NULL), ("drmModeGetResources failed: %s (%d)", strerror (errno), errno)); -+ goto fail; -+ -+plane_resources_failed: -+ GST_ELEMENT_ERROR (sink, RESOURCE, FAILED, -+ (NULL), ("drmModeGetPlaneResources failed: %s (%d)", -+ strerror (errno), errno)); -+ goto fail; -+} -+ -+static gboolean -+gst_kms_sink_stop (GstBaseSink * bsink) -+{ -+ GstKMSSink *sink; -+ -+ sink = GST_KMS_SINK (bsink); -+ gst_kms_sink_reset (sink); -+ -+ return TRUE; -+} -+ -+ -+static gboolean -+gst_kms_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) -+{ -+ GstKMSSink *sink; -+ GstStructure *conf; -+ GstCaps *caps; -+ guint size; -+ gboolean need_pool; -+ GstStructure *s; -+ int num_buffers = 0; -+ -+ -+ sink = GST_KMS_SINK (bsink); -+ -+ GST_DEBUG_OBJECT (sink, "begin"); -+ -+ gst_query_parse_allocation (query, &caps, &need_pool); -+ -+ if (G_UNLIKELY (!caps)) { -+ GST_WARNING_OBJECT (sink, "have no caps, doing fallback allocation"); -+ return FALSE; -+ } -+ -+ if (need_pool) { -+ GstVideoInfo info; -+ -+ if (!gst_video_info_from_caps (&info, caps)) -+ goto invalid_caps; -+ -+ GST_LOG_OBJECT (sink, -+ "a bufferpool was requested with caps %" GST_PTR_FORMAT, caps); -+ -+ /* We already have a pool after set_caps */ -+ if (sink->pool) { -+ GstStructure *config; -+ int min,max; -+ config = gst_buffer_pool_get_config (sink->pool); -+ gst_buffer_pool_config_get_params (config, NULL, &size, &min, &max); -+ gst_structure_free (config); -+ -+ gst_query_add_allocation_pool (query, sink->pool, size, min, max); -+ gst_query_add_allocation_param (query, gst_drm_allocator_get (), NULL); -+ return TRUE; -+ } else { -+ GST_LOG_OBJECT (sink, "No bufferpool available"); -+ return FALSE; -+ } -+ } -+ -+ -+invalid_caps: -+ GST_DEBUG_OBJECT (sink, "invalid caps specified"); -+ return FALSE; -+} -+ -+static void -+gst_kms_sink_finalize (GObject * object) -+{ -+ GstKMSSink *sink; -+ -+ sink = GST_KMS_SINK (object); -+ g_mutex_clear (&sink->render_lock); -+ g_free (sink->conn_name); -+ if (sink->kmsbufferpriv){ -+ g_hash_table_destroy (sink->kmsbufferpriv); -+ sink->kmsbufferpriv = NULL; -+ gst_kms_sink_reset (sink); -+} -+ -+ G_OBJECT_CLASS (gst_kms_sink_parent_class)->finalize (object); -+} -+ -+static void -+kmsbufferpriv_free_func (GstKMSBufferPriv *priv) -+{ -+ drmModeRmFB (priv->fd, priv->fb_id); -+ omap_bo_del (priv->bo); -+ g_free(priv); -+} -+ -+ -+static void -+gst_kms_sink_init (GstKMSSink * sink) -+{ -+ sink->fd = -1; -+ gst_kms_sink_reset (sink); -+ sink->kmsbufferpriv = g_hash_table_new_full (g_direct_hash, g_direct_equal, -+ NULL, (GDestroyNotify) kmsbufferpriv_free_func); -+ g_mutex_init (&sink->render_lock); -+} -+ -+static void -+gst_kms_sink_class_init (GstKMSSinkClass * klass) -+{ -+ GObjectClass *gobject_class; -+ GstElementClass *gstelement_class; -+ GstBaseSinkClass *gstbasesink_class; -+ GstVideoSinkClass *videosink_class; -+ -+ gobject_class = (GObjectClass *) klass; -+ gstelement_class = (GstElementClass *) klass; -+ gstbasesink_class = (GstBaseSinkClass *) klass; -+ videosink_class = (GstVideoSinkClass *) klass; -+ -+ gobject_class->finalize = gst_kms_sink_finalize; -+ gobject_class->set_property = gst_kms_sink_set_property; -+ gobject_class->get_property = gst_kms_sink_get_property; -+ -+ g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO, -+ g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio", -+ "When enabled, reverse caps negotiation (scaling) will respect " -+ "original aspect ratio", FALSE, -+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -+ g_object_class_install_property (gobject_class, PROP_PIXEL_ASPECT_RATIO, -+ g_param_spec_string ("pixel-aspect-ratio", "Pixel Aspect Ratio", -+ "The pixel aspect ratio of the device", "1/1", -+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -+ g_object_class_install_property (gobject_class, PROP_SCALE, -+ g_param_spec_boolean ("scale", "Scale", -+ "When true, scale to render fullscreen", FALSE, -+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -+ g_object_class_install_property (gobject_class, PROP_CONNECTOR, -+ g_param_spec_uint ("connector", "Connector", -+ "DRM connector id (0 for automatic selection)", 0, G_MAXUINT32, 0, -+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT)); -+ g_object_class_install_property (gobject_class, PROP_CONNECTOR_NAME, -+ g_param_spec_string ("connector-name", "Connector name", -+ "DRM connector name (alternative to the connector property, " -+ "use $type$index, $type-$index, or $type)", "", -+ G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); -+ -+ gst_element_class_set_details_simple (gstelement_class, -+ "Video sink", "Sink/Video", -+ "A video sink using the linux kernel mode setting API", -+ "Alessandro Decina <alessandro.d@gmail.com>"); -+ -+ gst_element_class_add_pad_template (gstelement_class, -+ gst_static_pad_template_get (&gst_kms_sink_template_factory)); -+ -+ gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_kms_sink_setcaps); -+ gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_kms_sink_get_times); -+ gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_kms_sink_event); -+ gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_kms_sink_start); -+ gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_kms_sink_stop); -+ gstbasesink_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_kms_sink_propose_allocation); -+ -+ /* disable preroll as it's called before GST_CROP_EVENT has been received, so -+ * we end up configuring the wrong mode... (based on padded caps) -+ */ -+ gstbasesink_class->preroll = NULL; -+ videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_kms_sink_show_frame); -+} -+ -+static gboolean -+plugin_init (GstPlugin * plugin) -+{ -+ if (!gst_element_register (plugin, "kmssink", -+ GST_RANK_PRIMARY + 1, GST_TYPE_KMS_SINK)) -+ return FALSE; -+ -+ GST_DEBUG_CATEGORY_INIT (gst_debug_kms_sink, "kmssink", 0, "kmssink element"); -+ -+ return TRUE; -+} -+ -+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, -+ GST_VERSION_MINOR, -+ kms, -+ "KMS video output element", -+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) -diff --git a/sys/kms/gstkmssink.h b/sys/kms/gstkmssink.h -new file mode 100644 -index 0000000..9f76839 ---- /dev/null -+++ b/sys/kms/gstkmssink.h -@@ -0,0 +1,92 @@ -+/* GStreamer -+ * -+ * Copyright (C) 2012 Texas Instruments -+ * Copyright (C) 2012 Collabora Ltd -+ * -+ * Authors: -+ * Alessandro Decina <alessandro.decina@collabora.co.uk> -+ * -+ * 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., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+ -+#ifndef __GST_KMS_SINK_H__ -+#define __GST_KMS_SINK_H__ -+ -+#include <gst/video/video.h> -+#include <gst/video/gstvideosink.h> -+#include <gst/drm/gstdrmallocator.h> -+ -+#include <stdio.h> -+#include <stdint.h> -+#include <stdlib.h> -+#include <string.h> -+#include <errno.h> -+#include <unistd.h> -+#include <assert.h> -+ -+#include "gstdrmutils.h" -+ -+G_BEGIN_DECLS -+#define GST_TYPE_KMS_SINK \ -+ (gst_kms_sink_get_type()) -+#define GST_KMS_SINK(obj) \ -+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_KMS_SINK, GstKMSSink)) -+#define GST_KMS_SINK_CLASS(klass) \ -+ (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_KMS_SINK, GstKMSSinkClass)) -+#define GST_IS_KMS_SINK(obj) \ -+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_KMS_SINK)) -+#define GST_IS_KMS_SINK_CLASS(klass) \ -+ (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_KMS_SINK)) -+typedef struct _GstKMSSink GstKMSSink; -+typedef struct _GstKMSSinkClass GstKMSSinkClass; -+ -+#define NUM_DISPLAY_BUFS 1 -+ -+struct _GstKMSSink -+{ -+ GstVideoSink videosink; -+ gint input_width, input_height; -+ GstVideoFormat format; -+ gint par_n, par_d; -+ gint fps_n, fps_d; -+ gboolean keep_aspect; -+ GstVideoRectangle src_rect; -+ GstVideoRectangle dst_rect; -+ int fd; -+ struct omap_device *dev; -+ drmModeRes *resources; -+ drmModePlaneRes *plane_resources; -+ struct connector conn; -+ uint32_t conn_id; -+ char *conn_name; -+ drmModePlane *plane; -+ GstBufferPool *pool; -+ GHashTable *kmsbufferpriv; -+ /* current displayed buffer and last displayed buffer: */ -+ GstBuffer *display_bufs[NUM_DISPLAY_BUFS]; -+ gboolean scale; -+ GMutex render_lock; -+}; -+ -+struct _GstKMSSinkClass -+{ -+ GstVideoSinkClass parent_class; -+}; -+ -+GType gst_kms_sink_get_type (void); -+ -+G_END_DECLS -+#endif /* __GST_KMS_SINK_H__ */ --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0003-kmssink-add-YUYV-support.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0003-kmssink-add-YUYV-support.patch deleted file mode 100644 index a57a0bbfa..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0003-kmssink-add-YUYV-support.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 11a3ff4b9451f12374006f853ef5736f5d098932 Mon Sep 17 00:00:00 2001 -From: Eric Ruei <e-ruei1@ti.com> -Date: Tue, 14 Mar 2017 17:24:07 -0400 -Subject: [PATCH 3/3] kmssink: add YUYV support - -Signed-off-by: Eric Ruei <e-ruei1@ti.com> ---- - sys/kms/gstkmsbufferpriv.c | 32 +++++++++++++++++++++++++++----- - sys/kms/gstkmssink.c | 2 +- - 2 files changed, 28 insertions(+), 6 deletions(-) - -diff --git a/sys/kms/gstkmsbufferpriv.c b/sys/kms/gstkmsbufferpriv.c -index 172a4c3..57c01f8 100644 ---- a/sys/kms/gstkmsbufferpriv.c -+++ b/sys/kms/gstkmsbufferpriv.c -@@ -41,22 +41,44 @@ - static int - create_fb (GstKMSBufferPriv * priv, GstKMSSink * sink) - { -+ - /* TODO get format, etc from caps.. and query device for - * supported formats, and make this all more flexible to - * cope with various formats: - */ -- uint32_t fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2'); -- -+ GstVideoFormat format = sink->format; -+ uint32_t fourcc; - uint32_t handles[4] = { -- omap_bo_handle (priv->bo), omap_bo_handle (priv->bo), -+ omap_bo_handle (priv->bo), - }; - uint32_t pitches[4] = { -- GST_ROUND_UP_4 (sink->input_width), GST_ROUND_UP_4 (sink->input_width), -+ GST_ROUND_UP_4 (sink->input_width), - }; - uint32_t offsets[4] = { -- 0, pitches[0] * sink->input_height -+ 0, - }; - -+ /** -+ * Only two formats are supported: -+ * AM3/4: YUYV -+ * AM5: NV12, YUYV -+ */ -+ if(format == GST_VIDEO_FORMAT_YUY2) -+ { -+ /* YUYV */ -+ fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V'); -+ pitches[0] = GST_ROUND_UP_4 (sink->input_width*2); -+ } -+ else -+ { -+ /* NV12 */ -+ fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2'); -+ handles[1] = omap_bo_handle (priv->bo); -+ pitches[1] = GST_ROUND_UP_4 (sink->input_width); -+ offsets[1] = pitches[0] * sink->input_height; -+ } -+ -+ - return drmModeAddFB2 (priv->fd, sink->input_width, sink->input_height, - fourcc, handles, pitches, offsets, &priv->fb_id, 0); - } -diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c -index 9795bdf..b36d88f 100644 ---- a/sys/kms/gstkmssink.c -+++ b/sys/kms/gstkmssink.c -@@ -50,7 +50,7 @@ static GstStaticPadTemplate gst_kms_sink_template_factory = - GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, -- GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE("NV12")) -+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE("{NV12,YUY2}")) - ); - - enum --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0004-gstwaylandsink-Add-DRM-support-on-waylandsink.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0004-gstwaylandsink-Add-DRM-support-on-waylandsink.patch deleted file mode 100644 index 2902bc3b2..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0004-gstwaylandsink-Add-DRM-support-on-waylandsink.patch +++ /dev/null @@ -1,1728 +0,0 @@ -From 78ddc83ebfe7cf69c62610e1f7d14e7f49bf65c9 Mon Sep 17 00:00:00 2001 -From: Pooja Prajod <a0132412@ti.com> -Date: Wed, 25 Jan 2017 17:09:35 +0530 -Subject: [gst-bad-1.8] gstwaylandsink: Add DRM support on waylandsink - -Add wl_drm interface on waylandsink. -The following features are supported: -1. Support for mouse drag and drop. -2. Support for video cropping - -The following bug fixes identified earlier have been picked: -1. Consolidate header files to avoid circular dependency -2. Fix bug reported on waylandsink incase of same process looping - -Signed-off-by: Pooja Prajod <a0132412@ti.com> ---- - configure.ac | 4 +- - ext/wayland/Makefile.am | 17 +- - ext/wayland/gstwaylandsink.c | 82 ++++++- - ext/wayland/gstwaylandsink.h | 4 +- - ext/wayland/wayland-drm-client-protocol.h | 213 ++++++++++++++++++ - ext/wayland/wayland-drm-protocol.c | 74 +++++++ - ext/wayland/wlbuffer.c | 2 +- - ext/wayland/wlbuffer.h | 67 ------ - ext/wayland/wldisplay-wlwindow-wlbuffer.h | 216 ++++++++++++++++++ - ext/wayland/wldisplay.c | 350 +++++++++++++++++++++++++++++- - ext/wayland/wldisplay.h | 84 ------- - ext/wayland/wldrm.c | 69 ++++++ - ext/wayland/wldrm.h | 3 + - ext/wayland/wlshmallocator.h | 2 +- - ext/wayland/wlvideoformat.c | 8 +- - ext/wayland/wlwindow.c | 47 +++- - ext/wayland/wlwindow.h | 84 ------- - 17 files changed, 1056 insertions(+), 270 deletions(-) - create mode 100644 ext/wayland/wayland-drm-client-protocol.h - create mode 100644 ext/wayland/wayland-drm-protocol.c - delete mode 100644 ext/wayland/wlbuffer.h - create mode 100644 ext/wayland/wldisplay-wlwindow-wlbuffer.h - delete mode 100644 ext/wayland/wldisplay.h - create mode 100644 ext/wayland/wldrm.c - create mode 100644 ext/wayland/wldrm.h - delete mode 100644 ext/wayland/wlwindow.h - -diff --git a/configure.ac b/configure.ac -index 9fdfbc7..76166cb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -2172,8 +2172,10 @@ AG_GST_CHECK_FEATURE(DIRECTFB, [directfb], dfbvideosink , [ - dnl **** Wayland **** - translit(dnm, m, l) AM_CONDITIONAL(USE_WAYLAND, true) - AC_PATH_PROG([wayland_scanner], [wayland-scanner]) --AG_GST_CHECK_FEATURE(WAYLAND, [wayland sink], wayland , [ -+AG_GST_CHECK_FEATURE(WAYLAND, [wayland sink], wayland libdrm libdrm_omap, [ - PKG_CHECK_MODULES(WAYLAND, wayland-client >= 1.4.0, [ -+ AC_SUBST(DRM_CFLAGS) -+ AC_SUBST(DRM_LIBS) - if test "x$wayland_scanner" != "x"; then - HAVE_WAYLAND="yes" - else -diff --git a/ext/wayland/Makefile.am b/ext/wayland/Makefile.am -index c742bfc..eb6e326 100644 ---- a/ext/wayland/Makefile.am -+++ b/ext/wayland/Makefile.am -@@ -3,31 +3,34 @@ plugin_LTLIBRARIES = libgstwaylandsink.la - libgstwaylandsink_la_SOURCES = \ - gstwaylandsink.c \ - wlshmallocator.c \ -+ wldrm.c \ - wlbuffer.c \ - wldisplay.c \ - wlwindow.c \ - wlvideoformat.c \ -- scaler-protocol.c -+ scaler-protocol.c \ -+ wayland-drm-protocol.c - - libgstwaylandsink_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \ -- $(WAYLAND_CFLAGS) $(GST_PLUGINS_BAD_CFLAGS) -+ $(WAYLAND_CFLAGS) $(GST_PLUGINS_BAD_CFLAGS) $(DRM_CFLAGS) - libgstwaylandsink_la_LIBADD = \ - $(GST_PLUGINS_BASE_LIBS) \ - -lgstvideo-$(GST_API_VERSION) \ - -lgstallocators-$(GST_API_VERSION) \ - $(WAYLAND_LIBS) \ -- $(top_builddir)/gst-libs/gst/wayland/libgstwayland-$(GST_API_VERSION).la -+ $(top_builddir)/gst-libs/gst/wayland/libgstwayland-$(GST_API_VERSION).la \ -+ $(top_builddir)/gst-libs/gst/drm/libgstdrm-$(GST_API_VERSION).la - libgstwaylandsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) - libgstwaylandsink_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) - - noinst_HEADERS = \ - gstwaylandsink.h \ - wlshmallocator.h \ -- wlbuffer.h \ -- wldisplay.h \ -- wlwindow.h \ -+ wldisplay-wlwindow-wlbuffer.h \ -+ wldrm.h \ - wlvideoformat.h \ -- scaler-client-protocol.h -+ scaler-client-protocol.h \ -+ wayland-drm-client-protocol.h - - EXTRA_DIST = scaler.xml - CLEANFILES = scaler-protocol.c scaler-client-protocol.h -diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c -index f4f34a8..3e8ff19 100644 ---- a/ext/wayland/gstwaylandsink.c -+++ b/ext/wayland/gstwaylandsink.c -@@ -43,8 +43,14 @@ - - #include "gstwaylandsink.h" - #include "wlvideoformat.h" --#include "wlbuffer.h" - #include "wlshmallocator.h" -+#include "wldrm.h" -+ -+#include <gst/drm/gstdrmallocator.h> -+#include "wayland-drm-client-protocol.h" -+#include <omap_drm.h> -+#include <omap_drmif.h> -+#include <wayland-client.h> - - #include <gst/wayland/wayland.h> - #include <gst/video/videooverlay.h> -@@ -60,7 +66,8 @@ enum - enum - { - PROP_0, -- PROP_DISPLAY -+ PROP_DISPLAY, -+ PROP_ALLOCATION - }; - - GST_DEBUG_CATEGORY (gstwayland_debug); -@@ -75,6 +82,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", - "YUV9, YVU9, Y41B, I420, YV12, Y42B, v308 }")) - ); - -+ - static void gst_wayland_sink_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - static void gst_wayland_sink_set_property (GObject * object, -@@ -158,6 +166,11 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass) - g_param_spec_string ("display", "Wayland Display name", "Wayland " - "display name to connect to, if not supplied via the GstContext", - NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -+ -+ g_object_class_install_property (gobject_class, PROP_ALLOCATION, -+ g_param_spec_boolean ("use-drm", "Wayland Allocation name", "Wayland " -+ "Use DRM based memory for allocation", -+ FALSE, G_PARAM_WRITABLE)); - } - - static void -@@ -197,6 +210,11 @@ gst_wayland_sink_set_property (GObject * object, - sink->display_name = g_value_dup_string (value); - GST_OBJECT_UNLOCK (sink); - break; -+ case PROP_ALLOCATION: -+ GST_OBJECT_LOCK (sink); -+ sink->use_drm = g_value_get_boolean (value); -+ GST_OBJECT_UNLOCK (sink); -+ break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; -@@ -281,6 +299,7 @@ gst_wayland_sink_find_display (GstWaylandSink * sink) - /* if the application didn't set a display, let's create it ourselves */ - GST_OBJECT_LOCK (sink); - sink->display = gst_wl_display_new (sink->display_name, &error); -+ sink->display->use_drm = sink->use_drm; - GST_OBJECT_UNLOCK (sink); - - if (error) { -@@ -408,7 +427,6 @@ gst_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps * filter) - - caps = gst_caps_make_writable (caps); - gst_structure_set_value (gst_caps_get_structure (caps, 0), "format", &list); -- - GST_DEBUG_OBJECT (sink, "display caps: %" GST_PTR_FORMAT, caps); - } - -@@ -426,6 +444,18 @@ gst_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps * filter) - return caps; - } - -+static void -+wait_authentication (GstWaylandSink * sink) -+{ -+ GST_DEBUG_OBJECT (sink, "Before wait aunthenticated value is %d : \n", sink->display->authenticated ); -+ while (!sink->display->authenticated) { -+ GST_DEBUG_OBJECT (sink, "waiting for authentication"); -+ wl_display_roundtrip (sink->display->display); -+ } -+ GST_DEBUG_OBJECT (sink, "After wait aunthenticated value is %d : \n", sink->display->authenticated ); -+} -+ -+ - static gboolean - gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) - { -@@ -436,11 +466,20 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) - GArray *formats; - gint i; - GstStructure *structure; -+ GstStructure *s; -+ gboolean use_drm = 0; -+ int num_buffers = 0; - - sink = GST_WAYLAND_SINK (bsink); - - GST_DEBUG_OBJECT (sink, "set caps %" GST_PTR_FORMAT, caps); - -+ wait_authentication (sink); -+ -+ while (!sink->display->authenticated) { -+ GST_DEBUG_OBJECT (sink, "not authenticated yet"); -+ } -+ - /* extract info from caps */ - if (!gst_video_info_from_caps (&info, caps)) - goto invalid_format; -@@ -460,14 +499,27 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) - goto unsupported_format; - - /* create a new pool for the new configuration */ -- newpool = gst_video_buffer_pool_new (); -+ -+ s = gst_caps_get_structure (caps, 0); -+ gst_structure_get_boolean (s, "drm_mem", &use_drm); -+ gst_structure_get_int (s, "max-ref-frames", &num_buffers); -+ if (num_buffers ) -+ num_buffers = num_buffers + 2; -+ -+ newpool = gst_buffer_pool_new (); - if (!newpool) - goto pool_failed; - - structure = gst_buffer_pool_get_config (newpool); -- gst_buffer_pool_config_set_params (structure, caps, info.size, 2, 0); -- gst_buffer_pool_config_set_allocator (structure, gst_wl_shm_allocator_get (), -- NULL); -+ gst_buffer_pool_config_set_params (structure, caps, info.size, 2, num_buffers); -+ if ( use_drm ) { -+ gst_buffer_pool_config_set_allocator (structure, gst_drm_allocator_get (), -+ NULL); -+ sink->display->use_drm = TRUE; -+ } else { -+ gst_buffer_pool_config_set_allocator (structure, gst_wl_shm_allocator_get (), -+ NULL); -+ } - if (!gst_buffer_pool_set_config (newpool, structure)) - goto config_failed; - -@@ -518,8 +570,11 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) - /* we do have a pool for sure (created in set_caps), - * so let's propose it anyway, but also propose the allocator on its own */ - gst_query_add_allocation_pool (query, sink->pool, size, min_bufs, max_bufs); -- gst_query_add_allocation_param (query, gst_wl_shm_allocator_get (), NULL); -- -+ if (sink->display->use_drm) { -+ gst_query_add_allocation_param (query, gst_drm_allocator_get (), NULL); -+ } else { -+ gst_query_add_allocation_param (query, gst_wl_shm_allocator_get (), NULL); -+ } - gst_structure_free (config); - - return TRUE; -@@ -582,6 +637,10 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer) - - GST_LOG_OBJECT (sink, "render buffer %p", buffer); - -+ if (sink->display) { -+ sink->display->crop = gst_buffer_get_video_crop_meta (buffer); -+ } -+ - if (G_UNLIKELY (!sink->window)) { - /* ask for window handle. Unlock render_lock while doing that because - * set_window_handle & friends will lock it in this context */ -@@ -623,6 +682,11 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer) - wbuf = gst_wl_shm_memory_construct_wl_buffer (mem, sink->display, - &sink->video_info); - } -+ -+ if (gst_is_drm_memory (mem)) { -+ wbuf = gst_wl_drm_memory_construct_wl_buffer (mem, sink->display, -+ &sink->video_info); -+ } - - if (wbuf) { - gst_buffer_add_wl_buffer (buffer, wbuf, sink->display); -diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h -index afbed40..c1092ce 100644 ---- a/ext/wayland/gstwaylandsink.h -+++ b/ext/wayland/gstwaylandsink.h -@@ -27,8 +27,7 @@ - - #include <wayland-client.h> - --#include "wldisplay.h" --#include "wlwindow.h" -+#include "wldisplay-wlwindow-wlbuffer.h" - - G_BEGIN_DECLS - -@@ -61,6 +60,7 @@ struct _GstWaylandSink - GstVideoInfo video_info; - - gchar *display_name; -+ gboolean use_drm; - - gboolean redraw_pending; - GMutex render_lock; -diff --git a/ext/wayland/wayland-drm-client-protocol.h b/ext/wayland/wayland-drm-client-protocol.h -new file mode 100644 -index 0000000..7ddb614 ---- /dev/null -+++ b/ext/wayland/wayland-drm-client-protocol.h -@@ -0,0 +1,213 @@ -+/* -+ * Copyright © 2008-2011 Kristian Høgsberg -+ * Copyright © 2010-2011 Intel Corporation -+ * -+ * Permission to use, copy, modify, distribute, and sell this -+ * software and its documentation for any purpose is hereby granted -+ * without fee, provided that\n the above copyright notice appear in -+ * all copies and that both that copyright notice and this permission -+ * notice appear in supporting documentation, and that the name of -+ * the copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -+ * THIS SOFTWARE. -+ */ -+ -+#ifndef DRM_CLIENT_PROTOCOL_H -+#define DRM_CLIENT_PROTOCOL_H -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#include <stdint.h> -+#include <stddef.h> -+#include "wayland-util.h" -+ -+struct wl_client; -+struct wl_resource; -+ -+struct wl_drm; -+ -+extern const struct wl_interface wl_drm_interface; -+ -+#ifndef WL_DRM_ERROR_ENUM -+#define WL_DRM_ERROR_ENUM -+enum wl_drm_error { -+ WL_DRM_ERROR_AUTHENTICATE_FAIL = 0, -+ WL_DRM_ERROR_INVALID_FORMAT = 1, -+ WL_DRM_ERROR_INVALID_NAME = 2, -+}; -+#endif /* WL_DRM_ERROR_ENUM */ -+ -+#ifndef WL_DRM_FORMAT_ENUM -+#define WL_DRM_FORMAT_ENUM -+enum wl_drm_format { -+ WL_DRM_FORMAT_C8 = 0x20203843, -+ WL_DRM_FORMAT_RGB332 = 0x38424752, -+ WL_DRM_FORMAT_BGR233 = 0x38524742, -+ WL_DRM_FORMAT_XRGB4444 = 0x32315258, -+ WL_DRM_FORMAT_XBGR4444 = 0x32314258, -+ WL_DRM_FORMAT_RGBX4444 = 0x32315852, -+ WL_DRM_FORMAT_BGRX4444 = 0x32315842, -+ WL_DRM_FORMAT_ARGB4444 = 0x32315241, -+ WL_DRM_FORMAT_ABGR4444 = 0x32314241, -+ WL_DRM_FORMAT_RGBA4444 = 0x32314152, -+ WL_DRM_FORMAT_BGRA4444 = 0x32314142, -+ WL_DRM_FORMAT_XRGB1555 = 0x35315258, -+ WL_DRM_FORMAT_XBGR1555 = 0x35314258, -+ WL_DRM_FORMAT_RGBX5551 = 0x35315852, -+ WL_DRM_FORMAT_BGRX5551 = 0x35315842, -+ WL_DRM_FORMAT_ARGB1555 = 0x35315241, -+ WL_DRM_FORMAT_ABGR1555 = 0x35314241, -+ WL_DRM_FORMAT_RGBA5551 = 0x35314152, -+ WL_DRM_FORMAT_BGRA5551 = 0x35314142, -+ WL_DRM_FORMAT_RGB565 = 0x36314752, -+ WL_DRM_FORMAT_BGR565 = 0x36314742, -+ WL_DRM_FORMAT_RGB888 = 0x34324752, -+ WL_DRM_FORMAT_BGR888 = 0x34324742, -+ WL_DRM_FORMAT_XRGB8888 = 0x34325258, -+ WL_DRM_FORMAT_XBGR8888 = 0x34324258, -+ WL_DRM_FORMAT_RGBX8888 = 0x34325852, -+ WL_DRM_FORMAT_BGRX8888 = 0x34325842, -+ WL_DRM_FORMAT_ARGB8888 = 0x34325241, -+ WL_DRM_FORMAT_ABGR8888 = 0x34324241, -+ WL_DRM_FORMAT_RGBA8888 = 0x34324152, -+ WL_DRM_FORMAT_BGRA8888 = 0x34324142, -+ WL_DRM_FORMAT_XRGB2101010 = 0x30335258, -+ WL_DRM_FORMAT_XBGR2101010 = 0x30334258, -+ WL_DRM_FORMAT_RGBX1010102 = 0x30335852, -+ WL_DRM_FORMAT_BGRX1010102 = 0x30335842, -+ WL_DRM_FORMAT_ARGB2101010 = 0x30335241, -+ WL_DRM_FORMAT_ABGR2101010 = 0x30334241, -+ WL_DRM_FORMAT_RGBA1010102 = 0x30334152, -+ WL_DRM_FORMAT_BGRA1010102 = 0x30334142, -+ WL_DRM_FORMAT_YUYV = 0x56595559, -+ WL_DRM_FORMAT_YVYU = 0x55595659, -+ WL_DRM_FORMAT_UYVY = 0x59565955, -+ WL_DRM_FORMAT_VYUY = 0x59555956, -+ WL_DRM_FORMAT_AYUV = 0x56555941, -+ WL_DRM_FORMAT_NV12 = 0x3231564e, -+ WL_DRM_FORMAT_NV21 = 0x3132564e, -+ WL_DRM_FORMAT_NV16 = 0x3631564e, -+ WL_DRM_FORMAT_NV61 = 0x3136564e, -+ WL_DRM_FORMAT_YUV410 = 0x39565559, -+ WL_DRM_FORMAT_YVU410 = 0x39555659, -+ WL_DRM_FORMAT_YUV411 = 0x31315559, -+ WL_DRM_FORMAT_YVU411 = 0x31315659, -+ WL_DRM_FORMAT_YUV420 = 0x32315559, -+ WL_DRM_FORMAT_YVU420 = 0x32315659, -+ WL_DRM_FORMAT_YUV422 = 0x36315559, -+ WL_DRM_FORMAT_YVU422 = 0x36315659, -+ WL_DRM_FORMAT_YUV444 = 0x34325559, -+ WL_DRM_FORMAT_YVU444 = 0x34325659, -+}; -+#endif /* WL_DRM_FORMAT_ENUM */ -+ -+struct wl_drm_listener { -+ /** -+ * device - (none) -+ * @name: (none) -+ */ -+ void (*device)(void *data, -+ struct wl_drm *wl_drm, -+ const char *name); -+ /** -+ * format - (none) -+ * @format: (none) -+ */ -+ void (*format)(void *data, -+ struct wl_drm *wl_drm, -+ uint32_t format); -+ /** -+ * authenticated - (none) -+ */ -+ void (*authenticated)(void *data, -+ struct wl_drm *wl_drm); -+}; -+ -+static inline int -+wl_drm_add_listener(struct wl_drm *wl_drm, -+ const struct wl_drm_listener *listener, void *data) -+{ -+ return wl_proxy_add_listener((struct wl_proxy *) wl_drm, -+ (void (**)(void)) listener, data); -+} -+ -+#define WL_DRM_AUTHENTICATE 0 -+#define WL_DRM_CREATE_BUFFER 1 -+#define WL_DRM_CREATE_PLANAR_BUFFER 2 -+ -+static inline void -+wl_drm_set_user_data(struct wl_drm *wl_drm, void *user_data) -+{ -+ wl_proxy_set_user_data((struct wl_proxy *) wl_drm, user_data); -+} -+ -+static inline void * -+wl_drm_get_user_data(struct wl_drm *wl_drm) -+{ -+ return wl_proxy_get_user_data((struct wl_proxy *) wl_drm); -+} -+ -+static inline void -+wl_drm_destroy(struct wl_drm *wl_drm) -+{ -+ wl_proxy_destroy((struct wl_proxy *) wl_drm); -+} -+ -+static inline void -+wl_drm_authenticate(struct wl_drm *wl_drm, uint32_t id) -+{ -+ wl_proxy_marshal((struct wl_proxy *) wl_drm, -+ WL_DRM_AUTHENTICATE, id); -+} -+ -+static inline struct wl_buffer * -+wl_drm_create_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_t height, uint32_t stride, uint32_t format) -+{ -+ struct wl_proxy *id; -+ -+ id = wl_proxy_create((struct wl_proxy *) wl_drm, -+ &wl_buffer_interface); -+ if (!id) -+ return NULL; -+ -+ wl_proxy_marshal((struct wl_proxy *) wl_drm, -+ WL_DRM_CREATE_BUFFER, id, name, width, height, stride, format); -+ -+ return (struct wl_buffer *) id; -+} -+ -+static inline struct wl_buffer * -+wl_drm_create_planar_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_t height, uint32_t format, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2) -+{ -+ struct wl_proxy *id; -+ -+ id = wl_proxy_create((struct wl_proxy *) wl_drm, -+ &wl_buffer_interface); -+ if (!id) -+ return NULL; -+ -+ wl_proxy_marshal((struct wl_proxy *) wl_drm, -+ WL_DRM_CREATE_PLANAR_BUFFER, id, name, width, height, format, offset0, stride0, offset1, stride1, offset2, stride2); -+ -+ return (struct wl_buffer *) id; -+} -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif -diff --git a/ext/wayland/wayland-drm-protocol.c b/ext/wayland/wayland-drm-protocol.c -new file mode 100644 -index 0000000..939af53 ---- /dev/null -+++ b/ext/wayland/wayland-drm-protocol.c -@@ -0,0 +1,74 @@ -+/* -+ * Copyright © 2008-2011 Kristian Høgsberg -+ * Copyright © 2010-2011 Intel Corporation -+ * -+ * Permission to use, copy, modify, distribute, and sell this -+ * software and its documentation for any purpose is hereby granted -+ * without fee, provided that\n the above copyright notice appear in -+ * all copies and that both that copyright notice and this permission -+ * notice appear in supporting documentation, and that the name of -+ * the copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -+ * THIS SOFTWARE. -+ */ -+ -+#include <stdlib.h> -+#include <stdint.h> -+#include "wayland-util.h" -+ -+#define ARRAY_LENGTH(a) (sizeof (a) /sizeof (a)[0]) -+ -+extern const struct wl_interface wl_buffer_interface; -+extern const struct wl_interface wl_buffer_interface; -+ -+static const struct wl_interface *types[] = { -+ NULL, -+ &wl_buffer_interface, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ &wl_buffer_interface, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+}; -+ -+static const struct wl_message wl_drm_requests[] = { -+ { "authenticate", "u", types + 0 }, -+ { "create_buffer", "nuiiuu", types + 1 }, -+ { "create_planar_buffer", "nuiiuiiiiii", types + 7 }, -+}; -+ -+static const struct wl_message wl_drm_events[] = { -+ { "device", "s", types + 0 }, -+ { "format", "u", types + 0 }, -+ { "authenticated", "", types + 0 }, -+}; -+ -+WL_EXPORT const struct wl_interface wl_drm_interface = { -+ "wl_drm", 1, -+ ARRAY_LENGTH(wl_drm_requests), wl_drm_requests, -+ ARRAY_LENGTH(wl_drm_events), wl_drm_events, -+}; -+ -diff --git a/ext/wayland/wlbuffer.c b/ext/wayland/wlbuffer.c -index 4ac99ef..0e38d2e 100644 ---- a/ext/wayland/wlbuffer.c -+++ b/ext/wayland/wlbuffer.c -@@ -76,7 +76,7 @@ - * as soon as we remove the reference that GstWlDisplay holds. - */ - --#include "wlbuffer.h" -+#include "wldisplay-wlwindow-wlbuffer.h" - - GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug); - #define GST_CAT_DEFAULT gstwayland_debug -diff --git a/ext/wayland/wlbuffer.h b/ext/wayland/wlbuffer.h -deleted file mode 100644 -index cbb50f7..0000000 ---- a/ext/wayland/wlbuffer.h -+++ /dev/null -@@ -1,67 +0,0 @@ --/* GStreamer Wayland video sink -- * -- * Copyright (C) 2014 Collabora Ltd. -- * -- * 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 Street, Fifth Floor, -- * Boston, MA 02110-1301 USA. -- */ -- --#ifndef __GST_WL_BUFFER_H__ --#define __GST_WL_BUFFER_H__ -- --#include "wldisplay.h" -- --G_BEGIN_DECLS -- --#define GST_TYPE_WL_BUFFER (gst_wl_buffer_get_type ()) --#define GST_WL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_BUFFER, GstWlBuffer)) --#define GST_IS_WL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_BUFFER)) --#define GST_WL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_BUFFER, GstWlBufferClass)) --#define GST_IS_WL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_BUFFER)) --#define GST_WL_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_BUFFER, GstWlBufferClass)) -- --typedef struct _GstWlBuffer GstWlBuffer; --typedef struct _GstWlBufferClass GstWlBufferClass; -- --struct _GstWlBuffer --{ -- GObject parent_instance; -- -- struct wl_buffer * wlbuffer; -- GstBuffer *gstbuffer; -- -- GstWlDisplay *display; -- -- gboolean used_by_compositor; --}; -- --struct _GstWlBufferClass --{ -- GObjectClass parent_class; --}; -- --GType gst_wl_buffer_get_type (void); -- --GstWlBuffer * gst_buffer_add_wl_buffer (GstBuffer * gstbuffer, -- struct wl_buffer * wlbuffer, GstWlDisplay * display); --GstWlBuffer * gst_buffer_get_wl_buffer (GstBuffer * gstbuffer); -- --void gst_wl_buffer_force_release_and_unref (GstWlBuffer * self); -- --void gst_wl_buffer_attach (GstWlBuffer * self, struct wl_surface *surface); -- --G_END_DECLS -- --#endif /* __GST_WL_BUFFER_H__ */ -diff --git a/ext/wayland/wldisplay-wlwindow-wlbuffer.h b/ext/wayland/wldisplay-wlwindow-wlbuffer.h -new file mode 100644 -index 0000000..684d145 ---- /dev/null -+++ b/ext/wayland/wldisplay-wlwindow-wlbuffer.h -@@ -0,0 +1,216 @@ -+/* GStreamer Wayland video sink -+ * -+ * Copyright (C) 2014 Collabora Ltd. -+ * -+ * 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 Street, Fifth Floor, -+ * Boston, MA 02110-1301 USA. -+ */ -+ -+#ifndef __GST_WL_DISPLAY_WL_WINDOW_H__ -+#define __GST_WL_DISPLAY_WL_WINDOW_H__ -+ -+#include <gst/gst.h> -+#include <stdlib.h> -+#include <stdio.h> -+#include <wayland-client.h> -+#include "scaler-client-protocol.h" -+#include <gst/video/video.h> -+#include <gst/video/gstvideometa.h> -+ -+G_BEGIN_DECLS -+ -+#define GST_TYPE_WL_DISPLAY (gst_wl_display_get_type ()) -+#define GST_WL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_DISPLAY, GstWlDisplay)) -+#define GST_IS_WL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_DISPLAY)) -+#define GST_WL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_DISPLAY, GstWlDisplayClass)) -+#define GST_IS_WL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_DISPLAY)) -+#define GST_WL_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_DISPLAY, GstWlDisplayClass)) -+ -+#define GST_TYPE_WL_WINDOW (gst_wl_window_get_type ()) -+#define GST_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_WINDOW, GstWlWindow)) -+#define GST_IS_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_WINDOW)) -+#define GST_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_WINDOW, GstWlWindowClass)) -+#define GST_IS_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_WINDOW)) -+#define GST_WL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_WINDOW, GstWlWindowClass)) -+ -+#define GST_TYPE_WL_BUFFER (gst_wl_buffer_get_type ()) -+#define GST_WL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_BUFFER, GstWlBuffer)) -+#define GST_IS_WL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_BUFFER)) -+#define GST_WL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_BUFFER, GstWlBufferClass)) -+#define GST_IS_WL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_BUFFER)) -+#define GST_WL_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_BUFFER, GstWlBufferClass)) -+ -+typedef struct _GstWlBuffer GstWlBuffer; -+typedef struct _GstWlBufferClass GstWlBufferClass; -+ -+typedef struct _GstWlWindow GstWlWindow; -+typedef struct _GstWlWindowClass GstWlWindowClass; -+ -+typedef struct _GstWlDisplay GstWlDisplay; -+typedef struct _GstWlDisplayClass GstWlDisplayClass; -+ -+struct _GstWlBuffer -+{ -+ GObject parent_instance; -+ -+ struct wl_buffer * wlbuffer; -+ GstBuffer *gstbuffer; -+ -+ GstWlDisplay *display; -+ -+ gboolean used_by_compositor; -+}; -+ -+struct _GstWlBufferClass -+{ -+ GObjectClass parent_class; -+}; -+ -+GType gst_wl_buffer_get_type (void); -+ -+GstWlBuffer * gst_buffer_add_wl_buffer (GstBuffer * gstbuffer, -+ struct wl_buffer * wlbuffer, GstWlDisplay * display); -+GstWlBuffer * gst_buffer_get_wl_buffer (GstBuffer * gstbuffer); -+ -+void gst_wl_buffer_force_release_and_unref (GstWlBuffer * self); -+ -+void gst_wl_buffer_attach (GstWlBuffer * self, struct wl_surface *surface); -+ -+ -+struct touch_point -+{ -+ int32_t id; -+ struct wl_list link; -+}; -+ -+struct input -+{ -+ GstWlDisplay *display; -+ struct wl_seat *seat; -+ struct wl_pointer *pointer; -+ struct wl_touch *touch; -+ struct wl_list touch_point_list; -+ GstWlWindow *pointer_focus; -+ GstWlWindow *touch_focus; -+ struct wl_list link; -+ GstWlWindow *grab; -+}; -+ -+ -+struct _GstWlWindow -+{ -+ GObject parent_instance; -+ -+ GstWlDisplay *display; -+ struct wl_surface *area_surface; -+ struct wl_subsurface *area_subsurface; -+ struct wl_viewport *area_viewport; -+ struct wl_surface *video_surface; -+ struct wl_subsurface *video_subsurface; -+ struct wl_viewport *video_viewport; -+ struct wl_shell_surface *shell_surface; -+ -+ /* the size and position of the area_(sub)surface */ -+ GstVideoRectangle render_rectangle; -+ /* the size of the video in the buffers */ -+ gint video_width, video_height; -+ /* the size of the video_(sub)surface */ -+ gint surface_width, surface_height; -+}; -+ -+struct _GstWlWindowClass -+{ -+ GObjectClass parent_class; -+}; -+ -+GType gst_wl_window_get_type (void); -+ -+GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display, -+ const GstVideoInfo * info); -+GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display, -+ struct wl_surface * parent); -+ -+GstWlDisplay *gst_wl_window_get_display (GstWlWindow * window); -+struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window); -+gboolean gst_wl_window_is_toplevel (GstWlWindow *window); -+ -+void gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer, -+ const GstVideoInfo * info); -+void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y, -+ gint w, gint h); -+ -+ -+struct _GstWlDisplay -+{ -+ GObject parent_instance; -+ -+ /* public objects */ -+ struct wl_display *display; -+ struct wl_event_queue *queue; -+ -+ /* globals */ -+ struct wl_registry *registry; -+ struct wl_compositor *compositor; -+ struct wl_subcompositor *subcompositor; -+ struct wl_shell *shell; -+ struct wl_shm *shm; -+ struct wl_drm *drm; -+ struct wl_scaler *scaler; -+ GArray *shm_formats; -+ -+ /* private */ -+ gboolean own_display; -+ GThread *thread; -+ GstPoll *wl_fd_poll; -+ -+ GMutex buffers_mutex; -+ GHashTable *buffers; -+ gboolean shutting_down; -+ -+ /* the drm device.. needed for sharing direct-render buffers.. -+ * TODO nothing about this should really be omapdrm specific. But some -+ * of the code, like hashtable of imported buffers in libdrm_omap should -+ * be refactored out into some generic libdrm code.. -+ */ -+ struct omap_device *dev; -+ int fd; -+ int authenticated; -+ gboolean use_drm; -+ -+ struct wl_list input_list; -+ int seat_version; -+ uint32_t serial; -+ -+ GstVideoCropMeta *crop; -+}; -+ -+struct _GstWlDisplayClass -+{ -+ GObjectClass parent_class; -+}; -+ -+GType gst_wl_display_get_type (void); -+ -+GstWlDisplay *gst_wl_display_new (const gchar * name, GError ** error); -+GstWlDisplay *gst_wl_display_new_existing (struct wl_display * display, -+ gboolean take_ownership, GError ** error); -+ -+/* see wlbuffer.c for explanation */ -+void gst_wl_display_register_buffer (GstWlDisplay * self, gpointer buf); -+void gst_wl_display_unregister_buffer (GstWlDisplay * self, gpointer buf); -+ -+G_END_DECLS -+ -+#endif /* __GST_WL_DISPLAY_WL_WINDOW_H__ */ -diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c -index 3318095..2f58fd2 100644 ---- a/ext/wayland/wldisplay.c -+++ b/ext/wayland/wldisplay.c -@@ -22,9 +22,15 @@ - #include <config.h> - #endif - --#include "wldisplay.h" --#include "wlbuffer.h" -- -+#include "wldisplay-wlwindow-wlbuffer.h" -+ -+#include <wayland-client-protocol.h> -+#include "wayland-drm-client-protocol.h" -+#include <linux/input.h> -+#include <omap_drm.h> -+#include <omap_drmif.h> -+#include <fcntl.h> -+#include <unistd.h> - #include <errno.h> - - GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug); -@@ -33,6 +39,8 @@ GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug); - G_DEFINE_TYPE (GstWlDisplay, gst_wl_display, G_TYPE_OBJECT); - - static void gst_wl_display_finalize (GObject * gobject); -+static void input_grab (struct input *input, GstWlWindow *window); -+static void input_ungrab (struct input *input); - - static void - gst_wl_display_class_init (GstWlDisplayClass * klass) -@@ -45,12 +53,62 @@ static void - gst_wl_display_init (GstWlDisplay * self) - { - self->shm_formats = g_array_new (FALSE, FALSE, sizeof (uint32_t)); -+ self->fd = -1; -+ self->use_drm = FALSE; - self->wl_fd_poll = gst_poll_new (TRUE); - self->buffers = g_hash_table_new (g_direct_hash, g_direct_equal); - g_mutex_init (&self->buffers_mutex); - } - - static void -+input_grab (struct input *input, GstWlWindow *window) -+{ -+ input->grab = window; -+} -+ -+static void -+input_ungrab (struct input *input) -+{ -+ input->grab = NULL; -+} -+ -+static void -+input_remove_pointer_focus (struct input *input) -+{ -+ GstWlWindow *window = input->pointer_focus; -+ -+ if (!window) -+ return; -+ -+ input->pointer_focus = NULL; -+} -+ -+static void -+input_destroy (struct input *input) -+{ -+ input_remove_pointer_focus (input); -+ -+ if (input->display->seat_version >= 3) { -+ if (input->pointer) -+ wl_pointer_release (input->pointer); -+ } -+ -+ wl_list_remove (&input->link); -+ wl_seat_destroy (input->seat); -+ free (input); -+} -+ -+static void -+display_destroy_inputs (GstWlDisplay *display) -+{ -+ struct input *tmp; -+ struct input *input; -+ -+ wl_list_for_each_safe (input, tmp, &display->input_list, link) -+ input_destroy (input); -+} -+ -+static void - gst_wl_display_finalize (GObject * gobject) - { - GstWlDisplay *self = GST_WL_DISPLAY (gobject); -@@ -71,13 +129,26 @@ gst_wl_display_finalize (GObject * gobject) - g_hash_table_remove_all (self->buffers); - - g_array_unref (self->shm_formats); -+ -+ if (self->dev) { -+ omap_device_del (self->dev); -+ self->dev = NULL; -+ } -+ if (self->fd !=-1) -+ close (self->fd); -+ - gst_poll_free (self->wl_fd_poll); - g_hash_table_unref (self->buffers); - g_mutex_clear (&self->buffers_mutex); - -+ display_destroy_inputs (self); -+ - if (self->shm) - wl_shm_destroy (self->shm); - -+ if (self->drm) -+ wl_drm_destroy (self->drm); -+ - if (self->shell) - wl_shell_destroy (self->shell); - -@@ -138,12 +209,277 @@ shm_format (void *data, struct wl_shm *wl_shm, uint32_t format) - GstWlDisplay *self = data; - - g_array_append_val (self->shm_formats, format); -+ GST_DEBUG ("shm got format: %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (format)); - } - - static const struct wl_shm_listener shm_listener = { - shm_format - }; - -+/* For wl_drm_listener */ -+ -+static void -+drm_handle_device (void *data, struct wl_drm *drm, const char *device) -+{ -+ GstWlDisplay *d = data; -+ drm_magic_t magic; -+ d->fd = open (device, O_RDWR | O_CLOEXEC); -+ if (d->fd == -1) { -+ GST_ERROR ("could not open %s: %m", device); -+ return; -+ } -+ drmGetMagic (d->fd, &magic); -+ wl_drm_authenticate (d->drm, magic); -+} -+ -+static void -+drm_handle_format (void *data, struct wl_drm *drm, uint32_t format) -+{ -+ GstWlDisplay *self = data; -+ g_array_append_val (self->shm_formats, format); -+ GST_DEBUG ("drm got format: %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (format)); -+} -+ -+static void -+drm_handle_authenticated (void *data, struct wl_drm *drm) -+{ -+ GstWlDisplay *d = data; -+ GST_DEBUG ("authenticated"); -+ d->dev = omap_device_new (d->fd); -+ d->authenticated = 1; -+ GST_DEBUG ("drm_handle_authenticated: dev: %p, d->authenticated: %d\n", -+ d->dev, d->authenticated); -+} -+ -+static const struct wl_drm_listener drm_listener = { -+ drm_handle_device, -+ drm_handle_format, -+ drm_handle_authenticated -+}; -+ -+ -+static void -+pointer_handle_enter (void *data, struct wl_pointer *pointer, -+ uint32_t serial, struct wl_surface *surface, -+ wl_fixed_t sx_w, wl_fixed_t sy_w) -+{ -+ struct input *input = data; -+ -+ if (!surface) { -+ /* enter event for a window we've just destroyed */ -+ return; -+ } -+ -+ input->display->serial = serial; -+ input->pointer_focus = wl_surface_get_user_data (surface); -+} -+ -+static void -+pointer_handle_leave (void *data, struct wl_pointer *pointer, -+ uint32_t serial, struct wl_surface *surface) -+{ -+ struct input *input = data; -+ -+ input_remove_pointer_focus (input); -+} -+ -+static void -+pointer_handle_motion (void *data, struct wl_pointer *pointer, -+ uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) -+{ -+ struct input *input = data; -+ GstWlWindow *window = input->pointer_focus; -+ -+ if (!window) -+ return; -+ -+ if (input->grab) -+ wl_shell_surface_move (input->grab->shell_surface, input->seat, -+ input->display->serial); -+ -+} -+ -+static void -+pointer_handle_button (void *data, struct wl_pointer *pointer, uint32_t serial, -+ uint32_t time, uint32_t button, uint32_t state_w) -+{ -+ struct input *input = data; -+ enum wl_pointer_button_state state = state_w; -+ input->display->serial = serial; -+ -+ if (button == BTN_LEFT) { -+ if (state == WL_POINTER_BUTTON_STATE_PRESSED) -+ input_grab (input, input->pointer_focus); -+ -+ if (input->grab && state == WL_POINTER_BUTTON_STATE_RELEASED) -+ input_ungrab (input); -+ } -+ -+ if (input->grab) -+ wl_shell_surface_move (input->grab->shell_surface, input->seat, -+ input->display->serial); -+} -+ -+static void -+pointer_handle_axis (void *data, struct wl_pointer *pointer, -+ uint32_t time, uint32_t axis, wl_fixed_t value) -+{ -+} -+ -+static const struct wl_pointer_listener pointer_listener = { -+ pointer_handle_enter, -+ pointer_handle_leave, -+ pointer_handle_motion, -+ pointer_handle_button, -+ pointer_handle_axis, -+}; -+ -+static void -+touch_handle_down (void *data, struct wl_touch *wl_touch, -+ uint32_t serial, uint32_t time, struct wl_surface *surface, -+ int32_t id, wl_fixed_t x_w, wl_fixed_t y_w) -+{ -+ struct input *input = data; -+ struct touch_point *tp; -+ -+ input->display->serial = serial; -+ input->touch_focus = wl_surface_get_user_data (surface); -+ if (!input->touch_focus) { -+ return; -+ } -+ -+ tp = malloc (sizeof *tp); -+ if (tp) { -+ tp->id = id; -+ wl_list_insert (&input->touch_point_list, &tp->link); -+ wl_shell_surface_move (input->touch_focus->shell_surface, input->seat, -+ serial); -+ } -+} -+ -+static void -+touch_handle_motion (void *data, struct wl_touch *wl_touch, -+ uint32_t time, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w) -+{ -+ struct input *input = data; -+ struct touch_point *tp; -+ -+ -+ if (!input->touch_focus) { -+ return; -+ } -+ wl_list_for_each (tp, &input->touch_point_list, link) { -+ if (tp->id != id) -+ continue; -+ -+ wl_shell_surface_move (input->touch_focus->shell_surface, input->seat, -+ input->display->serial); -+ -+ return; -+ } -+} -+ -+static void -+touch_handle_frame (void *data, struct wl_touch *wl_touch) -+{ -+} -+ -+static void -+touch_handle_cancel (void *data, struct wl_touch *wl_touch) -+{ -+} -+ -+static void -+touch_handle_up (void *data, struct wl_touch *wl_touch, -+ uint32_t serial, uint32_t time, int32_t id) -+{ -+ struct input *input = data; -+ struct touch_point *tp, *tmp; -+ -+ if (!input->touch_focus) { -+ return; -+ } -+ -+ wl_list_for_each_safe (tp, tmp, &input->touch_point_list, link) { -+ if (tp->id != id) -+ continue; -+ -+ wl_list_remove (&tp->link); -+ free (tp); -+ -+ return; -+ } -+} -+ -+static const struct wl_touch_listener touch_listener = { -+ touch_handle_down, -+ touch_handle_up, -+ touch_handle_motion, -+ touch_handle_frame, -+ touch_handle_cancel, -+}; -+ -+ -+static void -+seat_handle_capabilities (void *data, struct wl_seat *seat, -+ enum wl_seat_capability caps) -+{ -+ struct input *input = data; -+ -+ if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) { -+ input->pointer = wl_seat_get_pointer (seat); -+ wl_pointer_set_user_data (input->pointer, input); -+ wl_pointer_add_listener (input->pointer, &pointer_listener, input); -+ } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { -+ wl_pointer_destroy (input->pointer); -+ input->pointer = NULL; -+ } -+ -+ if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) { -+ input->touch = wl_seat_get_touch (seat); -+ wl_touch_set_user_data (input->touch, input); -+ wl_touch_add_listener (input->touch, &touch_listener, input); -+ } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { -+ wl_touch_destroy (input->touch); -+ input->touch = NULL; -+ } -+} -+ -+static void -+seat_handle_name (void *data, struct wl_seat *seat, const char *name) -+{ -+ -+} -+ -+static const struct wl_seat_listener seat_listener = { -+ seat_handle_capabilities, -+ seat_handle_name -+}; -+ -+static void -+display_add_input (GstWlDisplay *d, uint32_t id) -+{ -+ struct input *input; -+ -+ input = calloc (1, sizeof (*input)); -+ if (input == NULL) { -+ fprintf (stderr, "%s: out of memory\n", "gst-wayland-sink"); -+ exit (EXIT_FAILURE); -+ } -+ input->display = d; -+ input->seat = wl_registry_bind (d->registry, id, &wl_seat_interface, -+ MAX (d->seat_version, 3)); -+ input->touch_focus = NULL; -+ input->pointer_focus = NULL; -+ wl_list_init (&input->touch_point_list); -+ wl_list_insert (d->input_list.prev, &input->link); -+ -+ wl_seat_add_listener (input->seat, &seat_listener, input); -+ wl_seat_set_user_data (input->seat, input); -+ -+} -+ -+ - static void - registry_handle_global (void *data, struct wl_registry *registry, - uint32_t id, const char *interface, uint32_t version) -@@ -161,6 +497,12 @@ registry_handle_global (void *data, struct wl_registry *registry, - } else if (g_strcmp0 (interface, "wl_shm") == 0) { - self->shm = wl_registry_bind (registry, id, &wl_shm_interface, 1); - wl_shm_add_listener (self->shm, &shm_listener, self); -+ } else if (g_strcmp0 (interface, "wl_drm") == 0) { -+ self->drm = wl_registry_bind (registry, id, &wl_drm_interface, 1); -+ wl_drm_add_listener (self->drm, &drm_listener, self); -+ } else if (g_strcmp0 (interface, "wl_seat") == 0) { -+ self->seat_version = version; -+ display_add_input (self, id); - } else if (g_strcmp0 (interface, "wl_scaler") == 0) { - self->scaler = wl_registry_bind (registry, id, &wl_scaler_interface, 2); - } -@@ -238,6 +580,7 @@ gst_wl_display_new_existing (struct wl_display * display, - self->own_display = take_ownership; - - self->queue = wl_display_create_queue (self->display); -+ wl_list_init (&self->input_list); - self->registry = wl_display_get_registry (self->display); - wl_proxy_set_queue ((struct wl_proxy *) self->registry, self->queue); - wl_registry_add_listener (self->registry, ®istry_listener, self); -@@ -266,6 +609,7 @@ gst_wl_display_new_existing (struct wl_display * display, - VERIFY_INTERFACE_EXISTS (subcompositor, "wl_subcompositor"); - VERIFY_INTERFACE_EXISTS (shell, "wl_shell"); - VERIFY_INTERFACE_EXISTS (shm, "wl_shm"); -+ VERIFY_INTERFACE_EXISTS (drm, "wl_drm"); - VERIFY_INTERFACE_EXISTS (scaler, "wl_scaler"); - - #undef VERIFY_INTERFACE_EXISTS -diff --git a/ext/wayland/wldisplay.h b/ext/wayland/wldisplay.h -deleted file mode 100644 -index e9df749..0000000 ---- a/ext/wayland/wldisplay.h -+++ /dev/null -@@ -1,84 +0,0 @@ --/* GStreamer Wayland video sink -- * -- * Copyright (C) 2014 Collabora Ltd. -- * -- * 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 Street, Fifth Floor, -- * Boston, MA 02110-1301 USA. -- */ -- --#ifndef __GST_WL_DISPLAY_H__ --#define __GST_WL_DISPLAY_H__ -- --#include <gst/gst.h> --#include <wayland-client.h> --#include "scaler-client-protocol.h" -- --G_BEGIN_DECLS -- --#define GST_TYPE_WL_DISPLAY (gst_wl_display_get_type ()) --#define GST_WL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_DISPLAY, GstWlDisplay)) --#define GST_IS_WL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_DISPLAY)) --#define GST_WL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_DISPLAY, GstWlDisplayClass)) --#define GST_IS_WL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_DISPLAY)) --#define GST_WL_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_DISPLAY, GstWlDisplayClass)) -- --typedef struct _GstWlDisplay GstWlDisplay; --typedef struct _GstWlDisplayClass GstWlDisplayClass; -- --struct _GstWlDisplay --{ -- GObject parent_instance; -- -- /* public objects */ -- struct wl_display *display; -- struct wl_event_queue *queue; -- -- /* globals */ -- struct wl_registry *registry; -- struct wl_compositor *compositor; -- struct wl_subcompositor *subcompositor; -- struct wl_shell *shell; -- struct wl_shm *shm; -- struct wl_scaler *scaler; -- GArray *shm_formats; -- -- /* private */ -- gboolean own_display; -- GThread *thread; -- GstPoll *wl_fd_poll; -- -- GMutex buffers_mutex; -- GHashTable *buffers; -- gboolean shutting_down; --}; -- --struct _GstWlDisplayClass --{ -- GObjectClass parent_class; --}; -- --GType gst_wl_display_get_type (void); -- --GstWlDisplay *gst_wl_display_new (const gchar * name, GError ** error); --GstWlDisplay *gst_wl_display_new_existing (struct wl_display * display, -- gboolean take_ownership, GError ** error); -- --/* see wlbuffer.c for explanation */ --void gst_wl_display_register_buffer (GstWlDisplay * self, gpointer buf); --void gst_wl_display_unregister_buffer (GstWlDisplay * self, gpointer buf); -- --G_END_DECLS -- --#endif /* __GST_WL_DISPLAY_H__ */ -diff --git a/ext/wayland/wldrm.c b/ext/wayland/wldrm.c -new file mode 100644 -index 0000000..3dc9c21 ---- /dev/null -+++ b/ext/wayland/wldrm.c -@@ -0,0 +1,69 @@ -+#include "wldisplay-wlwindow-wlbuffer.h" -+#include <gst/drm/gstdrmallocator.h> -+#include "wayland-drm-client-protocol.h" -+#include <omap_drm.h> -+#include <omap_drmif.h> -+#include <wayland-client.h> -+ -+struct wl_buffer * -+gst_wl_drm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display, -+ const GstVideoInfo * info) -+{ -+ gint video_width = GST_VIDEO_INFO_WIDTH (info); -+ gint video_height = GST_VIDEO_INFO_HEIGHT (info); -+ int fd = -1; -+ struct omap_bo *bo; -+ struct wl_buffer *buffer; -+ -+ /* TODO get format, etc from caps.. and query device for -+ * supported formats, and make this all more flexible to -+ * cope with various formats: -+ */ -+ uint32_t fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2'); -+ uint32_t name; -+ /* note: wayland and mesa use the terminology: -+ * stride - rowstride in bytes -+ * pitch - rowstride in pixels -+ */ -+ uint32_t strides[3] = { -+ GST_ROUND_UP_4 (video_width), GST_ROUND_UP_4 (video_width), 0, -+ }; -+ uint32_t offsets[3] = { -+ 0, strides[0] * video_height, 0 -+ }; -+ -+ fd = gst_fd_memory_get_fd (mem); -+ -+ if (fd < 0 ) { -+ GST_DEBUG ("Invalid fd"); -+ return NULL; -+ } -+ -+ bo = omap_bo_from_dmabuf (display->dev, fd); -+ -+ struct drm_gem_flink req = { -+ .handle = omap_bo_handle(bo), -+ }; -+ -+ int ret; -+ ret = drmIoctl(display->fd, DRM_IOCTL_GEM_FLINK, &req); -+ if (ret) { -+ GST_DEBUG ("could not get name, DRM_IOCTL_GEM_FLINK returned %d", ret); -+ return NULL; -+ } -+ -+ name = req.name; -+ -+ GST_LOG ("width = %d , height = %d , fourcc = %d ", video_width, video_height, fourcc ); -+ buffer = wl_drm_create_planar_buffer (display->drm, name, -+ video_width, video_height, fourcc, -+ offsets[0], strides[0], -+ offsets[1], strides[1], -+ offsets[2], strides[2]); -+ -+ GST_DEBUG ("create planar buffer: %p (name=%d)", -+ buffer, name); -+ -+ return buffer; -+} -+ -diff --git a/ext/wayland/wldrm.h b/ext/wayland/wldrm.h -new file mode 100644 -index 0000000..9751029 ---- /dev/null -+++ b/ext/wayland/wldrm.h -@@ -0,0 +1,3 @@ -+struct wl_buffer * -+gst_wl_drm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display, -+ const GstVideoInfo * info); -diff --git a/ext/wayland/wlshmallocator.h b/ext/wayland/wlshmallocator.h -index 07ae17f..2860fc3 100644 ---- a/ext/wayland/wlshmallocator.h -+++ b/ext/wayland/wlshmallocator.h -@@ -26,7 +26,7 @@ - #include <gst/video/video.h> - #include <gst/allocators/allocators.h> - #include <wayland-client-protocol.h> --#include "wldisplay.h" -+#include "wldisplay-wlwindow-wlbuffer.h" - - G_BEGIN_DECLS - -diff --git a/ext/wayland/wlvideoformat.c b/ext/wayland/wlvideoformat.c -index 1302da6..aa336aa 100644 ---- a/ext/wayland/wlvideoformat.c -+++ b/ext/wayland/wlvideoformat.c -@@ -106,6 +106,10 @@ gst_wl_shm_format_to_video_format (enum wl_shm_format wl_format) - const gchar * - gst_wl_shm_format_to_string (enum wl_shm_format wl_format) - { -- return gst_video_format_to_string -- (gst_wl_shm_format_to_video_format (wl_format)); -+ GstVideoFormat fmt = gst_wl_shm_format_to_video_format (wl_format); -+ if (fmt != GST_VIDEO_FORMAT_UNKNOWN) { -+ return gst_video_format_to_string (fmt); -+ } else { -+ return NULL; -+ } - } -diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c -index 79000ae..f7e3324 100644 ---- a/ext/wayland/wlwindow.c -+++ b/ext/wayland/wlwindow.c -@@ -24,9 +24,10 @@ - #include <config.h> - #endif - --#include "wlwindow.h" -+#include "wldisplay-wlwindow-wlbuffer.h" - #include "wlshmallocator.h" --#include "wlbuffer.h" -+#include "wldrm.h" -+#include <gst/drm/gstdrmallocator.h> - - GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug); - #define GST_CAT_DEFAULT gstwayland_debug -@@ -111,6 +112,8 @@ gst_wl_window_new_internal (GstWlDisplay * display) - - window->area_surface = wl_compositor_create_surface (display->compositor); - window->video_surface = wl_compositor_create_surface (display->compositor); -+ wl_surface_set_user_data (window->area_surface, window); -+ wl_surface_set_user_data (window->video_surface, window); - - wl_proxy_set_queue ((struct wl_proxy *) window->area_surface, display->queue); - wl_proxy_set_queue ((struct wl_proxy *) window->video_surface, -@@ -126,6 +129,21 @@ gst_wl_window_new_internal (GstWlDisplay * display) - window->area_surface); - window->video_viewport = wl_scaler_get_viewport (display->scaler, - window->video_surface); -+ if (display->crop) { -+ GST_DEBUG ("Setting source crop : %d %d %d %d",display->crop->x, display->crop->y, -+ display->crop->width, display->crop->height); -+ wl_viewport_set_source (window->area_viewport, -+ wl_fixed_from_int(display->crop->x), -+ wl_fixed_from_int(display->crop->y), -+ wl_fixed_from_int(display->crop->width), -+ wl_fixed_from_int(display->crop->height)); -+ wl_viewport_set_source (window->video_viewport, -+ wl_fixed_from_int(display->crop->x), -+ wl_fixed_from_int(display->crop->y), -+ wl_fixed_from_int(display->crop->width), -+ wl_fixed_from_int(display->crop->height)); -+ -+ } - - /* draw the area_subsurface */ - gst_video_info_set_format (&info, -@@ -136,14 +154,25 @@ gst_wl_window_new_internal (GstWlDisplay * display) - GST_VIDEO_FORMAT_BGRx, - #endif - 1, 1); -- -- buf = gst_buffer_new_allocate (gst_wl_shm_allocator_get (), info.size, NULL); -+ if (display->use_drm) { -+ buf = gst_buffer_new_allocate (gst_drm_allocator_get (), info.size, NULL); -+ } else { -+ buf = gst_buffer_new_allocate (gst_wl_shm_allocator_get (), info.size, NULL); -+ } - gst_buffer_map (buf, &mapinfo, GST_MAP_WRITE); -- *((guint32 *) mapinfo.data) = 0; /* paint it black */ -- gst_buffer_unmap (buf, &mapinfo); -- wlbuf = -- gst_wl_shm_memory_construct_wl_buffer (gst_buffer_peek_memory (buf, 0), -- display, &info); -+ *((guint32 *) mapinfo.data) = 0; /* paint it black */ -+ gst_buffer_unmap (buf, &mapinfo); -+ -+ if (display->use_drm) { -+ wlbuf = -+ gst_wl_drm_memory_construct_wl_buffer (gst_buffer_peek_memory (buf, 0), -+ display, &info); -+ } else { -+ wlbuf = -+ gst_wl_shm_memory_construct_wl_buffer (gst_buffer_peek_memory (buf, 0), -+ display, &info); -+ } -+ - gwlbuf = gst_buffer_add_wl_buffer (buf, wlbuf, display); - gst_wl_buffer_attach (gwlbuf, window->area_surface); - -diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h -deleted file mode 100644 -index e22cb26..0000000 ---- a/ext/wayland/wlwindow.h -+++ /dev/null -@@ -1,84 +0,0 @@ --/* GStreamer Wayland video sink -- * -- * Copyright (C) 2014 Collabora Ltd. -- * -- * 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 Street, Fifth Floor, -- * Boston, MA 02110-1301 USA. -- */ -- --#ifndef __GST_WL_WINDOW_H__ --#define __GST_WL_WINDOW_H__ -- --#include "wldisplay.h" --#include "wlbuffer.h" --#include <gst/video/video.h> -- --G_BEGIN_DECLS -- --#define GST_TYPE_WL_WINDOW (gst_wl_window_get_type ()) --#define GST_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_WINDOW, GstWlWindow)) --#define GST_IS_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_WINDOW)) --#define GST_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_WINDOW, GstWlWindowClass)) --#define GST_IS_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_WINDOW)) --#define GST_WL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_WINDOW, GstWlWindowClass)) -- --typedef struct _GstWlWindow GstWlWindow; --typedef struct _GstWlWindowClass GstWlWindowClass; -- --struct _GstWlWindow --{ -- GObject parent_instance; -- -- GstWlDisplay *display; -- struct wl_surface *area_surface; -- struct wl_subsurface *area_subsurface; -- struct wl_viewport *area_viewport; -- struct wl_surface *video_surface; -- struct wl_subsurface *video_subsurface; -- struct wl_viewport *video_viewport; -- struct wl_shell_surface *shell_surface; -- -- /* the size and position of the area_(sub)surface */ -- GstVideoRectangle render_rectangle; -- /* the size of the video in the buffers */ -- gint video_width, video_height; -- /* the size of the video_(sub)surface */ -- gint surface_width, surface_height; --}; -- --struct _GstWlWindowClass --{ -- GObjectClass parent_class; --}; -- --GType gst_wl_window_get_type (void); -- --GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display, -- const GstVideoInfo * info); --GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display, -- struct wl_surface * parent); -- --GstWlDisplay *gst_wl_window_get_display (GstWlWindow * window); --struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window); --gboolean gst_wl_window_is_toplevel (GstWlWindow *window); -- --void gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer, -- const GstVideoInfo * info); --void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y, -- gint w, gint h); -- --G_END_DECLS -- --#endif /* __GST_WL_WINDOW_H__ */ --- -2.7.4 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0005-gstwaylandsink-Implement-callbacks-for-version-5-of-.patch b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0005-gstwaylandsink-Implement-callbacks-for-version-5-of-.patch deleted file mode 100644 index bcb66c816..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad/0005-gstwaylandsink-Implement-callbacks-for-version-5-of-.patch +++ /dev/null @@ -1,65 +0,0 @@ -From adfc38273882a102d25fc420adc82b3f225588f9 Mon Sep 17 00:00:00 2001 -From: Pooja Prajod <a0132412@ti.com> -Date: Mon, 27 Mar 2017 18:27:06 +0530 -Subject: [PATCH] gstwaylandsink: Implement callbacks for version 5 of - wl_pointer - -Few extra callbacks are required for wl_pointer listener -with the newer weston. Without the extra dummy callbacks -the pipelines results in segfault. - -Signed-off-by: Pooja Prajod <a0132412@ti.com> ---- - ext/wayland/wldisplay.c | 22 +++++++++++++++++++++- - 1 file changed, 21 insertions(+), 1 deletion(-) - -diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c -index 2f58fd2..54acfdb 100644 ---- a/ext/wayland/wldisplay.c -+++ b/ext/wayland/wldisplay.c -@@ -326,12 +326,25 @@ pointer_handle_axis (void *data, struct wl_pointer *pointer, - { - } - -+static void pointer_frame(void *data, struct wl_pointer *wl_pointer) -+{ -+} -+static void pointer_axis_source(void *data, struct wl_pointer *wl_pointer, uint32_t axis_source) -+{ -+} -+void pointer_axis_stop(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis) -+{ -+} -+ - static const struct wl_pointer_listener pointer_listener = { - pointer_handle_enter, - pointer_handle_leave, - pointer_handle_motion, - pointer_handle_button, - pointer_handle_axis, -+ pointer_frame, -+ pointer_axis_source, -+ pointer_axis_stop - }; - - static void -@@ -508,8 +521,15 @@ registry_handle_global (void *data, struct wl_registry *registry, - } - } - -+static void -+registry_handle_global_remove(void *data, struct wl_registry *registry, -+ uint32_t name) -+{ -+} -+ - static const struct wl_registry_listener registry_listener = { -- registry_handle_global -+ registry_handle_global, -+ registry_handle_global_remove - }; - - static gpointer --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend deleted file mode 100644 index 8d3e6c7a7..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend +++ /dev/null @@ -1,31 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -PACKAGECONFIG = "faad" - -# gstreamer is now also included on Keystone, be mindful of any Graphics dependencies -PACKAGECONFIG_append_omap-a15 = " ${@bb.utils.contains('DISTRO_FEATURES','wayland','wayland','',d)}" -PACKAGECONFIG_append_ti43x = " ${@bb.utils.contains('DISTRO_FEATURES','wayland','wayland','',d)}" -PACKAGECONFIG_append_ti33x = " ${@bb.utils.contains('DISTRO_FEATURES','wayland','wayland','',d)}" - -DEPENDS_append_omap-a15 = " \ - libdrm \ -" - -DEPENDS_append_ti43x = " \ - libdrm \ -" - -DEPENDS_append_ti33x = " \ - libdrm \ -" - -############## F I X M E ##################### -# FIXME rocko -DISABLED_ROCKO_SRC_URI_append = " \ - file://0001-gstdrmallocator-Add-DRM-allocator-support.patch \ -" -################ F I X M E #################### - -PACKAGE_ARCH = "${MACHINE_ARCH}" - -PR = "r4" diff --git a/meta-agl-bsp/meta-ti/recipes-arago/ipumm-fw/ipumm-fw_3.00.13.00.bb b/meta-agl-bsp/meta-ti/recipes-arago/ipumm-fw/ipumm-fw_3.00.13.00.bb deleted file mode 100644 index a9653f4d3..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/ipumm-fw/ipumm-fw_3.00.13.00.bb +++ /dev/null @@ -1,33 +0,0 @@ -python __anonymous() { - features = d.getVar("MACHINE_FEATURES", 1) - if not features: - return - if "mmip" not in features: - raise bb.parse.SkipPackage('ipumm-fw does not apply to systems without the "mmip" flag in MACHINE_FEATURES') -} - -DESCRIPTION = "Firmware for IPU for supporting Accelerated MM decode and encode" -LICENSE = "TI-TSPA" - -LIC_FILES_CHKSUM = "file://MMIP-${PV}-Manifest.doc;md5=255f135205844dcbeab09b481ff9fb3a" - -COMPATIBLE_MACHINE = "dra7xx" -PACKAGE_ARCH = "${MACHINE_ARCH}" - -RDEPENDS_${PN} = " libdce" - -SRC_URI = "http://downloads.ti.com/infotainment/esd/jacinto6/processor-sdk-linux-automotive/03_02_00_03/exports/ipumm-dra7xx-evm-${PV}.tar.gz;protocol=http" - -SRC_URI[md5sum] = "d5cf8c3be28f22cd94e97ab2b781a4df" -SRC_URI[sha256sum] = "b003a981cc97d834c81ec653dca9888c0e6c99500ee695a24f3221898f6afed4" - -S = "${WORKDIR}/ipumm-dra7xx-evm-${PV}" - -TARGET = "dra7-ipu2-fw.xem4" - -do_install() { - mkdir -p ${D}${base_libdir}/firmware - cp ${S}/firmware/${TARGET} ${D}${base_libdir}/firmware/${TARGET} -} - -FILES_${PN} += "${base_libdir}/firmware/${TARGET}" diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-Weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-Weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch index 806f4900e..126d4ed33 100644 --- a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-Weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch +++ b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-Weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch @@ -17,23 +17,23 @@ cannot be hidden. It is required to set the current_panel to the text_input when the input_panel becomes visible at the first time. +Updated for weston 5.0.0 by Scott Murray <scott.murray@konsulko.com>. + Signed-off-by: Eric Ruei <e-ruei1@ti.com> +Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- compositor/text-backend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/compositor/text-backend.c b/compositor/text-backend.c -index ab4667f..36c70a5 100644 +index 664c36f7..b610dfb1 100644 --- a/compositor/text-backend.c +++ b/compositor/text-backend.c -@@ -337,6 +337,7 @@ text_input_show_input_panel(struct wl_client *client, +@@ -349,6 +349,7 @@ text_input_show_input_panel(struct wl_client *client, text_input->surface); wl_signal_emit(&ec->update_input_panel_signal, &text_input->cursor_rectangle); -+ text_input->manager->current_panel = text_input; ++ text_input->manager->current_text_input = text_input; } } --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km/add-AGL-toolchain-config.patch b/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km/add-AGL-toolchain-config.patch new file mode 100644 index 000000000..9fdd95b4c --- /dev/null +++ b/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km/add-AGL-toolchain-config.patch @@ -0,0 +1,12 @@ +diff --git a/eurasia_km/eurasiacon/build/linux2/config/compilers/arm-agl-linux-gnueabi.mk b/eurasia_km/eurasiacon/build/linux2/config/compilers/arm-agl-linux-gnueabi.mk +new file mode 100644 +index 0000000..2abaa9f +--- /dev/null ++++ b/eurasia_km/eurasiacon/build/linux2/config/compilers/arm-agl-linux-gnueabi.mk +@@ -0,0 +1,6 @@ ++# 32-bit ARM hard float compiler ++ifeq ($(MULTIARCH),1) ++ TARGET_SECONDARY_ARCH := target_armhf ++else ++ TARGET_PRIMARY_ARCH := target_armhf ++endif diff --git a/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km_%.bbappend b/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km_%.bbappend new file mode 100644 index 000000000..fd3c6ad8d --- /dev/null +++ b/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km_%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI += "file://add-AGL-toolchain-config.patch" diff --git a/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension/force-type-conversion.patch b/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension/force-type-conversion.patch index a72aeedf6..7256abb56 100644 --- a/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension/force-type-conversion.patch +++ b/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension/force-type-conversion.patch @@ -1,13 +1,13 @@ diff --git a/ivi-layermanagement-examples/EGLWLMockNavigation/src/OpenGLES2App.cpp b/ivi-layermanagement-examples/EGLWLMockNavigation/src/OpenGLES2App.cpp -index 2e65864..e14dbc0 100644 +index 50c3e38..2f4910e 100644 --- a/ivi-layermanagement-examples/EGLWLMockNavigation/src/OpenGLES2App.cpp +++ b/ivi-layermanagement-examples/EGLWLMockNavigation/src/OpenGLES2App.cpp -@@ -244,7 +247,7 @@ bool OpenGLES2App::createEGLContext() +@@ -248,7 +248,7 @@ bool OpenGLES2App::createEGLContext(SurfaceConfiguration* config) m_eglContextStruct.eglSurface = NULL; m_eglContextStruct.eglContext = NULL; - m_eglContextStruct.eglDisplay = eglGetDisplay(m_wlContextStruct.wlDisplay); + m_eglContextStruct.eglDisplay = eglGetDisplay((EGLNativeDisplayType)m_wlContextStruct.wlDisplay); - eglstatus = eglGetError(); if (!m_eglContextStruct.eglDisplay) { + cout << "Error: eglGetDisplay() failed.\n"; diff --git a/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension_2.%.bbappend b/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension_%.bbappend index e9a57d324..e9a57d324 100644 --- a/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension_2.%.bbappend +++ b/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension_%.bbappend diff --git a/meta-agl-bsp/meta-ti/recipes-kernel/linux/files/dcan2_pinmux_enable.patch b/meta-agl-bsp/meta-ti/recipes-kernel/linux/files/dcan2_pinmux_enable.patch index 22f467599..6c54c5ee1 100644 --- a/meta-agl-bsp/meta-ti/recipes-kernel/linux/files/dcan2_pinmux_enable.patch +++ b/meta-agl-bsp/meta-ti/recipes-kernel/linux/files/dcan2_pinmux_enable.patch @@ -1,9 +1,9 @@ diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts -index 02dc1ae..ec0acfe 100644 +index 35424da..08fca09 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts -@@ -166,6 +166,20 @@ - DRA7XX_CORE_IOPAD(0x3818, MUX_MODE15 | PULL_UP) /* wakeup0.off */ +@@ -243,6 +243,20 @@ + DRA7XX_CORE_IOPAD(0x380c, PIN_INPUT | MUX_MODE1) /* i2c2_scl.hdmi1_ddc_sda */ >; }; + dcan2_pins_default: dcan2_pins_default { @@ -21,12 +21,12 @@ index 02dc1ae..ec0acfe 100644 + }; + }; - + &i2c1 { -@@ -652,6 +666,13 @@ - pinctrl-2 = <&dcan1_pins_default>; +@@ -703,6 +717,13 @@ + memory-region = <&ipu1_memory_region>; }; - + +&dcan2 { + status = "ok"; + pinctrl-names = "default", "sleep"; @@ -36,4 +36,4 @@ index 02dc1ae..ec0acfe 100644 + &dsp1 { status = "okay"; - memory-region = <&dsp1_cma_pool>; + memory-region = <&dsp1_memory_region>; diff --git a/meta-agl-bsp/meta-ti/recipes-kernel/linux/files/fix_dcan_addresses.patch b/meta-agl-bsp/meta-ti/recipes-kernel/linux/files/fix_dcan_addresses.patch deleted file mode 100644 index e4b116f5b..000000000 --- a/meta-agl-bsp/meta-ti/recipes-kernel/linux/files/fix_dcan_addresses.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi -index 9be07c5..9ecc1f5 100644 ---- a/arch/arm/boot/dts/dra7.dtsi -+++ b/arch/arm/boot/dts/dra7.dtsi -@@ -2032,7 +2032,7 @@ - }; - }; - -- dcan1: can@481cc000 { -+ dcan1: can@4ae3c000 { - compatible = "ti,dra7-d_can"; - ti,hwmods = "dcan1"; - reg = <0x4ae3c000 0x2000>; -@@ -2042,7 +2042,7 @@ - status = "disabled"; - }; - -- dcan2: can@481d0000 { -+ dcan2: can@48480000 { - compatible = "ti,dra7-d_can"; - ti,hwmods = "dcan2"; - reg = <0x48480000 0x2000>; diff --git a/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend b/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend index 356f24fa3..2f6c449bc 100644 --- a/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend +++ b/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend @@ -1,5 +1,4 @@ require recipes-kernel/linux/linux-agl.inc -require recipes-kernel/linux/linux-agl-4.9.inc FILESEXTRAPATHS_prepend := "${THISDIR}/files:" @@ -8,6 +7,5 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SRC_URI += " \ file://dcan2_pinmux_enable.patch \ - file://fix_dcan_addresses.patch \ - " +" diff --git a/meta-agl-bsp/recipes-graphics/opencv/opencv_3.3.bbappend b/meta-agl-bsp/recipes-graphics/opencv/opencv_3.%.bbappend index 8a68b0641..8a68b0641 100644 --- a/meta-agl-bsp/recipes-graphics/opencv/opencv_3.3.bbappend +++ b/meta-agl-bsp/recipes-graphics/opencv/opencv_3.%.bbappend diff --git a/meta-agl-bsp/recipes-graphics/wayland/weston-ini-conf/core.cfg b/meta-agl-bsp/recipes-graphics/wayland/weston-ini-conf/core.cfg index 8d809a6a0..eb5d470ed 100644 --- a/meta-agl-bsp/recipes-graphics/wayland/weston-ini-conf/core.cfg +++ b/meta-agl-bsp/recipes-graphics/wayland/weston-ini-conf/core.cfg @@ -2,4 +2,4 @@ shell=ivi-shell.so backend=drm-backend.so require-input=false -modules=systemd-notify.so +modules=systemd-notify.so,ivi-controller.so diff --git a/meta-agl-bsp/recipes-graphics/wayland/weston-ini-conf/ivishell.cfg b/meta-agl-bsp/recipes-graphics/wayland/weston-ini-conf/ivishell.cfg index 6789d8819..d0bcb833f 100644 --- a/meta-agl-bsp/recipes-graphics/wayland/weston-ini-conf/ivishell.cfg +++ b/meta-agl-bsp/recipes-graphics/wayland/weston-ini-conf/ivishell.cfg @@ -1,4 +1,3 @@ [ivi-shell] ivi-input-module=ivi-input-controller.so -ivi-module=ivi-controller.so ivi-id-agent-module=ivi-id-agent.so diff --git a/meta-agl-bsp/recipes-kernel/kern-tools-native/files/0001-merge_config.sh-add-CR-after-fragment.patch b/meta-agl-bsp/recipes-kernel/kern-tools-native/files/0001-merge_config.sh-add-CR-after-fragment.patch deleted file mode 100644 index 350f9d4bf..000000000 --- a/meta-agl-bsp/recipes-kernel/kern-tools-native/files/0001-merge_config.sh-add-CR-after-fragment.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 8d12bbfc6179d7e9777e4663e10f1795de158b57 Mon Sep 17 00:00:00 2001 -From: Stephane Desneux <stephane.desneux@iot.bzh> -Date: Tue, 5 Jun 2018 10:53:24 +0200 -Subject: [PATCH] tools/merge_config.sh: add CR after each fragment - -If a fragment file doesn't contain a CR at the end, two config options -may be merged on the same line in the result file, leading to misconfiguration. - -This patch adds a CR after each fragment to ensure that config options -are well separated in the result file. - -Bug-AGL: SPEC-1475 - -Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> ---- - tools/merge_config.sh | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/tools/merge_config.sh b/tools/merge_config.sh -index 67d1314..296e759 100755 ---- a/tools/merge_config.sh -+++ b/tools/merge_config.sh -@@ -129,6 +129,8 @@ for MERGE_FILE in $MERGE_LIST ; do - sed -i "/$CFG[ =]/d" $TMP_FILE - done - cat $MERGE_FILE >> $TMP_FILE -+ # workaround for fragments not ending with carriage return -+ echo >> $TMP_FILE - done - - if [ "$RUNMAKE" = "false" ]; then --- -2.1.4 - diff --git a/meta-agl-bsp/recipes-kernel/kern-tools-native/kern-tools-native_git.bbappend b/meta-agl-bsp/recipes-kernel/kern-tools-native/kern-tools-native_git.bbappend deleted file mode 100644 index 814278302..000000000 --- a/meta-agl-bsp/recipes-kernel/kern-tools-native/kern-tools-native_git.bbappend +++ /dev/null @@ -1,6 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -SRC_URI += "\ - file://0001-merge_config.sh-add-CR-after-fragment.patch;patchdir=git \ - " - diff --git a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0001-utils.c-Prefer-monotonic-clock-to-calculate-elapsed-.patch b/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0001-utils.c-Prefer-monotonic-clock-to-calculate-elapsed-.patch deleted file mode 100644 index 6ca593be5..000000000 --- a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0001-utils.c-Prefer-monotonic-clock-to-calculate-elapsed-.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 41b7f4814d39c1930b1fcf0be2e247a73546fb80 Mon Sep 17 00:00:00 2001 -From: Jeffrey Pautler <jeffrey.pautler@ni.com> -Date: Tue, 31 Oct 2017 14:38:39 -0500 -Subject: [PATCH 1/7] utils.c: Prefer monotonic clock to calculate elapsed time - -The current implementation uses the system clock to calculate how long -a ptest has been running with no output. If a ptest changes the system -clock as part of the test, that can cause the current implementation -to falsely trigger a timeout or miss an actual timeout. It is -preferrable to use a monotonic clock for calculating elapsed time in -order to avoid these issues. - -This change tries to use the monotonic clock first and falls back to -the realtime clock if the monotonic clock is not supported. - -Signed-off-by: Jeffrey Pautler <jeffrey.pautler@ni.com> ---- - utils.c | 24 +++++++++++++++++------- - 1 file changed, 17 insertions(+), 7 deletions(-) - -diff --git a/utils.c b/utils.c -index 6d653887e9e4..933ecedf57e8 100644 ---- a/utils.c -+++ b/utils.c -@@ -257,7 +257,8 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid, - int timeout, int *fds, FILE **fps) - { - struct pollfd pfds[2]; -- time_t sentinel; -+ struct timespec sentinel; -+ clockid_t clock = CLOCK_MONOTONIC; - int r; - - int timeouted = 0; -@@ -269,7 +270,11 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid, - pfds[1].fd = fds[1]; - pfds[1].events = POLLIN; - -- sentinel = time(NULL); -+ if (clock_gettime(clock, &sentinel) == -1) { -+ clock = CLOCK_REALTIME; -+ clock_gettime(clock, &sentinel); -+ } -+ - while (1) { - waitflags = WNOHANG; - -@@ -288,11 +293,16 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid, - fwrite(buf, n, 1, fps[1]); - } - -- sentinel = time(NULL); -- } else if (timeout >= 0 && ((time(NULL) - sentinel) > timeout)) { -- timeouted = 1; -- kill(pid, SIGKILL); -- waitflags = 0; -+ clock_gettime(clock, &sentinel); -+ } else if (timeout >= 0) { -+ struct timespec time; -+ -+ clock_gettime(clock, &time); -+ if ((time.tv_sec - sentinel.tv_sec) > timeout) { -+ timeouted = 1; -+ kill(pid, SIGKILL); -+ waitflags = 0; -+ } - } - - if (waitpid(pid, &status, waitflags) == pid) --- -2.11.0 - diff --git a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0002-Makefile-libcheck-now-requires-to-link-subunit.patch b/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0002-Makefile-libcheck-now-requires-to-link-subunit.patch deleted file mode 100644 index 4ada99422..000000000 --- a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0002-Makefile-libcheck-now-requires-to-link-subunit.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 4f6d6c5e3f2f181e3cc380a76e635e7c34d3c5d1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linaro.org> -Date: Thu, 7 Dec 2017 17:42:44 -0600 -Subject: [PATCH 2/7] Makefile: libcheck now requires to link subunit -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Aníbal Limón <anibal.limon@linaro.org> ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index 434b89f34688..1bde7beff9d1 100644 ---- a/Makefile -+++ b/Makefile -@@ -22,7 +22,7 @@ TEST_SOURCES=tests/main.c tests/ptest_list.c tests/utils.c $(BASE_SOURCES) - TEST_OBJECTS=$(TEST_SOURCES:.c=.o) - TEST_EXECUTABLE=ptest-runner-test - TEST_LDFLAGS=-lm -lrt -lpthread --TEST_LIBSTATIC=-lcheck -+TEST_LIBSTATIC=-lcheck -lsubunit - - TEST_DATA=$(shell echo `pwd`/tests/data) - --- -2.11.0 - diff --git a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0003-Add-support-to-avoid-load-run-twice-a-run_ptest-scri.patch b/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0003-Add-support-to-avoid-load-run-twice-a-run_ptest-scri.patch deleted file mode 100644 index 47957333d..000000000 --- a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0003-Add-support-to-avoid-load-run-twice-a-run_ptest-scri.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 0e566f65fa31eaa5208d4a17413c7a4aad7eade5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linaro.org> -Date: Thu, 7 Dec 2017 17:42:45 -0600 -Subject: [PATCH 3/7] Add support to avoid load/run twice a run_ptest script -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In some ptest packages exists symlink in the ptest directory causing -to load/run twice the same ptest, - -For example in perl5: - -/usr/lib/perl -> /usr/lib/perl5 - -Signed-off-by: Aníbal Limón <anibal.limon@linaro.org> ---- - ptest_list.c | 40 ++++++++++++++++++++++++++++++++++++++++ - ptest_list.h | 3 +++ - tests/data/python3 | 1 + - tests/utils.c | 1 + - utils.c | 6 ++++++ - 5 files changed, 51 insertions(+) - create mode 120000 tests/data/python3 - -diff --git a/ptest_list.c b/ptest_list.c -index 2e1aa305752d..3e393d5fabe2 100644 ---- a/ptest_list.c -+++ b/ptest_list.c -@@ -110,6 +110,46 @@ ptest_list_search(struct ptest_list *head, char *ptest) - return q; - } - -+ -+struct ptest_list * -+ptest_list_search_by_file(struct ptest_list *head, char *run_ptest, struct stat st_buf) -+{ -+ struct ptest_list *q = NULL; -+ struct ptest_list *p; -+ struct stat st_buf_p; -+ -+ VALIDATE_PTR_RNULL(head); -+ VALIDATE_PTR_RNULL(run_ptest); -+ -+ for (p = head; p != NULL; p = p->next) { -+ if (p->ptest == NULL) -+ continue; -+ -+ if (stat(p->run_ptest, &st_buf_p) == -1) -+ continue; -+ -+ if (strcmp(p->run_ptest, run_ptest) == 0) { -+ q = p; -+ break; -+ } -+ -+ /* * -+ * In some ptest packages exists symlink in the ptest directory -+ * causing to load/run twice the same ptest, -+ * -+ * For example in perl5: -+ * /usr/lib/perl -> /usr/lib/perl5 -+ * */ -+ if (st_buf.st_dev == st_buf_p.st_dev && -+ st_buf.st_ino == st_buf_p.st_ino) { -+ q = p; -+ break; -+ } -+ } -+ -+ return q; -+} -+ - struct ptest_list * - ptest_list_add(struct ptest_list *head, char *ptest, char *run_ptest) - { -diff --git a/ptest_list.h b/ptest_list.h -index 8b394853c25b..03d75390a51d 100644 ---- a/ptest_list.h -+++ b/ptest_list.h -@@ -28,6 +28,8 @@ - #define PTEST_LIST_ITERATE_START(head, p) for (p = head->next; p != NULL; p = p->next) { - #define PTEST_LIST_ITERATE_END } - -+#include <sys/stat.h> -+ - struct ptest_list { - char *ptest; - char *run_ptest; -@@ -42,6 +44,7 @@ extern int ptest_list_free_all(struct ptest_list *); - - extern int ptest_list_length(struct ptest_list *); - extern struct ptest_list *ptest_list_search(struct ptest_list *, char *); -+extern struct ptest_list *ptest_list_search_by_file(struct ptest_list *, char *, struct stat); - extern struct ptest_list *ptest_list_add(struct ptest_list *, char *, char *); - extern struct ptest_list *ptest_list_remove(struct ptest_list *, char *, int); - -diff --git a/tests/data/python3 b/tests/data/python3 -new file mode 120000 -index 000000000000..d8654aa0e2f2 ---- /dev/null -+++ b/tests/data/python3 -@@ -0,0 +1 @@ -+python -\ No newline at end of file -diff --git a/tests/utils.c b/tests/utils.c -index ecf3e8af9a81..cf093793c4f2 100644 ---- a/tests/utils.c -+++ b/tests/utils.c -@@ -48,6 +48,7 @@ static int ptests_found_length = 6; - static char *ptests_not_found[] = { - "busybox", - "perl", -+ "python3", - NULL, - }; - -diff --git a/utils.c b/utils.c -index 933ecedf57e8..ed2eff7900c1 100644 ---- a/utils.c -+++ b/utils.c -@@ -143,6 +143,12 @@ get_available_ptests(const char *dir) - continue; - } - -+ if (ptest_list_search_by_file(head, run_ptest, st_buf)) { -+ free(run_ptest); -+ free(d_name); -+ continue; -+ } -+ - struct ptest_list *p = ptest_list_add(head, - d_name, run_ptest); - CHECK_ALLOCATION(p, sizeof(struct ptest_list *), 0); --- -2.11.0 - diff --git a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0004-README.md-Update-to-my-current-email.patch b/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0004-README.md-Update-to-my-current-email.patch deleted file mode 100644 index dbfe648cf..000000000 --- a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0004-README.md-Update-to-my-current-email.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 16413d71cc06b02a6d859c35a017cc49b88283f7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linaro.org> -Date: Thu, 7 Dec 2017 17:42:46 -0600 -Subject: [PATCH 4/7] README.md: Update to my current email -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Aníbal Limón <anibal.limon@linaro.org> ---- - README.md | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/README.md b/README.md -index fedab04b7f00..22b36a4b7bed 100644 ---- a/README.md -+++ b/README.md -@@ -50,7 +50,7 @@ $ mtrace ./ptest-runner $(MALLOC_TRACE) - - For contribute please send a patch with subject prefix "[ptest-runner]" to - yocto@yoctoproject.org and cc the current maintainer that is Aníbal Limón --<anibal.limon@linux.intel.com>. -+<anibal.limon@linaro.org>. - - ## Links - --- -2.11.0 - diff --git a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0005-main.c-Use-realpath-to-get-the-actual-directory-of-p.patch b/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0005-main.c-Use-realpath-to-get-the-actual-directory-of-p.patch deleted file mode 100644 index cb9e20a32..000000000 --- a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0005-main.c-Use-realpath-to-get-the-actual-directory-of-p.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 5bd94a93c89978c5e729db86b86b49919cd3b523 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linaro.org> -Date: Wed, 25 Apr 2018 12:05:29 -0500 -Subject: [PATCH 5/7] main.c: Use realpath to get the actual directory of - ptests -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fix usage of relative paths in -d argument. - -$ ./ptest-runner -d ./tests/data - -Signed-off-by: Aníbal Limón <anibal.limon@linaro.org> ---- - main.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/main.c b/main.c -index 505829cdad58..593aff1a1956 100644 ---- a/main.c -+++ b/main.c -@@ -19,6 +19,7 @@ - * Aníbal Limón <anibal.limon@intel.com> - */ - -+#include <limits.h> - #include <unistd.h> - #include <string.h> - #include <stdlib.h> -@@ -70,7 +71,7 @@ main(int argc, char *argv[]) - switch (opt) { - case 'd': - free(opts.directory); -- opts.directory = strdup(optarg); -+ opts.directory = realpath(optarg, NULL); - CHECK_ALLOCATION(opts.directory, 1, 1); - break; - case 'l': --- -2.11.0 - diff --git a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0006-main.c-Add-option-e-to-exclude-certain-tests-for-exe.patch b/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0006-main.c-Add-option-e-to-exclude-certain-tests-for-exe.patch deleted file mode 100644 index 7a4de868c..000000000 --- a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner/0006-main.c-Add-option-e-to-exclude-certain-tests-for-exe.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 49956f65bb53ea2a2c1b394e5e59ffdfcdcc490f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linaro.org> -Date: Wed, 25 Apr 2018 11:55:03 -0500 -Subject: [PATCH 6/7] main.c: Add option (-e) to exclude certain tests for - execution -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -You can specify a set of ptests to be excluded, it will not fail -if some ptest excluded isn't found in the list of execution. - -$ ./ptest-runner -e "hang glibc" -d tests/data - -Signed-off-by: Aníbal Limón <anibal.limon@linaro.org> ---- - main.c | 38 +++++++++++++++++++++++++++++++++++--- - utils.h | 1 + - 2 files changed, 36 insertions(+), 3 deletions(-) - -diff --git a/main.c b/main.c -index 593aff1a1956..83600b7d1b31 100644 ---- a/main.c -+++ b/main.c -@@ -19,6 +19,7 @@ - * Aníbal Limón <anibal.limon@intel.com> - */ - -+#include <ctype.h> - #include <limits.h> - #include <unistd.h> - #include <string.h> -@@ -42,8 +43,8 @@ - static inline void - print_usage(FILE *stream, char *progname) - { -- fprintf(stream, "Usage: %s [-d directory] [-l list] [-t timeout] [-x xml-filename]" -- " [-h] [ptest1 ptest2 ...]\n", progname); -+ fprintf(stream, "Usage: %s [-d directory] [-e exclude] [-l list] [-t timeout]" -+ " [-x xml-filename] [-h] [ptest1 ptest2 ...]\n", progname); - } - - int -@@ -53,6 +54,8 @@ main(int argc, char *argv[]) - int ptest_num = 0; - int i; - int rc; -+ int ptest_exclude_num = 0; -+ char *c, *tok; - - #ifdef MEMCHECK - mtrace(); -@@ -62,18 +65,44 @@ main(int argc, char *argv[]) - struct ptest_options opts; - - opts.directory = strdup(DEFAULT_DIRECTORY); -+ opts.exclude = NULL; - opts.list = 0; - opts.timeout = DEFAULT_TIMEOUT; - opts.ptests = NULL; - opts.xml_filename = NULL; - -- while ((opt = getopt(argc, argv, "d:lt:x:h")) != -1) { -+ while ((opt = getopt(argc, argv, "d:e:lt:x:h")) != -1) { - switch (opt) { - case 'd': - free(opts.directory); - opts.directory = realpath(optarg, NULL); - CHECK_ALLOCATION(opts.directory, 1, 1); - break; -+ case 'e': -+ c = optarg; -+ ptest_exclude_num = 1; -+ -+ while (*c) { -+ if (isspace(*c)) -+ ptest_exclude_num++; -+ c++; -+ } -+ -+ -+ opts.exclude = malloc(ptest_exclude_num * sizeof(char)); -+ CHECK_ALLOCATION(opts.exclude, 1, 1); -+ -+ i = 0; -+ tok = strtok_r(optarg, " ", &c); -+ opts.exclude[i] = strdup(tok); -+ CHECK_ALLOCATION(opts.exclude[i], 1, 1); -+ i++; -+ while ((tok = strtok_r(NULL, " ", &c)) != NULL) { -+ opts.exclude[i] = strdup(tok); -+ CHECK_ALLOCATION(opts.exclude[i], 1, 1); -+ i++; -+ } -+ break; - case 'l': - opts.list = 1; - break; -@@ -134,6 +163,9 @@ main(int argc, char *argv[]) - ptest_list_free_all(head); - } - -+ for (i = 0; i < ptest_exclude_num; i++) -+ ptest_list_remove(run, opts.exclude[i], 1); -+ - rc = run_ptests(run, opts, argv[0], stdout, stderr); - - ptest_list_free_all(run); -diff --git a/utils.h b/utils.h -index 8fa20a8bf621..ee85163ddfff 100644 ---- a/utils.h -+++ b/utils.h -@@ -32,6 +32,7 @@ - - struct ptest_options { - char *directory; -+ char **exclude; - int list; - int timeout; - char **ptests; --- -2.11.0 - diff --git a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner_2.1.bbappend b/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner_2.1.bbappend deleted file mode 100644 index 000ab3d53..000000000 --- a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner_2.1.bbappend +++ /dev/null @@ -1,4 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -SRC_URI += "file://0004-README.md-Update-to-my-current-email.patch file://0001-utils.c-Prefer-monotonic-clock-to-calculate-elapsed-.patch file://0002-Makefile-libcheck-now-requires-to-link-subunit.patch file://0003-Add-support-to-avoid-load-run-twice-a-run_ptest-scri.patch file://0005-main.c-Use-realpath-to-get-the-actual-directory-of-p.patch file://0006-main.c-Add-option-e-to-exclude-certain-tests-for-exe.patch file://0007-WIP-Initial-LAVA-support.patch" - diff --git a/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner_2.2.bbappend b/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner_2.2.bbappend new file mode 100644 index 000000000..7a1d2a8f8 --- /dev/null +++ b/meta-agl-bsp/recipes-support/ptest-runner/ptest-runner_2.2.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI += "file://0007-WIP-Initial-LAVA-support.patch" + |