libdrm-meson: modify amlogic source license [1/1]

PD#SWPL-112986

Problem:
modify amlogic source license in libdrm_amlogic

Solution:
modify amlogic source license in libdrm_amlogic

Verify:
no

Change-Id: I236e1e8fb91d515798ac40d59bae09f7e6bc0fb2
Signed-off-by: limin.tian <limin.tian@amlogic.com>
diff --git a/drm-tests/kernel/v4.9/include/uapi/linux/dma-buf.h b/drm-tests/kernel/v4.9/include/uapi/linux/dma-buf.h
deleted file mode 100644
index fb0dedb..0000000
--- a/drm-tests/kernel/v4.9/include/uapi/linux/dma-buf.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Framework for buffer objects that can be shared across devices/subsystems.
- *
- * Copyright(C) 2015 Intel Ltd
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _DMA_BUF_UAPI_H_
-#define _DMA_BUF_UAPI_H_
-
-#include <linux/types.h>
-
-/* begin/end dma-buf functions used for userspace mmap. */
-struct dma_buf_sync {
-	__u64 flags;
-};
-
-#define DMA_BUF_SYNC_READ      (1 << 0)
-#define DMA_BUF_SYNC_WRITE     (2 << 0)
-#define DMA_BUF_SYNC_RW        (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE)
-#define DMA_BUF_SYNC_START     (0 << 2)
-#define DMA_BUF_SYNC_END       (1 << 2)
-#define DMA_BUF_SYNC_VALID_FLAGS_MASK \
-	(DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END)
-
-#define DMA_BUF_BASE		'b'
-#define DMA_BUF_IOCTL_SYNC	_IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
-
-#endif
diff --git a/drm_fourcc.h b/drm_fourcc.h
index f9db1e7..65628d9 100644
--- a/drm_fourcc.h
+++ b/drm_fourcc.h
@@ -1,25 +1,25 @@
-/*
- * Copyright 2011 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
+/*

+ * Copyright 2011 Intel Corporation

+ *

+ * Permission is hereby granted, free of charge, to any person obtaining a

+ * copy of this software and associated documentation files (the "Software"),

+ * to deal in the Software without restriction, including without limitation

+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,

+ * and/or sell copies of the Software, and to permit persons to whom the

+ * Software is furnished to do so, subject to the following conditions:

+ *

+ * The above copyright notice and this permission notice (including the next

+ * paragraph) shall be included in all copies or substantial portions of the

+ * Software.

+ *

+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL

+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR

+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,

+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR

+ * OTHER DEALINGS IN THE SOFTWARE.

+ */

 
 #ifndef DRM_FOURCC_H
 #define DRM_FOURCC_H
diff --git a/meson/dma-buf.h b/meson/dma-buf.h
index d464311..7231d77 100644
--- a/meson/dma-buf.h
+++ b/meson/dma-buf.h
@@ -1,20 +1,20 @@
-/*
- * Framework for buffer objects that can be shared across devices/subsystems.
- *
- * Copyright(C) 2015 Intel Ltd
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- */
+/*

+ * Framework for buffer objects that can be shared across devices/subsystems.

+ *

+ * Copyright(C) 2015 Intel Ltd

+ *

+ * This program is free software; you can redistribute it and/or modify it

+ * under the terms of the GNU General Public License version 2 as published by

+ * the Free Software Foundation.

+ *

+ * This program 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 General Public License for

+ * more details.

+ *

+ * You should have received a copy of the GNU General Public License along with

+ * this program.  If not, see <http://www.gnu.org/licenses/>.

+ */

 
 #ifndef _DMA_BUF_UAPI_H_
 #define _DMA_BUF_UAPI_H_
diff --git a/meson/libdrm_meson_connector.c b/meson/libdrm_meson_connector.c
index 95e9c59..177615f 100644
--- a/meson/libdrm_meson_connector.c
+++ b/meson/libdrm_meson_connector.c
@@ -1,11 +1,12 @@
 /*
- * Copyright (c) 2020 Amlogic, Inc. All rights reserved.
+ * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
  *
  * This source code is subject to the terms and conditions defined in the
  * file 'LICENSE' which is part of this source code package.
  *
  * Description:
  */
