|
@@ -0,0 +1,379 @@
+diff --git a/meson.build b/meson.build
+index b3eb846..8d94a8b 100644
+--- a/meson.build
++++ b/meson.build
+@@ -150,6 +150,7 @@ if _etnaviv == 'true'
+ endif
+
+ with_exynos = get_option('exynos') == 'true'
++with_nexell = get_option('nexell') == 'true'
+
+ with_vc4 = false
+ _vc4 = get_option('vc4')
+@@ -257,6 +258,7 @@ config.set10('HAVE_VISIBILITY',
+
+ foreach t : [
+ [with_exynos, 'EXYNOS'],
++ [with_nexell, 'NEXELL'],
+ [with_freedreno_kgsl, 'FREEDRENO_KGSL'],
+ [with_intel, 'INTEL'],
+ [with_nouveau, 'NOUVEAU'],
+@@ -350,6 +352,9 @@ endif
+ if with_exynos
+ subdir('exynos')
+ endif
++if with_nexell
++ subdir('nexell')
++endif
+ if with_freedreno
+ subdir('freedreno')
+ endif
+@@ -379,6 +384,7 @@ message(' AMDGPU API @0@'.format(with_amdgpu))
+ message(' Nouveau API @0@'.format(with_nouveau))
+ message(' OMAP API @0@'.format(with_omap))
+ message(' EXYNOS API @0@'.format(with_exynos))
++message(' NEXELL API @0@'.format(with_nexell))
+ message(' Freedreno API @0@ (kgsl: @1@)'.format(with_freedreno, with_freedreno_kgsl))
+ message(' Tegra API @0@'.format(with_tegra))
+ message(' VC4 API @0@'.format(with_vc4))
+diff --git a/meson_options.txt b/meson_options.txt
+index 8af33f1..122d4d4 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -75,6 +75,14 @@ option(
+ description : '''Enable support for EXYNOS's experimental KMS API.''',
+ )
+ option(
++ 'nexell',
++ type : 'combo',
++ value : 'false',
++ choices : ['true', 'false', 'auto'],
++ description : '''Enable support for Nexell experimental KMS API.''',
++)
++
++option(
+ 'freedreno',
+ type : 'combo',
+ value : 'auto',
+diff --git a/nexell/libdrm_nexell.pc.in b/nexell/libdrm_nexell.pc.in
+new file mode 100644
+index 0000000..7e63800
+--- /dev/null
++++ b/nexell/libdrm_nexell.pc.in
+@@ -0,0 +1,11 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: libdrm_nexell
++Description: Userspace interface to nexell kernel DRM services
++Version: 0.7
++Libs: -L${libdir} -ldrm_nexell
++Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/nexell
++Requires.private: libdrm
+diff --git a/nexell/meson.build b/nexell/meson.build
+new file mode 100644
+index 0000000..77fa59b
+--- /dev/null
++++ b/nexell/meson.build
+@@ -0,0 +1,47 @@
++# Copyright © 2017-2018 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 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.
++
++libdrm_nexell = shared_library(
++ 'drm_nexell',
++ [files('nexell_drm.c'), config_file],
++ c_args : libdrm_c_args,
++ include_directories : [inc_root, inc_drm],
++ link_with : libdrm,
++ dependencies : [dep_pthread_stubs],
++ version : '1.0.0',
++ install : true,
++)
++
++install_headers('nexell_drmif.h', subdir : 'libdrm')
++install_headers('nexell_drm.h', subdir : 'nexell')
++
++ext_libdrm_nexell = declare_dependency(
++ link_with : [libdrm, libdrm_nexell],
++ include_directories : [inc_drm, include_directories('.')],
++)
++
++pkg.generate(
++ name : 'libdrm_nexell',
++ libraries : libdrm_nexell,
++ subdirs : ['.', 'libdrm', 'nexell'],
++ version : '0.7',
++ requires_private : 'libdrm',
++ description : 'Userspace interface to nexell kernel DRM services',
++)
+diff --git a/nexell/nexell_drm.c b/nexell/nexell_drm.c
+new file mode 100644
+index 0000000..bd6e6ae
+--- /dev/null
++++ b/nexell/nexell_drm.c
+@@ -0,0 +1,117 @@
++/*
++ * Copyright (C) 2016 Nexell Co., Ltd.
++ * Author: hyejung, kwon <cjscld15@nexell.co.kr>
++ *
++ * 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, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL
++ * THE COPYRIGHT HOLDERS, AUTHORS 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.
++ *
++ * The above copyright notice and this permission notice (including the
++ * next paragraph) shall be included in all copies or substantial portions
++ * of the Software.
++ *
++ */
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <fcntl.h>
++#include <stdint.h>
++#include <errno.h>
++#include <stdarg.h>
++#include <ctype.h>
++#include <string.h>
++#include <strings.h>
++
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <sys/ioctl.h>
++
++#include <nexell_drm.h>
++
++#define DRM_IOCTL_NR(n) _IOC_NR(n)
++#define DRM_IOC_VOID _IOC_NONE
++#define DRM_IOC_READ _IOC_READ
++#define DRM_IOC_WRITE _IOC_WRITE
++#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
++#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
++
++static int drm_ioctl(int drm_fd, unsigned long request, void *arg)
++{
++ int ret;
++
++ do {
++ ret = ioctl(drm_fd, request, arg);
++ } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
++ return ret;
++}
++
++static int drm_command_write_read(int fd, unsigned long command_index,
++ void *data, unsigned long size)
++{
++ unsigned long request;
++
++ request = DRM_IOC(DRM_IOC_READ|DRM_IOC_WRITE, DRM_IOCTL_BASE,
++ DRM_COMMAND_BASE + command_index, size);
|