.gitignore | 5 Makefile.am | 34 +++ Makefile.sources | 1 autogen.sh | 16 + configure.ac | 139 +++++++++----- exynos/Makefile.am | 3 exynos/exynos_drm.c | 19 + exynos/exynos_drm.h | 40 ---- exynos/exynos_fimg2d.c | 253 +++++++++++++++++++------ exynos/exynos_fimg2d.h | 328 +++++++++++++++++++++++++++++++++ exynos/fimg2d.h | 325 --------------------------------- exynos/fimg2d_reg.h | 2 freedreno/Android.mk | 3 freedreno/Makefile.am | 3 freedreno/Makefile.sources | 16 - freedreno/freedreno_bo.c | 7 freedreno/freedreno_device.c | 10 - include/drm/drm_mode.h | 20 ++ include/drm/i915_drm.h | 2 include/drm/tegra_drm.h | 200 ++++++++++++++++++++ intel/Android.mk | 2 intel/intel_bufmgr.h | 3 intel/intel_bufmgr_gem.c | 129 ++++++++----- intel/intel_chipset.h | 43 ++++ intel/intel_decode.c | 4 intel/test_decode.c | 5 libdrm.h | 2 libkms/exynos.c | 7 nouveau/Android.mk | 3 nouveau/bufctx.c | 6 nouveau/nouveau.c | 117 +++++------ radeon/Android.mk | 3 radeon/radeon_surface.c | 6 tegra/.gitignore | 1 tegra/Makefile.am | 23 ++ tegra/libdrm_tegra.pc.in | 11 + tegra/private.h | 51 +++++ tegra/tegra.c | 345 +++++++++++++++++++++++++++++++++++ tegra/tegra.h | 60 ++++++ tests/Makefile.am | 58 ++--- tests/auth.c | 1 tests/dristat.c | 7 tests/drmstat.c | 2 tests/exynos/Makefile.am | 1 tests/exynos/exynos_fimg2d_test.c | 187 ++++++++++++++++--- tests/gem_basic.c | 102 ---------- tests/gem_flink.c | 137 -------------- tests/gem_mmap.c | 136 ------------- tests/gem_readwrite.c | 139 -------------- tests/getclient.c | 1 tests/getstats.c | 3 tests/kmstest/Makefile.am | 1 tests/kmstest/main.c | 5 tests/lock.c | 1 tests/modeprint/Makefile.am | 1 tests/modeprint/modeprint.c | 18 - tests/modetest/Android.mk | 2 tests/modetest/Makefile.am | 3 tests/modetest/buffers.c | 219 +++++++++++++++++----- tests/modetest/buffers.h | 6 tests/modetest/cursor.c | 57 ++--- tests/modetest/modetest.c | 88 +++++---- tests/name_from_fd.c | 4 tests/nouveau/.gitignore | 1 tests/nouveau/Makefile.am | 16 + tests/nouveau/threaded.c | 156 +++++++++++++++ tests/proptest/Makefile.am | 12 + tests/proptest/proptest.c | 343 +++++++++++++++++++++++++++++++++++ tests/radeon/Makefile.am | 1 tests/radeon/list.h | 12 - tests/radeon/radeon_ttm.c | 4 tests/setversion.c | 1 tests/tegra/.gitignore | 1 tests/tegra/Makefile.am | 13 + tests/tegra/openclose.c | 71 +++++++ tests/updatedraw.c | 3 tests/vbltest/Makefile.am | 2 tests/vbltest/vbltest.c | 5 xf86atomic.h | 19 + xf86drm.c | 371 ++++++++++++++++++++++++++++++++------ xf86drm.h | 16 + xf86drmMode.c | 59 +++--- xf86drmMode.h | 9 xf86drmRandom.c | 12 - 84 files changed, 3106 insertions(+), 1447 deletions(-)
New commits: commit 5f7b6723e1bed755c230817eea0563bab5b2a8a7 Author: Damien Lespiau <damien.lesp...@intel.com> Date: Thu Mar 19 14:36:56 2015 +0000 build: Bump version number to 2.4.60 before release Signed-off-by: Damien Lespiau <damien.lesp...@intel.com> diff --git a/configure.ac b/configure.ac index 6e45fa8..155d577 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ AC_PREREQ([2.63]) AC_INIT([libdrm], - [2.4.59], + [2.4.60], [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI], [libdrm]) commit d556e068a7e4e9dfb57514244ae5f3e0eb9d0b39 Author: Jeff McGee <jeff.mc...@intel.com> Date: Mon Mar 9 16:13:03 2015 -0700 intel: Export total subslice and EU counts Update kernel interface with new I915_GETPARAM ioctl entries for subslice total and EU total. Add a wrapping function for each parameter. Userspace drivers need these values when constructing GPGPU commands. This kernel query method is intended to replace the PCI ID-based tables that userspace drivers currently maintain. The kernel driver can employ fuse register reads as needed to ensure the most accurate determination of GT config attributes. This first became important with Cherryview in which the config could differ between devices with the same PCI ID. The kernel detection of these values is device-specific. Userspace drivers should continue to maintain ID-based tables for older devices which return ENODEV when using this query. v2: remove unnecessary include of <stdbool.h> and increment the I915_GETPARAM indices to match updated kernel patch. For: VIZ-4636 Reviewed-by: Damien Lespiau <damien.lesp...@intel.com> Signed-off-by: Jeff McGee <jeff.mc...@intel.com> Signed-off-by: Damien Lespiau <damien.lesp...@intel.com> diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index 15dd01d..b037e56 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h @@ -340,6 +340,8 @@ typedef struct drm_i915_irq_wait { #define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 #define I915_PARAM_HAS_WT 27 #define I915_PARAM_CMD_PARSER_VERSION 28 +#define I915_PARAM_SUBSLICE_TOTAL 33 +#define I915_PARAM_EU_TOTAL 34 typedef struct drm_i915_getparam { int param; diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h index be83a56..285919e 100644 --- a/intel/intel_bufmgr.h +++ b/intel/intel_bufmgr.h @@ -264,6 +264,9 @@ int drm_intel_get_reset_stats(drm_intel_context *ctx, uint32_t *active, uint32_t *pending); +int drm_intel_get_subslice_total(int fd, unsigned int *subslice_total); +int drm_intel_get_eu_total(int fd, unsigned int *eu_total); + /** @{ Compatibility defines to keep old code building despite the symbol rename * from dri_* to drm_intel_* */ diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index acbfd4a..5a67f53 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -3295,6 +3295,37 @@ drm_intel_reg_read(drm_intel_bufmgr *bufmgr, return ret; } +drm_public int +drm_intel_get_subslice_total(int fd, unsigned int *subslice_total) +{ + drm_i915_getparam_t gp; + int ret; + + memclear(gp); + gp.value = (int*)subslice_total; + gp.param = I915_PARAM_SUBSLICE_TOTAL; + ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); + if (ret) + return -errno; + + return 0; +} + +drm_public int +drm_intel_get_eu_total(int fd, unsigned int *eu_total) +{ + drm_i915_getparam_t gp; + int ret; + + memclear(gp); + gp.value = (int*)eu_total; + gp.param = I915_PARAM_EU_TOTAL; + ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); + if (ret) + return -errno; + + return 0; +} /** * Annotate the given bo for use in aub dumping. commit d20413a7ce5816abe1127ffffc5bcab82f268c16 Author: Emil Velikov <emil.l.veli...@gmail.com> Date: Tue Mar 17 00:19:27 2015 +0000 configure.ac: error out if building freedreno_kgsl without freedreno The former is a subset of the latter. Error out early so the user is aware that they are doing something very wrong. Cc: Rob Clark <robdcl...@gmail.com> Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> Reviewed-by: Rob Clark <robdcl...@gmail.com> diff --git a/configure.ac b/configure.ac index 7f76083..6e45fa8 100644 --- a/configure.ac +++ b/configure.ac @@ -321,6 +321,11 @@ if test "x$FREEDRENO" = xyes; then AC_DEFINE(HAVE_FREEDRENO, 1, [Have freedreno support]) fi +if test "x$FREEDRENO_KGSL" = xyes; then + if test "x$FREEDRENO" != xyes; then + AC_MSG_ERROR([Cannot enable freedreno KGSL interface if freedreno is disabled]) + fi +fi AM_CONDITIONAL(HAVE_FREEDRENO_KGSL, [test "x$FREEDRENO_KGSL" = xyes]) if test "x$FREEDRENO_KGSL" = xyes; then AC_DEFINE(HAVE_FREEDRENO_KGSL, 1, [Have freedreno support for KGSL kernel interface]) commit 648508518ef4f199eee58dbca8d6412af989fe71 Author: Emil Velikov <emil.l.veli...@gmail.com> Date: Tue Mar 17 00:19:26 2015 +0000 configure.ac: fix help string copy/pasta The message "enabled on x86" was meant for the intel libdrm. Take the opportunity to mention how libkms is autodetected. Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> diff --git a/configure.ac b/configure.ac index 414383c..7f76083 100644 --- a/configure.ac +++ b/configure.ac @@ -61,12 +61,12 @@ AC_ARG_ENABLE([udev], AC_ARG_ENABLE(libkms, AS_HELP_STRING([--disable-libkms], - [Disable KMS mm abstraction library (default: auto, enabled on x86]), + [Disable KMS mm abstraction library (default: auto, enabled on supported platforms)]), [LIBKMS=$enableval], [LIBKMS=auto]) AC_ARG_ENABLE(intel, AS_HELP_STRING([--disable-intel], - [Enable support for intel's KMS API (default: auto)]), + [Enable support for intel's KMS API (default: auto, enabled on x86)]), [INTEL=$enableval], [INTEL=auto]) AC_ARG_ENABLE(radeon, commit 0e4d5a3a460fd00358132fd4b2391a093c5fe8dd Author: Emil Velikov <emil.l.veli...@gmail.com> Date: Tue Mar 17 00:19:25 2015 +0000 configure.ac: fix host_cpu/atomics detection Previous code was busted, as it wasn't checking directly for what it was meant to, and at the end changing the user's selection if host_cpu heuristics were involved. Simplify things by adding a macro that does the long message printing for us, and check for only what we need. This fixes commit 36cff14bb03(configure: omap, freedreno and tegra require atomics) which incorrectly assumed that the code was working fine, and effectively made impossible to enable freedreno due to it's host_cpu detection. Cc: Rob Clark <robdcl...@gmail.com> Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> diff --git a/configure.ac b/configure.ac index 0b37cc7..414383c 100644 --- a/configure.ac +++ b/configure.ac @@ -215,65 +215,56 @@ if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed]) fi -if test "x$INTEL" != "xno" -o \ - "x$RADEON" != "xno" -o \ - "x$NOUVEAU" != "xno" -o \ - "x$OMAP" != "xno" -o \ - "x$FREEDRENO" != "xno" -o \ - "x$TEGRA" != "xno"; then - if test "x$drm_cv_atomic_primitives" = "xnone"; then - if test "x$INTEL" != "xauto"; then - if test "x$INTEL" != "xno"; then - AC_MSG_ERROR([libdrm_intel depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Intel GPUs by passing --disable-intel to ./configure]) - fi - else - AC_MSG_WARN([Disabling libdrm_intel. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) - INTEL=no - fi - if test "x$RADEON" != "xauto"; then - if test "x$RADEON" != "xno"; then - AC_MSG_ERROR([libdrm_radeon depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Radeon GPUs by passing --disable-radeon to ./configure]) - fi - else - AC_MSG_WARN([Disabling libdrm_radeon. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) - RADEON=no - fi - if test "x$NOUVEAU" != "xauto"; then - if test "x$NOUVEAU" != "xno"; then - AC_MSG_ERROR([libdrm_nouveau depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for NVIDIA GPUs by passing --disable-nouveau to ./configure]) - fi - else - AC_MSG_WARN([Disabling libdrm_nouveau. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) - NOUVEAU=no - fi - if test "x$OMAP" != "xauto"; then - AC_MSG_ERROR([libdrm_omap depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for OMAP GPUs by passing --disable-omap-experimental-api to ./configure]) - fi - if test "x$FREEDRENO" != "xauto"; then - AC_MSG_ERROR([libdrm_freedreno depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for QCOM's Adreno GPUs by passing --disable-freedreno to ./configure]) - fi - if test "x$TEGRA" != "xauto"; then - AC_MSG_ERROR([libdrm_tegra depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for NVIDIA's Tegra GPUs by passing --disable-tegra-experimental-api to ./configure]) - fi - else - if test "x$INTEL" != "xno"; then - case $host_cpu in - i?86|x86_64) INTEL=yes ;; - *) INTEL=no ;; - esac - fi - if test "x$RADEON" != "xno"; then - RADEON=yes - fi - if test "x$NOUVEAU" != "xno"; then - NOUVEAU=yes - fi - if test "x$FREEDRENO" != "xno"; then - case $host_cpu in - arm*|aarch64) FREEDRENO=yes ;; - *) FREEDRENO=no ;; - esac - fi +dnl Print out the approapriate message considering the value set be the +dnl respective in $1. +dnl $1 - value to be evaluated. Eg. $INTEL, $NOUVEAU, ... +dnl $2 - libdrm shortname. Eg. intel, freedreno, ... +dnl $3 - GPU name/brand. Eg. Intel, NVIDIA Tegra, ... +dnl $4 - Configure switch. Eg. intel, omap-experimental-api, ... +AC_DEFUN([LIBDRM_ATOMICS_NOT_FOUND_MSG], [ + case "x$1" in + xyes) AC_MSG_ERROR([libdrm_$2 depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for $3 GPUs by passing --disable-$4 to ./configure]) ;; + xauto) AC_MSG_WARN([Disabling $2. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) ;; + *) ;; + esac +]) + +if test "x$drm_cv_atomic_primitives" = "xnone"; then + LIBDRM_ATOMICS_NOT_FOUND_MSG($INTEL, intel, Intel, intel) + INTEL=no + + LIBDRM_ATOMICS_NOT_FOUND_MSG($RADEON, radeon, Radeon, radeon) + RADEON=no + + LIBDRM_ATOMICS_NOT_FOUND_MSG($NOUVEAU, nouveau, NVIDIA, nouveau) + NOUVEAU=no + + LIBDRM_ATOMICS_NOT_FOUND_MSG($OMAP, omap, OMAP, omap-experimental-api) + OMAP=no + + LIBDRM_ATOMICS_NOT_FOUND_MSG($FREEDRENO, freedreno, Qualcomm Adreno, freedreno) + FREEDRENO=no + + LIBDRM_ATOMICS_NOT_FOUND_MSG($TEGRA, tegra, NVIDIA Tegra, tegra-experimental-api) + TEGRA=no +else + if test "x$INTEL" = xauto; then + case $host_cpu in + i?86|x86_64) INTEL=yes ;; + *) INTEL=no ;; + esac + fi + if test "x$RADEON" = xauto; then + RADEON=yes + fi + if test "x$NOUVEAU" = xauto; then + NOUVEAU=yes + fi + if test "x$FREEDRENO" = xauto; then + case $host_cpu in + arm*|aarch64) FREEDRENO=yes ;; + *) FREEDRENO=no ;; + esac fi fi commit ffb1e285306ae58f2861debb615047ca384710ba Author: Emil Velikov <emil.l.veli...@gmail.com> Date: Mon Mar 9 12:08:17 2015 +0000 autogen.sh: handle out-of-tree invokation Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> diff --git a/autogen.sh b/autogen.sh index 30d679f..c896097 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,14 @@ #! /bin/sh -test -n "$srcdir" || srcdir=`dirname "$0"` -test -n "$srcdir" || srcdir=. -autoreconf --force --install --verbose "$srcdir" -test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" +srcdir=`dirname "$0"` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd "$srcdir" + +autoreconf --force --verbose --install || exit 1 +cd "$ORIGDIR" || exit $? + +if test -z "$NOCONFIGURE"; then + "$srcdir"/configure "$@" +fi commit d8ea64d90b222b468c292d2c107a41a64ad5ce43 Author: Emil Velikov <emil.l.veli...@gmail.com> Date: Mon Mar 9 12:08:16 2015 +0000 configure: Stop using AM_MAINTAINER_MODE AM_MAINTAINER_MODE can be used to disable generation of rebuild rules. This is not something we want to condone/support, considering it can cause greater problems than the perceived benefits. Additionally the Automake manual leans towards avoiding the use of AM_MAINTAINER_MODE. http://www.gnu.org/software/automake/manual/html_node/maintainer_002dmode.html Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> diff --git a/autogen.sh b/autogen.sh index 3f190ba..30d679f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,4 +3,4 @@ test -n "$srcdir" || srcdir=`dirname "$0"` test -n "$srcdir" || srcdir=. autoreconf --force --install --verbose "$srcdir" -test -n "$NOCONFIGURE" || "$srcdir/configure" --enable-maintainer-mode "$@" +test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" diff --git a/configure.ac b/configure.ac index 1fd0818..0b37cc7 100644 --- a/configure.ac +++ b/configure.ac @@ -30,7 +30,6 @@ AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([1.10 foreign dist-bzip2]) -AM_MAINTAINER_MODE([enable]) # Enable quiet compiles on automake 1.11. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) commit 858b21f6af03c9658126fd6ec2aa35b4e5151ecb Author: Tobias Jakobi <tjak...@math.uni-bielefeld.de> Date: Wed Mar 11 20:38:46 2015 +0100 exynos: fimg2d: follow-up fix for G2D_COEFF_MODE_GB_COLOR Also add the register field formatting info provided by Inki Dae <inki....@samsung.com>. Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de> Suggested-by: Inki Dae <inki....@samsung.com> diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h index f76f2a9..9db0c88 100644 --- a/exynos/exynos_fimg2d.h +++ b/exynos/exynos_fimg2d.h @@ -151,6 +151,12 @@ enum e_g2d_op { G2D_OP_CONJOINT_DST = 0x22, }; +/* + * The G2D_COEFF_MODE_DST_{COLOR,ALPHA} modes both use the ALPHA_REG(0x618) + * register. The registers fields are as follows: + * bits 31:8 = color value (RGB order) + * bits 7:0 = alpha value + */ enum e_g2d_coeff_mode { G2D_COEFF_MODE_ONE, G2D_COEFF_MODE_ZERO, @@ -160,7 +166,7 @@ enum e_g2d_coeff_mode { G2D_COEFF_MODE_DST_COLOR, /* Global Alpha : Set by ALPHA_REG(0x618) */ G2D_COEFF_MODE_GB_ALPHA, - /* Global Color : Set by ALPHA_REG(0x618) */ + /* Global Color and Alpha : Set by ALPHA_REG(0x618) */ G2D_COEFF_MODE_GB_COLOR, /* (1-SRC alpha)/DST Alpha */ G2D_COEFF_MODE_DISJOINT_S, commit 3f12191f29c500c4adcffdcca73d74cdd93c1853 Author: Tobias Jakobi <tjak...@math.uni-bielefeld.de> Date: Wed Mar 11 20:38:45 2015 +0100 exynos: add fimg2d header to common includes The reason for this change is to let userspace use the header. Currently 'make install' does not install it. Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de> Reviewed-by: Inki Dae <inki....@samsung.com> Tested-by: Joonyoung Shim <jy0922.s...@samsung.com> diff --git a/exynos/Makefile.am b/exynos/Makefile.am index 1715a85..35bc71f 100644 --- a/exynos/Makefile.am +++ b/exynos/Makefile.am @@ -14,11 +14,10 @@ libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ libdrm_exynos_la_SOURCES = \ exynos_drm.c \ exynos_fimg2d.c \ - exynos_fimg2d.h \ fimg2d_reg.h libdrm_exynoscommonincludedir = ${includedir}/exynos -libdrm_exynoscommoninclude_HEADERS = exynos_drm.h +libdrm_exynoscommoninclude_HEADERS = exynos_drm.h exynos_fimg2d.h libdrm_exynosincludedir = ${includedir}/libdrm libdrm_exynosinclude_HEADERS = exynos_drmif.h commit 9a0949a8f46b6b844ab4a1ecce79a9e9078151c6 Author: Tobias Jakobi <tjak...@math.uni-bielefeld.de> Date: Wed Mar 11 20:38:44 2015 +0100 exynos: add exynos prefix to fimg2d header Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de> Reviewed-by: Inki Dae <inki....@samsung.com> Tested-by: Joonyoung Shim <jy0922.s...@samsung.com> diff --git a/exynos/Makefile.am b/exynos/Makefile.am index 06bee00..1715a85 100644 --- a/exynos/Makefile.am +++ b/exynos/Makefile.am @@ -14,7 +14,7 @@ libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ libdrm_exynos_la_SOURCES = \ exynos_drm.c \ exynos_fimg2d.c \ - fimg2d.h \ + exynos_fimg2d.h \ fimg2d_reg.h libdrm_exynoscommonincludedir = ${includedir}/exynos diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index aecd1c3..fc605ed 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -27,7 +27,7 @@ #include "libdrm.h" #include "exynos_drm.h" #include "fimg2d_reg.h" -#include "fimg2d.h" +#include "exynos_fimg2d.h" #define SET_BF(val, sc, si, scsa, scda, dc, di, dcsa, dcda) \ val.data.src_coeff = sc; \ diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h new file mode 100644 index 0000000..f76f2a9 --- /dev/null +++ b/exynos/exynos_fimg2d.h @@ -0,0 +1,322 @@ +/* + * Copyright (C) 2013 Samsung Electronics Co.Ltd + * Authors: + * Inki Dae <inki....@samsung.com> + * + * 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 _FIMG2D_H_ +#define _FIMG2D_H_ + +#define G2D_MAX_CMD_NR 64 +#define G2D_MAX_GEM_CMD_NR 64 +#define G2D_MAX_CMD_LIST_NR 64 +#define G2D_PLANE_MAX_NR 2 + +enum e_g2d_color_mode { + /* COLOR FORMAT */ + G2D_COLOR_FMT_XRGB8888, + G2D_COLOR_FMT_ARGB8888, + G2D_COLOR_FMT_RGB565, + G2D_COLOR_FMT_XRGB1555, + G2D_COLOR_FMT_ARGB1555, + G2D_COLOR_FMT_XRGB4444, + G2D_COLOR_FMT_ARGB4444, + G2D_COLOR_FMT_PRGB888, + G2D_COLOR_FMT_YCbCr444, + G2D_COLOR_FMT_YCbCr422, + G2D_COLOR_FMT_YCbCr420, + /* alpha 8bit */ + G2D_COLOR_FMT_A8, + /* Luminance 8bit: gray color */ + G2D_COLOR_FMT_L8, + /* alpha 1bit */ + G2D_COLOR_FMT_A1, + /* alpha 4bit */ + G2D_COLOR_FMT_A4, + G2D_COLOR_FMT_MASK, /* VER4.1 */ + + /* COLOR ORDER */ + G2D_ORDER_AXRGB = (0 << 4), /* VER4.1 */ + G2D_ORDER_RGBAX = (1 << 4), /* VER4.1 */ + G2D_ORDER_AXBGR = (2 << 4), /* VER4.1 */ + G2D_ORDER_BGRAX = (3 << 4), /* VER4.1 */ + G2D_ORDER_MASK = (3 << 4), /* VER4.1 */ + + /* Number of YCbCr plane */ + G2D_YCbCr_1PLANE = (0 << 8), /* VER4.1 */ + G2D_YCbCr_2PLANE = (1 << 8), /* VER4.1 */ + G2D_YCbCr_PLANE_MASK = (3 << 8), /* VER4.1 */ + + /* Order in YCbCr */ + G2D_YCbCr_ORDER_CrY1CbY0 = (0 << 12), /* VER4.1 */ + G2D_YCbCr_ORDER_CbY1CrY0 = (1 << 12), /* VER4.1 */ + G2D_YCbCr_ORDER_Y1CrY0Cb = (2 << 12), /* VER4.1 */ + G2D_YCbCr_ORDER_Y1CbY0Cr = (3 << 12), /* VER4.1 */ + G2D_YCbCr_ORDER_CrCb = G2D_YCbCr_ORDER_CrY1CbY0, /* VER4.1 */ + G2D_YCbCr_ORDER_CbCr = G2D_YCbCr_ORDER_CbY1CrY0, /* VER4.1 */ + G2D_YCbCr_ORDER_MASK = (3 < 12), /* VER4.1 */ + + /* CSC */ + G2D_CSC_601 = (0 << 16), /* VER4.1 */ + G2D_CSC_709 = (1 << 16), /* VER4.1 */ + G2D_CSC_MASK = (1 << 16), /* VER4.1 */ + + /* Valid value range of YCbCr */ + G2D_YCbCr_RANGE_NARROW = (0 << 17), /* VER4.1 */ + G2D_YCbCr_RANGE_WIDE = (1 << 17), /* VER4.1 */ + G2D_YCbCr_RANGE_MASK = (1 << 17), /* VER4.1 */ + + G2D_COLOR_MODE_MASK = 0xFFFFFFFF, +}; + +enum e_g2d_select_mode { + G2D_SELECT_MODE_NORMAL = (0 << 0), + G2D_SELECT_MODE_FGCOLOR = (1 << 0), + G2D_SELECT_MODE_BGCOLOR = (2 << 0), +}; + +enum e_g2d_repeat_mode { + G2D_REPEAT_MODE_REPEAT, + G2D_REPEAT_MODE_PAD, + G2D_REPEAT_MODE_REFLECT, + G2D_REPEAT_MODE_CLAMP, + G2D_REPEAT_MODE_NONE, +}; + +enum e_g2d_scale_mode { + G2D_SCALE_MODE_NONE = 0, + G2D_SCALE_MODE_NEAREST, + G2D_SCALE_MODE_BILINEAR, + G2D_SCALE_MODE_MAX, +}; + +enum e_g2d_buf_type { + G2D_IMGBUF_COLOR, + G2D_IMGBUF_GEM, + G2D_IMGBUF_USERPTR, +}; + +enum e_g2d_rop3_type { + G2D_ROP3_DST = 0xAA, + G2D_ROP3_SRC = 0xCC, + G2D_ROP3_3RD = 0xF0, + G2D_ROP3_MASK = 0xFF, +}; + +enum e_g2d_select_alpha_src { + G2D_SELECT_SRC_FOR_ALPHA_BLEND, /* VER4.1 */ + G2D_SELECT_ROP_FOR_ALPHA_BLEND, /* VER4.1 */ +}; + +enum e_g2d_transparent_mode { + G2D_TRANSPARENT_MODE_OPAQUE, + G2D_TRANSPARENT_MODE_TRANSPARENT, + G2D_TRANSPARENT_MODE_BLUESCREEN, + G2D_TRANSPARENT_MODE_MAX, +}; + +enum e_g2d_color_key_mode { + G2D_COLORKEY_MODE_DISABLE = 0, + G2D_COLORKEY_MODE_SRC_RGBA = (1<<0), + G2D_COLORKEY_MODE_DST_RGBA = (1<<1), + G2D_COLORKEY_MODE_SRC_YCbCr = (1<<2), /* VER4.1 */ + G2D_COLORKEY_MODE_DST_YCbCr = (1<<3), /* VER4.1 */ + G2D_COLORKEY_MODE_MASK = 15, +}; + +enum e_g2d_alpha_blend_mode { + G2D_ALPHA_BLEND_MODE_DISABLE, + G2D_ALPHA_BLEND_MODE_ENABLE, + G2D_ALPHA_BLEND_MODE_FADING, /* VER3.0 */ + G2D_ALPHA_BLEND_MODE_MAX, +}; + +enum e_g2d_op { + G2D_OP_CLEAR = 0x00, + G2D_OP_SRC = 0x01, + G2D_OP_DST = 0x02, + G2D_OP_OVER = 0x03, + G2D_OP_INTERPOLATE = 0x04, + G2D_OP_DISJOINT_CLEAR = 0x10, + G2D_OP_DISJOINT_SRC = 0x11, + G2D_OP_DISJOINT_DST = 0x12, + G2D_OP_CONJOINT_CLEAR = 0x20, + G2D_OP_CONJOINT_SRC = 0x21, + G2D_OP_CONJOINT_DST = 0x22, +}; + +enum e_g2d_coeff_mode { + G2D_COEFF_MODE_ONE, + G2D_COEFF_MODE_ZERO, + G2D_COEFF_MODE_SRC_ALPHA, + G2D_COEFF_MODE_SRC_COLOR, + G2D_COEFF_MODE_DST_ALPHA, + G2D_COEFF_MODE_DST_COLOR, + /* Global Alpha : Set by ALPHA_REG(0x618) */ + G2D_COEFF_MODE_GB_ALPHA, + /* Global Color : Set by ALPHA_REG(0x618) */ + G2D_COEFF_MODE_GB_COLOR, + /* (1-SRC alpha)/DST Alpha */ + G2D_COEFF_MODE_DISJOINT_S, + /* (1-DST alpha)/SRC Alpha */ + G2D_COEFF_MODE_DISJOINT_D, + /* SRC alpha/DST alpha */ + G2D_COEFF_MODE_CONJOINT_S, + /* DST alpha/SRC alpha */ + G2D_COEFF_MODE_CONJOINT_D, + /* DST alpha/SRC alpha */ + G2D_COEFF_MODE_MASK +}; + +enum e_g2d_acoeff_mode { + G2D_ACOEFF_MODE_A, /* alpha */ + G2D_ACOEFF_MODE_APGA, /* alpha + global alpha */ + G2D_ACOEFF_MODE_AMGA, /* alpha * global alpha */ + G2D_ACOEFF_MODE_MASK +}; + +union g2d_point_val { + unsigned int val; + struct { + /* + * Coordinate of Source Image + * Range: 0 ~ 8000 (Requirement: SrcLeftX < SrcRightX) + * In YCbCr 422 and YCbCr 420 format with even number. + */ + unsigned int x:16; + /* + * Y Coordinate of Source Image + * Range: 0 ~ 8000 (Requirement: SrcTopY < SrcBottomY) + * In YCbCr 420 format with even number. + */ + unsigned int y:16; + } data; +}; + +union g2d_rop4_val { + unsigned int val; + struct { + enum e_g2d_rop3_type unmasked_rop3:8; + enum e_g2d_rop3_type masked_rop3:8; + unsigned int reserved:16; + } data; +}; + +union g2d_bitblt_cmd_val { + unsigned int val; + struct { + /* [0:3] */ + unsigned int mask_rop4_en:1; + unsigned int masking_en:1; + enum e_g2d_select_alpha_src rop4_alpha_en:1; + unsigned int dither_en:1; + /* [4:7] */ + unsigned int resolved1:4; + /* [8:11] */ + unsigned int cw_en:4; + /* [12:15] */ + enum e_g2d_transparent_mode transparent_mode:4; + /* [16:19] */ + enum e_g2d_color_key_mode color_key_mode:4; + /* [20:23] */ + enum e_g2d_alpha_blend_mode alpha_blend_mode:4; + /* [24:27] */ + unsigned int src_pre_multiply:1; + unsigned int pat_pre_multiply:1; + unsigned int dst_pre_multiply:1; + unsigned int dst_depre_multiply:1; + /* [28:31] */ + unsigned int fast_solid_color_fill_en:1; + unsigned int reserved:3; + } data; +}; + +union g2d_blend_func_val { + unsigned int val; + struct { + /* [0:15] */ + enum e_g2d_coeff_mode src_coeff:4; + enum e_g2d_acoeff_mode src_coeff_src_a:2; + enum e_g2d_acoeff_mode src_coeff_dst_a:2; + enum e_g2d_coeff_mode dst_coeff:4; + enum e_g2d_acoeff_mode dst_coeff_src_a:2; + enum e_g2d_acoeff_mode dst_coeff_dst_a:2; + /* [16:19] */ + unsigned int inv_src_color_coeff:1; + unsigned int resoled1:1; + unsigned int inv_dst_color_coeff:1; + unsigned int resoled2:1; + /* [20:23] */ + unsigned int lighten_en:1; + unsigned int darken_en:1; + unsigned int win_ce_src_over_en:2; + /* [24:31] */ + unsigned int reserved:8; + } data; +}; + +struct g2d_image { + enum e_g2d_select_mode select_mode; + enum e_g2d_color_mode color_mode; + enum e_g2d_repeat_mode repeat_mode; + enum e_g2d_scale_mode scale_mode; + unsigned int xscale; + unsigned int yscale; + unsigned char rotate_90; + unsigned char x_dir; + unsigned char y_dir; + unsigned char component_alpha; + unsigned int width; + unsigned int height; + unsigned int stride; + unsigned int need_free; + unsigned int color; + enum e_g2d_buf_type buf_type; + unsigned int bo[G2D_PLANE_MAX_NR]; + struct drm_exynos_g2d_userptr user_ptr[G2D_PLANE_MAX_NR]; + void *mapped_ptr[G2D_PLANE_MAX_NR]; +}; + +struct g2d_context { + int fd; + unsigned int major; + unsigned int minor; + struct drm_exynos_g2d_cmd cmd[G2D_MAX_CMD_NR]; + struct drm_exynos_g2d_cmd cmd_buf[G2D_MAX_GEM_CMD_NR]; + unsigned int cmd_nr; + unsigned int cmd_buf_nr; + unsigned int cmdlist_nr; +}; + +struct g2d_context *g2d_init(int fd); +void g2d_fini(struct g2d_context *ctx); +int g2d_exec(struct g2d_context *ctx); +int g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img, + unsigned int x, unsigned int y, unsigned int w, + unsigned int h); +int g2d_copy(struct g2d_context *ctx, struct g2d_image *src, + struct g2d_image *dst, unsigned int src_x, + unsigned int src_y, unsigned int dst_x, unsigned int dst_y, + unsigned int w, unsigned int h); +int g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src, + struct g2d_image *dst, unsigned int src_x, + unsigned int src_y, unsigned int src_w, + unsigned int src_h, unsigned int dst_x, + unsigned int dst_y, unsigned int dst_w, + unsigned int dst_h, unsigned int negative); +int g2d_blend(struct g2d_context *ctx, struct g2d_image *src, + struct g2d_image *dst, unsigned int src_x, + unsigned int src_y, unsigned int dst_x, unsigned int dst_y, + unsigned int w, unsigned int h, enum e_g2d_op op); +int g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src, + struct g2d_image *dst, unsigned int src_x, unsigned int src_y, + unsigned int src_w, unsigned int src_h, unsigned int dst_x, + unsigned int dst_y, unsigned int dst_w, unsigned int dst_h, + enum e_g2d_op op); +#endif /* _FIMG2D_H_ */ diff --git a/exynos/fimg2d.h b/exynos/fimg2d.h deleted file mode 100644 index f76f2a9..0000000 --- a/exynos/fimg2d.h +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics Co.Ltd - * Authors: - * Inki Dae <inki....@samsung.com> - * - * 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 _FIMG2D_H_ -#define _FIMG2D_H_ - -#define G2D_MAX_CMD_NR 64 -#define G2D_MAX_GEM_CMD_NR 64 -#define G2D_MAX_CMD_LIST_NR 64 -#define G2D_PLANE_MAX_NR 2 - -enum e_g2d_color_mode { - /* COLOR FORMAT */ - G2D_COLOR_FMT_XRGB8888, - G2D_COLOR_FMT_ARGB8888, - G2D_COLOR_FMT_RGB565, - G2D_COLOR_FMT_XRGB1555, - G2D_COLOR_FMT_ARGB1555, - G2D_COLOR_FMT_XRGB4444, - G2D_COLOR_FMT_ARGB4444, - G2D_COLOR_FMT_PRGB888, - G2D_COLOR_FMT_YCbCr444, - G2D_COLOR_FMT_YCbCr422, - G2D_COLOR_FMT_YCbCr420, - /* alpha 8bit */ - G2D_COLOR_FMT_A8, - /* Luminance 8bit: gray color */ - G2D_COLOR_FMT_L8, - /* alpha 1bit */ - G2D_COLOR_FMT_A1, - /* alpha 4bit */ - G2D_COLOR_FMT_A4, - G2D_COLOR_FMT_MASK, /* VER4.1 */ - - /* COLOR ORDER */ - G2D_ORDER_AXRGB = (0 << 4), /* VER4.1 */ - G2D_ORDER_RGBAX = (1 << 4), /* VER4.1 */ - G2D_ORDER_AXBGR = (2 << 4), /* VER4.1 */ - G2D_ORDER_BGRAX = (3 << 4), /* VER4.1 */ - G2D_ORDER_MASK = (3 << 4), /* VER4.1 */ - - /* Number of YCbCr plane */ - G2D_YCbCr_1PLANE = (0 << 8), /* VER4.1 */ - G2D_YCbCr_2PLANE = (1 << 8), /* VER4.1 */ - G2D_YCbCr_PLANE_MASK = (3 << 8), /* VER4.1 */ - - /* Order in YCbCr */ - G2D_YCbCr_ORDER_CrY1CbY0 = (0 << 12), /* VER4.1 */ - G2D_YCbCr_ORDER_CbY1CrY0 = (1 << 12), /* VER4.1 */ - G2D_YCbCr_ORDER_Y1CrY0Cb = (2 << 12), /* VER4.1 */ - G2D_YCbCr_ORDER_Y1CbY0Cr = (3 << 12), /* VER4.1 */ - G2D_YCbCr_ORDER_CrCb = G2D_YCbCr_ORDER_CrY1CbY0, /* VER4.1 */ - G2D_YCbCr_ORDER_CbCr = G2D_YCbCr_ORDER_CbY1CrY0, /* VER4.1 */ - G2D_YCbCr_ORDER_MASK = (3 < 12), /* VER4.1 */ - - /* CSC */ - G2D_CSC_601 = (0 << 16), /* VER4.1 */ - G2D_CSC_709 = (1 << 16), /* VER4.1 */ - G2D_CSC_MASK = (1 << 16), /* VER4.1 */ - - /* Valid value range of YCbCr */ - G2D_YCbCr_RANGE_NARROW = (0 << 17), /* VER4.1 */ - G2D_YCbCr_RANGE_WIDE = (1 << 17), /* VER4.1 */ - G2D_YCbCr_RANGE_MASK = (1 << 17), /* VER4.1 */ - - G2D_COLOR_MODE_MASK = 0xFFFFFFFF, -}; - -enum e_g2d_select_mode { - G2D_SELECT_MODE_NORMAL = (0 << 0), - G2D_SELECT_MODE_FGCOLOR = (1 << 0), -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/e1ymjp2-0002dc...@moszumanska.debian.org