+
 #include <string.h>
 #include "libdrm_meson_connector.h"
 struct mesonConnector {
diff --git a/meson/libdrm_meson_property.c b/meson/libdrm_meson_property.c
index 529081f..fca34b8 100644
--- a/meson/libdrm_meson_property.c
+++ b/meson/libdrm_meson_property.c
@@ -1,11 +1,12 @@
-/*
- * Copyright (c) 2020 Amlogic, Inc. All rights reserved.
+ /*
+ * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
  *
  * This source code is subject to the terms and conditions defined in the
  * file 'LICENSE' which is part of this source code package.
  *
  * Description:
  */
+
 #include <string.h>
 #include "libdrm_meson_property.h"
 struct mesonProperty {
diff --git a/meson/libdrm_meson_property.h b/meson/libdrm_meson_property.h
index 9dca178..01c70d9 100644
--- a/meson/libdrm_meson_property.h
+++ b/meson/libdrm_meson_property.h
@@ -1,4 +1,4 @@
-/*
+ /*
  * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
  *
  * This source code is subject to the terms and conditions defined in the
@@ -6,6 +6,7 @@
  *
  * Description:
  */
+
 #ifndef LIBDRM_MESON_PROPERTY_H_
 #define LIBDRM_MESON_PROPERTY_H_
 #if defined(__cplusplus)
diff --git a/meson/meson_drm.c b/meson/meson_drm.c
index 813edca..91b4de2 100644
--- a/meson/meson_drm.c
+++ b/meson/meson_drm.c
@@ -1,10 +1,10 @@
-/*
- * Copyright (C) 2020 Amlogic, Inc. All rights reserved.
+ /*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
  *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
+ * This source code is subject to the terms and conditions defined in the
+ * file 'LICENSE' which is part of this source code package.
+ *
+ * Description:
  */
 
 #ifdef HAVE_CONFIG_H
diff --git a/meson/meson_drm_async_commit.c b/meson/meson_drm_async_commit.c
index 523f87e..e688a71 100644
--- a/meson/meson_drm_async_commit.c
+++ b/meson/meson_drm_async_commit.c
@@ -1,36 +1,10 @@
-/*
- * \file meson_drm_async_commit.c
- * add async commit, code syned from xf86drmmode.c
+ /*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
  *
- * \author Jakob Bornecrantz <wallbraker@gmail.com>
+ * This source code is subject to the terms and conditions defined in the
+ * file 'LICENSE' which is part of this source code package.
  *
- * \par Acknowledgements:
- * Feb 2007, Dave Airlie <airlied@linux.ie>
- */
-
-/*
- * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * Copyright (c) 2007-2008 Dave Airlie <airlied@linux.ie>
- * Copyright (c) 2007-2008 Jakob Bornecrantz <wallbraker@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
+ * Description:
  */
 
 #include <stdio.h>
diff --git a/meson/meson_drm_display.c b/meson/meson_drm_display.c
index 2c519eb..d766e80 100644
--- a/meson/meson_drm_display.c
+++ b/meson/meson_drm_display.c
@@ -1,4 +1,4 @@
-/*
+ /*
  * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
  *
  * This source code is subject to the terms and conditions defined in the
@@ -6,6 +6,7 @@
  *
  * Description:
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/meson/meson_drm_display.h b/meson/meson_drm_display.h
index 85e4b79..83ac24a 100644
--- a/meson/meson_drm_display.h
+++ b/meson/meson_drm_display.h
@@ -1,4 +1,4 @@
-/*
+ /*
  * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
  *
  * This source code is subject to the terms and conditions defined in the
diff --git a/meson/meson_drm_display_test.c b/meson/meson_drm_display_test.c
index 31d877d..4545d71 100644
--- a/meson/meson_drm_display_test.c
+++ b/meson/meson_drm_display_test.c
@@ -6,6 +6,7 @@
  *
  * Description:
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/meson/meson_drm_event.c b/meson/meson_drm_event.c
index 773141b..fc1603b 100644
--- a/meson/meson_drm_event.c
+++ b/meson/meson_drm_event.c
@@ -1,4 +1,4 @@
-/*
+ /*
  * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
  *
  * This source code is subject to the terms and conditions defined in the
@@ -6,6 +6,7 @@
  *
  * Description:
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/meson/meson_drm_event.h b/meson/meson_drm_event.h
index 5cfb197..627bcea 100644
--- a/meson/meson_drm_event.h
+++ b/meson/meson_drm_event.h
@@ -1,4 +1,4 @@
-/*
+ /*
  * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
  *
  * This source code is subject to the terms and conditions defined in the
diff --git a/meson/meson_drm_kms.c b/meson/meson_drm_kms.c
index a19bb19..451429a 100644
--- a/meson/meson_drm_kms.c
+++ b/meson/meson_drm_kms.c
@@ -1,12 +1,13 @@
-/*
- * Copyright (C) 2020 Amlogic, Inc. All rights reserved.
+ /*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
  *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
+ * This source code is subject to the terms and conditions defined in the
+ * file 'LICENSE' which is part of this source code package.
+ *
+ * Description:
  */
 
+
 #include <stdio.h>
 #include <fcntl.h>
 #include <sys/types.h>
@@ -90,6 +91,7 @@
     int i;
     struct kms_display *disp = to_kms_display(drm_disp);
     close(drm_disp->drm_fd);
+    close(drm_disp->dev->render_fd);
     meson_device_destroy(drm_disp->dev);
 
     for (i = 0; i < MAX_CRTC; i++) {
@@ -708,7 +710,8 @@
 static int drm_kms_init_resource(struct kms_display *disp)
 {
     int ret;
-    int drm_fd, render_fd;
+    int drm_fd = -1;
+    int render_fd = -1;
     drmModeRes *resources;
 
     drm_fd = open("/dev/dri/card0", O_RDWR | O_CLOEXEC);
@@ -722,7 +725,7 @@
     if (render_fd < 0) {
         fprintf(stderr, "Unable to open renderD128 node: %s\n",
                strerror(errno));
-        return -1;
+        goto error3;
     }
 
     disp->base.drm_fd = drm_fd;
@@ -771,7 +774,10 @@
 error2:
     meson_device_destroy(disp->base.dev);
 error3:
-    close(drm_fd);
+    if (drm_fd >= 0)
+        close(drm_fd);
+    if (render_fd >= 0)
+        close(render_fd);
 
     return -1;
 }
diff --git a/meson/meson_drm_util.c b/meson/meson_drm_util.c
index cba2b12..abe39ad 100644
--- a/meson/meson_drm_util.c
+++ b/meson/meson_drm_util.c
@@ -1,11 +1,12 @@
-/*
- * Copyright (C) 2020 Amlogic, Inc. All rights reserved.
+ /*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
  *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
+ * This source code is subject to the terms and conditions defined in the
+ * file 'LICENSE' which is part of this source code package.
+ *
+ * Description:
  */
+
 #include <poll.h>
 #include <sys/ioctl.h>
 #include "dma-buf.h"
diff --git a/meson/meson_drm_util.h b/meson/meson_drm_util.h
index 282e4ff..758fca7 100644
--- a/meson/meson_drm_util.h
+++ b/meson/meson_drm_util.h
@@ -1,10 +1,10 @@
-/*
- * Copyright (C) 2020 Amlogic, Inc. All rights reserved.
+ /*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
  *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
+ * This source code is subject to the terms and conditions defined in the
+ * file 'LICENSE' which is part of this source code package.
+ *
+ * Description:
  */
 
 #ifndef _MESON_DRM_UTIL_H_
diff --git a/meson/meson_drmif.h b/meson/meson_drmif.h
index 2c90080..201ce0c 100644
--- a/meson/meson_drmif.h
+++ b/meson/meson_drmif.h
@@ -1,10 +1,10 @@
-/*
- * Copyright (C) 2020 Amlogic, Inc. All rights reserved.
+ /*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
  *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
+ * This source code is subject to the terms and conditions defined in the
+ * file 'LICENSE' which is part of this source code package.
+ *
+ * Description:
  */
 
 #ifndef _MESON_DRMIF_H_
diff --git a/meson_drm.h b/meson_drm.h
index 26b6c7b..ce2d7f0 100644
--- a/meson_drm.h
+++ b/meson_drm.h
@@ -1,13 +1,13 @@
-/*
- * include/uapi/drm/meson_drm.h
- *
- * Copyright (C) 2016 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
+ /*
+  * include/uapi/drm/meson_drm.h
+  *
+  * Copyright (C) 2016 Amlogic, Inc. All rights reserved.
+  *
+  * This program is free software; you can redistribute  it and/or modify it
+  * under  the terms of  the GNU General  Public License as published by the
+  * Free Software Foundation;  either version 2 of the License, or (at your
+  * option) any later version.
+  */
 
 #ifndef _MESON_DRM_H
 #define _MESON_DRM_H