From 3ec9adcba5bdfabc87671dba7f9a0ca5382f2f04 Mon Sep 17 00:00:00 2001 From: "jk7744.park" Date: Tue, 8 Sep 2015 21:33:28 +0900 Subject: [PATCH] tizen 2.3.1 release --- COPYING | 7 +- Makefile.am | 2 +- configure.ac | 28 +- debian/changelog | 336 ---------- debian/compat | 1 - debian/control | 22 - debian/copyright | 21 - debian/rules | 102 --- debian/watch | 0 debian/xserver-xorg-video-emulfb.install | 2 - debian/xserver-xorg-video-emulfb.links | 1 - debian/xsfbs/repack.sh | 32 - debian/xsfbs/xsfbs.mk | 293 -------- debian/xsfbs/xsfbs.sh | 865 ------------------------ man/Makefile.am | 42 +- packaging/xorg-x11-drv-emulfb.spec | 16 +- src/Makefile.am | 52 -- src/crtcconfig/fbdev_crtc.c | 250 ------- src/crtcconfig/fbdev_crtc_priv.h | 45 -- src/crtcconfig/fbdev_crtcconfig.c | 139 ---- src/crtcconfig/fbdev_crtcconfig.h | 37 - src/crtcconfig/fbdev_mode.c | 173 ----- src/crtcconfig/fbdev_mode.h | 44 -- src/crtcconfig/fbdev_output_priv.h | 46 -- src/crtcconfig/lcd_output.c | 248 ------- src/debug/fbdev_event_trace.c | 100 --- src/debug/fbdev_event_trace.h | 38 -- src/fb/fbdev_fb.c | 296 -------- src/fb/fbdev_fb.h | 54 -- src/fbdev.c | 758 --------------------- src/fbdev.h | 105 --- src/fbdev_dpms.c | 140 ---- src/fbdev_dpms.h | 45 -- src/fbdevhw/fbdev_hw.c | 196 ------ src/fbdevhw/fbdev_hw.h | 51 -- src/util/fbdev_pixman.c | 173 ----- src/util/fbdev_pixman.h | 66 -- src/util/fbdev_util.c | 226 ------- src/util/fbdev_util.h | 74 -- src/xv/arm/fbdev_video_v4l2.c | 1081 ------------------------------ src/xv/fbdev_v4l2.c | 511 -------------- src/xv/fbdev_v4l2.h | 84 --- src/xv/fbdev_video.c | 1005 --------------------------- src/xv/fbdev_video.h | 73 -- src/xv/fbdev_video_fourcc.h | 196 ------ src/xv/fbdev_video_types.h | 107 --- src/xv/fbdev_video_v4l2.h | 69 -- src/xv/i386/fbdev_video_v4l2.c | 787 ---------------------- src/xv/xv_types.h | 80 --- 49 files changed, 61 insertions(+), 9058 deletions(-) delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100755 debian/rules delete mode 100644 debian/watch delete mode 100644 debian/xserver-xorg-video-emulfb.install delete mode 100644 debian/xserver-xorg-video-emulfb.links delete mode 100755 debian/xsfbs/repack.sh delete mode 100755 debian/xsfbs/xsfbs.mk delete mode 100755 debian/xsfbs/xsfbs.sh delete mode 100644 src/Makefile.am delete mode 100644 src/crtcconfig/fbdev_crtc.c delete mode 100644 src/crtcconfig/fbdev_crtc_priv.h delete mode 100644 src/crtcconfig/fbdev_crtcconfig.c delete mode 100644 src/crtcconfig/fbdev_crtcconfig.h delete mode 100644 src/crtcconfig/fbdev_mode.c delete mode 100644 src/crtcconfig/fbdev_mode.h delete mode 100644 src/crtcconfig/fbdev_output_priv.h delete mode 100644 src/crtcconfig/lcd_output.c delete mode 100755 src/debug/fbdev_event_trace.c delete mode 100644 src/debug/fbdev_event_trace.h delete mode 100644 src/fb/fbdev_fb.c delete mode 100644 src/fb/fbdev_fb.h delete mode 100644 src/fbdev.c delete mode 100644 src/fbdev.h delete mode 100644 src/fbdev_dpms.c delete mode 100644 src/fbdev_dpms.h delete mode 100644 src/fbdevhw/fbdev_hw.c delete mode 100644 src/fbdevhw/fbdev_hw.h delete mode 100644 src/util/fbdev_pixman.c delete mode 100644 src/util/fbdev_pixman.h delete mode 100644 src/util/fbdev_util.c delete mode 100644 src/util/fbdev_util.h delete mode 100644 src/xv/arm/fbdev_video_v4l2.c delete mode 100644 src/xv/fbdev_v4l2.c delete mode 100644 src/xv/fbdev_v4l2.h delete mode 100644 src/xv/fbdev_video.c delete mode 100644 src/xv/fbdev_video.h delete mode 100644 src/xv/fbdev_video_fourcc.h delete mode 100644 src/xv/fbdev_video_types.h delete mode 100644 src/xv/fbdev_video_v4l2.h delete mode 100644 src/xv/i386/fbdev_video_v4l2.c delete mode 100644 src/xv/xv_types.h diff --git a/COPYING b/COPYING index 84baeaa..05596fe 100644 --- a/COPYING +++ b/COPYING @@ -1,3 +1,4 @@ +Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. Copyright (C) 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -17,5 +18,7 @@ XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - +Except as contained in this notice, the name of the XFree86 Project shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from the XFree86 +Project. diff --git a/Makefile.am b/Makefile.am index 7052905..62d9bb1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,4 +19,4 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. AUTOMAKE_OPTIONS = foreign -SUBDIRS = src man +SUBDIRS = man diff --git a/configure.ac b/configure.ac index 3848efa..d5cf29b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,3 +1,25 @@ +# Copyright 2005 Adam Jackson. +# Copyright (C) 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. +# +# 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 +# on 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON 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. +# +# Process this file with autoconf to produce a configure script AC_PREREQ(2.57) AC_INIT([xserver-xorg-video-emulfb], @@ -53,9 +75,10 @@ EMULFB_LIBS="" PKG_CHECK_MODULES(DLOG, dlog) PKG_CHECK_MODULES(DRM, libdrm) PKG_CHECK_MODULES(PIXMAN, pixman-1) +PKG_CHECK_MODULES(XDBG, xdbg) -EMULFB_CFLAGS="$EMULFB_CFLAGS $DLOG_CFLAGS $PIXMAN_CFLAGS $DRM_CFLAGS " -EMULFB_LIBS="$EMULFB_LIBS $DLOG_LIBS $PIXMAN_LIBS $DRM_LIBS " +EMULFB_CFLAGS="$EMULFB_CFLAGS $DLOG_CFLAGS $PIXMAN_CFLAGS $DRM_CFLAGS $XDBG_CFLAGS " +EMULFB_LIBS="$EMULFB_LIBS $DLOG_LIBS $PIXMAN_LIBS $DRM_LIBS $XDBG_LIBS " AM_CONDITIONAL(ENABLE_ARM, [test "x$ARM" = xyes]) @@ -89,6 +112,5 @@ XORG_RELEASE_VERSION AC_OUTPUT([ Makefile - src/Makefile man/Makefile ]) diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 2648622..0000000 --- a/debian/changelog +++ /dev/null @@ -1,336 +0,0 @@ -xserver-xorg-video-emulfb (1:0.5.0-11) unstable; urgency=low - - * xv : fix flip bug - * Git: slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-11 - - -- Boram Park Fri, 18 May 2012 13:44:20 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-10) unstable; urgency=low - - * update changelog - * Git: slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-10 - - -- Boram Park Fri, 20 Apr 2012 16:41:02 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-9) unstable; urgency=low - - * change driver name - * Git: slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-9 - - -- Boram Park Fri, 23 Dec 2011 10:12:56 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-8) unstable; urgency=low - - * code clean up - * Git: slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-8 - - -- SooChan Lim Mon, 19 Dec 2011 14:43:14 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-7) unstable; urgency=low - - * enable DPMS at emulator - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-7 - - -- SooChan Lim Tue, 15 Nov 2011 17:41:00 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-6) unstable; urgency=low - - * remove unsupported format of target. - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-6 - - -- Boram Park Wed, 19 Oct 2011 10:53:00 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-5) unstable; urgency=low - - * FIX : drawing partial area has problem. - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-5 - - -- Boram Park Sat, 15 Oct 2011 11:17:34 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-4) unstable; urgency=low - - * Update changelog - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-4 - - -- Boram Park Fri, 14 Oct 2011 07:23:03 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-3) unstable; urgency=low - - * Support image mirror - * support RGB565 - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-3 - - -- Boram Park Thu, 13 Oct 2011 10:36:04 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-2) unstable; urgency=low - - * Disable debug message - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-2 - - -- Boram Park Fri, 15 Jul 2011 16:00:58 +0900 - -xserver-xorg-video-emulfb (1:0.5.0-1) unstable; urgency=low - - * Work for armel enviroment - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.5.0-1 - - -- Boram Park Wed, 13 Jul 2011 20:57:17 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-13) unstable; urgency=low - - *Work for emulator - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.4.0-13 - - -- Boram Park Fri, 01 Jul 2011 09:37:10 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-12) unstable; urgency=low - - * oal rollback - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.4.0-12 - - -- SooChan Lim Fri, 08 Apr 2011 14:07:19 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-11) unstable; urgency=low - - * work for oal - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.4.0-11 - - -- SooChan Lim Tue, 05 Apr 2011 10:43:41 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-10) unstable; urgency=low - - * fix the buf - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.4.0-10 - - -- SooChan Lim Sun, 13 Mar 2011 09:44:22 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-9) unstable; urgency=low - - * [X11R7.6] upgrade package - * Git: 165.213.180.234:slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.4.0-9 - - -- SooChan Lim Thu, 03 Mar 2011 19:41:57 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-8) unstable; urgency=low - - * Add xserver-xorg-video-emulfb-dbg package - * Git: 165.213.180.234:/git/slp/pkgs/xorg/driver/xserver-xorg-video-emulfb - * Tag: xserver-xorg-video-emulfb_0.4.0-8 - - -- Sung-Jin Park Mon, 22 Nov 2010 14:56:32 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-7) unstable; urgency=low - - * Reupload for xserver-1.8.0 - * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/X11 - * Tag: xserver-xorg-video-emulfb_0.4.0-7 - - -- Sung-Jin Park Tue, 11 May 2010 10:26:17 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-6) unstable; urgency=low - - * Update maintainer - * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/X11 - * Tag: xserver-xorg-video-emulfb_0.4.0-6 - - -- Sung-Jin Park Wed, 21 Apr 2010 11:51:39 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-5) unstable; urgency=low - - * change the conflicted pakcage name - - -- SooChan Lim Mon, 11 Jan 2010 15:36:47 +0900 - -xserver-xorg-video-emulfb (1:0.4.0-4) unstable; urgency=low - - * Upload to unstable. - - -- Julien Cristau Thu, 09 Apr 2009 10:00:03 +0100 - -xserver-xorg-video-emulfb (1:0.4.0-3) experimental; urgency=low - - * Cherry-pick from upstream git: Make ISA optional. - * Run autoreconf on build; build-depend on automake, libtool, xutils-dev. - * Handle parallel builds. - * Build against xserver 1.6 rc. - - -- Julien Cristau Mon, 02 Feb 2009 22:01:22 +0100 - -xserver-xorg-video-emulfb (1:0.4.0-2) experimental; urgency=low - - * Build against xserver 1.5. - - -- Julien Cristau Thu, 04 Sep 2008 19:32:21 +0200 - -xserver-xorg-video-emulfb (1:0.4.0-1) unstable; urgency=low - - * New upstream release. - * Refresh patch 01_emulfb_man.diff. - * Bump Standards-Version to 3.7.3. - * Drop the XS- prefix from Vcs-* control fields. - * Add myself to Uploaders. - * Bump debhelper compat level to 5. - * Run dpkg-shlibdeps with --warnings=6. Drivers reference symbols from - /usr/bin/Xorg and other modules, and that's not a bug, so we want - dpkg-shlibdeps to shut up about symbols it can't find. Build-depend on - dpkg-dev >= 1.14.17. - - -- Julien Cristau Thu, 05 Jun 2008 20:47:48 +0200 - -xserver-xorg-video-emulfb (1:0.3.1-4) unstable; urgency=low - - * Upload to unstable - - -- David Nusinow Sun, 16 Sep 2007 16:30:50 -0400 - -xserver-xorg-video-emulfb (1:0.3.1-3) experimental; urgency=low - - [ Julien Cristau ] - * Add patch to fix minor warnings from man in emulfb(4). - - [ Timo Aaltonen ] - * Replaces/Conflicts: xserver-xorg-driver-emulfb. - - [ Brice Goglin ] - * Build against xserver 1.4. - * Install the upstream changelog. - * Bump Build-Depends: xserver-xorg-dev to >= 2:1.2.99.902 - (needed to let xsfbs get access to serverminver). - * Add XS-Vcs-*. - * Add a link to www.X.org and a reference to the xf86-video-emulfb - module in the long description. - * Add myself to Uploaders, and remove Branden and Fabio with their - permission. - * Add upstream URL to debian/copyright. - * Bump Standards-Version to 3.7.2.2, no change needed. - * Pull upstream up to commit b17f9256d5958fdd45dd5fe0ce10663ef9634900. - + Fixes non-ascii character in the manpage, closes: #441829. - - -- Brice Goglin Wed, 12 Sep 2007 10:56:04 +0200 - -xserver-xorg-video-emulfb (1:0.3.1-2) experimental; urgency=low - - * Pull some minor fixes from upstream - * Generate server dependencies automatically from the ABI - - -- David Nusinow Wed, 21 Feb 2007 22:54:22 -0500 - -xserver-xorg-video-emulfb (1:0.3.1-1) unstable; urgency=medium - - [ Julien Cristau ] - * Add link to xserver-xorg-core bug script, so that bugreports contain - the user's config and log files. - * Bump dependency on xserver-xorg-core to >= 2:1.1.1-11, as previous - versions don't have the bug script. - - [ David Nusinow ] - * New upstream release - + Fixes Shadowfb and rotation. Closes: #389433 - - -- David Nusinow Fri, 29 Dec 2006 20:06:00 -0500 - -xserver-xorg-video-emulfb (1:0.3.0-3) unstable; urgency=low - - [ Steve Langasek ] - * Prepare for upload to unstable - - -- David Nusinow Mon, 18 Sep 2006 19:57:34 -0400 - -xserver-xorg-video-emulfb (1:0.3.0-2) experimental; urgency=low - - [ Drew Parsons ] - * Provides: xserver-xorg-video-1.0 not xserver-xorg-video. - - [ David Nusinow ] - * Bump xserver (build-)depends epochs to 2: to deal with botched - server upload - - -- David Nusinow Tue, 22 Aug 2006 23:46:30 +0000 - -xserver-xorg-video-emulfb (1:0.3.0-1) experimental; urgency=low - - [ Andres Salomon ] - * Test for obj-$(DEB_BUILD_GNU_TYPE) before creating it during build; - idempotency fix. - * Run dh_install w/ --list-missing. - - [ David Nusinow ] - * New upstream release - * Bump dependency on xserver-xorg-core to >= 1:1.1.1. Do the same thing for - the build-dep on xserver-xorg-dev. - - -- David Nusinow Mon, 7 Aug 2006 20:35:45 +0000 - -xserver-xorg-video-emulfb (1:0.1.0.5-2) unstable; urgency=low - - * Upload to modular - - -- David Nusinow Sun, 26 Mar 2006 20:25:33 -0500 - -xserver-xorg-video-emulfb (1:0.1.0.5-1) experimental; urgency=low - - * First upload to Debian - * Change source package, package, and provides names to denote the - type of driver and that they are for xserver-xorg - - -- David Nusinow Fri, 13 Jan 2006 00:36:54 -0500 - -xserver-xorg-driver-emulfb (1:0.1.0.5-0ubuntu1) dapper; urgency=low - - * New upstream release. - * Add provides on xserver-xorg-driver. - - -- Daniel Stone Wed, 4 Jan 2006 19:55:27 +1100 - -xserver-xorg-driver-emulfb (1:0.1.0.4-0ubuntu1) dapper; urgency=low - - * New upstream release. - - -- Daniel Stone Mon, 19 Dec 2005 09:04:07 +1100 - -xserver-xorg-driver-emulfb (1:0.1.0.3-0ubuntu1) dapper; urgency=low - - * New upstream release. - - -- Daniel Stone Mon, 12 Dec 2005 13:02:06 +1100 - -xserver-xorg-driver-emulfb (1:0.1.0.2-0ubuntu2) dapper; urgency=low - - * Add missing Build-Depends (x11proto-core-dev, x11proto-fonts-dev, - x11proto-randr-dev, x11proto-render-dev, x11proto-video-dev). - - -- Daniel Stone Mon, 5 Dec 2005 12:53:33 +1100 - -xserver-xorg-driver-emulfb (1:0.1.0.2-0ubuntu1) dapper; urgency=low - - * New upstream release. - - -- Daniel Stone Tue, 22 Nov 2005 13:28:55 +1100 - -xserver-xorg-driver-emulfb (1:0.1.0.1-1) dapper; urgency=low - - * New upstream release. - - -- Daniel Stone Tue, 25 Oct 2005 17:00:29 +1000 - -xserver-xorg-driver-emulfb (1:0.1.0-1) breezy; urgency=low - - * First xserver-xorg-driver-emulfb release. - - -- Daniel Stone Wed, 6 Jul 2005 15:48:17 +1000 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100644 index be6cb62..0000000 --- a/debian/control +++ /dev/null @@ -1,22 +0,0 @@ -Source: xserver-xorg-video-emulfb -Section: x11 -Priority: optional -Maintainer: SooChan Lim -Uploaders: Sung-Jin Park , SooChan Lim , YoungHoon Jung , Sangjin Lee , Boram Park -Build-Depends: debhelper (>= 5.0.0), quilt, pkg-config, xserver-xorg-dev (>= 1.5.99.901), x11proto-core-dev, x11proto-fonts-dev, x11proto-randr-dev, x11proto-render-dev, x11proto-video-dev, dpkg-dev (>= 1.14.17), automake, libtool, xutils-dev, libdrm-dev, dlog-dev (>= 0.3.3-0), libpixman-1-dev -Standards-Version: 3.7.3 - -Package: xserver-xorg-video-emulfb -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${xserver} -Provides: ${xviddriver:Provides} -Replaces: xserver-xorg (<< 6.8.2-35) -Description: X.Org X server -- emulfb display driver for sdk emulation - This package provides the driver for the Samsung display device - -Package: xserver-xorg-video-emulfb-dbg -Architecture: any -Section: debug -Depends: ${shlibs:Depends}, ${misc:Depends}, ${xserver}, xserver-xorg-video-emulfb -Description: X.Org X server -- emulfb display driver for sdk emulation (unstripped) - This package provides the driver for the Samsung display device diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 84baeaa..0000000 --- a/debian/copyright +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (C) 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -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 fur- -nished 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, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 14adf82..0000000 --- a/debian/rules +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/make -f - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -include debian/xsfbs/xsfbs.mk - -CFLAGS = -Wall -Werror -g -LDFLAGS += -Wl,--hash-style=both -Wl,--as-needed -ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif -ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) - NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) - MAKEFLAGS += -j$(NUMJOBS) -endif - -DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) - confflags += --build=$(DEB_HOST_GNU_TYPE) -else - confflags += --build=$(DEB_HOST_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) -# confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) -endif - -ifeq (armel, $(DEB_HOST_ARCH)) - confflags += --enable-v4l2 - confflags += --enable-arm -endif - -# kbd_drv.a isn't phenomenally useful; kbd_drv.so more so -confflags += --disable-static - -configure: $(STAMP_DIR)/patch - dh_testdir - autoreconf -vfi - -build: build-stamp -build-stamp: configure - dh_testdir - - test -d obj-$(DEB_BUILD_GNU_TYPE) || mkdir obj-$(DEB_BUILD_GNU_TYPE) - cd obj-$(DEB_BUILD_GNU_TYPE) && \ - ../configure --prefix=/usr --mandir=\$${prefix}/share/man \ - --infodir=\$${prefix}/share/info $(confflags) \ - CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" - cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) - >$@ - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - -# Build architecture-dependent files here. -binary: build install - dh_testdir - dh_testroot - dh_installdocs - dh_installchangelogs ChangeLog - dh_install --sourcedir=debian/tmp --list-missing - dh_link - dh_strip --dbg-package=xserver-xorg-video-emulfb-dbg - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps -- - #dh_shlibdeps -- --warnings=6 - dh_gencontrol - dh_md5sums - dh_builddeb - - - -clean: xsfclean - dh_testdir - dh_testroot - rm -f build-stamp - - rm -f config.cache config.log config.status - rm -f */config.cache */config.log */config.status - rm -f conftest* */conftest* - rm -rf autom4te.cache */autom4te.cache - rm -rf obj-* - rm -f aclocal.m4 config.guess config.sub config.h.in configure - rm -f depcomp install-sh ltmain.sh missing mkinstalldirs - rm -f $$(find -name Makefile.in) - rm -f build-stamp-* - dh_clean - - -binary-arch: binary - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/watch b/debian/watch deleted file mode 100644 index e69de29..0000000 diff --git a/debian/xserver-xorg-video-emulfb.install b/debian/xserver-xorg-video-emulfb.install deleted file mode 100644 index 614cfb4..0000000 --- a/debian/xserver-xorg-video-emulfb.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib/xorg/modules/drivers/*.so -usr/share/man/man4/* diff --git a/debian/xserver-xorg-video-emulfb.links b/debian/xserver-xorg-video-emulfb.links deleted file mode 100644 index fd8928c..0000000 --- a/debian/xserver-xorg-video-emulfb.links +++ /dev/null @@ -1 +0,0 @@ -usr/share/bug/xserver-xorg-core/script usr/share/bug/xserver-xorg-video-emulfb/script diff --git a/debian/xsfbs/repack.sh b/debian/xsfbs/repack.sh deleted file mode 100755 index 5935cc9..0000000 --- a/debian/xsfbs/repack.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -set -e - -if ! [ -d debian/prune ]; then - exit 0 -fi - -if [ "x$1" != x--upstream-version ]; then - exit 1 -fi - -version="$2" -filename="$3" - -if [ -z "$version" ] || ! [ -f "$filename" ]; then - exit 1 -fi - -dir="$(pwd)" -tempdir="$(mktemp -d)" - -cd "$tempdir" -tar xf "$dir/$filename" -cat "$dir"/debian/prune/* | while read file; do rm -f */$file; done - -tar czf "$dir/$filename" * -cd "$dir" -rm -rf "$tempdir" -echo "Done pruning upstream tarball" - -exit 0 diff --git a/debian/xsfbs/xsfbs.mk b/debian/xsfbs/xsfbs.mk deleted file mode 100755 index f0f8953..0000000 --- a/debian/xsfbs/xsfbs.mk +++ /dev/null @@ -1,293 +0,0 @@ -#!/usr/bin/make -f - -# Debian X Strike Force Build System (XSFBS): Make portion - -# Copyright 1996 Stephen Early -# Copyright 1997 Mark Eichin -# Copyright 1998-2005, 2007 Branden Robinson -# Copyright 2005 David Nusinow -# -# Licensed under the GNU General Public License, version 2. See the file -# /usr/share/common-licenses/GPL or . - -# Originally by Stephen Early -# Modified by Mark W. Eichin -# Modified by Adam Heath -# Modified by Branden Robinson -# Modified by Fabio Massimo Di Nitto -# Modified by David Nusinow -# Acknowledgements to Manoj Srivastava. - -# Pass $(DH_OPTIONS) into the environment for debhelper's benefit. -export DH_OPTIONS - -# force quilt to not use ~/.quiltrc and to use debian/patches -QUILT = QUILT_PATCHES=debian/patches quilt --quiltrc /dev/null - -# Set up parameters for the upstream build environment. - -# Determine (source) package name from Debian changelog. -SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \ - | grep '^Source:' | awk '{print $$2}') - -# Determine package version from Debian changelog. -SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \ - | grep '^Version:' | awk '{print $$2}') - -# Determine upstream version number. -UPSTREAM_VERSION:=$(shell echo $(SOURCE_VERSION) | sed 's/-.*//') - -# Determine the source version without the epoch for make-orig-tar-gz -NO_EPOCH_VER:=$(shell echo $(UPSTREAM_VERSION) | sed 's/^.://') - -# Figure out who's building this package. -BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}}) - -# Find out if this is an official build; an official build has nothing but -# digits, dots, and/or the codename of a release in the Debian part of the -# version number. Anything else indicates an unofficial build. -OFFICIAL_BUILD:=$(shell VERSION=$(SOURCE_VERSION); if ! expr "$$(echo $${VERSION\#\#*-} | sed 's/\(woody\|sarge\|etch\|lenny\)//g')" : ".*[^0-9.].*" >/dev/null 2>&1; then echo yes; fi) - -# Set up parameters for the Debian build environment. - -# Determine our architecture. -BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) -# Work around some old-time dpkg braindamage. -BUILD_ARCH:=$(subst i486,i386,$(BUILD_ARCH)) -# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy. -ifdef DEB_HOST_ARCH - ARCH:=$(DEB_HOST_ARCH) -else - # dpkg-cross sets the ARCH environment variable; if set, use it. - ifdef ARCH - ARCH:=$(ARCH) - else - ARCH:=$(BUILD_ARCH) - endif -endif - -# $(STAMP_DIR) houses stamp files for complex targets. -STAMP_DIR:=stampdir - -# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place -# their files. -DEBTREEDIR:=$(CURDIR)/debian/tmp - -# All "important" targets have four lines: -# 1) A target name that is invoked by a package-building tool or the user. -# This consists of a dependency on a "$(STAMP_DIR)/"-prefixed counterpart. -# 2) A line delcaring 1) as a phony target (".PHONY:"). -# 3) A "$(STAMP_DIR)/"-prefixed target which does the actual work, and may -# depend on other targets. -# 4) A line declaring 3) as a member of the $(stampdir_targets) variable; the -# "$(STAMP_DIR)/" prefix is omitted. -# -# This indirection is needed so that the "stamp" files that signify when a rule -# is done can be located in a separate "stampdir". Recall that make has no way -# to know when a goal has been met for a phony target (like "build" or -# "install"). -# -# At the end of each "$(STAMP_DIR)/" target, be sure to run the command ">$@" -# so that the target will not be run again. Removing the file will make Make -# run the target over. - -# All phony targets should be declared as dependencies of .PHONY, even if they -# do not have "($STAMP_DIR)/"-prefixed counterparts. - -# Define a harmless default rule to keep things from going nuts by accident. -.PHONY: default -default: - -# Set up the $(STAMP_DIR) directory. -.PHONY: stampdir -stampdir_targets+=stampdir -stampdir: $(STAMP_DIR)/stampdir -$(STAMP_DIR)/stampdir: - mkdir $(STAMP_DIR) - >$@ - -# Set up the package build directory as quilt expects to find it. -.PHONY: prepare -stampdir_targets+=prepare -prepare: $(STAMP_DIR)/prepare -$(STAMP_DIR)/prepare: $(STAMP_DIR)/log $(STAMP_DIR)/genscripts - >$@ - -.PHONY: log -stampdir_targets+=log -log: $(STAMP_DIR)/log -$(STAMP_DIR)/log: $(STAMP_DIR)/stampdir - mkdir -p $(STAMP_DIR)/log - -# Apply all patches to the upstream source. -.PHONY: patch -stampdir_targets+=patch -patch: $(STAMP_DIR)/patch -$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare - if ! [ `which quilt` ]; then \ - echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \ - exit 1; \ - fi; \ - if $(QUILT) next >/dev/null 2>&1; then \ - echo -n "Applying patches..."; \ - if $(QUILT) push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \ - cat $(STAMP_DIR)/log/patch; \ - echo "successful."; \ - else \ - cat $(STAMP_DIR)/log/patch; \ - echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \ - exit 1; \ - fi; \ - else \ - echo "No patches to apply"; \ - fi; \ - >$@ - -# Revert all patches to the upstream source. -.PHONY: unpatch -unpatch: $(STAMP_DIR)/log - rm -f $(STAMP_DIR)/patch - @echo -n "Unapplying patches..."; \ - if $(QUILT) applied >/dev/null 2>/dev/null; then \ - if $(QUILT) pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \ - cat $(STAMP_DIR)/log/unpatch; \ - echo "successful."; \ - else \ - cat $(STAMP_DIR)/log/unpatch; \ - echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \ - exit 1; \ - fi; \ - else \ - echo "nothing to do."; \ - fi - -# Clean the generated maintainer scripts. -.PHONY: cleanscripts -cleanscripts: - rm -f $(STAMP_DIR)/genscripts - rm -f debian/*.config \ - debian/*.postinst \ - debian/*.postrm \ - debian/*.preinst \ - debian/*.prerm - -# Clean the package build tree. -.PHONY: xsfclean -xsfclean: cleanscripts unpatch - dh_testdir - rm -rf .pc - rm -rf $(STAMP_DIR) $(SOURCE_DIR) - rm -rf imports - dh_clean debian/shlibs.local \ - debian/po/pothead - -# Generate the debconf templates POT file header. -debian/po/pothead: debian/po/pothead.in - sed -e 's/SOURCE_VERSION/$(SOURCE_VERSION)/' \ - -e 's/DATE/$(shell date "+%F %X%z"/)' <$< >$@ - -# Update POT and PO files. -.PHONY: updatepo -updatepo: debian/po/pothead - debian/scripts/debconf-updatepo --pot-header=pothead --verbose - -# Remove files from the upstream source tree that we don't need, or which have -# licensing problems. It must be run before creating the .orig.tar.gz. -# -# Note: This rule is for Debian package maintainers' convenience, and is not -# needed for conventional build scenarios. -.PHONY: prune-upstream-tree -prune-upstream-tree: - # Ensure we're in the correct directory. - dh_testdir - grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf - -# Verify that there are no offsets or fuzz in the patches we apply. -# -# Note: This rule is for Debian package maintainers' convenience, and is not -# needed for conventional build scenarios. -.PHONY: patch-audit -patch-audit: prepare unpatch - @echo -n "Auditing patches..."; \ - >$(STAMP_DIR)/log/patch; \ - FUZZY=; \ - while [ -n "$$($(QUILT) next)" ]; do \ - RESULT=$$($(QUILT) push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\ - case "$$RESULT" in \ - succeeded) \ - echo "fuzzy patch: $$($(QUILT) top)" \ - | tee -a $(STAMP_DIR)/log/$$($(QUILT) top); \ - FUZZY=yes; \ - ;; \ - FAILED) \ - echo "broken patch: $$($(QUILT) next)" \ - | tee -a $(STAMP_DIR)/log/$$($(QUILT) next); \ - exit 1; \ - ;; \ - esac; \ - done; \ - if [ -n "$$FUZZY" ]; then \ - echo "there were fuzzy patches; please fix."; \ - exit 1; \ - else \ - echo "done."; \ - fi - -# Generate the maintainer scripts. -.PHONY: genscripts -stampdir_targets+=genscripts -genscripts: $(STAMP_DIR)/genscripts -$(STAMP_DIR)/genscripts: $(STAMP_DIR)/stampdir - for FILE in debian/*.config.in \ - debian/*.postinst.in \ - debian/*.postrm.in \ - debian/*.preinst.in \ - debian/*.prerm.in; do \ - if [ -e "$$FILE" ]; then \ - MAINTSCRIPT=$$(echo $$FILE | sed 's/.in$$//'); \ - sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' <$$FILE \ - | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >$$MAINTSCRIPT.tmp; \ - cat debian/xsfbs/xsfbs.sh >>$$MAINTSCRIPT.tmp; \ - sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' <$$FILE \ - | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \ - sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \ - -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \ - -e 's/@DEFAULT_DCRESOLUTIONS@/$(DEFAULT_DCRESOLUTIONS)/' \ - <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \ - rm $$MAINTSCRIPT.tmp; \ - fi; \ - done - # Validate syntax of generated shell scripts. - #sh debian/scripts/validate-posix-sh debian/*.config \ - # debian/*.postinst \ - # debian/*.postrm \ - # debian/*.preinst \ - # debian/*.prerm - >$@ - -# Generate the shlibs.local file. -debian/shlibs.local: - cat debian/*.shlibs >$@ - -SERVERMINVERS = $(shell cat /usr/share/xserver-xorg/serverminver 2>/dev/null) -VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null) -INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null) -SERVER_DEPENDS = xserver-xorg-core (>= $(SERVERMINVERS)) -VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI) -INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI) -ifeq ($(PACKAGE),) -PACKAGE=$(shell awk '/^Package:/ { print $$2; exit }' < debian/control) -endif - -.PHONY: serverabi -serverabi: install -ifeq ($(SERVERMINVERS),) - @echo error: xserver-xorg-dev needs to be installed - @exit 1 -else - echo "xserver:Depends=$(SERVER_DEPENDS)" >> debian/$(PACKAGE).substvars - echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars - echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars -endif - -# vim:set noet ai sts=8 sw=8 tw=0: diff --git a/debian/xsfbs/xsfbs.sh b/debian/xsfbs/xsfbs.sh deleted file mode 100755 index 8840ff9..0000000 --- a/debian/xsfbs/xsfbs.sh +++ /dev/null @@ -1,865 +0,0 @@ -# $Id$ - -# This is the X Strike Force shell library for X Window System package -# maintainer scripts. It serves to define shell functions commonly used by -# such packages, and performs some error checking necessary for proper operation -# of those functions. By itself, it does not "do" much; the maintainer scripts -# invoke the functions defined here to accomplish package installation and -# removal tasks. - -# If you are reading this within a Debian package maintainer script (e.g., -# /var/lib/dpkg)info/PACKAGE.{config,preinst,postinst,prerm,postrm}), you can -# skip past this library by scanning forward in this file to the string -# "GOBSTOPPER". - -SOURCE_VERSION=@SOURCE_VERSION@ -OFFICIAL_BUILD=@OFFICIAL_BUILD@ - -# Use special abnormal exit codes so that problems with this library are more -# easily tracked down. -SHELL_LIB_INTERNAL_ERROR=86 -SHELL_LIB_THROWN_ERROR=74 -SHELL_LIB_USAGE_ERROR=99 - -# old -> new variable names -if [ -z "$DEBUG_XORG_PACKAGE" ] && [ -n "$DEBUG_XFREE86_PACKAGE" ]; then - DEBUG_XORG_PACKAGE="$DEBUG_XFREE86_PACKAGE" -fi -if [ -z "$DEBUG_XORG_DEBCONF" ] && [ -n "$DEBUG_XFREE86_DEBCONF" ]; then - DEBUG_XORG_DEBCONF="$DEBUG_XFREE86_DEBCONF" -fi - -# initial sanity checks -if [ -z "$THIS_PACKAGE" ]; then - cat >&2 < on the World Wide Web for -instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the -"doc-debian" package, or install the "reportbug" package and use the command of -the same name to file a report against version $SOURCE_VERSION of this package. -EOF - exit $SHELL_LIB_USAGE_ERROR -fi - -if [ -z "$THIS_SCRIPT" ]; then - cat >&2 < on the World Wide Web for -instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the -"doc-debian" package, or install the "reportbug" package and use the command of -the same name to file a report against version $SOURCE_VERSION of the -"$THIS_PACKAGE" package. -EOF - exit $SHELL_LIB_USAGE_ERROR -fi - -ARCHITECTURE="$(dpkg --print-installation-architecture)" - -if [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then - RECONFIGURE="true" -else - RECONFIGURE= -fi - -if ([ "$1" = "install" ] || [ "$1" = "configure" ]) && [ -z "$2" ]; then - FIRSTINST="yes" -fi - -if [ -z "$RECONFIGURE" ] && [ -z "$FIRSTINST" ]; then - UPGRADE="yes" -fi - -trap "message;\ - message \"Received signal. Aborting $THIS_PACKAGE package $THIS_SCRIPT script.\";\ - message;\ - exit 1" HUP INT QUIT TERM - -reject_nondigits () { - # syntax: reject_nondigits [ operand ... ] - # - # scan operands (typically shell variables whose values cannot be trusted) for - # characters other than decimal digits and barf if any are found - while [ -n "$1" ]; do - # does the operand contain anything but digits? - if ! expr "$1" : "[[:digit:]]\+$" > /dev/null 2>&1; then - # can't use die(), because it wraps message() which wraps this function - echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_nondigits() encountered" \ - "possibly malicious garbage \"$1\"" >&2 - exit $SHELL_LIB_THROWN_ERROR - fi - shift - done -} - -reject_whitespace () { - # syntax: reject_whitespace [ operand ] - # - # scan operand (typically a shell variable whose value cannot be trusted) for - # whitespace characters and barf if any are found - if [ -n "$1" ]; then - # does the operand contain any whitespace? - if expr "$1" : "[[:space:]]" > /dev/null 2>&1; then - # can't use die(), because I want to avoid forward references - echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_whitespace() encountered" \ - "possibly malicious garbage \"$1\"" >&2 - exit $SHELL_LIB_THROWN_ERROR - fi - fi -} - -reject_unlikely_path_chars () { - # syntax: reject_unlikely_path_chars [ operand ... ] - # - # scan operands (typically shell variables whose values cannot be trusted) for - # characters unlikely to be seen in a path and which the shell might - # interpret and barf if any are found - while [ -n "$1" ]; do - # does the operand contain any funny characters? - if expr "$1" : '.*[!$&()*;<>?|].*' > /dev/null 2>&1; then - # can't use die(), because I want to avoid forward references - echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_unlikely_path_chars()" \ - "encountered possibly malicious garbage \"$1\"" >&2 - exit $SHELL_LIB_THROWN_ERROR - fi - shift - done -} - -# Query the terminal to establish a default number of columns to use for -# displaying messages to the user. This is used only as a fallback in the -# event the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while -# the script is running, and this cannot, only being calculated once.) -DEFCOLUMNS=$(stty size 2> /dev/null | awk '{print $2}') || true -if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" > /dev/null 2>&1; then - DEFCOLUMNS=80 -fi - -message () { - # pretty-print messages of arbitrary length - reject_nondigits "$COLUMNS" - echo "$*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} >&2 -} - -observe () { - # syntax: observe message ... - # - # issue observational message suitable for logging someday when support for - # it exists in dpkg - if [ -n "$DEBUG_XORG_PACKAGE" ]; then - message "$THIS_PACKAGE $THIS_SCRIPT note: $*" - fi -} - -warn () { - # syntax: warn message ... - # - # issue warning message suitable for logging someday when support for - # it exists in dpkg; also send to standard error - message "$THIS_PACKAGE $THIS_SCRIPT warning: $*" -} - -die () { - # syntax: die message ... - # - # exit script with error message - message "$THIS_PACKAGE $THIS_SCRIPT error: $*" - exit $SHELL_LIB_THROWN_ERROR -} - -internal_error () { - # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message - message "internal error: $*" - if [ -n "$OFFICIAL_BUILD" ]; then - message "Please report a bug in the $THIS_SCRIPT script of the" \ - "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \ - "Tracking System. Include all messages above that mention the" \ - "$THIS_PACKAGE package. Visit " \ - " on the World Wide Web for" \ - "instructions, read the file" \ - "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \ - "package, or install the reportbug package and use the command of" \ - "the same name to file a report." - fi - exit $SHELL_LIB_INTERNAL_ERROR -} - -usage_error () { - message "usage error: $*" - message "Please report a bug in the $THIS_SCRIPT script of the" \ - "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \ - "Tracking System. Include all messages above that mention the" \ - "$THIS_PACKAGE package. Visit " \ - " on the World Wide Web for" \ - "instructions, read the file" \ - "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \ - "package, or install the reportbug package and use the command of" \ - "the same name to file a report." - exit $SHELL_LIB_USAGE_ERROR -} - - -maplink () { - # returns what symlink should point to; i.e., what the "sane" answer is - # Keep this in sync with the debian/*.links files. - # This is only needed for symlinks to directories. - # - # XXX: Most of these look wrong in the X11R7 world and need to be fixed. - # If we've stopped using this function, fixing it might enable us to re-enable - # it again and catch more errors. - case "$1" in - /etc/X11/xkb/compiled) echo /var/lib/xkb ;; - /etc/X11/xkb/xkbcomp) echo /usr/X11R6/bin/xkbcomp ;; - /usr/X11R6/lib/X11/app-defaults) echo /etc/X11/app-defaults ;; - /usr/X11R6/lib/X11/fs) echo /etc/X11/fs ;; - /usr/X11R6/lib/X11/lbxproxy) echo /etc/X11/lbxproxy ;; - /usr/X11R6/lib/X11/proxymngr) echo /etc/X11/proxymngr ;; - /usr/X11R6/lib/X11/rstart) echo /etc/X11/rstart ;; - /usr/X11R6/lib/X11/twm) echo /etc/X11/twm ;; - /usr/X11R6/lib/X11/xdm) echo /etc/X11/xdm ;; - /usr/X11R6/lib/X11/xinit) echo /etc/X11/xinit ;; - /usr/X11R6/lib/X11/xkb) echo /etc/X11/xkb ;; - /usr/X11R6/lib/X11/xserver) echo /etc/X11/xserver ;; - /usr/X11R6/lib/X11/xsm) echo /etc/X11/xsm ;; - /usr/bin/X11) echo ../X11R6/bin ;; - /usr/bin/rstartd) echo ../X11R6/bin/rstartd ;; - /usr/include/X11) echo ../X11R6/include/X11 ;; - /usr/lib/X11) echo ../X11R6/lib/X11 ;; - *) internal_error "maplink() called with unknown path \"$1\"" ;; - esac -} - -analyze_path () { - # given a supplied set of pathnames, break each one up by directory and do an - # ls -dl on each component, cumulatively; i.e. - # analyze_path /usr/X11R6/bin -> ls -dl /usr /usr/X11R6 /usr/X11R6/bin - # Thanks to Randolph Chung for this clever hack. - - local f g - - while [ -n "$1" ]; do - reject_whitespace "$1" - g= - message "Analyzing $1:" - for f in $(echo "$1" | tr / \ ); do - if [ -e /$g$f ]; then - ls -dl /$g$f /$g$f.dpkg-* 2> /dev/null || true - g=$g$f/ - else - message "/$g$f: nonexistent; directory contents of /$g:" - ls -l /$g - break - fi - done - shift - done -} - -find_culprits () { - local f p dpkg_info_dir possible_culprits smoking_guns bad_packages package \ - msg - - reject_whitespace "$1" - message "Searching for overlapping packages..." - dpkg_info_dir=/var/lib/dpkg/info - if [ -d $dpkg_info_dir ]; then - if [ "$(echo $dpkg_info_dir/*.list)" != "$dpkg_info_dir/*.list" ]; then - possible_culprits=$(ls -1 $dpkg_info_dir/*.list | egrep -v \ - "(xbase-clients|x11-common|xfs|xlibs)") - if [ -n "$possible_culprits" ]; then - smoking_guns=$(grep -l "$1" $possible_culprits || true) - if [ -n "$smoking_guns" ]; then - bad_packages=$(printf "\\n") - for f in $smoking_guns; do - # too bad you can't nest parameter expansion voodoo - p=${f%*.list} # strip off the trailing ".list" - package=${p##*/} # strip off the directories - bad_packages=$(printf "%s\n%s" "$bad_packages" "$package") - done - msg=$(cat < /dev/null 2>&1; then - message "The readlink command was not found. Please install version" \ - "1.13.1 or later of the debianutils package." - readlink () { - # returns what symlink in $1 actually points to - perl -e '$l = shift; exit 1 unless -l $l; $r = readlink $l; exit 1 unless $r; print "$r\n"' "$1" - } -fi - -check_symlink () { - # syntax: check_symlink symlink - # - # See if specified symlink points where it is supposed to. Return 0 if it - # does, and 1 if it does not. - # - # Primarily used by check_symlinks_and_warn() and check_symlinks_and_bomb(). - - local symlink - - # validate arguments - if [ $# -ne 1 ]; then - usage_error "check_symlink() called with wrong number of arguments;" \ - "expected 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - symlink="$1" - - if [ "$(maplink "$symlink")" = "$(readlink "$symlink")" ]; then - return 0 - else - return 1 - fi -} - -check_symlinks_and_warn () { - # syntax: check_symlinks_and_warn symlink ... - # - # For each argument, check for symlink sanity, and warn if it isn't sane. - # - # Call this function from a preinst script in the event $1 is "upgrade" or - # "install". - - local errmsg symlink - - # validate arguments - if [ $# -lt 1 ]; then - usage_error "check_symlinks_and_warn() called with wrong number of" \ - "arguments; expected at least 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - while [ -n "$1" ]; do - symlink="$1" - if [ -L "$symlink" ]; then - if ! check_symlink "$symlink"; then - observe "$symlink symbolic link points to wrong location" \ - "$(readlink "$symlink"); removing" - rm "$symlink" - fi - elif [ -e "$symlink" ]; then - errmsg="$symlink exists and is not a symbolic link; this package cannot" - errmsg="$errmsg be installed until this" - if [ -f "$symlink" ]; then - errmsg="$errmsg file" - elif [ -d "$symlink" ]; then - errmsg="$errmsg directory" - else - errmsg="$errmsg thing" - fi - errmsg="$errmsg is removed" - die "$errmsg" - fi - shift - done -} - -check_symlinks_and_bomb () { - # syntax: check_symlinks_and_bomb symlink ... - # - # For each argument, check for symlink sanity, and bomb if it isn't sane. - # - # Call this function from a postinst script. - - local problem symlink - - # validate arguments - if [ $# -lt 1 ]; then - usage_error "check_symlinks_and_bomb() called with wrong number of" - "arguments; expected at least 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - while [ -n "$1" ]; do - problem= - symlink="$1" - if [ -L "$symlink" ]; then - if ! check_symlink "$symlink"; then - problem=yes - warn "$symlink symbolic link points to wrong location" \ - "$(readlink "$symlink")" - fi - elif [ -e "$symlink" ]; then - problem=yes - warn "$symlink is not a symbolic link" - else - problem=yes - warn "$symlink symbolic link does not exist" - fi - if [ -n "$problem" ]; then - analyze_path "$symlink" "$(readlink "$symlink")" - find_culprits "$symlink" - die "bad symbolic links on system" - fi - shift - done -} - -font_update () { - # run $UPDATECMDS in $FONTDIRS - - local dir cmd shortcmd x_font_dir_prefix - - x_font_dir_prefix="/usr/share/fonts/X11" - - if [ -z "$UPDATECMDS" ]; then - usage_error "font_update() called but \$UPDATECMDS not set" - fi - if [ -z "$FONTDIRS" ]; then - usage_error "font_update() called but \$FONTDIRS not set" - fi - - reject_unlikely_path_chars "$UPDATECMDS" - reject_unlikely_path_chars "$FONTDIRS" - - for dir in $FONTDIRS; do - if [ -d "$x_font_dir_prefix/$dir" ]; then - for cmd in $UPDATECMDS; do - if which "$cmd" > /dev/null 2>&1; then - shortcmd=${cmd##*/} - observe "running $shortcmd in $dir font directory" - cmd_opts= - if [ "$shortcmd" = "update-fonts-alias" ]; then - cmd_opts=--x11r7-layout - fi - if [ "$shortcmd" = "update-fonts-dir" ]; then - cmd_opts=--x11r7-layout - fi - if [ "$shortcmd" = "update-fonts-scale" ]; then - cmd_opts=--x11r7-layout - fi - $cmd $cmd_opts $dir || warn "$cmd $cmd_opts $dir" \ - "failed; font directory data may not" \ - "be up to date" - else - warn "$cmd not found; not updating corresponding $dir font" \ - "directory data" - fi - done - else - warn "$dir is not a directory; not updating font directory data" - fi - done -} - -remove_conffile_prepare () { - # syntax: remove_conffile_prepare filename official_md5sum ... - # - # Check a conffile "filename" against a list of canonical MD5 checksums. - # If the file's current MD5 checksum matches one of the "official_md5sum" - # operands provided, then prepare the conffile for removal from the system. - # We defer actual deletion until the package is configured so that we can - # roll this operation back if package installation fails. - # - # Call this function from a preinst script in the event $1 is "upgrade" or - # "install" and verify $2 to ensure the package is being upgraded from a - # version (or installed over a version removed-but-not-purged) prior to the - # one in which the conffile was obsoleted. - - local conffile current_checksum - - # validate arguments - if [ $# -lt 2 ]; then - usage_error "remove_conffile_prepare() called with wrong number of" \ - "arguments; expected at least 2, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - conffile="$1" - shift - - # does the conffile even exist? - if [ -e "$conffile" ]; then - # calculate its checksum - current_checksum=$(md5sum < "$conffile" | sed 's/[[:space:]].*//') - # compare it to each supplied checksum - while [ -n "$1" ]; do - if [ "$current_checksum" = "$1" ]; then - # we found a match; move the confffile and stop looking - observe "preparing obsolete conffile $conffile for removal" - mv "$conffile" "$conffile.$THIS_PACKAGE-tmp" - break - fi - shift - done - fi -} - -remove_conffile_lookup () { - # syntax: remove_conffile_lookup package filename - # - # Lookup the md5sum of a conffile in dpkg's database, and prepare for removal - # if it matches the actual file's md5sum. - # - # Call this function when you would call remove_conffile_prepare but only - # want to check against dpkg's status database instead of known checksums. - - local package conffile old_md5sum - - # validate arguments - if [ $# -ne 2 ]; then - usage_error "remove_conffile_lookup() called with wrong number of" \ - "arguments; expected 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - package="$1" - conffile="$2" - - if ! [ -e "$conffile" ]; then - return - fi - old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$package" | \ - awk '{ if (match($0, "^ '"$conffile"' ")) print $2}')" - if [ -n "$old_md5sum" ]; then - remove_conffile_prepare "$conffile" "$old_md5sum" - fi -} - -remove_conffile_commit () { - # syntax: remove_conffile_commit filename - # - # Complete the removal of a conffile "filename" that has become obsolete. - # - # Call this function from a postinst script after having used - # remove_conffile_prepare() in the preinst. - - local conffile - - # validate arguments - if [ $# -ne 1 ]; then - usage_error "remove_conffile_commit() called with wrong number of" \ - "arguments; expected 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - conffile="$1" - - # if the temporary file created by remove_conffile_prepare() exists, remove it - if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then - observe "committing removal of obsolete conffile $conffile" - rm "$conffile.$THIS_PACKAGE-tmp" - fi -} - -remove_conffile_rollback () { - # syntax: remove_conffile_rollback filename - # - # Roll back the removal of a conffile "filename". - # - # Call this function from a postrm script in the event $1 is "abort-upgrade" - # or "abort-install" is after having used remove_conffile_prepare() in the - # preinst. - - local conffile - - # validate arguments - if [ $# -ne 1 ]; then - usage_error "remove_conffile_rollback() called with wrong number of" \ - "arguments; expected 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - conffile="$1" - - # if the temporary file created by remove_conffile_prepare() exists, move it - # back - if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then - observe "rolling back removal of obsolete conffile $conffile" - mv "$conffile.$THIS_PACKAGE-tmp" "$conffile" - fi -} - -replace_conffile_with_symlink_prepare () { - # syntax: replace_conffile_with_symlink_prepare oldfilename newfilename \ - # official_md5sum ... - # - # Check a conffile "oldfilename" against a list of canonical MD5 checksums. - # If the file's current MD5 checksum matches one of the "official_md5sum" - # operands provided, then prepare the conffile for removal from the system. - # We defer actual deletion until the package is configured so that we can - # roll this operation back if package installation fails. Otherwise copy it - # to newfilename and let dpkg handle it through conffiles mechanism. - # - # Call this function from a preinst script in the event $1 is "upgrade" or - # "install" and verify $2 to ensure the package is being upgraded from a - # version (or installed over a version removed-but-not-purged) prior to the - # one in which the conffile was obsoleted. - - local conffile current_checksum - - # validate arguments - if [ $# -lt 3 ]; then - usage_error "replace_conffile_with_symlink_prepare() called with wrong" \ - " number of arguments; expected at least 3, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - oldconffile="$1" - shift - newconffile="$1" - shift - - remove_conffile_prepare "$_oldconffile" "$@" - # If $oldconffile still exists, then md5sums didn't match. - # Copy it to new one. - if [ -f "$oldconffile" ]; then - cp "$oldconffile" "$newconffile" - fi - -} - -replace_conffile_with_symlink_commit () { - # syntax: replace_conffile_with_symlink_commit oldfilename - # - # Complete the removal of a conffile "oldfilename" that has been - # replaced by a symlink. - # - # Call this function from a postinst script after having used - # replace_conffile_with_symlink_prepare() in the preinst. - - local conffile - - # validate arguments - if [ $# -ne 1 ]; then - usage_error "replace_conffile_with_symlink_commit() called with wrong" \ - "number of arguments; expected 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - conffile="$1" - - remove_conffile_commit "$conffile" -} - -replace_conffile_with_symlink_rollback () { - # syntax: replace_conffile_with_symlink_rollback oldfilename newfilename - # - # Roll back the replacing of a conffile "oldfilename" with symlink to - # "newfilename". - # - # Call this function from a postrm script in the event $1 is "abort-upgrade" - # or "abort-install" and verify $2 to ensure the package failed to upgrade - # from a version (or install over a version removed-but-not-purged) prior - # to the one in which the conffile was obsoleted. - # You should have used replace_conffile_with_symlink_prepare() in the - # preinst. - - local conffile - - # validate arguments - if [ $# -ne 2 ]; then - usage_error "replace_conffile_with_symlink_rollback() called with wrong" \ - "number of arguments; expected 2, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - oldconffile="$1" - newconffile="$2" - - remove_conffile_rollback "$_oldconffile" - if [ -f "$newconffile" ]; then - rm "$newconffile" - fi -} - -run () { - # syntax: run command [ argument ... ] - # - # Run specified command with optional arguments and report its exit status. - # Useful for commands whose exit status may be nonzero, but still acceptable, - # or commands whose failure is not fatal to us. - # - # NOTE: Do *not* use this function with db_get or db_metaget commands; in - # those cases the return value of the debconf command *must* be checked - # before the string returned by debconf is used for anything. - - local retval - - # validate arguments - if [ $# -lt 1 ]; then - usage_error "run() called with wrong number of arguments; expected at" \ - "least 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - "$@" || retval=$? - - if [ ${retval:-0} -ne 0 ]; then - observe "command \"$*\" exited with status $retval" - fi -} - -make_symlink_sane () { - # syntax: make_symlink_sane symlink target - # - # Ensure that the symbolic link symlink exists, and points to target. - # - # If symlink does not exist, create it and point it at target. - # - # If symlink exists but is not a symbolic link, back it up. - # - # If symlink exists, is a symbolic link, but points to the wrong location, fix - # it. - # - # If symlink exists, is a symbolic link, and already points to target, do - # nothing. - # - # This function wouldn't be needed if ln had an -I, --idempotent option. - - # Validate arguments. - if [ $# -ne 2 ]; then - usage_error "make_symlink_sane() called with wrong number of arguments;" \ - "expected 2, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - # We could just use the positional parameters as-is, but that makes things - # harder to follow. - local symlink target - - symlink="$1" - target="$2" - - if [ -L "$symlink" ] && [ "$(readlink "$symlink")" = "$target" ]; then - observe "link from $symlink to $target already exists" - else - observe "creating symbolic link from $symlink to $target" - mkdir -p "${target%/*}" "${symlink%/*}" - ln -s -b -S ".dpkg-old" "$target" "$symlink" - fi -} - -migrate_dir_to_symlink () { - # syntax: migrate_dir_to_symlink old_location new_location - # - # Per Debian Policy section 6.5.4, "A directory will never be replaced by a - # symbolic link to a directory or vice versa; instead, the existing state - # (symlink or not) will be left alone and dpkg will follow the symlink if - # there is one." - # - # We have to do it ourselves. - # - # This function moves the contents of old_location, a directory, into - # new_location, a directory, then makes old_location a symbolic link to - # new_location. - # - # old_location need not exist, but if it does, it must be a directory (or a - # symlink to a directory). If it is not, it is backed up. If new_location - # exists already and is not a directory, it is backed up. - # - # This function should be called from a package's preinst so that other - # packages unpacked after this one --- but before this package's postinst runs - # --- are unpacked into new_location even if their payloads contain - # old_location filespecs. - - # Validate arguments. - if [ $# -ne 2 ]; then - usage_error "migrate_dir_to_symlink() called with wrong number of" - "arguments; expected 2, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - # We could just use the positional parameters as-is, but that makes things - # harder to follow. - local new old - - old="$1" - new="$2" - - # Is old location a symlink? - if [ -L "$old" ]; then - # Does it already point to new location? - if [ "$(readlink "$old")" = "$new" ]; then - # Nothing to do; migration has already been done. - observe "migration of $old to $new already done" - return 0 - else - # Back it up. - warn "backing up symbolic link $old as $old.dpkg-old" - mv -b "$old" "$old.dpkg-old" - fi - fi - - # Does old location exist, but is not a directory? - if [ -e "$old" ] && ! [ -d "$old" ]; then - # Back it up. - warn "backing up non-directory $old as $old.dpkg-old" - mv -b "$old" "$old.dpkg-old" - fi - - observe "migrating $old to $new" - - # Is new location a symlink? - if [ -L "$new" ]; then - # Does it point the wrong way, i.e., back to where we're migrating from? - if [ "$(readlink "$new")" = "$old" ]; then - # Get rid of it. - observe "removing symbolic link $new which points to $old" - rm "$new" - else - # Back it up. - warn "backing up symbolic link $new as $new.dpkg-old" - mv -b "$new" "$new.dpkg-old" - fi - fi - - # Does new location exist, but is not a directory? - if [ -e "$new" ] && ! [ -d "$new" ]; then - warn "backing up non-directory $new as $new.dpkg-old" - mv -b "$new" "$new.dpkg-old" - fi - - # Create new directory if it does not yet exist. - if ! [ -e "$new" ]; then - observe "creating $new" - mkdir -p "$new" - fi - - # Copy files in old location to new location. Back up any filenames that - # already exist in the new location with the extension ".dpkg-old". - observe "copying files from $old to $new" - if ! (cd "$old" && cp -a -b -S ".dpkg-old" . "$new"); then - die "error(s) encountered while copying files from $old to $new" - fi - - # Remove files at old location. - observe "removing $old" - rm -r "$old" - - # Create symlink from old location to new location. - make_symlink_sane "$old" "$new" -} - -# vim:set ai et sw=2 ts=2 tw=80: - -# GOBSTOPPER: The X Strike Force shell library ends here. diff --git a/man/Makefile.am b/man/Makefile.am index bf7ec17..ecd9bb8 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,28 +1,26 @@ # $Id$ # # Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation. -# -# 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 OPEN GROUP 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. -# -# Except as contained in this notice, the name of the copyright holders shall -# not be used in advertising or otherwise to promote the sale, use or -# other dealings in this Software without prior written authorization -# from the copyright holders. +# Copyright (C) 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. +# +# 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 +# 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. # drivermandir = $(DRIVER_MAN_DIR) diff --git a/packaging/xorg-x11-drv-emulfb.spec b/packaging/xorg-x11-drv-emulfb.spec index 6ab42d3..3c269ce 100644 --- a/packaging/xorg-x11-drv-emulfb.spec +++ b/packaging/xorg-x11-drv-emulfb.spec @@ -3,11 +3,11 @@ Name: xorg-x11-drv-emulfb Summary: X.Org X server driver for sdk emulation -Version: 0.5.0 -Release: 16 +Version: 0.5.10 +Release: 1 #ExclusiveArch: %arm Group: System/X Hardware Support -License: Samsung +License: MIT Source0: %{name}-%{version}.tar.gz BuildRequires: prelink @@ -22,6 +22,7 @@ BuildRequires: pkgconfig(resourceproto) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(pixman-1) +BuildRequires: pkgconfig(xdbg) %description This package provides the driver for sdk emulation @@ -43,7 +44,7 @@ This package provides the driver for sdk emulation %endif %reconfigure --disable-static %{ENABLE_ARM} \ - CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed" + CFLAGS="-Wall -Werror ${CFLAGS}" LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed" make %{?jobs:-j%jobs} @@ -53,15 +54,18 @@ make %{?jobs:-j%jobs} rm -rf %{buildroot} # >> install pre # << install pre +mkdir -p %{buildroot}/usr/share/license +cp -af COPYING %{buildroot}/usr/share/license/%{name} %make_install # >> install post -execstack -c %{buildroot}%{_libdir}/xorg/modules/drivers/emulfb_drv.so +#execstack -c %{buildroot}%{_libdir}/xorg/modules/drivers/emulfb_drv.so # << install post %files %defattr(-,root,root,-) # >> files emulfb -%{_libdir}/xorg/modules/drivers/*.so +#%{_libdir}/xorg/modules/drivers/*.so %{_datadir}/man/man4/* # << files emulfb +/usr/share/license/%{name} diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 56fecdb..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -AM_CFLAGS = -I@top_srcdir@/src @XORG_CFLAGS@ @EMULFB_CFLAGS@ -emulfb_drv_la_LTLIBRARIES = emulfb_drv.la -#emulfb_drv_la_LDFLAGS = -module -avoid-version @EMULFB_LIBS@ -emulfb_drv_la_LDFLAGS = -module -avoid-version -emulfb_drv_la_LIBADD = @EMULFB_LIBS@ -emulfb_drv_ladir = @moduledir@/drivers - -# common -emulfb_drv_la_SOURCES = \ - fbdev.c \ - fb/fbdev_fb.c \ - fbdev_dpms.c -AM_CFLAGS += -I@top_srcdir@/src/fb - -if ENABLE_ARM - xvtarget = arm -else - xvtarget = i386 -endif - -# xv -emulfb_drv_la_SOURCES += \ - xv/fbdev_video.c \ - xv/fbdev_v4l2.c \ - xv/${xvtarget}/fbdev_video_v4l2.c -AM_CFLAGS += -I@top_srcdir@/src/xv -AM_CFLAGS += -I@top_srcdir@/src/xv/${xvtarget} - -# fbdevhw -emulfb_drv_la_SOURCES += \ - fbdevhw/fbdev_hw.c -AM_CFLAGS += -I@top_srcdir@/src/fbdevhw - -# util -emulfb_drv_la_SOURCES += \ - util/fbdev_util.c \ - util/fbdev_pixman.c -AM_CFLAGS += -I@top_srcdir@/src/util - -# crtcconfig -emulfb_drv_la_SOURCES += \ - crtcconfig/fbdev_crtcconfig.c \ - crtcconfig/fbdev_crtc.c \ - crtcconfig/lcd_output.c \ - crtcconfig/fbdev_mode.c -AM_CFLAGS += -I@top_srcdir@/src/crtcconfig - -# crtcconfig -emulfb_drv_la_SOURCES += \ - debug/fbdev_event_trace.c -AM_CFLAGS += -I@top_srcdir@/src/debug - diff --git a/src/crtcconfig/fbdev_crtc.c b/src/crtcconfig/fbdev_crtc.c deleted file mode 100644 index 478836d..0000000 --- a/src/crtcconfig/fbdev_crtc.c +++ /dev/null @@ -1,250 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -#include "xace.h" -#include "xacestr.h" -#include - -#include "fbdev.h" -#include "fbdevhw.h" -#include "fbdev_hw.h" -#include "fbdev_crtc_priv.h" -#include "fbdev_util.h" - -#include "xf86Crtc.h" -#include "xf86Xinput.h" -#include "exevents.h" - -/********************************************************************************************/ -/* Implementation of Crtc entry points */ -/********************************************************************************************/ -/** - * Turns the crtc on/off, or sets intermediate power levels if available. - * - * Unsupported intermediate modes drop to the lower power setting. If the - * mode is DPMSModeOff, the crtc must be disabled sufficiently for it to - * be safe to call mode_set. - */ -static void fbdev_crtc_dpms(xf86CrtcPtr crtc, int mode) -{ - return; -} - -/** - * Lock CRTC prior to mode setting, mostly for DRI. - * Returns whether unlock is needed - */ -static Bool fbdev_crtc_lock(xf86CrtcPtr crtc) -{ - - /* check whether unlock is needed */ - return TRUE; -} - -/** - * Lock CRTC prior to mode setting, mostly for DRI. - * Returns whether unlock is needed - */ -static void fbdev_crtc_unlock(xf86CrtcPtr crtc) -{ - return; -} - - -/** - * Callback to adjust the mode to be set in the CRTC. - * - * This allows a CRTC to adjust the clock or even the entire set of - * timings, which is used for panels with fixed timings or for - * buses with clock limitations. - */ -static Bool fbdev_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, - DisplayModePtr adjusted_mode) -{ - return TRUE; -} - -/** - * Prepare CRTC for an upcoming mode set. - */ -static void fbdev_crtc_prepare(xf86CrtcPtr crtc) -{ - -} - -/** - * Callback for setting up a video mode after fixups have been made. - */ -static void fbdev_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, - DisplayModePtr adjusted_mode, int x, int y) -{ - -} - -/** - * Commit mode changes to a CRTC - */ -static void fbdev_crtc_commit(xf86CrtcPtr crtc) -{ - -} - -/* Set the color ramps for the CRTC to the given values. */ -static void fbdev_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, - CARD16 * blue, int size) -{ - -} - -/** - * Set cursor colors - */ -void fbdev_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg) -{ - return; -} - -/** - * Set cursor position - */ -void fbdev_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) -{ - - return; -} - -/** - * Show cursor - */ -void fbdev_crtc_show_cursor(xf86CrtcPtr crtc) -{ - - return; -} - -/** - * Hide cursor - */ -void fbdev_crtc_hide_cursor(xf86CrtcPtr crtc) -{ - - return; -} - -/** - * Load ARGB image - */ -void fbdev_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image) -{ - - return; -} - -/** - * Less fine-grained mode setting entry point for kernel modesetting - */ -Bool fbdev_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, - Rotation rotation, int x, int y) -{ - return TRUE; -} - - -/** - * Callback for panning. Doesn't change the mode. - * Added in ABI version 2 - */ -static void fbdev_crtc_set_origin(xf86CrtcPtr crtc, int x, int y) -{ - xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, "set_origin: unimplemented"); - return; /* XXX implement */ -} - -/* crtc funcs */ -static const xf86CrtcFuncsRec fbdev_crtc_funcs = -{ - .dpms = fbdev_crtc_dpms, - .save = NULL, /* XXX */ - .restore = NULL, /* XXX */ - .lock = fbdev_crtc_lock, - .unlock = fbdev_crtc_unlock, - .mode_fixup = fbdev_crtc_mode_fixup, - - .prepare = fbdev_crtc_prepare, - .mode_set = fbdev_crtc_mode_set, - .commit = fbdev_crtc_commit, - .gamma_set = fbdev_crtc_gamma_set, - - .shadow_create = NULL, - .shadow_allocate = NULL, - .shadow_destroy = NULL, - - .set_cursor_colors = fbdev_crtc_set_cursor_colors, - .set_cursor_position = fbdev_crtc_set_cursor_position, - .show_cursor = fbdev_crtc_show_cursor, - .hide_cursor = fbdev_crtc_hide_cursor, - .load_cursor_argb = fbdev_crtc_load_cursor_argb, - .destroy = NULL, /* XXX */ - .set_mode_major = NULL, /*???*/ -#if RANDR_13_INTERFACE - .set_origin = fbdev_crtc_set_origin, -#endif -}; - -void FBDevCrtcInit(ScrnInfoPtr pScrn, int num) -{ - xf86CrtcPtr crtc; - FBDevCrtcPrivPtr fbdev_crtc; - - crtc = xf86CrtcCreate (pScrn, &fbdev_crtc_funcs); - if (crtc == NULL) - return; - - fbdev_crtc = xnfcalloc (sizeof (FBDevCrtcPriv), 1); - if (!fbdev_crtc) - { - xf86CrtcDestroy (crtc); - return; - } - - crtc->driver_private = fbdev_crtc; - -} - - diff --git a/src/crtcconfig/fbdev_crtc_priv.h b/src/crtcconfig/fbdev_crtc_priv.h deleted file mode 100644 index 7919fab..0000000 --- a/src/crtcconfig/fbdev_crtc_priv.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 _FBDEV_CRTC_PRIV_H_ -#define _FBDEV_CRTC_PRIV_H_ - -#include "fbdev.h" - -/* fbdev crtc private infomation */ -typedef struct _fbdevCrtcPriv -{ - int type; - -} FBDevCrtcPriv, *FBDevCrtcPrivPtr; -#define FBDEVCRTCPTR(o) ((FBDevCrtcPrivPtr)((o)->driver_private)) - -void FBDevCrtcInit(ScrnInfoPtr pScrn, int num); -#endif // _FBDEV_CRTC_PRIV_H_ diff --git a/src/crtcconfig/fbdev_crtcconfig.c b/src/crtcconfig/fbdev_crtcconfig.c deleted file mode 100644 index 412162b..0000000 --- a/src/crtcconfig/fbdev_crtcconfig.c +++ /dev/null @@ -1,139 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include "fbdev.h" -#include "fbdevhw.h" -#include "fbdev_crtcconfig.h" -#include "fbdev_crtc_priv.h" -#include "fbdev_output_priv.h" - -#include "xf86Crtc.h" - -#define MIN_CRTC_DPY_WIDTH 320 -#define MAX_CRTC_DPY_WIDTH 1024 -#define MIN_CRTC_DPY_HEIGHT 200 -#define MAX_CRTC_DPY_HEIGHT 1024 - -#define NUM_CRTCS 1 - -/** - * Requests that the driver resize the screen. - * - * The driver is responsible for updating scrn->virtualX and scrn->virtualY. - * If the requested size cannot be set, the driver should leave those values - * alone and return FALSE. - * - * A naive driver that cannot reallocate the screen may simply change - * virtual[XY]. A more advanced driver will want to also change the - * devPrivate.ptr and devKind of the screen pixmap, update any offscreen - * pixmaps it may have moved, and change pScrn->displayWidth. - */ -static Bool fbdev_crtc_config_resize (ScrnInfoPtr scrn, int width, int height) -{ - - scrn->virtualX = width; - scrn->virtualY = height; - - return TRUE; -} - - -/* crtc_config_func */ -static const xf86CrtcConfigFuncsRec fbdev_crtc_config_funcs = -{ - .resize = fbdev_crtc_config_resize, -}; - - -/* - * Initialize the CrtcConfig. - * And initialize the mode setting throught create the avaliable crtcs and outputs - * then Initialize the Configuration of Crtc - */ -Bool FBDevCrtcConfigInit(ScrnInfoPtr pScrn) -{ - int min_width, max_width, min_height, max_height; - xf86CrtcConfigPtr crtc_config; - int i, o, c; - FBDevPtr pFBDev = FBDEVPTR(pScrn); - /* TODO: check this routines later whether it is right setting */ - { - - fbdevHWUseBuildinMode(pScrn); /* sets pScrn->modes */ - pScrn->modes = xf86DuplicateMode(pScrn->modes); /* well done, fbdevhw. */ - pScrn->modes->name = NULL; /* fbdevhw string can't be freed */ - pScrn->modes->type = M_T_DRIVER | M_T_PREFERRED; - pScrn->currentMode = pScrn->modes; - pFBDev->builtin = xf86DuplicateMode(pScrn->modes); - - } - - /* allocate an xf86CrtcConfig */ - xf86CrtcConfigInit(pScrn, &fbdev_crtc_config_funcs); - crtc_config = XF86_CRTC_CONFIG_PTR (pScrn); - - min_width = pScrn->modes->HDisplay; - max_width = pScrn->modes->HDisplay; - min_height = pScrn->modes->VDisplay; - max_height = pScrn->modes->VDisplay; - - xf86CrtcSetSizeRange(pScrn, min_width, min_height, max_width, max_height); - - /* set up the crtcs */ - for( i = 0; i < NUM_CRTCS; i++) - FBDevCrtcInit(pScrn, i); - - /* set up the outputs */ - LcdOutputInit(pScrn); - - /* [TODO]: set the crtc to the output in some manner ???? */ - for (o = 0; o < crtc_config->num_output; o++) - { - xf86OutputPtr output = crtc_config->output[o]; - int crtc_mask; - - crtc_mask = 0; - for (c = 0; c < crtc_config->num_crtc; c++) - { - crtc_mask |= (1 << c); - } - output->possible_crtcs = crtc_mask; - output->possible_clones = FALSE; - } - - /* initialize the configuration */ - if(!xf86InitialConfiguration(pScrn, TRUE)) - { - return FALSE; - } - - return TRUE; - -} diff --git a/src/crtcconfig/fbdev_crtcconfig.h b/src/crtcconfig/fbdev_crtcconfig.h deleted file mode 100644 index d84928a..0000000 --- a/src/crtcconfig/fbdev_crtcconfig.h +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 _FBDEV_CRTCCONFIG_H_ -#define _FBDEV_CRTCCONFIG_H_ - -Bool FBDevCrtcConfigInit(ScrnInfoPtr pScrn); - - -#endif // _FBDEV_CRTCCONFIG_H_ diff --git a/src/crtcconfig/fbdev_mode.c b/src/crtcconfig/fbdev_mode.c deleted file mode 100644 index 446417d..0000000 --- a/src/crtcconfig/fbdev_mode.c +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - - -#include "fbdev.h" - -#include -#include "fbdev_hw.h" -#include "fbdev_mode.h" - -typedef struct _FBDevDisplayModeRec -{ - char name[32]; /* identifier for the mode */ - - /* These are the values that the user sees/provides */ - int Clock; /* pixel clock freq (kHz) */ - int HDisplay; /* horizontal timing */ - int HSyncStart; - int HSyncEnd; - int HTotal; - int HSkew; - int VDisplay; /* vertical timing */ - int VSyncStart; - int VSyncEnd; - int VTotal; - int VScan; - int Flags; - -} FBDevDisplayModeRec, *FBDevDisplayModePtr; - -/* [soolim: 20100206][TODO] : it has to be recalculated when it comes to change the target framebuffer - * The display mode data has to be changed whenever the target is changed - * Always check it out. - */ -const FBDevDisplayModeRec fbdevDisplayModes[] = -{ - /* CGA ( 320 x 200 ) */ - {"320x200", 38, 320, 336, 338, 354, 0, 200, 203, 205, 233, 0, 0,}, - /* QVGA ( 320 x 240 ) */ - {"320x240", 38, 320, 336, 338, 354, 0, 240, 243, 245, 273, 0, 0,}, - /* XX ( 240 x 400 ) */ - {"240x400", 38, 240, 256, 258, 274, 0, 400, 428, 430, 433, 0, 0,}, - /* HVGA (320 x 480 ) */ - {"320x480", 38, 320, 336, 338, 354, 0, 480, 483, 485, 513, 0, 0,}, - /* WVGA ( 480 x 720 ) */ - {"480x720", 38, 480, 496, 498, 514, 0, 720, 723, 725, 753, 0, 0}, - /* WVGA ( 480 x 800 ) */ - {"480x800", 38, 480, 496, 498, 514, 0, 800, 803, 805, 833, 0, 0}, - /* VGA ( 640 x 480 ) */ - {"640x480", 19, 640, 840, 880, 959, 0, 480, 491, 501, 511, 0, 0,}, - /* NTSC ( 720 x 480 ) */ - {"720x480", 19, 720, 920, 960, 1039, 0, 480, 491, 501, 511, 0, 0,}, - /* PAL ( 768 x 576 ) */ - {"768x576", 19, 768, 968, 1008, 1087, 0, 576, 587, 597, 607, 0, 0,}, - /* WVGA ( 800 x 480 ) */ - {"800x480", 19, 800, 1000, 1040, 1119, 0, 480, 491, 501, 511, 0, 0}, - /* WVGA ( 854 x 480 ) */ - {"854x480", 19, 854, 1054, 1094, 1173, 0, 480, 491, 501, 511, 0, 0,}, - /* WSVGA ( 600 x 1024 ) */ - {"600x1024", 19, 600, 611, 621, 631, 0, 1024, 1224, 1264, 1343, 0, 0}, - /* WSVGA ( 1024 x 600 ) */ - {"1024x600", 19, 1024, 1224, 1264, 1343, 0, 600, 611, 621, 631, 0, 0}, -#if 0 - /* XGA ( 1024 x 768 ) */ - {"1024x768", 19, 1024, 1224, 1264, 1343, 600, 611, 621, 631, 0,}, -#endif -}; - - -#define NUM_DISPLAY_MODES (sizeof(fbdevDisplayModes)/sizeof(fbdevDisplayModes[0])) - -const int fbdevNumDisplayModes = NUM_DISPLAY_MODES; - - -DisplayModePtr -FBDevGetSupportModes(DisplayModePtr builtin_mode) -{ - DisplayModePtr pMode = NULL; - DisplayModePtr prev_pMode = NULL; - DisplayModePtr ret_pMode = NULL; - int i; - int clock = 0; - if(builtin_mode) - clock = builtin_mode->Clock; - else - clock = 0; - - for(i=0; i< fbdevNumDisplayModes; i++) - { - pMode = calloc(1, sizeof(DisplayModeRec)); - pMode->next = NULL; - pMode->prev = NULL; - pMode->name = calloc(1, sizeof(char)*32); - sprintf(pMode->name,"%s", fbdevDisplayModes[i].name); - pMode->status = MODE_OK; - pMode->type = M_T_DRIVER | M_T_PREFERRED; - - pMode->Clock = clock; - pMode->HDisplay = fbdevDisplayModes[i].HDisplay; - pMode->HSyncStart = fbdevDisplayModes[i].HSyncStart; - pMode->HSyncEnd = fbdevDisplayModes[i].HSyncEnd; - pMode->HTotal = fbdevDisplayModes[i].HTotal; - pMode->HSkew = fbdevDisplayModes[i].HSkew; - pMode->VDisplay = fbdevDisplayModes[i].VDisplay; - pMode->VSyncStart = fbdevDisplayModes[i].VSyncStart; - pMode->VSyncEnd = fbdevDisplayModes[i].VSyncEnd; - pMode->VTotal = fbdevDisplayModes[i].VTotal; - pMode->VScan = fbdevDisplayModes[i].VScan; - pMode->Flags = fbdevDisplayModes[i].Flags; - - if(prev_pMode) - { - pMode->prev = prev_pMode; - prev_pMode->next = pMode; - prev_pMode = prev_pMode->next; - } - else - { - prev_pMode = pMode; - ret_pMode = pMode; - } - - pMode = NULL; - } - - return ret_pMode; -} - -#define OPTION_PREFERRED_MODE 0 - -char * -FBDevCheckPreferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output) -{ - char *preferred_mode = NULL; - - /* Check for a configured preference for a particular mode */ - preferred_mode = xf86GetOptValString (output->options, - OPTION_PREFERRED_MODE); - if (preferred_mode) - return preferred_mode; - - if (pScrn->display->modes && *pScrn->display->modes) - preferred_mode = *pScrn->display->modes; - - return preferred_mode; -} diff --git a/src/crtcconfig/fbdev_mode.h b/src/crtcconfig/fbdev_mode.h deleted file mode 100644 index 3cd7417..0000000 --- a/src/crtcconfig/fbdev_mode.h +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 FBDEV_MODE_H -#define FBDEV_MODE_H - -#include "xf86Crtc.h" - -DisplayModePtr -FBDevGetSupportModes(DisplayModePtr builtin_mode); - -char * -FBDevCheckPreferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output); - -#endif //FBDEV_MODE_H - - diff --git a/src/crtcconfig/fbdev_output_priv.h b/src/crtcconfig/fbdev_output_priv.h deleted file mode 100644 index ade694b..0000000 --- a/src/crtcconfig/fbdev_output_priv.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 _FBDEV_OUTPUT_PRIV_H_ -#define _FBDEV_OUTPUT_PRIV_H_ - -/* fbdev output private infomation */ -typedef struct _fbdevOutputPriv -{ - int type; - void *devPrivate; -} FBDevOutputPriv, *FBDevOutputPrivPtr; -#define FBDEVOUTPUTPTR(o) ((FBDevOutputPrivPtr)((o)->driver_private)) - -void LcdOutputInit(ScrnInfoPtr pScrn); - -#endif // _FBDEV_OUTPUT_PRIV_H_ - - diff --git a/src/crtcconfig/lcd_output.c b/src/crtcconfig/lcd_output.c deleted file mode 100644 index 2aedbe5..0000000 --- a/src/crtcconfig/lcd_output.c +++ /dev/null @@ -1,248 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include "fbdev.h" -#include "fbdev_output_priv.h" -#include "fbdev_mode.h" - -#include - -/********************************************************************************************/ -/* Implementation of Output entry points */ -/********************************************************************************************/ -static void lcd_output_create_resources(xf86OutputPtr output) -{ -} - -static void lcd_output_dpms(xf86OutputPtr output, int mode) -{ - return; -} - -static void lcd_output_save(xf86OutputPtr output) -{ - return; -} - -static void lcd_output_restore(xf86OutputPtr output) -{ - return; -} - -static int lcd_output_mode_valid(xf86OutputPtr output, DisplayModePtr mode) -{ - FBDevPtr pFBDev = FBDEVPTR(output->scrn); - - if(pFBDev->builtin->HDisplay < mode->HDisplay) - return MODE_HSYNC; - - if(pFBDev->builtin->VDisplay < mode->VDisplay) - return MODE_VSYNC; - - output->scrn->currentMode = mode; - - return MODE_OK; - -} - -static Bool lcd_output_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, - DisplayModePtr adjusted_mode) -{ - return TRUE; -} - -static void lcd_output_prepare(xf86OutputPtr output) -{ - return; -} - -static void lcd_output_mode_set(xf86OutputPtr output, DisplayModePtr mode, - DisplayModePtr adjusted_mode) -{ - ScrnInfoPtr pScrn = output ->scrn; - FBDevPtr pFBDev = FBDEVPTR(pScrn); - - /* have to set the physical size of the output */ - output->mm_width = pFBDev->var.width; - output->mm_height = pFBDev->var.height; - output->conf_monitor->mon_width = pFBDev->var.width; - output ->conf_monitor->mon_height = pFBDev->var.height; - - return; -} - -static void lcd_output_commit(xf86OutputPtr output) -{ - return; -} - -static xf86OutputStatus lcd_output_detect(xf86OutputPtr output) -{ - return XF86OutputStatusConnected; -} - - - -/** - * Name : lcd_output_get_modes - * Input : xf86OutputPtr - * Return : DisplayModePtr - * Description : Query the device for the modes it provides. - This function may also update MonInfo, mm_width, and mm_height. - return singly-linked list of modes or NULL if no modes found. - - */ -static int first_time_rotated = TRUE; -static DisplayModePtr lcd_output_get_modes(xf86OutputPtr output) -{ - FBDevPtr pFBDev = FBDEVPTR(output->scrn); - - /* [soolim:20100205] : if there is no mode name in xorg.conf, use the builtin mode */ - char *preferred_mode; - preferred_mode = FBDevCheckPreferredMode(output->scrn, output); - if(!preferred_mode) - { - int HDisplay, VDisplay; - - Bool rotated = (pFBDev->rotate & (RR_Rotate_90|RR_Rotate_270)) != 0; - - if(rotated) - { - if(first_time_rotated) - { - memcpy(&pFBDev->builtin_saved, pFBDev->builtin, sizeof(*pFBDev->builtin)); - VDisplay = pFBDev->builtin->VDisplay; - HDisplay = pFBDev->builtin->HDisplay; - pFBDev->builtin->HDisplay = VDisplay; - pFBDev->builtin->VDisplay = HDisplay; - pFBDev->builtin->name = "fake_mode"; - first_time_rotated = FALSE; - } - return xf86DuplicateMode(pFBDev->builtin); - } - else - { - return xf86DuplicateMode(pFBDev->builtin); - } - } - - /* [soolim:20100205] : gets the supported modes from framebuffer and makes the list */ - DisplayModePtr support_modes = NULL; - - if(!pFBDev->support_modes) - { - support_modes = FBDevGetSupportModes(pFBDev->builtin); - if(pFBDev->builtin != NULL) - { - if(!pFBDev->builtin->next) - { - support_modes->prev = pFBDev->builtin; - pFBDev->builtin->next = support_modes; - pFBDev->builtin->prev = NULL; - } - } - else - { - pFBDev->builtin = support_modes; - } - } - - return support_modes; -} - -static Bool lcd_output_set_property(xf86OutputPtr output, Atom property, - RRPropertyValuePtr value) -{ - return TRUE; -} - -static Bool lcd_output_get_property(xf86OutputPtr output, Atom property) -{ - return TRUE; -} - -static xf86CrtcPtr lcd_output_crtc_get(xf86OutputPtr output) -{ - return 0; -} - -static void lcd_output_destroy(xf86OutputPtr output) -{ - return; -} - - -/* output funcs */ -static const xf86OutputFuncsRec lcd_output_funcs = -{ - .create_resources = lcd_output_create_resources, - .destroy = lcd_output_destroy, - .dpms = lcd_output_dpms, - .save = lcd_output_save, - .restore = lcd_output_restore, - .mode_valid = lcd_output_mode_valid, - - .mode_fixup = lcd_output_mode_fixup, - .prepare = lcd_output_prepare, - .mode_set = lcd_output_mode_set, - .commit = lcd_output_commit, - .detect = lcd_output_detect, - .get_modes = lcd_output_get_modes, -#ifdef RANDR_12_INTERFACE - .set_property = lcd_output_set_property, -#endif -#ifdef RANDR_13_INTERFACE /* not a typo */ - .get_property = lcd_output_get_property, -#endif -#ifdef RANDR_GET_CRTC_INTERFACE - .get_crtc = lcd_output_crtc_get, -#endif -}; - -void LcdOutputInit(ScrnInfoPtr pScrn) -{ - xf86OutputPtr output; - FBDevOutputPrivPtr lcd_output; - - output = xf86OutputCreate (pScrn, &lcd_output_funcs, "LVDS1"); - if (!output) - return; - lcd_output = xnfcalloc (sizeof (FBDevOutputPriv), 1); - if (!lcd_output) - { - xf86OutputDestroy (output); - return; - } - - output->driver_private = lcd_output; - output->interlaceAllowed = FALSE; - output->doubleScanAllowed = FALSE; - -} diff --git a/src/debug/fbdev_event_trace.c b/src/debug/fbdev_event_trace.c deleted file mode 100755 index 120633a..0000000 --- a/src/debug/fbdev_event_trace.c +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include "fbdev.h" -#include "xace.h" -#include "xacestr.h" - -#if 0 -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "windowstr.h" - -#define XREGISTRY -#include "registry.h" - -#define __USE_GNU -#include -#include - -#ifdef HAS_GETPEERUCRED -# include -#endif -#endif - -static void -_traceReceive (CallbackListPtr *pcbl, pointer unused, pointer calldata) -{ - XaceReceiveAccessRec *rec = calldata; - - if (rec->events->u.u.type != VisibilityNotify) - return; - - rec->status = BadAccess; -} - -Bool -fbdevTraceInstallHooks (void) -{ - int ret = TRUE; - - /*Disable Visibility Event*/ - ret &= XaceRegisterCallback (XACE_RECEIVE_ACCESS, _traceReceive, NULL); - - if (!ret) - { - ErrorF ("fbdevInstallHooks: Failed to register one or more callbacks\n"); - return BadAlloc; - } - - return Success; -} - - -Bool -fbdevTraceUninstallHooks (void) -{ - XaceDeleteCallback (XACE_RECEIVE_ACCESS, _traceReceive, NULL); - - return Success; -} - diff --git a/src/debug/fbdev_event_trace.h b/src/debug/fbdev_event_trace.h deleted file mode 100644 index 1b0dbbd..0000000 --- a/src/debug/fbdev_event_trace.h +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 __HEADER_FBDEV_EVENT_TRACE -#define __HEADER_FBDEV_EVENT_TRACE - -Bool fbdevTraceInstallHooks (void); -Bool fbdevTraceUninstallHooks (void); - -#endif /* __HEADER_FBDEV_EVENT_TRACE */ - diff --git a/src/fb/fbdev_fb.c b/src/fb/fbdev_fb.c deleted file mode 100644 index 070504e..0000000 --- a/src/fb/fbdev_fb.c +++ /dev/null @@ -1,296 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include "fbdev.h" -#include "fbdev_util.h" -#include "fbdev_fb.h" - -struct s3cfb_user_window -{ - int x; - int y; -}; - -#define S3CFB_WIN_ON _IOW('F', 305, uint) -#define S3CFB_WIN_OFF _IOW('F', 306, uint) -#define S3CFB_WIN_POSITION _IOW('F', 203, struct s3cfb_user_window) -#define S3CFB_WIN_SET_PIXEL_ALPHA _IOW('F', 211, struct fb_var_screeninfo) - -Bool -fbdevFbGetVarScreenInfo (int fd, struct fb_var_screeninfo *fbVarInfo) -{ - int ret; - - return_val_if_fail (fd >= 0, FALSE); - return_val_if_fail (fbVarInfo != NULL, FALSE); - - ret = ioctl (fd, FBIOGET_VSCREENINFO, (void*)fbVarInfo); - - if (ret) - { - xf86DrvMsg (0, X_ERROR, "FBIOGET_VSCREENINFO failed.\n"); - return FALSE; - } - - return TRUE; -} - -Bool -fbdevFbSetVarScreenInfo (int fd, struct fb_var_screeninfo *fbVarInfo) -{ - int ret; - - return_val_if_fail (fd >= 0, FALSE); - return_val_if_fail (fbVarInfo != NULL, FALSE); - - ret = ioctl (fd, FBIOPUT_VSCREENINFO, (void*)fbVarInfo); - - if (ret) - { - xf86DrvMsg (0, X_ERROR, "FBIOPUT_VSCREENINFO failed.\n"); - return FALSE; - } - - return TRUE; -} - -Bool -fbdevFbGetFixScreenInfo (int fd, struct fb_fix_screeninfo *fbFixInfo) -{ - int ret; - - return_val_if_fail (fd >= 0, FALSE); - return_val_if_fail (fbFixInfo != NULL, FALSE); - - ret = ioctl (fd, FBIOGET_FSCREENINFO, (void*)fbFixInfo); - - if (ret) - { - xf86DrvMsg (0, X_ERROR, "FBIOGET_FSCREENINFO failed.\n"); - return FALSE; - } - - return TRUE; -} - -Bool -fbdevFbSetWinPosition (int fd, int x, int y) -{ - struct s3cfb_user_window pos; - int ret; - - return_val_if_fail (fd >= 0, FALSE); - - pos.x = x; - pos.y = y; - - ret = ioctl (fd, S3CFB_WIN_POSITION, &pos); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "S3CFB_WIN_POSITION failed. pos(%d,%d)\n", x, y); - return FALSE; - } - - return TRUE; -} - -Bool -fbdevFbScreenAlphaInit (int fd) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl (fd, FBIOGET_VSCREENINFO, &var); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "failed to get fb_var\n"); - return FALSE; - } - - if (var.bits_per_pixel != 32) - { - xf86DrvMsg (0, X_ERROR, "per pixel overlay alpha is supported with 32 bpp mode\n"); - return FALSE; - } - var.transp.length = 8; - var.activate = FB_ACTIVATE_FORCE; - ret = ioctl (fd, FBIOPUT_VSCREENINFO, &var); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "failed to set fb_var\n"); - return FALSE; - } - - return TRUE; -} - -Bool -fbdevFbScreenAlphaDeinit (int fd) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl (fd, FBIOGET_VSCREENINFO, &var); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "failed to get fb_var\n"); - return FALSE; - } - - var.transp.length = 0; - ret = ioctl (fd, FBIOPUT_VSCREENINFO, &var); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "failed to set fb_var\n"); - return FALSE; - } - - return TRUE; -} - -#include -void -fbdevFbResetLCDModule() -{ - char rmmod[255]; - char insmod[255]; - struct utsname name; - - if (uname (&name)) - { - ErrorF ("Fail get umane\n"); - } - sprintf (rmmod, "/sbin/rmmod s3c_lcd"); - sprintf (insmod, "/sbin/insmod /opt/driver/s3c_lcd.ko"); - - system (rmmod); - system (insmod); -} - - -/* activate fb */ -Bool -fbdevFbActivate (int fd) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl (fd, FBIOGET_VSCREENINFO, &var); - if (ret < 0) - { - ErrorF ("failed to get fb_var\n"); - return FALSE; - } - - var.activate = FB_ACTIVATE_FORCE; - - ret = ioctl (fd, FBIOPUT_VSCREENINFO, &var); - if (ret < 0) - { - ErrorF ("failed to set fb_var.activate\n"); - return FALSE; - } - - ret = ioctl (fd, FBIOBLANK, FB_BLANK_UNBLANK); - if (ret < 0) - { - ErrorF ("failed to set FBIOBLANK : FB_BLANK_UNBLANK\n"); - return FALSE; - } - - return TRUE; -} - -/* deactivate fb3 */ -Bool -fbdevFbDeActivate (int fd) -{ - int ret; - - ret = ioctl (fd, FBIOBLANK, FB_BLANK_NORMAL); - if (ret < 0) - { - ErrorF ("failed to set FBIOBLANK : FB_BLANK_NORMAL\n"); - return FALSE; - } - - return TRUE; -} - -Bool -fbdevFbSetBase (int fd) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl (fd, FBIOGET_VSCREENINFO, &var); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "failed to get fb_var\n"); - return FALSE; - } - - var.yoffset = 0; - ret = ioctl (fd, FBIOPAN_DISPLAY,&var); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "failed to set fb_var\n"); - return FALSE; - } - return TRUE; -} - - -void -fbdevFbHWPanDisplay (int fd, int x, int y) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl (fd, FBIOGET_VSCREENINFO, &var); - if (ret < 0) - { - xf86DrvMsg (0, X_WARNING, "!!WARNING::%s::fail to get vscreen_info\n", - __func__); - return; - } - - var.xoffset = x; - var.yoffset = y; - ret = ioctl (fd, FBIOPAN_DISPLAY, &var); - if (ret < 0) - { - xf86DrvMsg (0, X_WARNING, "!!WARNING::%s::fail to pandisplay(xoff,%d)(yoff,%d)\n", - __func__, - var.xoffset, - var.yoffset); - return; - } -} diff --git a/src/fb/fbdev_fb.h b/src/fb/fbdev_fb.h deleted file mode 100644 index 6fa8c15..0000000 --- a/src/fb/fbdev_fb.h +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 __FBDEV_FB_H__ -#define __FBDEV_FB_H__ - -#include -#include -#include -#include -#include - -Bool fbdevFbGetVarScreenInfo (int fd, struct fb_var_screeninfo *fbVarInfo); -Bool fbdevFbSetVarScreenInfo (int fd, struct fb_var_screeninfo *fbVarInfo); -Bool fbdevFbGetFixScreenInfo (int fd, struct fb_fix_screeninfo *fbFixInfo); - -Bool fbdevFbSetWinPosition (int fd, int x, int y); - -Bool fbdevFbScreenAlphaInit (int fd); -Bool fbdevFbScreenAlphaDeinit (int fd); -void fbdevFbResetLCDModule (void); -Bool fbdevFbActivate (int fd); -Bool fbdevFbDeActivate (int fd); -Bool fbdevFbSetBase (int fd); -void fbdevFbHWPanDisplay (int fd, int x, int y); - -#endif //__FBDEV_FB_H__ \ No newline at end of file diff --git a/src/fbdev.c b/src/fbdev.c deleted file mode 100644 index 41df0b2..0000000 --- a/src/fbdev.c +++ /dev/null @@ -1,758 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* all driver need this */ -#include "xf86.h" -#include "xf86_OSproc.h" - -#include "fb.h" -#include "mipointer.h" -#include "mibstore.h" -#include "micmap.h" -#include "colormapst.h" -#include "xf86cmap.h" -#include "xf86xv.h" -#include "xf86Crtc.h" - -#include "fbdev.h" -#include "fbdevhw.h" -#include "fbdev_hw.h" -#include "fbdev_video.h" -#include "fbdev_crtcconfig.h" -#include "fbdev_dpms.h" -#include "fbdev_event_trace.h" - -#include -#include -#include - -/* prototypes */ -static const OptionInfoRec * FBDevAvailableOptions(int chipid, int busid); -static void FBDevIdentify(int flags); -static Bool FBDevProbe(DriverPtr drv, int flags); -static Bool FBDevPreInit(ScrnInfoPtr pScrn, int flags); -static Bool FBDevScreenInit(ScreenPtr pScreen, int argc, char **argv); -static Bool FBDevEnterVT(ScrnInfoPtr pScrn); -static void FBDevLeaveVT(ScrnInfoPtr pScrn); -static Bool FBDevCloseScreen(ScreenPtr pScreen); -static void FBDevSaveCurrent(ScrnInfoPtr pScrn); - -/* This DriverRec must be defined in the driver for Xserver to load this driver */ -_X_EXPORT DriverRec FBDEV = -{ - FBDEV_VERSION, - FBDEV_DRIVER_NAME, - FBDevIdentify, - FBDevProbe, - FBDevAvailableOptions, - NULL, - 0, - NULL, -}; - -/* Supported "chipsets" */ -static SymTabRec FBDevChipsets[] = -{ - {-1, NULL } -}; - -/* Supported options */ -typedef enum -{ - OPTION_SWCURSOR, - OPTION_FBDEV -} FBDevOpts; - -static const OptionInfoRec FBDevOptions[] = -{ - { OPTION_SWCURSOR, "swcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FBDEV, "fbdev", OPTV_STRING, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } -}; - -/* -------------------------------------------------------------------- */ - - -#ifdef XFree86LOADER - -MODULESETUPPROTO(FBDevSetup); - -static XF86ModuleVersionInfo FBDevVersRec = -{ - "emulfb", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - PACKAGE_VERSION_MAJOR, - PACKAGE_VERSION_MINOR, - PACKAGE_VERSION_PATCHLEVEL, - ABI_CLASS_VIDEODRV, - ABI_VIDEODRV_VERSION, - NULL, - {0,0,0,0} -}; - -_X_EXPORT XF86ModuleData emulfbModuleData = { &FBDevVersRec, FBDevSetup, NULL }; - -pointer -FBDevSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - - if (!setupDone) - { - setupDone = TRUE; - xf86AddDriver(&FBDEV, module, HaveDriverFuncs); - return (pointer)1; - } - else - { - if (errmaj) *errmaj = LDR_ONCEONLY; - return NULL; - } -} - -#endif /* XFree86LOADER */ - -static Bool -FBDevGetRec(ScrnInfoPtr pScrn) -{ - if (pScrn->driverPrivate != NULL) - return TRUE; - - pScrn->driverPrivate = xnfcalloc(sizeof(FBDevRec), 1); - return TRUE; -} - -static void -FBDevFreeRec(ScrnInfoPtr pScrn) -{ - if (pScrn->driverPrivate == NULL) - return; - free(pScrn->driverPrivate); - pScrn->driverPrivate = NULL; -} - -/* -------------------------------------------------------------------- */ - -static const OptionInfoRec * -FBDevAvailableOptions(int chipid, int busid) -{ - return FBDevOptions; -} - -static void -FBDevIdentify(int flags) -{ - xf86PrintChipsets(FBDEV_NAME, "driver for framebuffer", FBDevChipsets); -} - -/* - * Probing the device with the device node, this probing depend on the specific hw. - * This function just verify whether the display hw is avaliable or not. - */ -static Bool -FBDevHWProbe(struct pci_device * pPci, const char *device,char **namep) -{ - return fbdevHWProbe(pPci, (char *)device,namep); -} - -/* The purpose of this function is to identify all instances of hardware supported - * by the driver. The probe must find the active device sections that match the driver - * by calling xf86MatchDevice(). - */ -static Bool -FBDevProbe(DriverPtr drv, int flags) -{ - int i; - ScrnInfoPtr pScrn; - GDevPtr *devSections; - int numDevSections; - const char *dev; - int entity; - Bool foundScreen = FALSE; - const char * drv_name = "fbdev"; - const char * module_name = "fbdevhw"; - - /* For now, just bail out for PROBE_DETECT. */ - if (flags & PROBE_DETECT) - return FALSE; - - if ((numDevSections = xf86MatchDevice(FBDEV_DRIVER_NAME, &devSections)) <= 0) - return FALSE; - - if (!xf86LoadDrvSubModule (drv, module_name)) - return FALSE; - - for (i = 0; i < numDevSections; i++) - { - dev = xf86FindOptionValue (devSections[i]->options, drv_name); - if (FBDevHWProbe(NULL,dev,NULL)) - { - pScrn = NULL; - entity = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE); - pScrn = xf86ConfigFbEntity(pScrn,0,entity, NULL,NULL,NULL,NULL); - - if (pScrn) - { - foundScreen = TRUE; - - pScrn->driverVersion = FBDEV_VERSION; - pScrn->driverName = FBDEV_DRIVER_NAME; - pScrn->name = FBDEV_NAME; - pScrn->Probe = FBDevProbe; - pScrn->PreInit = FBDevPreInit; - pScrn->ScreenInit = FBDevScreenInit; - pScrn->SwitchMode = fbdevHWSwitchModeWeak(); - pScrn->AdjustFrame = fbdevHWAdjustFrameWeak(); - pScrn->EnterVT = FBDevEnterVT; - pScrn->LeaveVT = FBDevLeaveVT; - pScrn->ValidMode = fbdevHWValidModeWeak(); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO - ,"using %s\n", dev ? dev : "default device"); - } - } - } - free(devSections); - - return foundScreen; -} - -/* - * Return the default depth and bits per pixel. - * Determine the depth and the bpp supported by hw with the hw color format. - */ -static int -FBDevGetDefaultDepth(ScrnInfoPtr pScrn, int *bitsPerPixel) -{ - int defaultDepth; - - /* finding out the valid default_depth */ - defaultDepth = fbdevHWGetDepth(pScrn,bitsPerPixel); - - /* the default depth is not more than 24 */ - defaultDepth = ((*bitsPerPixel)==32)?24:*bitsPerPixel; - - return defaultDepth; -} - -/* - * Initialize the device Probing the device with the device node, - * this probing depend on the specific hw. - * This function just verify whether the display hw is avaliable or not. - */ -static Bool -FBDevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci, const char *device) -{ - /* open device : open the framebuffer device */ - if (!fbdevHWInit(pScrn, NULL, (char *)device)) - { - return FALSE; - } - - return TRUE; -} - -/* - * DeInitialize the hw - */ -static void -FBDevHWDeInit(ScrnInfoPtr pScrn) -{ - /* close the fd of the fb device ??? */ - - return; -} - -/* - * Check the driver option. - * Set the option flags to the driver private - */ -static void -FBDevCheckDriverOptions(ScrnInfoPtr pScrn) -{ - FBDevPtr pFBDev = FBDEVPTR(pScrn); - - /* sw cursor */ - if (xf86ReturnOptValBool(pFBDev->Options, OPTION_SWCURSOR, FALSE)) - pFBDev->bSWCursorEnbled = TRUE; -} - - - -/* - * This is called before ScreenInit to probe the screen configuration. - * The main tasks to do in this funtion are probing, module loading, option handling, - * card mapping, and Crtcs setup. - */ -static Bool -FBDevPreInit(ScrnInfoPtr pScrn, int flags) -{ - FBDevPtr pFBDev; - int default_depth, fbbpp; - const char *path; - Gamma defualt_gamma = {0.0, 0.0, 0.0}; - rgb default_weight = { 0, 0, 0 }; - int flag24; - const char * fb_name = "fbdev"; - - if (flags & PROBE_DETECT) return FALSE; - - /* Check the number of entities, and fail if it isn't one. */ - if (pScrn->numEntities != 1) - return FALSE; - - pScrn->monitor = pScrn->confScreen->monitor; - - /* allocate private */ - FBDevGetRec(pScrn); - pFBDev = FBDEVPTR(pScrn); - - pFBDev->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); - - /* can set the path with fbdev option */ - path = xf86FindOptionValue(pFBDev->pEnt->device->options, fb_name); - - /* Init HW */ - if(!FBDevHWInit(pScrn,NULL,path)) - { - xf86DrvMsg(pScrn->scrnIndex, X_Error - , "fail to initialize hardware\n"); - goto bail1; - } - - /* finding out the valid default_depth */ - default_depth = FBDevGetDefaultDepth(pScrn,&fbbpp); - - /* set the depth and the bpp to pScrn */ - flag24 = Support24bppFb | Support32bppFb; - if (!xf86SetDepthBpp(pScrn, default_depth, default_depth, fbbpp, flag24)) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR - , "fail to find the depth\n"); - goto bail1; - } - xf86PrintDepthBpp(pScrn); /* just print out the depth and the bpp */ - - /* color weight */ - if (!xf86SetWeight(pScrn, default_weight, default_weight)) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR - , "fail to set the color weight of RGB\n"); - goto bail1; - } - - /* visual init, make a TrueColor, -1 */ - if (!xf86SetDefaultVisual(pScrn, -1)) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR - , "fail to initialize the default visual\n"); - goto bail1; - } - - /* set gamma */ - if (!xf86SetGamma(pScrn,defualt_gamma)) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR - , "fail to set the gamma\n"); - goto bail1; - } - - pScrn->progClock = TRUE; - pScrn->rgbBits = 8; - pScrn->chipset = "fbdev"; - pScrn->videoRam = fbdevHWGetVidmem(pScrn); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO - , "hardware: %s (video memory: %dkB)\n" - , fbdevHWGetName(pScrn) - , pScrn->videoRam/1024); - - /* Collect all the option flags (fill in pScrn->options) */ - xf86CollectOptions(pScrn, NULL); - - /* - * Process the options based on the information S5POptions. - * The results are written to pS5P->Options. If all the options - * processing is done within this fuction a local variable "options" - * can be used instead of pS5P->Options - */ - if (!(pFBDev->Options = malloc(sizeof(FBDevOptions)))) - goto bail1; - memcpy(pFBDev->Options, FBDevOptions, sizeof(FBDevOptions)); - xf86ProcessOptions(pScrn->scrnIndex, pFBDev->pEnt->device->options, pFBDev->Options); - - /* Check with the driver options */ - FBDevCheckDriverOptions(pScrn); - - /* Set the Crtc, the default Output, and the current Mode */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO - , "checking modes against framebuffer device and creating crtc and ouput...\n"); - if(!FBDevCrtcConfigInit(pScrn)) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR - , "Fail to init the CrtcConfig\n"); - goto bail1; - } - FBDevSaveCurrent(pScrn); - - /* TODO::soolim:: re-confirm this condition */ - if(pScrn->currentMode->HDisplay == pFBDev->var.xres_virtual - && pScrn->currentMode->VDisplay <= pFBDev->var.yres_virtual) - { - pScrn->virtualX = pFBDev->var.xres_virtual; - pScrn->virtualY = pFBDev->var.yres_virtual; - } - else - { - pScrn->virtualX = pScrn->currentMode->HDisplay; - pScrn->virtualY = pScrn->currentMode->VDisplay; - } - pScrn->displayWidth = pScrn->virtualX; - xf86PrintModes(pScrn); /* just print the current mode */ - - /* Set display resolution */ - if(pFBDev->var.width && pFBDev->var.height) - { - pScrn->monitor->widthmm = pFBDev->var.width; - pScrn->monitor->heightmm = pFBDev->var.height; - } - xf86SetDpi(pScrn, 0, 0); - - /* Load fb submodule */ - if (!xf86LoadSubModule(pScrn, "fb")) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "fail to load fb module\n"); - goto bail1; - } - - return TRUE; - -bail1: - FBDevFreeRec(pScrn); - FBDevHWDeInit(pScrn); - return FALSE; -} - -static void -FBDevAdjustFrame(ScrnInfoPtr pScrn, int x, int y) -{ - fbdevHWAdjustFrame(pScrn, x, y); -} - - -/* Save the hw information */ -static void -FBDevSave(ScrnInfoPtr pScrn) -{ - FBDevPtr pFBDev = FBDEVPTR(pScrn); - - FBDevGetVarScreenInfo(fbdevHWGetFD(pScrn), &pFBDev->saved_var); -} - -/* Restore the hw information */ -static void -FBDevRestore(ScrnInfoPtr pScrn) -{ - FBDevPtr pFBDev = FBDEVPTR(pScrn); - - FBDevSetVarScreenInfo(fbdevHWGetFD(pScrn), &pFBDev->saved_var); -} - -/* Save the current hw information */ -static void -FBDevSaveCurrent(ScrnInfoPtr pScrn) -{ - FBDevPtr pFBDev = FBDEVPTR(pScrn); - - FBDevGetVarScreenInfo(fbdevHWGetFD(pScrn), &pFBDev->var); - FBDevGetFixScreenInfo(fbdevHWGetFD(pScrn), &pFBDev->fix); -} - -static Bool -FBDevModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - if (!fbdevHWModeInit(pScrn, mode)) - return FALSE; - - return TRUE; -} - -/* Get the address of the framebuffer */ -static unsigned char * -FBDevGetFbAddr(ScrnInfoPtr pScrn) -{ - FBDevPtr pFBDev = FBDEVPTR(pScrn); - return pFBDev->fbstart; -} - -static Bool -FBDevScreenInit(ScreenPtr pScreen, int argc, char **argv) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - FBDevPtr pFBDev = FBDEVPTR(pScrn); - VisualPtr visual; - int init_picture = 0; - unsigned char * pFbAddr; - pFBDev->rotate = RR_Rotate_0; - Bool rotated = (pFBDev->rotate & (RR_Rotate_90|RR_Rotate_270)) != 0; - - xf86DrvMsg(pScrn->scrnIndex,X_INFO, - "Infomation of Visual is \n\tbitsPerPixel=%d, depth=%d, defaultVisual=%s\n" - "\tmask: %x,%x,%x, offset: %d,%d,%d\n", - pScrn->bitsPerPixel, - pScrn->depth, - xf86GetVisualName(pScrn->defaultVisual), - (unsigned int) pScrn->mask.red, - (unsigned int) pScrn->mask.green, - (unsigned int) pScrn->mask.blue, - (int)pScrn->offset.red, - (int)pScrn->offset.green, - (int)pScrn->offset.blue); - - pFBDev->fbmem = fbdevHWMapVidmem(pScrn); /* mmap memory pointer */ - if (!pFBDev->fbmem) - { - xf86DrvMsg(pScrn->scrnIndex,X_ERROR - ,"mapping of video memory failed\n"); - return FALSE; - } - pFBDev->fboff = fbdevHWLinearOffset(pScrn); - - /* save fb information */ - FBDevSave(pScrn); - - /* set mode and set fb info */ - DisplayModePtr tmpMode; - - if(rotated) - tmpMode = &pFBDev->builtin_saved; - else - tmpMode = pScrn->currentMode; - - if (!FBDevModeInit(pScrn, tmpMode)) - { - xf86DrvMsg(pScrn->scrnIndex,X_ERROR - ,"mode initialization failed\n"); - return FALSE; - } - - fbdevHWSaveScreen(pScreen, SCREEN_SAVER_ON); - FBDevAdjustFrame(pScrn,0,0); - - FBDevSaveCurrent(pScrn); - - /* mi layer */ - miClearVisualTypes(); - if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, TrueColor)) - { - xf86DrvMsg(pScrn->scrnIndex,X_ERROR - ,"visual type setup failed for %d bits per pixel [1]\n" - , pScrn->bitsPerPixel); - return FALSE; - } - if (!miSetPixmapDepths()) - { - xf86DrvMsg(pScrn->scrnIndex,X_ERROR - ,"pixmap depth setup failed\n"); - return FALSE; - } - - /* set the starting point of the framebuffer */ - pFBDev->fbstart = pFBDev->fbmem + pFBDev->fboff; - - /* Get the screen address */ - pFbAddr = FBDevGetFbAddr(pScrn); - - switch (pScrn->bitsPerPixel) - { - case 16: - case 24: - case 32: - if(! fbScreenInit(pScreen, pFbAddr, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->virtualX, /*Pixel width for framebuffer*/ - pScrn->bitsPerPixel)) - return FALSE; - - init_picture = 1; - - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR - , "internal error: invalid number of bits per pixel (%d) encountered\n" - , pScrn->bitsPerPixel); - break; - } - - if (pScrn->bitsPerPixel > 8) - { - /* Fixup RGB ordering */ - visual = pScreen->visuals + pScreen->numVisuals; - while (--visual >= pScreen->visuals) - { - if ((visual->class | DynamicClass) == DirectColor) - { - visual->offsetRed = pScrn->offset.red; - visual->offsetGreen = pScrn->offset.green; - visual->offsetBlue = pScrn->offset.blue; - visual->redMask = pScrn->mask.red; - visual->greenMask = pScrn->mask.green; - visual->blueMask = pScrn->mask.blue; - } - } - } - - /* must be after RGB ordering fixed */ - if (init_picture && !fbPictureInit(pScreen, NULL, 0)) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING - , "Render extension initialisation failed\n"); - - /* XVideo Initiailization here */ -#ifdef XV - if (!fbdevVideoInit(pScreen)) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "XVideo extention initialization failed\n"); -#endif - - xf86SetBlackWhitePixels(pScreen); - miInitializeBackingStore(pScreen); - xf86SetBackingStore(pScreen); - - /* Check whether the SWCURSOR option is enbled */ - if(pFBDev->bSWCursorEnbled) - { - /* use software cursor */ - miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - } - else - { - /* use dummy hw_cursro instead of sw_cursor */ - miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - xf86DrvMsg(pScrn->scrnIndex, X_INFO - , "Initializing HW Cursor\n"); - - if(!xf86_cursors_init(pScreen, SEC_CURSOR_W, SEC_CURSOR_H, (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | - HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | - HARDWARE_CURSOR_INVERT_MASK | - HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | - HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | - HARDWARE_CURSOR_ARGB))) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR - , "Hardware cursor initialization failed\n"); - } - } - - /* crtc init */ - if (!xf86CrtcScreenInit(pScreen)) - return FALSE; - - /* set the desire mode : set the mode to xf86crtc here */ - xf86SetDesiredModes(pScrn); - - /* colormap */ - if (!miCreateDefColormap(pScreen)) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR - , "internal error: miCreateDefColormap failed \n"); - return FALSE; - } - - if(!xf86HandleColormaps(pScreen, 256, 8, fbdevHWLoadPaletteWeak(), NULL, CMAP_PALETTED_TRUECOLOR)) - return FALSE; - - xf86DPMSInit(pScreen, FBDevDPMSSet(), 0); - pScreen->SaveScreen = FBDevSaveScreen(); - pFBDev->isLcdOff = FALSE; - - /* Wrap the current CloseScreen function */ - pFBDev->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = FBDevCloseScreen; - - /* register the event hook */ - fbdevTraceInstallHooks (); - - return TRUE; -} - - -static Bool -FBDevEnterVT(ScrnInfoPtr pScrn) -{ - xf86DrvMsg(pScrn->scrnIndex, X_INFO - , "EnterVT::Hardware state at EnterVT:\n"); - return TRUE; -} - -static void -FBDevLeaveVT(ScrnInfoPtr pScrn) -{ - xf86DrvMsg(pScrn->scrnIndex, X_INFO - , "LeaveVT::Hardware state at LeaveVT:\n"); -} - -static Bool -FBDevCloseScreen(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - FBDevPtr pFBDev = FBDEVPTR(pScrn); - - fbdevTraceUninstallHooks (); - - FBDevRestore(pScrn); - - fbdevHWUnmapVidmem(pScrn); - pScrn->vtSema = FALSE; - - if(!pFBDev->bLockScreen) - FBDevRestore(pScrn); - else - ErrorF("Screen closed but LCD was locked\n"); - - FBDevHWDeInit(pScrn); - - pScreen->CreateScreenResources = pFBDev->CreateScreenResources; - pScreen->CloseScreen = pFBDev->CloseScreen; - - return (*pScreen->CloseScreen)(pScreen); -} - - - - diff --git a/src/fbdev.h b/src/fbdev.h deleted file mode 100644 index 0ef4b7c..0000000 --- a/src/fbdev.h +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 FBDEV_H -#define FBDEV_H - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "fbdevhw.h" -#include "xf86xv.h" -#include - -#define PAGE_SIZE 4096 - -#define FBDEV_VERSION 1000 /* the version of the driver */ -#define FBDEV_NAME "FBDEV" /* the name used to prefix messages */ -#define FBDEV_DRIVER_NAME "emulfb" /* the driver name as used in config file. - * This name should match the name of the driver module binary - * In this driver, the name of the driver libary module is emulfb_drv.so. - */ -#define SWAPINT(i, j) \ -{ int _t = i; i = j; j = _t; } - -#define SEC_CURSOR_W 64 -#define SEC_CURSOR_H 64 - -/* FBDev driver private data structure to hold the driver's screen-specific data */ -typedef struct { - unsigned char *fbstart; /* start memory point of framebuffer: (fbmem + fboff) */ - unsigned char *fbmem; /* mmap memory pointer of framebuffer */ - int fboff; /* fb offset */ - int lineLength; - CloseScreenProcPtr CloseScreen; - CreateScreenResourcesProcPtr CreateScreenResources; - void (*PointerMoved)(int index, int x, int y); - EntityInfoPtr pEnt; - - /* driver options */ - OptionInfoPtr Options; - Bool bSWCursorEnbled; /* software cursor enabled */ - int rotate; - - /* saved video mode */ - struct fb_var_screeninfo saved_var; - - /* Current information of Framebuffer */ - struct fb_var_screeninfo var; - struct fb_fix_screeninfo fix; - - /* mode infos */ - DisplayModePtr builtin; - DisplayModeRec builtin_saved; /* original mode to send the fake mode when the screen rotates */ - DisplayModePtr support_modes; - - /* xv */ -#ifdef XV - XF86VideoAdaptorPtr pAdaptor; - void **v4l2_owner; - int v4l2_num; - Bool bFbAlphaEnabled; -#endif - - Bool bLockScreen; - - /* dpms - flag for the control of lcd onoff*/ - Bool isLcdOff; - - /* Cursor */ - Bool enableCursor; -} FBDevRec, *FBDevPtr; -#define FBDEVPTR(p) ((FBDevPtr)((p)->driverPrivate)) - -#endif //FBDEV_H - diff --git a/src/fbdev_dpms.c b/src/fbdev_dpms.c deleted file mode 100644 index a049cef..0000000 --- a/src/fbdev_dpms.c +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include "fbdev.h" -#include -#include -#include -#include -#include -#include "fbdev.h" -#include "fbdevhw.h" -#include "fbdev_hw.h" -#include - -#include "misc.h" -#include "fbdev_dpms.h" - -CallbackListPtr DPMSCallback; - -static void -_dpmsCallCallback (ScrnInfoPtr pScrn, int mode, int flags) -{ - FBDevDPMSRec dpmsinfo; - - if (!DPMSCallback) - return; - - dpmsinfo.pScrn = pScrn; - dpmsinfo.mode = mode; - dpmsinfo.flags = flags; - - CallCallbacks (&DPMSCallback, (pointer) &dpmsinfo); -} - -static void -fbdevDPMSSetFunc(ScrnInfoPtr pScrn, int mode, int flags) -{ - FBDevPtr pFBDev = FBDEVPTR(pScrn); - int call_before; - - call_before = (DPMSPowerLevel == DPMSModeSuspend || - DPMSPowerLevel == DPMSModeOff) ? 1 : 0; - - if (call_before) - _dpmsCallCallback (pScrn, mode, flags); - - switch(DPMSPowerLevel) - { - case DPMSModeOn: - case DPMSModeSuspend: - break; - case DPMSModeStandby: - if(pFBDev->isLcdOff == FALSE) break; - - /* lcd on */ - if (-1 == ioctl(fbdevHWGetFD(pScrn), FBIOBLANK, FB_BLANK_UNBLANK)) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOBLANK: %s\n", strerror(errno)); - } - - pFBDev->isLcdOff = FALSE; - break; - case DPMSModeOff: - if(pFBDev->isLcdOff == TRUE) break; - - /* lcd off */ - if (-1 == ioctl(fbdevHWGetFD(pScrn), FBIOBLANK, FB_BLANK_POWERDOWN)) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOBLANK: %s\n", strerror(errno)); - } - - pFBDev->isLcdOff = TRUE; - break; - default: - return; - } - - if (!call_before) - _dpmsCallCallback (pScrn, mode, flags); -} - -xf86DPMSSetProc* -FBDevDPMSSet(void) -{ - return fbdevDPMSSetFunc; -} - -static Bool first_savescreen = FALSE; - -static Bool -fbdevSaveScreenFunc(ScreenPtr pScreen, int mode) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - - if(!first_savescreen) - { - first_savescreen = TRUE; - if (-1 == ioctl(fbdevHWGetFD(pScrn), FBIOBLANK, (void *)(0))) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOBLANK: %s\n", strerror(errno)); - } - } - - return TRUE; -} - - -SaveScreenProcPtr -FBDevSaveScreen(void) -{ - return fbdevSaveScreenFunc; -} - diff --git a/src/fbdev_dpms.h b/src/fbdev_dpms.h deleted file mode 100644 index 9633efc..0000000 --- a/src/fbdev_dpms.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 FBDEV_DPMS_H -#define FBDEV_DPMS_H - -typedef struct -{ - ScrnInfoPtr pScrn; - int mode; - int flags; -} FBDevDPMSRec, *FBDevDPMSPtr; - -xf86DPMSSetProc* FBDevDPMSSet(void); -SaveScreenProcPtr FBDevSaveScreen(void); - -#endif /* FBDEV_DPMS_H */ - diff --git a/src/fbdevhw/fbdev_hw.c b/src/fbdevhw/fbdev_hw.c deleted file mode 100644 index fd5c0d4..0000000 --- a/src/fbdevhw/fbdev_hw.c +++ /dev/null @@ -1,196 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include "fbdev.h" -#include "fbdev_hw.h" - -void -FBDevGetVarScreenInfo(int fd, struct fb_var_screeninfo *fbVarInfo) -{ - if (0 != ioctl(fd,FBIOGET_VSCREENINFO, (void*)fbVarInfo)) - fprintf(stderr, "Error : fail to get FBIOGET_VSCREENINFO\n"); -} - -void -FBDevSetVarScreenInfo(int fd, struct fb_var_screeninfo *fbVarInfo) -{ - if (0 != ioctl(fd,FBIOPUT_VSCREENINFO,(void*)fbVarInfo)) - fprintf(stderr, "Error : fail to get FBIOPUT_VSCREENINFO\n"); -} - -void -FBDevGetFixScreenInfo(int fd, struct fb_fix_screeninfo *fbFixInfo) -{ - if (0 != ioctl(fd,FBIOGET_FSCREENINFO,(void*)fbFixInfo)) - fprintf(stderr, "Error : fail to get FBIOGET_FSCREENINFO\n"); -} - -Bool -FBDevScreenAlphaInit(int fd) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl(fd, FBIOGET_VSCREENINFO, &var); - if (ret < 0) - { - return FALSE; - } - - if (var.bits_per_pixel != 32) - { - return FALSE; - } - var.transp.length = 8; - var.activate = FB_ACTIVATE_FORCE; - ret = ioctl(fd, FBIOPUT_VSCREENINFO, &var); - if (ret < 0) - { - return FALSE; - } - - return TRUE; -} - -Bool -FBDevScreenAlphaDeinit(int fd) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl(fd, FBIOGET_VSCREENINFO, &var); - if (ret < 0) - { - return FALSE; - } - - var.transp.length = 0; - ret = ioctl(fd, FBIOPUT_VSCREENINFO, &var); - if (ret < 0) - { - return FALSE; - } - - return TRUE; -} - -#include - -/* activate fb */ -Bool -FBDevActivateFB(int fd) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl(fd, FBIOGET_VSCREENINFO, &var); - if (ret < 0) - { - ErrorF("failed to get fb_var\n"); - return FALSE; - } - - var.activate = FB_ACTIVATE_FORCE; - - ret = ioctl (fd, FBIOPUT_VSCREENINFO, &var); - if (ret < 0) - { - ErrorF("failed to set fb_var.activate\n"); - return FALSE; - } - - ret = ioctl (fd, FBIOBLANK, FB_BLANK_UNBLANK); - if (ret < 0) - { - ErrorF("failed to set FBIOBLANK : FB_BLANK_UNBLANK\n"); - return FALSE; - } - - return TRUE; -} - -/* deactivate fb3 */ -Bool -FBDevDeActivateFB(int fd) -{ - int ret; - - ret = ioctl (fd, FBIOBLANK, FB_BLANK_POWERDOWN); - if (ret < 0) - { - ErrorF("failed to set FBIOBLANK : FB_BLANK_POWERDOWN\n"); - return FALSE; - } - - return TRUE; -} - -Bool -FBDevSetBaseFrameBuffer(int fd) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl(fd, FBIOGET_VSCREENINFO, &var); - if (ret < 0) - { - return FALSE; - } - - var.yoffset = 0; - ret = ioctl (fd, FBIOPAN_DISPLAY,&var); - if (ret < 0) - { - return FALSE; - } - return TRUE; -} - - -void -FBDevHWPanDisplay(int fd, int x, int y) -{ - struct fb_var_screeninfo var; - int ret; - - ret = ioctl(fd, FBIOGET_VSCREENINFO, &var); - if(ret < 0) - { - return; - } - - var.xoffset = x; - var.yoffset = y; - ret = ioctl(fd, FBIOPAN_DISPLAY, &var); - if(ret < 0) - { - return; - } -} diff --git a/src/fbdevhw/fbdev_hw.h b/src/fbdevhw/fbdev_hw.h deleted file mode 100644 index 1f83443..0000000 --- a/src/fbdevhw/fbdev_hw.h +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: SooChan Lim - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 FBDEV_HW_H -#define FBDEV_HW_H - -#include -#include -#include -#include - -void FBDevGetVarScreenInfo(int fd, struct fb_var_screeninfo *fbVarInfo); -void FBDevSetVarScreenInfo(int fd, struct fb_var_screeninfo *fbVarInfo); -void FBDevGetFixScreenInfo(int fd, struct fb_fix_screeninfo *fbFixInfo); - -Bool FBDevScreenAlphaInit(int fd); -Bool FBDevScreenAlphaDeinit(int fd); -Bool FBDevActivateFB(int fd); -Bool FBDevDeActivateFB(int fd); -Bool FBDevSetBaseFrameBuffer(int fd); -void FBDevHWPanDisplay(int fd, int x, int y); - -#endif //FBDEV_HW_H - diff --git a/src/util/fbdev_pixman.c b/src/util/fbdev_pixman.c deleted file mode 100644 index 4a74b72..0000000 --- a/src/util/fbdev_pixman.c +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include "fbdev_util.h" -#include "fbdev_pixman.h" - -int -fbdev_pixman_convert_image (int xres, - int yres, - unsigned char *srcbuf, - unsigned char *dstbuf, - pixman_format_code_t src_format, - pixman_format_code_t dst_format, - xRectangle *img, - xRectangle *pixmap, - xRectangle *draw, - xRectangle *src, - xRectangle *dst, - RegionPtr clip_region, - int rotate, - int hflip, - int vflip) -{ - pixman_image_t *src_img; - pixman_image_t *dst_img; - struct pixman_f_transform ft; - pixman_transform_t transform; - int src_stride, dst_stride; - int src_bpp; - int dst_bpp; - double scale_x, scale_y; - pixman_op_t op; - int rotate_step; - int ret = FALSE; - - return_val_if_fail (srcbuf != NULL, FALSE); - return_val_if_fail (dstbuf != NULL, FALSE); - return_val_if_fail (img != NULL, FALSE); - return_val_if_fail (pixmap != NULL, FALSE); - return_val_if_fail (draw != NULL, FALSE); - return_val_if_fail (src != NULL, FALSE); - return_val_if_fail (dst != NULL, FALSE); - return_val_if_fail (rotate <= 360 && rotate >= -360, FALSE); - - DRVLOG ("[Convert] img(%dx%d) src(%d,%d %dx%d) dst(%dx%d) flip(%d,%d), r(%d)\n", - img->width, img->height, src->x, src->y, src->width, src->height, - dst->width, dst->height, hflip, vflip, rotate); - - op = PIXMAN_OP_SRC; - - src_bpp = PIXMAN_FORMAT_BPP (src_format) / 8; - return_val_if_fail (src_bpp > 0, FALSE); - - dst_bpp = PIXMAN_FORMAT_BPP (dst_format) / 8; - return_val_if_fail (dst_bpp > 0, FALSE); - - rotate_step = (rotate + 360) / 90 % 4; - - src_stride = img->width * src_bpp; - dst_stride = pixmap->width * dst_bpp; - - src_img = pixman_image_create_bits (src_format, img->width, img->height, (uint32_t*)srcbuf, src_stride); - dst_img = pixman_image_create_bits (dst_format, pixmap->width, pixmap->height, (uint32_t*)dstbuf, dst_stride); - - goto_if_fail (src_img != NULL, CANT_CONVERT); - goto_if_fail (dst_img != NULL, CANT_CONVERT); - - pixman_f_transform_init_identity (&ft); - - if (hflip) - { - pixman_f_transform_scale (&ft, NULL, -1, 1); - pixman_f_transform_translate (&ft, NULL, draw->width, 0); - } - - if (vflip) - { - pixman_f_transform_scale (&ft, NULL, 1, -1); - pixman_f_transform_translate (&ft, NULL, 0, draw->height); - } - - if (rotate_step > 0) - { - int c, s, tx = 0, ty = 0; - switch (rotate_step) - { - case 1: - /* 270 degrees */ - c = 0; - s = -1; - ty = draw->width; - break; - case 2: - /* 180 degrees */ - c = -1; - s = 0; - tx = draw->width; - ty = draw->height; - break; - case 3: - /* 90 degrees */ - c = 0; - s = 1; - tx = draw->height; - break; - default: - /* 0 degrees */ - c = 0; - s = 0; - break; - } - pixman_f_transform_rotate (&ft, NULL, c, s); - pixman_f_transform_translate (&ft, NULL, tx, ty); - } - - if (rotate_step % 2 == 0) - { - scale_x = (double)src->width / dst->width; - scale_y = (double)src->height / dst->height; - } - else - { - scale_x = (double)src->width / dst->height; - scale_y = (double)src->height / dst->width; - } - - pixman_f_transform_scale (&ft, NULL, scale_x, scale_y); - pixman_f_transform_translate (&ft, NULL, src->x, src->y); - - pixman_transform_from_pixman_f_transform (&transform, &ft); - pixman_image_set_transform (src_img, &transform); - - pixman_image_composite (op, src_img, NULL, dst_img, - 0, 0, 0, 0, dst->x, dst->y, dst->width, dst->height); - - ret = TRUE; - -CANT_CONVERT: - if (src_img) - pixman_image_unref (src_img); - if (dst_img) - pixman_image_unref (dst_img); - - return ret; -} - diff --git a/src/util/fbdev_pixman.h b/src/util/fbdev_pixman.h deleted file mode 100644 index 4ea4561..0000000 --- a/src/util/fbdev_pixman.h +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 __FBDEV_PIXMAN_H__ -#define __FBDEV_PIXMAN_H__ - -#include -#include -#include - -#include - -#ifndef FALSE -#define FALSE 0 -#define TRUE (!FALSE) -#endif - -#ifndef NULL -#define NULL (void*)0 -#endif - -int -fbdev_pixman_convert_image (int xres, - int yres, - unsigned char *srcbuf, - unsigned char *dstbuf, - pixman_format_code_t src_format, - pixman_format_code_t dst_format, - xRectangle *img, - xRectangle *pixmap, - xRectangle *draw, - xRectangle *src, - xRectangle *dst, - RegionPtr clip_region, - int rotate, - int hflip, - int vflip); - -#endif /* __FBDEV_PIXMAN_H__ */ diff --git a/src/util/fbdev_util.c b/src/util/fbdev_util.c deleted file mode 100644 index 44ace73..0000000 --- a/src/util/fbdev_util.c +++ /dev/null @@ -1,226 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: YoungHoon Jung - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include -#include -#include -#include -#include - -#include "X11/XWDFile.h" -#include "fbdev.h" -#include "fbdev_util.h" - -int fbdev_util_dump_raw(const char * file, const void * data, int width, int height) -{ - unsigned int * blocks; - - FILE * fp = fopen(file, "w+"); - if (fp == NULL) - return 0; - - blocks = (unsigned int *) data; - fwrite(blocks, 4, width*height, fp); - - fclose(fp); - - return 1; -} - -#ifndef RR_Rotate_All -#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270) -#endif - -int fbdev_util_degree_to_rotate(int degree) -{ - int rotate; - - switch(degree) - { - case 0: - rotate = RR_Rotate_0; - break; - case 90: - rotate = RR_Rotate_90; - break; - case 180: - rotate = RR_Rotate_180; - break; - case 270: - rotate = RR_Rotate_270; - break; - default: - rotate = 0; /* ERROR */ - break; - } - - return rotate; -} - -int fbdev_util_rotate_to_degree(int rotate) -{ - int degree; - - switch(rotate & RR_Rotate_All) - { - case RR_Rotate_0: - degree = 0; - break; - case RR_Rotate_90: - degree = 90; - break; - case RR_Rotate_180: - degree = 180; - break; - case RR_Rotate_270: - degree = 270; - break; - default: - degree = -1; /* ERROR */ - break; - } - - return degree; -} - -static int -_fbdev_util_rotate_to_int(int rot) -{ - switch(rot & RR_Rotate_All) - { - case RR_Rotate_0: - return 0; - case RR_Rotate_90: - return 1; - case RR_Rotate_180: - return 2; - case RR_Rotate_270: - return 3; - } - - return 0; -} - -int fbdev_util_rotate_add(int rot_a, int rot_b) -{ - int a = _fbdev_util_rotate_to_int(rot_a); - int b = _fbdev_util_rotate_to_int(rot_b); - - return (int)((1 << ((a+b)%4))&RR_Rotate_All); -} - -const PropertyPtr -fbdev_util_get_window_property(WindowPtr pWin, const char* prop_name) -{ - int rc; - Mask prop_mode = DixReadAccess; - Atom property; - PropertyPtr pProp; - - property = MakeAtom(prop_name, strlen(prop_name), FALSE); - if(property == None) - return NULL; - - rc = dixLookupProperty(&pProp, pWin, property, serverClient, prop_mode); - if (rc == Success && pProp->data) - { - return pProp; - } - - return NULL; -} - - -void -fbdev_util_rotate_rect (int xres, - int yres, - int src_rot, - int dst_rot, - xRectangle *src) -{ - int diff; - xRectangle temp; - - return_if_fail (src != NULL); - - if (src_rot == dst_rot) - return; - - diff = (dst_rot - src_rot); - if (diff < 0) - diff = 360 + diff; - - if (src_rot % 180 && diff % 180) - SWAP (xres, yres); - - switch (diff) - { - case 270: - temp.x = yres - (src->y + src->height); - temp.y = src->x; - temp.width = src->height; - temp.height = src->width; - break; - case 180: - temp.x = xres - (src->x + src->width); - temp.y = yres - (src->y + src->height); - temp.width = src->width; - temp.height = src->height; - break; - case 90: - temp.x = src->y; - temp.y = xres - (src->x + src->width); - temp.width = src->height; - temp.height = src->width; - break; - default: - temp.x = src->x; - temp.y = src->y; - temp.width = src->width; - temp.height = src->height; - break; - } - - *src = temp; -} - - -void -drvlog (const char * f, ...) -{ - va_list args; - char temp[1024]; - - va_start (args, f); - vsnprintf (temp, sizeof (temp), f, args); - va_end (args); - - fwrite (temp, strlen (temp), 1, stderr); -} diff --git a/src/util/fbdev_util.h b/src/util/fbdev_util.h deleted file mode 100644 index bb6f6b4..0000000 --- a/src/util/fbdev_util.h +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: YoungHoon Jung - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ -#include "property.h" - -#ifndef CLEAR -#define CLEAR(x) memset(&(x), 0, sizeof (x)) -#endif - -#ifndef MAX -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#ifndef SWAP -#define SWAP(a, b) ({int t; t = a; a = b; b = t;}) -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -void drvlog (const char * f, ...); - -#if ENABLE_DEBUG -#define DRVLOG(fmt, arg...) drvlog(fmt, ##arg) -#else -#define DRVLOG(fmt, arg...) {;} -#endif - -#define return_if_fail(cond) {if (!(cond)) { ErrorF ("%s : '%s' failed.\n", __FUNCTION__, #cond); return; }} -#define return_val_if_fail(cond, val) {if (!(cond)) { ErrorF ("%s : '%s' failed.\n", __FUNCTION__, #cond); return val; }} -#define goto_if_fail(cond, dst) {if (!(cond)) { ErrorF ("%s : '%s' failed.\n", __FUNCTION__, #cond); goto dst; }} - -int fbdev_util_degree_to_rotate(int degree); -int fbdev_util_rotate_to_degree(int rotate); -int fbdev_util_rotate_add(int rot_a, int rot_b); - -void fbdev_util_rotate_rect (int xres, int yres, int src_rot, int dst_rot, xRectangle *src); - -const PropertyPtr fbdev_util_get_window_property(WindowPtr pWin, const char* prop_name); - diff --git a/src/xv/arm/fbdev_video_v4l2.c b/src/xv/arm/fbdev_video_v4l2.c deleted file mode 100644 index 33831bb..0000000 --- a/src/xv/arm/fbdev_video_v4l2.c +++ /dev/null @@ -1,1081 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "fbdev_util.h" -#include "fbdev_video_v4l2.h" - -#include "fbdev.h" -#include "fbdev_fb.h" -#include "fbdev_util.h" -#include "fbdev_video.h" -#include "fbdev_video_fourcc.h" - -typedef struct _DeviceInfo -{ - char *video; /* video */ - char *fb; /* output frame buffer */ - int type; - int bOpened; -} DeviceInfo; - -typedef struct _FormatInfo -{ - int id; - int type; - uint pixelformat; - FBDevV4l2Memory memory; -} FormatInfo; - -typedef struct -{ - int index; - - ScreenPtr pScreen; - - int video_fd; - - int fb_fd; - char *fb_base; - Bool fb_shown; - - struct - { - int init; - xRectangle img; - xRectangle crop; - xRectangle pxm; - xRectangle dst; - int id; - int hw_rotate; - int scn_rotate; - int hflip; - int vflip; - int requestbuffer; - int streamon; - int cur_idx; - - void* last_buffer; - int queued_index; - - void* backup; - Bool sync; - } status; - - int size; - unsigned int pixfmt; - FBDevV4l2FimcBuffer fimcbuf; - FBDevV4l2SrcBuffer *src_buf; - FBDevV4l2Memory memory; - - int initial_dequeued_buf; - int re_setting; -} FBDevDispHandle; - -enum -{ - TYPE_RGB, - TYPE_YUV444, - TYPE_YUV422, - TYPE_YUV420, -}; - -static FormatInfo format_infos [] = -{ - { FOURCC_RGB565, TYPE_RGB, V4L2_PIX_FMT_RGB565, V4L2_MEMORY_MMAP }, - { FOURCC_RGB32, TYPE_RGB, V4L2_PIX_FMT_RGB32, V4L2_MEMORY_MMAP }, - { FOURCC_I420, TYPE_YUV420, V4L2_PIX_FMT_YUV420, V4L2_MEMORY_MMAP }, - { FOURCC_S420, TYPE_YUV420, V4L2_PIX_FMT_YUV420, V4L2_MEMORY_USERPTR }, - { FOURCC_ST12, TYPE_YUV420, V4L2_PIX_FMT_NV12T, V4L2_MEMORY_USERPTR }, - { FOURCC_NV12, TYPE_YUV420, V4L2_PIX_FMT_NV12, V4L2_MEMORY_MMAP }, - { FOURCC_SN12, TYPE_YUV420, V4L2_PIX_FMT_NV12, V4L2_MEMORY_USERPTR }, - { FOURCC_YUY2, TYPE_YUV422, V4L2_PIX_FMT_YUYV, V4L2_MEMORY_MMAP }, - { FOURCC_SUYV, TYPE_YUV422, V4L2_PIX_FMT_YUYV, V4L2_MEMORY_USERPTR }, -}; - -static XF86ImageRec Images[] = -{ - XVIMAGE_YUY2, - XVIMAGE_SUYV, - XVIMAGE_I420, - XVIMAGE_S420, - XVIMAGE_ST12, - XVIMAGE_NV12, - XVIMAGE_SN12, - XVIMAGE_RGB32, - XVIMAGE_RGB565, -}; - -static DeviceInfo device_infos[] = -{ - { "/dev/video2", "/dev/fb1", OUTPUT_PATH_DMA, FALSE }, - { "/dev/video3", "/dev/fb2", OUTPUT_PATH_DMA, FALSE }, -}; - -#define NUM_IMAGES (sizeof(Images) / sizeof(XF86ImageRec)) -#define DEVICE_NUMS (sizeof (device_infos) / sizeof (DeviceInfo)) - -static Bool -_fbdevVideoV4l2SetSrc (int fd, - xRectangle *src_rect, - xRectangle *crop_rect, - uint pixelformat) -{ - struct v4l2_format format = {0,}; - struct v4l2_crop crop = {0,}; - int capabilities; - - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[SetSrc] src_r(%d,%d %dx%d) crop_r(%d,%d %dx%d) pixfmt(0x%08x) \n", - src_rect->x, src_rect->y, src_rect->width, src_rect->height, - crop_rect->x, crop_rect->y, crop_rect->width, crop_rect->height, - pixelformat); - - /* check if capabilities is valid */ - capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OVERLAY; - if (!fbdev_v4l2_querycap (fd, capabilities)) - return FALSE; - - /* set format */ - CLEAR (format); - format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - if (!fbdev_v4l2_g_fmt (fd, &format)) - return FALSE; - - format.fmt.pix.width = src_rect->width; - format.fmt.pix.height = src_rect->height; - format.fmt.pix.pixelformat = pixelformat; - format.fmt.pix.field = V4L2_FIELD_NONE; - if (!fbdev_v4l2_s_fmt (fd, &format)) - return FALSE; - - /* set crop_rect */ - CLEAR (crop); - crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - crop.c.left = crop_rect->x; - crop.c.top = crop_rect->y; - crop.c.width = crop_rect->width; - crop.c.height = crop_rect->height; - if (!fbdev_v4l2_cropcap (fd, crop.type, &crop.c)) - return FALSE; - - if (!fbdev_v4l2_s_crop (fd, &crop)) - return FALSE; - - return TRUE; -} - -static Bool -_fbdevVideoV4l2SetDst (int fd, - xRectangle *dst_rect, - xRectangle *win_rect, - int rotation, - int hflip, - int vflip, - int path, - uint addr) -{ - struct v4l2_format format = {0,}; - struct v4l2_control ctrl = {0,}; - struct v4l2_framebuffer fbuf = {0,}; - - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[SetDst] dst_r(%d,%d %dx%d) win_r(%d,%d %dx%d) rot(%d) flip(%d,%d) path(%d) addr(%p) \n", - dst_rect->x, dst_rect->y, dst_rect->width, dst_rect->height, - win_rect->x, win_rect->y, win_rect->width, win_rect->height, - rotation, hflip, vflip, path, (void*)addr); - - /* set rotation */ - CLEAR (ctrl); - ctrl.id = V4L2_CID_ROTATION; - ctrl.value = rotation; - if (!fbdev_v4l2_s_ctrl (fd, &ctrl)) - return FALSE; - - CLEAR (ctrl); - ctrl.id = V4L2_CID_HFLIP; - ctrl.value = hflip; - if (!fbdev_v4l2_s_ctrl (fd, &ctrl)) - return FALSE; - - CLEAR (ctrl); - ctrl.id = V4L2_CID_VFLIP; - ctrl.value = vflip; - if (!fbdev_v4l2_s_ctrl (fd, &ctrl)) - return FALSE; - - ctrl.id = V4L2_CID_OVLY_MODE; - ctrl.value = 0x4; //single buffer - if (!fbdev_v4l2_s_ctrl (fd, &ctrl)) - return FALSE; - - /* set framebuffer */ - CLEAR (fbuf); - if (!fbdev_v4l2_g_fbuf (fd, &fbuf)) - return FALSE; - - if (path == OUTPUT_PATH_DMA) - fbuf.base = (void*)addr; - - fbuf.fmt.width = dst_rect->width; - fbuf.fmt.height = dst_rect->height; - fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB32; - if (!fbdev_v4l2_s_fbuf (fd, &fbuf)) - return FALSE; - - /* set format */ - CLEAR (format); - format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - if (!fbdev_v4l2_g_fmt (fd, &format)) - return FALSE; - - format.fmt.win.w.left = win_rect->x; - format.fmt.win.w.top = win_rect->y; - format.fmt.win.w.width = win_rect->width; - format.fmt.win.w.height = win_rect->height; - if (!fbdev_v4l2_s_fmt (fd, &format)) - return FALSE; - - return TRUE; -} - -static Bool -_fbdevVideoV4l2SetBuffer (int fd, - FBDevV4l2BufType type, - FBDevV4l2Memory memory, - int num_buf, - FBDevV4l2SrcBuffer **mem_buf) -{ - struct v4l2_requestbuffers req = {0,}; - - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[SetBuffer] num_buf(%d) mem_buf(%p) memory(%d)\n", - num_buf, mem_buf, memory); - - CLEAR (req); - req.count = num_buf; - req.type = type; - req.memory = memory; - if (!fbdev_v4l2_reqbuf (fd, &req)) - return FALSE; - - if (memory == V4L2_MEMORY_MMAP) - { - FBDevV4l2SrcBuffer *out_buf; - int i; - - return_val_if_fail (mem_buf != NULL, FALSE); - - out_buf = calloc (req.count, sizeof (FBDevV4l2SrcBuffer)); - return_val_if_fail (out_buf != NULL, FALSE); - - for (i = 0; i < num_buf; i++) - { - struct v4l2_buffer buffer = {0,}; - - CLEAR (buffer); - buffer.index = i; - buffer.type = type; - buffer.memory = V4L2_MEMORY_MMAP; - if (!fbdev_v4l2_querybuf (fd, &buffer)) - { - free (out_buf); - return FALSE; - } - - out_buf[i].index = buffer.index; - out_buf[i].size = buffer.length; - out_buf[i].buf = mmap (NULL, buffer.length, - PROT_READ | PROT_WRITE , \ - MAP_SHARED , fd, buffer.m.offset); - if (out_buf[i].buf == MAP_FAILED) - { - xf86DrvMsg (0, X_ERROR, "[SetBuffer] mmap failed. index(%d)\n", i); - free (out_buf); - return FALSE; - } - } - - *mem_buf = out_buf; - } - - return TRUE; -} - -static Bool -_fbdevVideoV4l2ClearBuffer (int fd, - FBDevV4l2BufType type, - FBDevV4l2Memory memory, - int num_buf, - FBDevV4l2SrcBuffer *mem_buf) -{ - struct v4l2_requestbuffers req = {0,}; - - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[ClearBuffer] memory(%d) num_buf(%d) mem_buf(%p)\n", - num_buf, mem_buf, memory); - - if (memory == V4L2_MEMORY_MMAP && mem_buf) - { - int i; - - for (i = 0; i < num_buf; i++) - if (mem_buf[i].buf) - if (munmap (mem_buf[i].buf, mem_buf[i].size) == -1) - xf86DrvMsg (0, X_WARNING, "[ClearBuffer] Failed to unmap v4l2 buffer at index %d\n", i); - - free (mem_buf); - } - - CLEAR (req); - req.count = 0; - req.type = type; - req.memory = memory; - if (!fbdev_v4l2_reqbuf (fd, &req)) - return FALSE; - - return TRUE; -} - -static Bool -_fbdevVideoV4l2StreamOn (int fd, FBDevV4l2BufType type) -{ - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[StreamOn] type(%d) \n", type); - - if (!fbdev_v4l2_streamon (fd, type)) - return FALSE; - - return TRUE; -} - - -static Bool -_fbdevVideoV4l2StreamOff (int fd, FBDevV4l2BufType type) -{ - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[StreamOff] type(%d) \n", type); - - if (!fbdev_v4l2_streamoff (fd, type)) - return FALSE; - - return TRUE; -} - -static int -_fbdevVideoV4l2Dequeue (int fd, FBDevV4l2BufType type, FBDevV4l2Memory memory) -{ - struct v4l2_buffer buf = {0,}; - - return_val_if_fail (fd >= 0, -1); - - CLEAR (buf); - buf.type = type; - buf.memory = memory; - - if (!fbdev_v4l2_dequeue (fd, &buf)) - return FALSE; - - DRVLOG ("[Dequeue] index(%d) type(%d) memory(%d)\n", - buf.index, type, memory); - - return buf.index; -} - -static int -_fbdevVideoV4l2Queue (int fd, FBDevV4l2BufType type, FBDevV4l2Memory memory, int index, FBDevV4l2FimcBuffer *fimc_buf) -{ - struct v4l2_buffer buf = {0,}; - - return_val_if_fail (fd >= 0, -1); - - CLEAR (buf); - buf.index = index; - buf.type = type; - buf.memory = memory; - - if (memory == V4L2_MEMORY_USERPTR) - buf.m.userptr = (unsigned long) fimc_buf; - - if (!fbdev_v4l2_queue (fd, &buf)) - return FALSE; - - DRVLOG ("[Queue] index(%d) type(%d) memory(%d)\n", - index, type, memory); - - return index; -} - -static int -_open_device (char *device) -{ - int fd; - - return_val_if_fail (device != NULL, -1); - - fd = open (device, O_RDWR); - if (fd < 0) - { - xf86DrvMsg (0, X_ERROR, "Cannot open '%s'. fd(%d)\n", device, fd); - return -1; - } - - DRVLOG ("'%s' opened. fd(%d) \n", device, fd); - - return fd; -} - -static void -_close_device (int fd) -{ - int ret; - - return_if_fail (fd >= 0); - - ret = close (fd); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "Cannot close fd(%d)\n", fd); - return; - } - - DRVLOG ("fd(%d) closed. \n", fd); -} - -static Bool -_move_resize_fb (FBDevDispHandle *hdisp, int x, int y, int width, int height) -{ - struct fb_var_screeninfo var; - struct fb_fix_screeninfo fix; - - return_val_if_fail (hdisp->fb_fd >= 0, FALSE); - - DRVLOG ("[MoveResize] '%s' to (%d,%d %dx%d) \n", - device_infos[hdisp->index].fb, x, y, width, height); - - if (!fbdevFbGetVarScreenInfo (hdisp->fb_fd, &var)) - return FALSE; - - var.xres = var.xres_virtual = width; - var.yres = var.yres_virtual = height; - var.transp.length = 0; - var.activate = FB_ACTIVATE_FORCE; - if (!fbdevFbSetVarScreenInfo (hdisp->fb_fd, &var)) - return FALSE; - - if (!fbdevFbGetFixScreenInfo (hdisp->fb_fd, &fix)) - return FALSE; - - if (fix.smem_len == 0) - return FALSE; - - hdisp->fb_base = (void*)fix.smem_start; /* Physical address */ - if (!hdisp->fb_base) - return FALSE; - - if (!fbdevFbSetWinPosition (hdisp->fb_fd, x, y)) /* 1 : auto */ - return FALSE; - - return TRUE; -} - -static Bool -_fbdevVideoV4l2EnsureStreamOff (FBDevDispHandle *hdisp) -{ - if (!hdisp->status.streamon) - return TRUE; - - if (!_fbdevVideoV4l2StreamOff (hdisp->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT)) - return FALSE; - - hdisp->status.streamon = FALSE; - - return TRUE; -} - -static Bool -_fbdevVideoV4l2OpenDevice (FBDevDispHandle *hdisp, int index, int requestbuffer) -{ - if (device_infos[index].bOpened) - { - DRVLOG ("[OpenDevice, %p] Already opened : %s\n", hdisp, device_infos[index].video); - return FALSE; - } - - hdisp->video_fd = _open_device (device_infos[index].video); - if (hdisp->video_fd < 0) - return FALSE; - - if (device_infos[index].type == OUTPUT_PATH_DMA) - { - hdisp->fb_fd = _open_device (device_infos[index].fb); - if (hdisp->fb_fd < 0) - { - _close_device (hdisp->video_fd); - hdisp->video_fd = -1; - return FALSE; - } - } - - device_infos[index].bOpened = TRUE; - - return TRUE; -} - -/* This function never failed. - * If failed, it means kernel has some problems. - * Then a device should be rebooted. - */ -static void -_fbdevVideoV4l2CloseDevice (FBDevDispHandle *hdisp) -{ - if (!_fbdevVideoV4l2EnsureStreamOff (hdisp)) // We will consider this as a LCD Off case. - xf86DrvMsg (0, X_WARNING, "[CloseDevice, %p] Warning : Cannot stream off!! \n", hdisp); - - if (hdisp->status.requestbuffer > 0) - { - if (hdisp->video_fd >= 0) - if (!_fbdevVideoV4l2ClearBuffer (hdisp->video_fd, - V4L2_BUF_TYPE_VIDEO_OUTPUT, - hdisp->memory, - hdisp->status.requestbuffer, - hdisp->src_buf)) - xf86DrvMsg (0, X_WARNING, "[CloseDevice, %p] Warning : Cannot clear buffer!! \n", hdisp); - - hdisp->status.requestbuffer = 0; - hdisp->src_buf = NULL; - } - - if (hdisp->video_fd >= 0) - { - _close_device (hdisp->video_fd); - hdisp->video_fd = -1; - } - - if (hdisp->fb_fd >= 0) - { - fbdevFbDeActivate (hdisp->fb_fd); - _close_device (hdisp->fb_fd); - hdisp->fb_fd = -1; - hdisp->fb_base = NULL; - hdisp->fb_shown = FALSE; - } - - device_infos[hdisp->index].bOpened = FALSE; -} - -int -fbdevVideoV4l2GetHandleNums (void) -{ - return DEVICE_NUMS; -} - -Bool -fbdevVideoV4l2HandleOpened (int index) -{ - return_val_if_fail (index < DEVICE_NUMS, FALSE); - - return device_infos[index].bOpened; -} - -void * -fbdevVideoV4l2OpenHandle (ScreenPtr pScreen, int index, int requestbuffer) -{ - FBDevDispHandle *handle; - - return_val_if_fail (pScreen != NULL, NULL); - return_val_if_fail (index < DEVICE_NUMS, NULL); - - handle = (FBDevDispHandle*)calloc (sizeof (FBDevDispHandle), 1); - - return_val_if_fail (handle != NULL, NULL); - - handle->pScreen = pScreen; - handle->index = index; - handle->status.hw_rotate = -1; - handle->status.id = 0; - handle->status.cur_idx = -1; - handle->status.init = 0; - handle->memory = V4L2_MEMORY_MMAP; - handle->initial_dequeued_buf = requestbuffer; - handle->video_fd = -1; - handle->fb_fd = -1; - - if (!_fbdevVideoV4l2OpenDevice (handle, index, requestbuffer)) - { - free (handle); - return NULL; - } - - DRVLOG ("[OpenHandle, %p] Handle(%d) opened. \n", handle, index); - - return handle; -} - -void -fbdevVideoV4l2CloseHandle (void *handle) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - - return_if_fail (handle != NULL); - - _fbdevVideoV4l2CloseDevice ((FBDevDispHandle*)handle); - - if (hdisp->status.backup) - { - free (hdisp->status.backup); - hdisp->status.backup = NULL; - } - - DRVLOG ("[CloseHandle, %p] Handle(%d) closed. \n", hdisp, hdisp->index); - - free (handle); -} - -Bool -fbdevVideoV4l2StreamOn (void *handle) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - uint phy_addrs[3]; - - return_val_if_fail (hdisp != NULL, FALSE); - - hdisp->re_setting = TRUE; - - if (!_fbdevVideoV4l2OpenDevice (hdisp, hdisp->index, hdisp->status.requestbuffer)) - return FALSE; - - fbdevVideoV4l2SetFormat (handle, - &hdisp->status.img, - &hdisp->status.crop, - &hdisp->status.dst, - hdisp->status.id, - hdisp->status.scn_rotate, - hdisp->status.hw_rotate, - hdisp->status.hflip, - hdisp->status.vflip, - hdisp->status.requestbuffer, - hdisp->status.sync); - - phy_addrs[0] = hdisp->fimcbuf.base[0]; - phy_addrs[1] = hdisp->fimcbuf.base[1]; - phy_addrs[2] = hdisp->fimcbuf.base[2]; - - fbdevVideoV4l2Draw (handle, hdisp->status.backup, phy_addrs); - - if (hdisp->status.backup) - { - free (hdisp->status.backup); - hdisp->status.backup = NULL; - } - - hdisp->re_setting = FALSE; - - DRVLOG ("%s \n", __FUNCTION__); - - return TRUE; -} - -void -fbdevVideoV4l2StreamOff (void *handle) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - int requestbuffer; - - return_if_fail (hdisp != NULL); - - if (hdisp->memory == V4L2_MEMORY_MMAP) - { - int size; - - if (hdisp->status.backup) - { - free (hdisp->status.backup); - hdisp->status.backup = NULL; - } - - size = fbdevVideoQueryImageAttributes (NULL, hdisp->status.id, - (unsigned short*)&hdisp->status.img.width, - (unsigned short*)&hdisp->status.img.height, - NULL, NULL); - - if (size > 0) - hdisp->status.backup = malloc (size); - - if (hdisp->status.backup && - hdisp->src_buf && - hdisp->src_buf[hdisp->status.queued_index].buf) - memcpy (hdisp->status.backup, - hdisp->src_buf[hdisp->status.queued_index].buf, - size); - } - - requestbuffer = hdisp->status.requestbuffer; - - _fbdevVideoV4l2CloseDevice (hdisp); - - hdisp->status.requestbuffer = requestbuffer; - - DRVLOG ("%s \n", __FUNCTION__); -} - -/* img->x, img->y : not used. */ -Bool -fbdevVideoV4l2SetFormat (void *handle, - xRectangle *img, xRectangle *crop, xRectangle *dst, - uint id, - int scn_rotate, - int hw_rotate, - int hflip, - int vflip, - int requestbuffer, - Bool sync) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - Bool src_changed = FALSE; - Bool dst_changed = FALSE; - Bool buf_changed = FALSE; - - return_val_if_fail (handle != NULL, FALSE); - return_val_if_fail (img != NULL, FALSE); - return_val_if_fail (crop != NULL, FALSE); - return_val_if_fail (dst != NULL, FALSE); - - DRVLOG ("[SetFormat, %p] try to set : img(%d,%d %dx%d) crop(%d,%d %dx%d) dst(%d,%d %dx%d) id(%x), rot(%d), flip(%d,%d) req(%d)\n", hdisp, - img->x, img->y, img->width, img->height, - crop->x, crop->y, crop->width, crop->height, - dst->x, dst->y, dst->width, dst->height, - id, hw_rotate, hflip, vflip, requestbuffer); - - if (memcmp (&hdisp->status.img, img, sizeof (xRectangle)) || - memcmp (&hdisp->status.crop, crop, sizeof (xRectangle)) || - hdisp->status.id != id) - src_changed = TRUE; - - if (memcmp (&hdisp->status.dst, dst, sizeof (xRectangle)) || - hdisp->status.hw_rotate != hw_rotate || - hdisp->status.hflip != hflip || - hdisp->status.vflip != vflip) - dst_changed = TRUE; - - if (hdisp->status.requestbuffer != requestbuffer) - buf_changed = TRUE; - - if (hdisp->status.init && (src_changed || dst_changed || buf_changed)) - { - _fbdevVideoV4l2CloseDevice (hdisp); - _fbdevVideoV4l2OpenDevice (hdisp, hdisp->index, requestbuffer); - - DRVLOG ("[SetFormat, %p] changed : img(%d) dst(%d) buf(%d) \n", hdisp, - src_changed, dst_changed, buf_changed); - - /* After close device, below all steps should be done. */ - src_changed = dst_changed = buf_changed = TRUE; - hdisp->status.init = 0; - } - - if (hdisp->re_setting) - src_changed = dst_changed = buf_changed = TRUE; - - if (src_changed) - { - fbdevVideoV4l2GetFormatInfo (id, NULL, &hdisp->pixfmt, &hdisp->memory); - - DRVLOG ("[SetFormat, %p] id(%c%c%c%c) => pixfmt(%d) memory(%d) \n", hdisp, - id & 0xFF, (id & 0xFF00) >> 8, (id & 0xFF0000) >> 16, (id & 0xFF000000) >> 24, - hdisp->pixfmt, hdisp->memory); - - if (img->width % 16) - xf86DrvMsg (0, X_WARNING, "img->width(%d) is not multiple of 16!!!\n", img->width); - - if (!_fbdevVideoV4l2SetSrc (hdisp->video_fd, img, crop, hdisp->pixfmt)) - { - xf86DrvMsg (0, X_ERROR, "[SetFormat, %p] _fbdevVideoV4l2SetSrc is failed. \n", hdisp); - return FALSE; - } - - hdisp->status.img = *img; - hdisp->status.crop = *crop; - hdisp->status.id = id; - hdisp->status.sync = sync; - - hdisp->status.requestbuffer = 0; - hdisp->status.init = 1; - } - - if (dst_changed) - { - hdisp->status.cur_idx = 0; - hdisp->status.hw_rotate = hw_rotate; - hdisp->status.scn_rotate = scn_rotate; - hdisp->status.hflip = hflip; - hdisp->status.vflip = vflip; - hdisp->status.dst = *dst; - - if (hdisp->fb_fd >= 0) - { - xRectangle fb_rect = *dst; - if (!_move_resize_fb (hdisp, fb_rect.x, fb_rect.y, fb_rect.width, fb_rect.height)) - { - xf86DrvMsg (0, X_ERROR, "[SetFormat, %p] _move_resize_fb is failed. \n", hdisp); - return FALSE; - } - } - - fbdev_util_rotate_rect ((int)hdisp->pScreen->width, - (int)hdisp->pScreen->height, - 0, (hw_rotate + (360 - scn_rotate)) % 360, dst); - if (hdisp->fb_base) - { - xRectangle win_rect = {0, 0, dst->width, dst->height}; - - if (!_fbdevVideoV4l2SetDst (hdisp->video_fd, dst, &win_rect, hw_rotate, hflip, vflip, OUTPUT_PATH_DMA, (uint)hdisp->fb_base)) - { - xf86DrvMsg (0, X_ERROR, "[SetFormat, %p] _fbdevVideoV4l2SetDst is failed. \n", hdisp); - return FALSE; - } - } - else - { - if (!_fbdevVideoV4l2SetDst (hdisp->video_fd, dst, dst, hw_rotate, hflip, vflip, OUTPUT_PATH_FIMD, 0)) - { - xf86DrvMsg (0, X_ERROR, "[SetFormat, %p] _fbdevVideoV4l2SetDst is failed. \n", hdisp); - return FALSE; - } - } - } - - if (buf_changed) - { - if (!_fbdevVideoV4l2SetBuffer (hdisp->video_fd, - V4L2_BUF_TYPE_VIDEO_OUTPUT, - hdisp->memory, - requestbuffer, - &hdisp->src_buf)) - { - xf86DrvMsg (0, X_ERROR, "[SetFormat, %p] _fbdevVideoV4l2SetBuffer is failed. \n", hdisp); - return FALSE; - } - - hdisp->status.cur_idx = 0; - hdisp->status.requestbuffer = requestbuffer; - hdisp->initial_dequeued_buf = requestbuffer; - } - - if (!hdisp->status.streamon) - { - _fbdevVideoV4l2StreamOn (hdisp->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT); - hdisp->status.streamon = TRUE; - } - - return TRUE; -} - -XF86ImagePtr -fbdevVideoV4l2SupportImages (int *count) -{ - if (count) - *count = NUM_IMAGES; - - return Images; -} - -int -fbdevVideoV4l2Draw (void *handle, uchar *buf, uint *phy_addrs) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - int idx; - - return_val_if_fail (handle != NULL, FALSE); -// return_val_if_fail (phy_addrs != NULL, FALSE); - - if (!hdisp->status.sync) - { - if (hdisp->initial_dequeued_buf > 0) - { - idx = hdisp->status.requestbuffer - hdisp->initial_dequeued_buf; - hdisp->initial_dequeued_buf--; - } - else - { - if ((idx = _fbdevVideoV4l2Dequeue (hdisp->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT, hdisp->memory)) < 0) - { - xf86DrvMsg (0, X_ERROR, "[Draw, %p] _fbdevVideoV4l2Dequeue is failed. \n", hdisp); - return FALSE; - } - } - } - else - idx = hdisp->status.queued_index; - - if (hdisp->memory == V4L2_MEMORY_MMAP) - { - uchar *destbuf = hdisp->src_buf[idx].buf; - int size; - - return_val_if_fail (buf != NULL, FALSE); - - hdisp->status.last_buffer = destbuf; - - size = fbdevVideoQueryImageAttributes (NULL, hdisp->status.id, - (unsigned short*)&hdisp->status.img.width, - (unsigned short*)&hdisp->status.img.height, - NULL, NULL); - memcpy (destbuf, buf, size); - } - - hdisp->fimcbuf.base[0] = phy_addrs[0]; - hdisp->fimcbuf.base[1] = phy_addrs[1]; - hdisp->fimcbuf.base[2] = phy_addrs[2]; - hdisp->fimcbuf.length[0] = hdisp->status.img.width * hdisp->status.img.height; - hdisp->fimcbuf.length[1] = hdisp->fimcbuf.length[0] >> 1; - hdisp->fimcbuf.length[2] = hdisp->fimcbuf.base[1] + hdisp->fimcbuf.length[1]; - - if ((idx = _fbdevVideoV4l2Queue (hdisp->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT, - hdisp->memory, idx, &hdisp->fimcbuf)) < 0) - { - xf86DrvMsg (0, X_ERROR, "[Draw, %p] _fbdevVideoV4l2Queue is failed. \n", hdisp); - return FALSE; - } - - if (hdisp->status.sync) - { - if ((idx = _fbdevVideoV4l2Dequeue (hdisp->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT, hdisp->memory)) < 0) - { - xf86DrvMsg (0, X_ERROR, "[Draw, %p] _fbdevVideoV4l2Dequeue is failed. \n", hdisp); - return FALSE; - } - } - - if (hdisp->fb_fd >= 0 && !hdisp->fb_shown) - { - if (!fbdevFbActivate (hdisp->fb_fd)) - { - xf86DrvMsg (0, X_ERROR, "[%s, %p] %d failed. \n", __FUNCTION__, hdisp, __LINE__); - return FALSE; - } - - hdisp->fb_shown = TRUE; - } - - hdisp->status.queued_index = idx + 1; - if (hdisp->status.queued_index > hdisp->status.requestbuffer - 1) - hdisp->status.queued_index = 0; - - return TRUE; -} - -Bool -fbdevVideoV4l2GetFormatInfo (int id, int *type, uint *pixelformat, FBDevV4l2Memory *memory) -{ - int i; - - for (i = 0; i < sizeof (format_infos) / sizeof (FormatInfo); i++) - if (format_infos[i].id == id) - { - if (type) - *type = format_infos[i].type; - if (pixelformat) - *pixelformat = format_infos[i].pixelformat; - if (memory) - *memory = format_infos[i].memory; - return TRUE; - } - - return FALSE; -} - -/* img : original src size - * src : real src size (cropped area inside img) - * dst : real dst size - * original dst size (in case that image is drawn on opened framebuffer) - */ -Bool -fbdevVideoV4l2CheckSize (void *handle, uint pixelformat, - xRectangle *img, xRectangle *src, xRectangle *dst, - int type, int memory) -{ - /* img */ - if (img) - { - if (img->width % 16) - xf86DrvMsg (0, X_WARNING, "img's width(%d) is not multiple of 16!!!\n", img->width); - - if (type == TYPE_YUV420 && img->height % 2) - xf86DrvMsg (0, X_WARNING, "img's height(%d) is not multiple of 2!!!\n", img->height); - - return_val_if_fail (img->width >= 16, FALSE); - return_val_if_fail (img->height >= 16, FALSE); - } - - /* src */ - if (src) - { - if (type == TYPE_YUV420 || type == TYPE_YUV422) - { - src->x = src->x & (~0x1); - src->width = src->width & (~0x1); - } - - if (type == TYPE_YUV420) - src->height = src->height & (~0x1); - - return_val_if_fail (src->width >= 16, FALSE); - return_val_if_fail (src->height >= 16, FALSE); - } - - /* dst */ - if (dst) - { - dst->width = dst->width & (~0x1); - dst->height = dst->height & (~0x1); - - return_val_if_fail (dst->width >= 8, FALSE); - return_val_if_fail (dst->height >= 8, FALSE); - } - - return TRUE; -} diff --git a/src/xv/fbdev_v4l2.c b/src/xv/fbdev_v4l2.c deleted file mode 100644 index a49305e..0000000 --- a/src/xv/fbdev_v4l2.c +++ /dev/null @@ -1,511 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include -#include -#include -#include - -#include "xf86.h" - -#include "fbdev_v4l2.h" -#include "fbdev_util.h" - -typedef struct _CapInfo -{ - int value; - char *name; -} CapInfo; - -static CapInfo cap_infos [] = -{ - {V4L2_CAP_VIDEO_CAPTURE, "VIDEO_CAPTURE"}, - {V4L2_CAP_VIDEO_OUTPUT, "VIDEO_OUTPUT"}, - {V4L2_CAP_VIDEO_OVERLAY, "VIDEO_OVERLAY"}, - {V4L2_CAP_VBI_CAPTURE, "VBI_CAPTURE"}, - {V4L2_CAP_VBI_OUTPUT, "VBI_OUTPUT"}, - {V4L2_CAP_SLICED_VBI_CAPTURE, "SLICED_VBI_CAPTURE"}, - {V4L2_CAP_SLICED_VBI_OUTPUT, "SLICED_VBI_OUTPUT"}, - {V4L2_CAP_RDS_CAPTURE, "RDS_CAPTURE"}, - {V4L2_CAP_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY"}, - {V4L2_CAP_HW_FREQ_SEEK, "HW_FREQ_SEEK"}, - {V4L2_CAP_RDS_OUTPUT, "RDS_OUTPUT"}, - {V4L2_CAP_TUNER, "TUNER"}, - {V4L2_CAP_AUDIO, "AUDIO"}, - {V4L2_CAP_RADIO, "RADIO"}, - {V4L2_CAP_MODULATOR, "MODULATOR"}, - {V4L2_CAP_READWRITE, "READWRITE"}, - {V4L2_CAP_ASYNCIO, "ASYNCIO"}, - {V4L2_CAP_STREAMING, "STREAMING"} -}; - -static Bool _fbdev_v4l2_ioctl (int fd, int cmd, void *data, char *debug) -{ - int retry = 0; - int ret; - -try_again: - ret = ioctl (fd, cmd, data); - if (ret < 0) - { - if (errno == EINTR || errno == EAGAIN) - { - if (retry < 100) - { - retry++; - goto try_again; - } - } - - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_querycap (int fd, int capabilities) -{ - struct v4l2_capability cap; - int ret; - - CLEAR (cap); - ret = ioctl (fd, VIDIOC_QUERYCAP, &cap); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[QUERYCAP] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - if (~(cap.capabilities) & capabilities) - { - int unsupport = ~(cap.capabilities) & capabilities; - int i; - - for (i = 0; i < sizeof (cap_infos) / sizeof (CapInfo); i++) - if (unsupport & cap_infos[i].value) - xf86DrvMsg (0, X_ERROR, "[QUERYCAP] %s not support.\n", cap_infos[i].name); - - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_cropcap (int fd, FBDevV4l2BufType type, struct v4l2_rect *crop) -{ - struct v4l2_cropcap cropcap; - int ret; - - CLEAR(cropcap); - cropcap.type = type; - ret = ioctl (fd, VIDIOC_CROPCAP, &cropcap); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[CROPCAP] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - /* check if crop_rect si valid */ - if ((crop->left < cropcap.bounds.left) && - (crop->top < cropcap.bounds.top) && - (crop->width > cropcap.bounds.width) && - (crop->height > cropcap.bounds.height)) - { - xf86DrvMsg (0, X_ERROR, "(%d,%d %dx%d) is out of bound(%d,%d %dx%d)\n", - crop->left, crop->top, crop->width, crop->height, - cropcap.bounds.left, cropcap.bounds.top, - cropcap.bounds.width, cropcap.bounds.height); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_enum_std (int fd, struct v4l2_standard *std, v4l2_std_id std_id) -{ - std->index = 0; - - while (0 == ioctl (fd, VIDIOC_ENUMSTD, std)) - { - /* return TRUE if std_id found */ - if (std->id & std_id) - { - xf86DrvMsg (0, X_ERROR, "[ENUMSTD] name(%s). (%s)\n", std->name, strerror(errno)); - return TRUE; - } - - std->index++; - } - - return FALSE; -} - -Bool fbdev_v4l2_enum_output (int fd, struct v4l2_output *output, FBDevV4l2BufType type) -{ - output->index = 0; - - while (0 == ioctl (fd, VIDIOC_ENUMOUTPUT, output)) - { - /* return TRUE if type found */ - if (output->type & type) - { - xf86DrvMsg (0, X_ERROR, "[ENUMOUTPUT] index(%d) type(0x%08x) name(%s). (%s)\n", - output->index,output->type,output->name, strerror(errno)); - return TRUE; - } - - output->index++; - } - - return FALSE; -} - -Bool fbdev_v4l2_enum_fmt (int fd, struct v4l2_fmtdesc *desc, FBDevV4l2BufType type) -{ - desc->index = 0; - - while (0 == ioctl (fd, VIDIOC_ENUM_FMT, desc)) - { - /* return TRUE if type found */ - if (desc->type & type) - { - xf86DrvMsg (0, X_ERROR, "[ENUM_FMT] index(%d) type(0x%08x) desc(%s) pxlfmt(0x%08x). (%s)\n", - desc->index, desc->type, desc->description, desc->pixelformat, strerror(errno)); - return TRUE; - } - - desc->index++; - } - - return FALSE; -} - -Bool fbdev_v4l2_g_std (int fd, v4l2_std_id *std_id) -{ - int ret; - - ret = ioctl (fd, VIDIOC_G_STD, std_id); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[G_STD] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_s_std (int fd, v4l2_std_id std_id) -{ - int ret; - - ret = ioctl (fd, VIDIOC_S_STD, &std_id); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[S_STD] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_g_output (int fd, int *index) -{ - int ret; - - ret = ioctl (fd, VIDIOC_G_OUTPUT, index); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[G_OUTPUT] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_s_output (int fd, int index) -{ - int ret; - - ret = ioctl (fd, VIDIOC_S_OUTPUT, &index); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[S_OUTPUT] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_try_fmt (int fd, struct v4l2_format *format) -{ - int ret; - - ret = ioctl (fd, VIDIOC_TRY_FMT, format); - if (ret < 0) - return FALSE; - - return TRUE; -} - -Bool fbdev_v4l2_g_fmt (int fd, struct v4l2_format *format) -{ - int ret; - - ret = ioctl (fd, VIDIOC_G_FMT, format); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[G_FMT] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_s_fmt (int fd, struct v4l2_format *format) -{ - int ret; - - ret = ioctl (fd, VIDIOC_S_FMT, format); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[S_FMT] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_g_parm (int fd, struct v4l2_streamparm *parm) -{ - int ret; - - ret = ioctl (fd, VIDIOC_G_PARM, parm); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[G_PARM] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_s_parm (int fd, struct v4l2_streamparm *parm) -{ - int ret; - - ret = ioctl (fd, VIDIOC_S_PARM, parm); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[S_PARM] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_g_fbuf (int fd, struct v4l2_framebuffer *frame) -{ - int ret; - - ret = ioctl (fd, VIDIOC_G_FBUF, frame); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[G_FBUF] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_s_fbuf (int fd, struct v4l2_framebuffer *frame) -{ - int ret; - - ret = ioctl (fd, VIDIOC_S_FBUF, frame); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[S_FBUF] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_g_crop (int fd, struct v4l2_crop *crop) -{ - int ret; - - ret = ioctl (fd, VIDIOC_G_CROP, crop); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[G_CROP] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_s_crop (int fd, struct v4l2_crop *crop) -{ - int ret; - - ret = ioctl (fd, VIDIOC_S_CROP, crop); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[S_CROP] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_g_ctrl (int fd, struct v4l2_control *ctrl) -{ - int ret; - - ret = ioctl (fd, VIDIOC_G_CTRL, ctrl); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[G_CTRL] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_s_ctrl (int fd, struct v4l2_control *ctrl) -{ - int ret; - - ret = ioctl (fd, VIDIOC_S_CTRL, ctrl); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "[S_CTRL] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_streamon (int fd, FBDevV4l2BufType type) -{ - if (!_fbdev_v4l2_ioctl (fd, VIDIOC_STREAMON, (void*)&type, "STREAMON")) - { - xf86DrvMsg (0, X_ERROR, "[STREAMON] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_streamoff (int fd, FBDevV4l2BufType type) -{ - if (!_fbdev_v4l2_ioctl (fd, VIDIOC_STREAMOFF, (void*)&type, "STREAMOFF")) - { - xf86DrvMsg (0, X_ERROR, "[STREAMOFF] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - - -Bool fbdev_v4l2_start_overlay (int fd) -{ - int start = 1; - - if (!_fbdev_v4l2_ioctl (fd, VIDIOC_OVERLAY, (void*)&start, "OVERLAY (start)")) - { - xf86DrvMsg (0, X_ERROR, "[OVERLAY] (start) failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_stop_overlay (int fd) -{ - int stop = 0; - - if (!_fbdev_v4l2_ioctl (fd, VIDIOC_OVERLAY, (void*)&stop, "OVERLAY (stop)")) - { - xf86DrvMsg (0, X_ERROR, "[OVERLAY] (stop) failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_reqbuf (int fd, struct v4l2_requestbuffers *req) -{ - if (!_fbdev_v4l2_ioctl (fd, VIDIOC_REQBUFS, (void*)req, "REQBUFS")) - { - xf86DrvMsg (0, X_ERROR, "[REQBUFS] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_querybuf (int fd, struct v4l2_buffer *set_buf) -{ - if (!_fbdev_v4l2_ioctl (fd, VIDIOC_QUERYBUF, (void*)set_buf, "QUERYBUF")) - { - xf86DrvMsg (0, X_ERROR, "[QUERYBUF] failed. (%s)\n", strerror(errno)); - return FALSE; - } - - return TRUE; -} - - -Bool fbdev_v4l2_queue (int fd, struct v4l2_buffer *buf) -{ - if (!_fbdev_v4l2_ioctl (fd, VIDIOC_QBUF, (void*)buf, "QBUF")) - { - xf86DrvMsg (0, X_ERROR, "[QBUF] failed. (%s)\n", strerror(errno)); - - return FALSE; - } - - return TRUE; -} - -Bool fbdev_v4l2_dequeue (int fd, struct v4l2_buffer *buf) -{ - if (!_fbdev_v4l2_ioctl (fd, VIDIOC_DQBUF, (void*)buf, "DQBUF")) - { - xf86DrvMsg (0, X_ERROR, "[DQBUF] failed. (%s)\n", strerror(errno)); - - return FALSE; - } - - return TRUE; -} diff --git a/src/xv/fbdev_v4l2.h b/src/xv/fbdev_v4l2.h deleted file mode 100644 index 931da95..0000000 --- a/src/xv/fbdev_v4l2.h +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 __FBDEV_V4L2_H__ -#define __FBDEV_V4L2_H__ - -#include "fbdev_video_types.h" - - -#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ -#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0) -#define V4L2_CID_PADDR_Y (V4L2_CID_PRIVATE_BASE + 1) -#define V4L2_CID_PADDR_CB (V4L2_CID_PRIVATE_BASE + 2) -#define V4L2_CID_PADDR_CR (V4L2_CID_PRIVATE_BASE + 3) -#define V4L2_CID_PADDR_CBCR (V4L2_CID_PRIVATE_BASE + 4) -#define V4L2_CID_OVERLAY_AUTO (V4L2_CID_PRIVATE_BASE + 5) -#define V4L2_CID_OVERLAY_VADDR0 (V4L2_CID_PRIVATE_BASE + 6) -#define V4L2_CID_OVERLAY_VADDR1 (V4L2_CID_PRIVATE_BASE + 7) -#define V4L2_CID_OVERLAY_VADDR2 (V4L2_CID_PRIVATE_BASE + 8) -#define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9) - - -Bool fbdev_v4l2_querycap (int fd, int capabilities); -Bool fbdev_v4l2_cropcap (int fd, FBDevV4l2BufType type, struct v4l2_rect *crop); - -Bool fbdev_v4l2_enum_std (int fd, struct v4l2_standard *std, v4l2_std_id std_id); -Bool fbdev_v4l2_enum_output (int fd, struct v4l2_output *output, FBDevV4l2BufType type); -Bool fbdev_v4l2_enum_fmt (int fd, struct v4l2_fmtdesc *desc, FBDevV4l2BufType type); - -Bool fbdev_v4l2_g_std (int fd, v4l2_std_id *std_id); -Bool fbdev_v4l2_s_std (int fd, v4l2_std_id std_id); -Bool fbdev_v4l2_g_output (int fd, int *index); -Bool fbdev_v4l2_s_output (int fd, int index); -Bool fbdev_v4l2_try_fmt (int fd, struct v4l2_format *format); -Bool fbdev_v4l2_g_fmt (int fd, struct v4l2_format *format); -Bool fbdev_v4l2_s_fmt (int fd, struct v4l2_format *format); -Bool fbdev_v4l2_g_parm (int fd, struct v4l2_streamparm *parm); -Bool fbdev_v4l2_s_parm (int fd, struct v4l2_streamparm *parm); -Bool fbdev_v4l2_g_fbuf (int fd, struct v4l2_framebuffer *frame); -Bool fbdev_v4l2_s_fbuf (int fd, struct v4l2_framebuffer *frame); -Bool fbdev_v4l2_g_crop (int fd, struct v4l2_crop *crop); -Bool fbdev_v4l2_s_crop (int fd, struct v4l2_crop *crop); -Bool fbdev_v4l2_g_ctrl (int fd, struct v4l2_control *ctrl); -Bool fbdev_v4l2_s_ctrl (int fd, struct v4l2_control *ctrl); - -Bool fbdev_v4l2_reqbuf (int fd, struct v4l2_requestbuffers *req); -Bool fbdev_v4l2_querybuf (int fd, struct v4l2_buffer *set_buf); -Bool fbdev_v4l2_queue (int fd, struct v4l2_buffer *buf); -Bool fbdev_v4l2_dequeue (int fd, struct v4l2_buffer *buf); - -Bool fbdev_v4l2_streamon (int fd, FBDevV4l2BufType type); -Bool fbdev_v4l2_streamoff (int fd, FBDevV4l2BufType type); -Bool fbdev_v4l2_start_overlay (int fd); -Bool fbdev_v4l2_stop_overlay (int fd); - - -#endif diff --git a/src/xv/fbdev_video.c b/src/xv/fbdev_video.c deleted file mode 100644 index 936afea..0000000 --- a/src/xv/fbdev_video.c +++ /dev/null @@ -1,1005 +0,0 @@ -/* - * xserver-xorg-video-emulfb - * - * Copyright 2004 Keith Packard - * Copyright 2005 Eric Anholt - * Copyright 2006 Nokia Corporation - * Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - * - * Contact: Boram Park - * - * Permission to use, copy, modify, distribute and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * 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 names of the authors and/or copyright holders - * not be used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. The authors and - * copyright holders make no representations about the suitability of this - * software for any purpose. It is provided "as is" without any express - * or implied warranty. - * - * THE AUTHORS AND COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE AUTHORS OR 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. - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include "fourcc.h" - -#include "fb.h" -#include "fbdevhw.h" -#include "damage.h" - -#include "xf86xv.h" - -#include "fbdev.h" - -#include "fbdev_dpms.h" -#include "fbdev_video.h" -#include "fbdev_util.h" -#include "fbdev_util.h" -#include "fbdev_fb.h" -#include "fbdev_video_fourcc.h" -#include "fbdev_video_v4l2.h" - -#include "xv_types.h" - -extern CallbackListPtr DPMSCallback; - -static XF86VideoEncodingRec DummyEncoding[] = -{ - { 0, "XV_IMAGE", -1, -1, { 1, 1 } }, - { 1, "XV_IMAGE", 2560, 2560, { 1, 1 } }, -}; - -static XF86VideoFormatRec Formats[] = -{ - { 16, TrueColor }, - { 24, TrueColor }, - { 32, TrueColor }, -}; - -static XF86AttributeRec Attributes[] = -{ - { 0, -1, 270, "_USER_WM_PORT_ATTRIBUTE_ROTATION" }, - { 0, 0, 1, "_USER_WM_PORT_ATTRIBUTE_HFLIP" }, - { 0, 0, 1, "_USER_WM_PORT_ATTRIBUTE_VFLIP" }, - { 0, -1, 1, "_USER_WM_PORT_ATTRIBUTE_PREEMPTION" }, - { 0, 0, 1, "_USER_WM_PORT_ATTRIBUTE_DRAWING_MODE" }, - { 0, 0, 1, "_USER_WM_PORT_ATTRIBUTE_STREAM_OFF" }, -}; - -typedef enum -{ - PAA_MIN, - PAA_ROTATION, - PAA_HFLIP, - PAA_VFLIP, - PAA_PREEMPTION, - PAA_DRAWINGMODE, - PAA_STREAMOFF, - PAA_MAX -} FBDevPortAttrAtom; - -static struct -{ - FBDevPortAttrAtom paa; - const char *name; - Atom atom; -} atom_list[] = -{ - { PAA_ROTATION, "_USER_WM_PORT_ATTRIBUTE_ROTATION", None }, - { PAA_HFLIP, "_USER_WM_PORT_ATTRIBUTE_HFLIP", None }, - { PAA_VFLIP, "_USER_WM_PORT_ATTRIBUTE_VFLIP", None }, - { PAA_PREEMPTION, "_USER_WM_PORT_ATTRIBUTE_PREEMPTION", None }, - { PAA_DRAWINGMODE, "_USER_WM_PORT_ATTRIBUTE_DRAWING_MODE", None }, - { PAA_STREAMOFF, "_USER_WM_PORT_ATTRIBUTE_STREAM_OFF", None }, -}; - -static int registered_handler; -extern CallbackListPtr DPMSCallback; - -#define FBDEV_MAX_PORT 16 -#define REQ_BUF_NUM 3 - -#define NUM_FORMATS (sizeof(Formats) / sizeof(Formats[0])) -#define NUM_ATTRIBUTES (sizeof(Attributes) / sizeof(Attributes[0])) -#define NUM_ATOMS (sizeof(atom_list) / sizeof(atom_list[0])) - -static void -_fbdevVideoGetRotation (ScreenPtr pScreen, - FBDevPortPrivPtr pPortPriv, - DrawablePtr pDraw, - int *scn_rotate, - int *rotate, - int *hw_rotate) -{ - ScrnInfoPtr pScrnInfo = xf86Screens[pScreen->myNum]; - FBDevPtr pFBDev = FBDEVPTR (pScrnInfo); - - *scn_rotate = 0; - *rotate = 0; - *hw_rotate = 0; - -#ifdef RANDR - switch (pFBDev->rotate) - { - case RR_Rotate_90: - *scn_rotate += 90; - case RR_Rotate_180: - *scn_rotate += 90; - case RR_Rotate_270: - *scn_rotate += 90; - case RR_Rotate_0: - break; - } -#endif - - if (pPortPriv->rotate >= 0) - *rotate = pPortPriv->rotate; - - *hw_rotate = (*rotate + *scn_rotate + 360) % 360; -} - -static void -_fbdevVideoCloseV4l2Handle (ScrnInfoPtr pScrnInfo, FBDevPortPrivPtr pPortPriv) -{ - FBDevPtr pFBDev = (FBDevPtr) pScrnInfo->driverPrivate; - - if (!pPortPriv->v4l2_handle) - return; - - fbdevVideoV4l2CloseHandle (pPortPriv->v4l2_handle); - - pFBDev->v4l2_owner[pPortPriv->v4l2_index] = NULL; - - pPortPriv->v4l2_handle = NULL; - pPortPriv->v4l2_index = -1; -} - -static Atom -_fbdevVideoGetPortAtom (FBDevPortAttrAtom paa) -{ - int i; - - return_val_if_fail (paa > PAA_MIN && paa < PAA_MAX, None); - - for (i = 0; i < NUM_ATOMS; i++) - { - if (paa == atom_list[i].paa) - { - if (atom_list[i].atom == None) - atom_list[i].atom = MakeAtom (atom_list[i].name, strlen (atom_list[i].name), TRUE); - - return atom_list[i].atom; - } - } - - ErrorF ("Error: Unknown Port Attribute Name!\n"); - - return None; -} - -static int -_fbdevVideoInterfbdevtXRects (xRectangle *dest, xRectangle *src1, xRectangle *src2) -{ - int dest_x, dest_y; - int dest_x2, dest_y2; - int return_val; - - return_val_if_fail (src1 != NULL, FALSE); - return_val_if_fail (src2 != NULL, FALSE); - - return_val = FALSE; - - dest_x = MAX (src1->x, src2->x); - dest_y = MAX (src1->y, src2->y); - dest_x2 = MIN (src1->x + src1->width, src2->x + src2->width); - dest_y2 = MIN (src1->y + src1->height, src2->y + src2->height); - - if (dest_x2 > dest_x && dest_y2 > dest_y) - { - if (dest) - { - dest->x = dest_x; - dest->y = dest_y; - dest->width = dest_x2 - dest_x; - dest->height = dest_y2 - dest_y; - } - return_val = TRUE; - } - else if (dest) - { - dest->width = 0; - dest->height = 0; - } - - return return_val; -} - -static int -_fbdevVideoParseFormatBuffer (uchar *buf, uint *phy_addrs) -{ - XV_PUTIMAGE_DATA_PTR data = (XV_PUTIMAGE_DATA_PTR) buf; - - int valid = XV_PUTIMAGE_VALIDATE_DATA (data); - if (valid < 0) - return valid; - - phy_addrs[0] = data->YPhyAddr; - phy_addrs[1] = data->CbPhyAddr; - phy_addrs[2] = data->CrPhyAddr; - - return 0; -} - -static XF86ImageRec * -_fbdevVideoGetImageInfo (int id) -{ - XF86ImagePtr pImages; - int i, count = 0; - - pImages = fbdevVideoV4l2SupportImages (&count); - - for (i = 0; i < count; i++) - { - if (pImages[i].id == id) - return &pImages[i]; - } - - return NULL; -}; - -static Bool -_fbdevVideoSetMode (ScrnInfoPtr pScrnInfo, FBDevPortPrivPtr pPortPriv, int *index) -{ - FBDevPtr pFBDev = (FBDevPtr) pScrnInfo->driverPrivate; - Bool full = TRUE; - int i = 0; - - *index = -1; - - if (pPortPriv->preemption == -1) - { - pPortPriv->mode = PORT_MODE_WAITING; - return TRUE; - } - - for (i = 0; i < pFBDev->v4l2_num; i++) - if (!fbdevVideoV4l2HandleOpened (i)) - { - full = FALSE; - break; - } - - if (!full) - { - *index = i; - pPortPriv->mode = PORT_MODE_V4L2; - return TRUE; - } - - /* All handles are occupied. So we need to steal one of them. */ - - if (pPortPriv->preemption == 0) - { - pPortPriv->mode = PORT_MODE_WAITING; - return TRUE; - } - - for (i = 0; i < pFBDev->v4l2_num; i++) - { - FBDevPortPrivPtr pOwnerPort = (FBDevPortPrivPtr) pFBDev->v4l2_owner[i]; - - if (pOwnerPort && pOwnerPort->preemption == 0) - { - _fbdevVideoCloseV4l2Handle (pScrnInfo, pOwnerPort); - - pOwnerPort->mode = PORT_MODE_WAITING; - pPortPriv->mode = PORT_MODE_V4L2; - *index = i; - return TRUE; - } - } - - xf86DrvMsg (0, X_ERROR, "fbdev/put_image: Three or more preemptive ports were requested\n"); - - return FALSE; -} - -static int -_fbdevVideoPutImageV4l2 (ScrnInfoPtr pScrnInfo, - FBDevPortPrivPtr pPortPriv, - xRectangle *img, - xRectangle *src, - xRectangle *dst, - RegionPtr clip_boxes, - int scn_rotate, - int rotate, - int hw_rotate, - XF86ImageRec *image_info, - uchar *buf, - FBDevPortMode modeBefore, - int v4l2_index, - DrawablePtr pDraw) -{ - FBDevPtr pFBDev = (FBDevPtr) pScrnInfo->driverPrivate; - uint phy_addrs[4] = {0,}; - FBDevV4l2Memory memory; - uint pixelformat; - int fmt_type = 0; - - if (!fbdevVideoV4l2GetFormatInfo (image_info->id, &fmt_type, &pixelformat, &memory)) - { - xf86DrvMsg (0, X_ERROR, "ID(%c%c%c%c) is not in 'format_infos'.\n", - image_info->id & 0xFF, (image_info->id & 0xFF00) >> 8, - (image_info->id & 0xFF0000) >> 16, (image_info->id & 0xFF000000) >> 24); - return BadRequest; - } - - if (memory == V4L2_MEMORY_USERPTR) - { - int ret; - if ((ret = _fbdevVideoParseFormatBuffer (buf, phy_addrs)) < 0) - { - if (ret == XV_HEADER_ERROR) - xf86DrvMsg (0, X_ERROR, "XV_HEADER_ERROR\n"); - else if (ret == XV_VERSION_MISMATCH) - xf86DrvMsg (0, X_ERROR, "XV_VERSION_MISMATCH\n"); - - return BadRequest; - } - - /* Skip frame */ - if (phy_addrs[0] == 0) - return Success; - } - - if (!pPortPriv->v4l2_handle) - { - pPortPriv->v4l2_handle = fbdevVideoV4l2OpenHandle (pScrnInfo->pScreen, v4l2_index, REQ_BUF_NUM); - if (!pPortPriv->v4l2_handle) - { - int other_index = (v4l2_index == 0) ? 1 : 0; - if (fbdevVideoV4l2HandleOpened (other_index)) - { - xf86DrvMsg (0, X_ERROR, "fbdevVideoV4l2OpenHandle failed. no empty.\n"); - return BadRequest; - } - else - { - pPortPriv->v4l2_handle = fbdevVideoV4l2OpenHandle (pScrnInfo->pScreen, other_index, REQ_BUF_NUM); - if (!pPortPriv->v4l2_handle) - { - xf86DrvMsg (0, X_ERROR, "fbdevVideoV4l2OpenHandle failed. fail open.\n"); - return BadRequest; - } - } - - v4l2_index = other_index; - } - - pFBDev->v4l2_owner[v4l2_index] = (void*)pPortPriv; - pPortPriv->v4l2_index = v4l2_index; - } - - if (!fbdevVideoV4l2CheckSize (pPortPriv->v4l2_handle, pixelformat, img, src, dst, fmt_type, V4L2_MEMORY_MMAP)) - return BadRequest; - - if (fbdevVideoV4l2SetFormat (pPortPriv->v4l2_handle, img, src, dst, - image_info->id, scn_rotate, hw_rotate, - pPortPriv->hflip, pPortPriv->vflip, - REQ_BUF_NUM, FALSE)) - { - fbdevVideoV4l2Draw (pPortPriv->v4l2_handle, buf, phy_addrs); - - if (modeBefore == PORT_MODE_WAITING) - pScrnInfo->pScreen->WindowExposures ((WindowPtr) pDraw, clip_boxes, NULL); - -#if ENABLE_ARM - /* update cliplist */ - if (!REGION_EQUAL (pScrnInfo->pScreen, &pPortPriv->clip, clip_boxes)) - { - /* setting transparency length to 8 */ - if (!pFBDev->bFbAlphaEnabled) - { - fbdevFbScreenAlphaInit (fbdevHWGetFD (pScrnInfo)); - pFBDev->bFbAlphaEnabled = TRUE; - } - } -#endif - - return Success; - } - - _fbdevVideoCloseV4l2Handle (pScrnInfo, pPortPriv); - - pPortPriv->mode = PORT_MODE_WAITING; - - return Success; -} - -static Bool -_fbdevVideoSetHWPortsProperty (ScreenPtr pScreen, int nums) -{ - WindowPtr pWin = pScreen->root; - Atom atom_hw_ports; - - if (!pWin || !serverClient) - return FALSE; - - atom_hw_ports = MakeAtom ("X_HW_PORTS", strlen ("X_HW_PORTS"), TRUE); - - dixChangeWindowProperty (serverClient, - pWin, atom_hw_ports, XA_CARDINAL, 32, - PropModeReplace, 1, (unsigned int*)&nums, FALSE); - - return TRUE; -} - -static void -_fbdevVideoDPMSHandler(CallbackListPtr *list, pointer closure, pointer calldata) -{ - FBDevDPMSPtr pDPMSInfo = (FBDevDPMSPtr) calldata; - - if(!pDPMSInfo || !pDPMSInfo->pScrn) - { - xf86DrvMsg (0, X_ERROR, "[%s] DPMS info or screen info is invalid !\n", __FUNCTION__); - return; - } - - switch(DPMSPowerLevel) - { - case DPMSModeOn: - break; - - case DPMSModeSuspend: - break; - - case DPMSModeStandby://LCD on - { - ScrnInfoPtr pScrnInfo = pDPMSInfo->pScrn; - FBDevPtr pFBDev = FBDEVPTR (pScrnInfo); - XF86VideoAdaptorPtr pAdaptor = pFBDev->pAdaptor; - int i; - - DRVLOG ("%s : DPMSModeStandby \n", __FUNCTION__); - - for (i = 0; i < FBDEV_MAX_PORT; i++) - { - FBDevPortPrivPtr pPortPriv = (FBDevPortPrivPtr) pAdaptor->pPortPrivates[i].ptr; - if (!pPortPriv->v4l2_handle || !pPortPriv->need_streamon) - continue; - - if (!fbdevVideoV4l2StreamOn (pPortPriv->v4l2_handle)) - { - /* will re-open if failed */ - _fbdevVideoCloseV4l2Handle (pScrnInfo, pPortPriv->v4l2_handle); - pPortPriv->v4l2_handle = NULL; - } - pPortPriv->need_streamon = FALSE; - } - break; - } - case DPMSModeOff://LCD off - { - ScrnInfoPtr pScrnInfo = pDPMSInfo->pScrn; - FBDevPtr pFBDev = FBDEVPTR (pScrnInfo); - XF86VideoAdaptorPtr pAdaptor = pFBDev->pAdaptor; - int i; - - DRVLOG ("%s : DPMSModeOff \n", __FUNCTION__); - - for (i = 0; i < FBDEV_MAX_PORT; i++) - { - FBDevPortPrivPtr pPortPriv = (FBDevPortPrivPtr) pAdaptor->pPortPrivates[i].ptr; - if (!pPortPriv->v4l2_handle || pPortPriv->need_streamon) - continue; - - fbdevVideoV4l2StreamOff (pPortPriv->v4l2_handle); - pPortPriv->need_streamon = TRUE; - } - - break; - } - default: - return; - } -} - -static void -_fbdevVideoBlockHandler (pointer data, OSTimePtr pTimeout, pointer pRead) -{ - ScrnInfoPtr pScrnInfo = (ScrnInfoPtr)data; - FBDevPtr pFBDev = FBDEVPTR (pScrnInfo); - ScreenPtr pScreen = pScrnInfo->pScreen; - - if(registered_handler && _fbdevVideoSetHWPortsProperty (pScreen, pFBDev->v4l2_num)) - { - RemoveBlockAndWakeupHandlers(_fbdevVideoBlockHandler, (WakeupHandlerProcPtr)NoopDDA, data); - registered_handler = FALSE; - } -} - -static int -FBDevVideoGetPortAttribute (ScrnInfoPtr pScrnInfo, - Atom attribute, - INT32 *value, - pointer data) -{ - DRVLOG ("[GetPortAttribute] \n"); - - FBDevPortPrivPtr pPortPriv = (FBDevPortPrivPtr) data; - - if (attribute == _fbdevVideoGetPortAtom (PAA_ROTATION)) - { - *value = pPortPriv->rotate; - return Success; - } - else if (attribute == _fbdevVideoGetPortAtom (PAA_HFLIP)) - { - *value = pPortPriv->hflip; - return Success; - } - else if (attribute == _fbdevVideoGetPortAtom (PAA_VFLIP)) - { - *value = pPortPriv->vflip; - return Success; - } - else if (attribute == _fbdevVideoGetPortAtom (PAA_PREEMPTION)) - { - *value = pPortPriv->preemption; - return Success; - } - else if (attribute == _fbdevVideoGetPortAtom (PAA_DRAWINGMODE)) - { - *value = (pPortPriv->mode == PORT_MODE_WAITING); - return Success; - } - return BadMatch; -} - -static int -FBDevVideoSetPortAttribute (ScrnInfoPtr pScrnInfo, - Atom attribute, - INT32 value, - pointer data) -{ - FBDevPortPrivPtr pPortPriv = (FBDevPortPrivPtr) data; - - if (attribute == _fbdevVideoGetPortAtom (PAA_ROTATION)) - { - pPortPriv->rotate = value; - DRVLOG ("[SetPortAttribute] rotate(%d) \n", value); - return Success; - } - else if (attribute == _fbdevVideoGetPortAtom (PAA_HFLIP)) - { - pPortPriv->hflip = value; - DRVLOG ("[SetPortAttribute] hflip(%d) \n", value); - return Success; - } - else if (attribute == _fbdevVideoGetPortAtom (PAA_VFLIP)) - { - pPortPriv->vflip = value; - DRVLOG ("[SetPortAttribute] vflip(%d) \n", value); - return Success; - } - else if (attribute == _fbdevVideoGetPortAtom (PAA_PREEMPTION)) - { - pPortPriv->preemption = value; - DRVLOG ("[SetPortAttribute] preemption(%d) \n", value); - return Success; - } - else if (attribute == _fbdevVideoGetPortAtom (PAA_STREAMOFF)) - { - DRVLOG ("[SetPortAttribute] STREAMOFF \n"); - - if (!pPortPriv->need_streamon && pPortPriv->v4l2_handle) - { - fbdevVideoV4l2StreamOff (pPortPriv->v4l2_handle); - pPortPriv->need_streamon = TRUE; - } - - return Success; - } - return BadMatch; -} - -static void -FBDevVideoQueryBestSize (ScrnInfoPtr pScrnInfo, - Bool motion, - short vid_w, short vid_h, - short dst_w, short dst_h, - uint *p_w, uint *p_h, - pointer data) -{ - DRVLOG ("%s (%s:%d)\n", __FUNCTION__, __FILE__, __LINE__); - - *p_w = dst_w; - *p_h = dst_h; -} - -static void -FBDevVideoStop (ScrnInfoPtr pScrnInfo, pointer data, Bool exit) -{ - DRVLOG ("%s (%s:%d) exit(%d)\n", __FUNCTION__, __FILE__, __LINE__, exit); - - FBDevPortPrivPtr pPortPriv = (FBDevPortPrivPtr) data; - - if (pPortPriv->mode == PORT_MODE_V4L2) - { - FBDevPtr pFBDev = (FBDevPtr) pScrnInfo->driverPrivate; - - _fbdevVideoCloseV4l2Handle (pScrnInfo, pPortPriv); - -#if ENABLE_ARM - if (pFBDev->bFbAlphaEnabled) - { - fbdevFbScreenAlphaDeinit (fbdevHWGetFD (pScrnInfo)); - pFBDev->bFbAlphaEnabled = FALSE; - } -#endif - } - - pPortPriv->mode = PORT_MODE_INIT; - pPortPriv->preemption = 0; - pPortPriv->rotate = -1; - pPortPriv->need_streamon = FALSE; - - if (exit) - REGION_EMPTY (pScrnInfo, &pPortPriv->clip); -} - -static int -FBDevVideoReputImage (ScrnInfoPtr pScrnInfo, - short drw_x, - short drw_y, - RegionPtr clipBoxes, - pointer data, - DrawablePtr pDraw) - -{ - return Success; -} - -int -fbdevVideoQueryImageAttributes (ScrnInfoPtr pScrnInfo, - int id, - unsigned short *w, - unsigned short *h, - int *pitches, - int *offsets) -{ - int size = 0, tmp = 0; - - *w = (*w + 1) & ~1; - if (offsets) - offsets[0] = 0; - - switch (id) - { - case FOURCC_RGB565: - size += (*w << 1); - if (pitches) - pitches[0] = size; - size *= *h; - break; - case FOURCC_RGB24: - size += (*w << 1) + *w; - if (pitches) - pitches[0] = size; - size *= *h; - break; - case FOURCC_RGB32: - size += (*w << 2); - if (pitches) - pitches[0] = size; - size *= *h; - break; - case FOURCC_I420: - case FOURCC_S420: - case FOURCC_YV12: - *h = (*h + 1) & ~1; - size = (*w + 3) & ~3; - if (pitches) - pitches[0] = size; - - size *= *h; - if (offsets) - offsets[1] = size; - - tmp = ((*w >> 1) + 3) & ~3; - if (pitches) - pitches[1] = pitches[2] = tmp; - - tmp *= (*h >> 1); - size += tmp; - if (offsets) - offsets[2] = size; - - size += tmp; - break; - case FOURCC_UYVY: - case FOURCC_SUYV: - case FOURCC_YUY2: - case FOURCC_ST12: - case FOURCC_SN12: - size = *w << 1; - if (pitches) - pitches[0] = size; - - size *= *h; - break; - case FOURCC_NV12: - size = *w; - if (pitches) - pitches[0] = size; - - size *= *h; - if (offsets) - offsets[1] = size; - - tmp = *w; - if (pitches) - pitches[1] = tmp; - - tmp *= (*h >> 1); - size += tmp; - break; - default: - return BadIDChoice; - } - - return size; -} - -static int -FBDevVideoPutImage (ScrnInfoPtr pScrnInfo, - short src_x, short src_y, short dst_x, short dst_y, - short src_w, short src_h, short dst_w, short dst_h, - int id, - uchar *buf, - short width, short height, - Bool sync, - RegionPtr clip_boxes, - pointer data, - DrawablePtr pDraw) -{ - ScreenPtr pScreen = pScrnInfo->pScreen; - FBDevPortPrivPtr pPortPriv = (FBDevPortPrivPtr) data; - XF86ImageRec *image_info; - FBDevPortMode modeBefore = pPortPriv->mode; - xRectangle img = {0, 0, width, height}; - xRectangle src = {src_x, src_y, src_w, src_h}; - xRectangle dst = {dst_x, dst_y, dst_w, dst_h}; - xRectangle clip; - BoxPtr clip_box; - int scn_rotate, rotate, hw_rotate; - int v4l2_index = 0; - FBDevPtr pFBDev = FBDEVPTR (pScrnInfo); - - if (pFBDev->isLcdOff) - return Success; - - pPortPriv->pDraw = pDraw; - - image_info = _fbdevVideoGetImageInfo (id); - if (!image_info) - { - xf86DrvMsg (0, X_ERROR, "ID(%c%c%c%c) not supported.\n", - id & 0xFF, (id & 0xFF00) >> 8, - (id & 0xFF0000) >> 16, (id & 0xFF000000) >> 24); - return BadRequest; - } - - if (pPortPriv->need_streamon && pPortPriv->v4l2_handle) - { - _fbdevVideoCloseV4l2Handle (pScrnInfo, pPortPriv->v4l2_handle); - pPortPriv->need_streamon = FALSE; - pPortPriv->v4l2_handle = NULL; - } - - if (!pPortPriv->v4l2_handle) - if (!_fbdevVideoSetMode (pScrnInfo, pPortPriv, &v4l2_index)) - return BadRequest; - - if (pPortPriv->mode != PORT_MODE_V4L2) - return Success; - - _fbdevVideoGetRotation (pScreen, pPortPriv, pDraw, &scn_rotate, &rotate, &hw_rotate); - - clip_box = RegionRects(clip_boxes); - clip.x = clip_box->x1; - clip.y = clip_box->y1; - clip.width = clip_box->x2 - clip_box->x1; - clip.height = clip_box->y2 - clip_box->y1; - - DRVLOG ("[PutImage] buf(%p) ID(%c%c%c%c) mode(%s) preem(%d) handle(%p) rot(%d+%d=%d) res(%dx%d)\n", - buf, id & 0xFF, (id & 0xFF00) >> 8, (id & 0xFF0000) >> 16, (id & 0xFF000000) >> 24, - pPortPriv->mode == PORT_MODE_WAITING ? "waiting" : "V4L2", - pPortPriv->preemption, - pPortPriv->v4l2_handle, - scn_rotate, rotate, hw_rotate, - pScreen->width, pScreen->height); - - DRVLOG ("[PutImage] \tpDraw(%d,%d %dx%d) clip(%d,%d %dx%d)\n", - pDraw->x, pDraw->y, pDraw->width, pDraw->height, - clip.x, clip.y, clip.width, clip.height); - - DRVLOG ("[PutImage] \t img(%d,%d %dx%d) src(%d,%d %dx%d) dst(%d,%d %dx%d) \n", - img.x, img.y, img.width, img.height, - src.x, src.y, src.width, src.height, - dst.x, dst.y, dst.width, dst.height); - - _fbdevVideoInterfbdevtXRects (&src, &src, &img); - - DRVLOG ("[PutImage] \t=> img(%d,%d %dx%d) src(%d,%d %dx%d) dst(%d,%d %dx%d) \n", - img.x, img.y, img.width, img.height, - src.x, src.y, src.width, src.height, - dst.x, dst.y, dst.width, dst.height); - - return _fbdevVideoPutImageV4l2 (pScrnInfo, pPortPriv, &img, &src, &dst, clip_boxes, - scn_rotate, rotate, hw_rotate, - image_info, buf, modeBefore, v4l2_index, pDraw); -} - -/** - * Set up all our internal structures. - */ -static XF86VideoAdaptorPtr -fbdevVideoSetupImageVideo (ScreenPtr pScreen) -{ - DRVLOG ("%s (%s:%d)\n", __FUNCTION__, __FILE__, __LINE__); - - XF86VideoAdaptorPtr pAdaptor; - FBDevPortPrivPtr pPortPriv; - XF86ImagePtr pImages; - int i, count = 0; - - pAdaptor = calloc (1, sizeof (XF86VideoAdaptorRec) + - (sizeof (DevUnion) + sizeof (FBDevPortPriv)) * FBDEV_MAX_PORT); - if (pAdaptor == NULL) - return NULL; - - DummyEncoding[0].width = pScreen->width; - DummyEncoding[0].height = pScreen->height; - - pAdaptor->type = XvWindowMask | XvPixmapMask | XvInputMask | XvImageMask; - pAdaptor->flags = (VIDEO_CLIP_TO_VIEWPORT | VIDEO_OVERLAID_IMAGES); - pAdaptor->name = "FBDEV supporting Software Video Conversions"; - pAdaptor->nEncodings = sizeof (DummyEncoding) / sizeof (XF86VideoEncodingRec); - pAdaptor->pEncodings = DummyEncoding; - pAdaptor->nFormats = NUM_FORMATS; - pAdaptor->pFormats = Formats; - pAdaptor->nPorts = FBDEV_MAX_PORT; - pAdaptor->pPortPrivates = (DevUnion*)(&pAdaptor[1]); - - pPortPriv = - (FBDevPortPrivPtr) (&pAdaptor->pPortPrivates[FBDEV_MAX_PORT]); - - for (i=0; ipPortPrivates[i].ptr = &pPortPriv[i]; - - pPortPriv[i].index = i; - pPortPriv[i].rotate = -1; - pPortPriv[i].v4l2_index = -1; - - REGION_INIT (pScreen, &pPortPriv[i].clipBoxes, NullBox, 0); - } - - pImages = fbdevVideoV4l2SupportImages (&count); - - pAdaptor->nAttributes = NUM_ATTRIBUTES; - pAdaptor->pAttributes = Attributes; - pAdaptor->nImages = count; - pAdaptor->pImages = pImages; - - pAdaptor->PutImage = FBDevVideoPutImage; - pAdaptor->ReputImage = FBDevVideoReputImage; - pAdaptor->StopVideo = FBDevVideoStop; - pAdaptor->GetPortAttribute = FBDevVideoGetPortAttribute; - pAdaptor->SetPortAttribute = FBDevVideoSetPortAttribute; - pAdaptor->QueryBestSize = FBDevVideoQueryBestSize; - pAdaptor->QueryImageAttributes = fbdevVideoQueryImageAttributes; - - return pAdaptor; -} - -#ifdef XV -/** - * Set up everything we need for Xv. - */ -Bool fbdevVideoInit (ScreenPtr pScreen) -{ - DRVLOG ("%s (%s:%d)\n", __FUNCTION__, __FILE__, __LINE__); - - ScrnInfoPtr pScrnInfo = xf86Screens[pScreen->myNum]; - FBDevPtr pFBDev = (FBDevPtr) pScrnInfo->driverPrivate; - - pFBDev->pAdaptor = fbdevVideoSetupImageVideo (pScreen); - - if (pFBDev->pAdaptor) - { - xf86XVScreenInit (pScreen, &pFBDev->pAdaptor, 1); - - pFBDev->v4l2_num = fbdevVideoV4l2GetHandleNums (); - pFBDev->v4l2_owner = (void**)calloc (sizeof (void*), pFBDev->v4l2_num); - - if(registered_handler == FALSE) - { - RegisterBlockAndWakeupHandlers(_fbdevVideoBlockHandler, (WakeupHandlerProcPtr)NoopDDA, pScrnInfo); - registered_handler = TRUE; - } - - if (AddCallback (&DPMSCallback, _fbdevVideoDPMSHandler, NULL) != TRUE) - { - xf86DrvMsg (pScrnInfo->scrnIndex, X_ERROR, "Failed to register _fbdevVideoDPMSHandler. \n"); - return FALSE; - } - - return TRUE; - } - else - return FALSE; -} - -/** - * Shut down Xv, used on regeneration. - */ -void fbdevVideoFini (ScreenPtr pScreen) -{ - DRVLOG ("%s (%s:%d)\n", __FUNCTION__, __FILE__, __LINE__); - - ScrnInfoPtr pScrnInfo = xf86Screens[pScreen->myNum]; - FBDevPtr pFBDev = (FBDevPtr) pScrnInfo->driverPrivate; - - XF86VideoAdaptorPtr pAdaptor = pFBDev->pAdaptor; - int i; - - if (!pAdaptor) - return; - - DeleteCallback (&DPMSCallback, _fbdevVideoDPMSHandler, NULL); - - for (i = 0; i < FBDEV_MAX_PORT; i++) - { - FBDevPortPrivPtr pPortPriv = (FBDevPortPrivPtr) pAdaptor->pPortPrivates[i].ptr; - - REGION_UNINIT (pScreen, &pPortPriv->clipBoxes); - - _fbdevVideoCloseV4l2Handle (pScrnInfo, pPortPriv); - } - - free (pAdaptor); - pFBDev->pAdaptor = NULL; - - if (pFBDev->v4l2_owner) - { - free (pFBDev->v4l2_owner); - pFBDev->v4l2_owner = NULL; - pFBDev->v4l2_num = 0; - } -} - -#endif diff --git a/src/xv/fbdev_video.h b/src/xv/fbdev_video.h deleted file mode 100644 index 3e4bf59..0000000 --- a/src/xv/fbdev_video.h +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 FBDEV_VIDEO_H -#define FBDEV_VIDEO_H - -typedef enum -{ - PORT_MODE_INIT, - PORT_MODE_V4L2, - PORT_MODE_WAITING -} FBDevPortMode; - -/* FBDEV port information structure */ -typedef struct -{ - int index; - FBDevPortMode mode; - int drawing; - int size; - - RegionRec clip; - - int rotate; - int hflip; - int vflip; - xRectangle dst; - RegionRec clipBoxes; - int preemption; /* 1:high, 0:default, -1:low */ - DrawablePtr pDraw; - - int v4l2_index; - void *v4l2_handle; - - int need_streamon; -} FBDevPortPriv, *FBDevPortPrivPtr; - -extern Bool fbdevVideoInit (ScreenPtr pScreen); -extern void fbdevVideoFini (ScreenPtr pScreen); -int fbdevVideoQueryImageAttributes (ScrnInfoPtr pScrnInfo, - int id, - unsigned short *w, - unsigned short *h, - int *pitches, - int *offsets); - -#endif // FBDEV_VIDEO_H diff --git a/src/xv/fbdev_video_fourcc.h b/src/xv/fbdev_video_fourcc.h deleted file mode 100644 index 8c5f0e2..0000000 --- a/src/xv/fbdev_video_fourcc.h +++ /dev/null @@ -1,196 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 __FBDEV_VIDEO_FOURCC_H__ -#define __FBDEV_VIDEO_FOURCC_H__ - -#include - -#define B(c,s) ((((unsigned int)(c)) & 0xff) << (s)) -#define FOURCC(a,b,c,d) (B(d,24) | B(c,16) | B(b,8) | B(a,0)) - -/* http://www.fourcc.org/yuv.php - * http://en.wikipedia.org/wiki/YUV - */ -#define FOURCC_RGB565 FOURCC('R','G','B','P') -#define XVIMAGE_RGB565 \ - { \ - FOURCC_RGB565, \ - XvRGB, \ - LSBFirst, \ - {'R','G','B','P', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 16, \ - XvPacked, \ - 1, \ - 16, 0x0000F800, 0x000007E0, 0x0000001F, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - {'R','G','B',0, \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_RGB24 FOURCC('R','G','B','3') -#define XVIMAGE_RGB24 \ - { \ - FOURCC_RGB24, \ - XvRGB, \ - LSBFirst, \ - {'R','G','B',0, \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 24, \ - XvPacked, \ - 1, \ - 24, 0x00FF0000, 0x0000FF00, 0x000000FF, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - {'R','G','B',0, \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_RGB32 FOURCC('R','G','B','4') -#define XVIMAGE_RGB32 \ - { \ - FOURCC_RGB32, \ - XvRGB, \ - LSBFirst, \ - {'R','G','B',0, \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 32, \ - XvPacked, \ - 1, \ - 24, 0x00FF0000, 0x0000FF00, 0x000000FF, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - {'X','R','G','B', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_ST12 FOURCC('S','T','1','2') -#define XVIMAGE_ST12 \ - { \ - FOURCC_ST12, \ - XvYUV, \ - LSBFirst, \ - {'S','T','1','2', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 12, \ - XvPlanar, \ - 3, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 2, 2, \ - 1, 2, 2, \ - {'Y','U','V', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_SN12 FOURCC('S','N','1','2') -#define XVIMAGE_SN12 \ - { \ - FOURCC_SN12, \ - XvYUV, \ - LSBFirst, \ - {'S','N','1','2', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 12, \ - XvPlanar, \ - 3, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 2, 2, \ - 1, 2, 2, \ - {'Y','U','V', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_NV12 FOURCC('N','V','1','2') -#define XVIMAGE_NV12 \ - { \ - FOURCC_NV12, \ - XvYUV, \ - LSBFirst, \ - {'N','V','1','2', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 12, \ - XvPacked, \ - 1, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 2, 2, \ - 1, 2, 2, \ - {'Y','U','V', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_S420 FOURCC('S','4','2','0') -#define XVIMAGE_S420 \ - { \ - FOURCC_S420, \ - XvYUV, \ - LSBFirst, \ - {'S','4','2','0', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 12, \ - XvPlanar, \ - 3, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 2, 2, \ - 1, 2, 2, \ - {'Y','U','V', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } -#define FOURCC_SUYV FOURCC('S','U','Y','V') -#define XVIMAGE_SUYV \ - { \ - FOURCC_SUYV, \ - XvYUV, \ - LSBFirst, \ - {'S','U','Y','V', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 16, \ - XvPacked, \ - 1, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 2, 2, \ - 1, 1, 1, \ - {'Y','U','Y','V', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - - -#endif // __FBDEV_VIDEO_FOURCC_H__ diff --git a/src/xv/fbdev_video_types.h b/src/xv/fbdev_video_types.h deleted file mode 100644 index 3f9f48b..0000000 --- a/src/xv/fbdev_video_types.h +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 __FBDEV_V4L2_TYPES_H__ -#define __FBDEV_V4L2_TYPES_H__ - -#include -#include - -#include - -enum -{ - OUTPUT_PATH_DMA, /* FrameBuffer */ - OUTPUT_PATH_FIMD, /* LCD */ -}; - -/************************************************************ - * TYPE DEFINITION - ************************************************************/ -typedef enum v4l2_buf_type FBDevV4l2BufType; -typedef enum v4l2_memory FBDevV4l2Memory; - -#ifndef uint -typedef unsigned int uint; -#endif - -#ifndef uchar -typedef unsigned char uchar; -#endif - -#ifndef ushort -typedef unsigned short ushort; -#endif - -/************************************************************ - * STRUCTURE - ************************************************************/ -typedef struct _FBDevV4l2Data -{ - __u32 path; - __u32 in_format; - __u32 out_format; - __u32 field; - char in_file_name[50]; - - struct v4l2_rect src; - struct v4l2_rect crop; - struct v4l2_rect dst; - struct v4l2_rect win; - - __u32 s_size[3]; - __u32 src_size; - __u32 d_size[3]; - __u32 dst_size; - - int rotation; -} FBDevV4l2Data; - -typedef struct _FBDevV4l2FimcBuffer -{ - uint base[3]; - size_t length[3]; -} FBDevV4l2FimcBuffer; - -typedef struct _FBDevV4l2SrcBuffer -{ - int index; - int size; - uchar *buf; -} FBDevV4l2SrcBuffer; - -typedef struct _FBDevV4l2DstBuffer -{ - int index; - int size; - uchar *buf; -} FBDevV4l2DstBuffer; - -#endif diff --git a/src/xv/fbdev_video_v4l2.h b/src/xv/fbdev_video_v4l2.h deleted file mode 100644 index e161ec1..0000000 --- a/src/xv/fbdev_video_v4l2.h +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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 __FBDEV_VIDEO_V4L2_H__ -#define __FBDEV_VIDEO_V4L2_H__ - -#include -#include - -#include "fbdev_v4l2.h" - -XF86ImagePtr fbdevVideoV4l2SupportImages (int *count); - -Bool fbdevVideoV4l2GetFormatInfo (int id, int *type, uint *pixelformat, FBDevV4l2Memory *memory); -Bool fbdevVideoV4l2CheckSize (void *handle, uint pixelformat, - xRectangle *img, xRectangle *src, xRectangle *dst, - int type, int memory); - -int fbdevVideoV4l2GetHandleNums (void); -Bool fbdevVideoV4l2HandleOpened (int index); - -void* fbdevVideoV4l2OpenHandle (ScreenPtr pScreen, int index, int requestbuffer); -void fbdevVideoV4l2CloseHandle (void *handle); - -Bool fbdevVideoV4l2StreamOn (void *handle); -void fbdevVideoV4l2StreamOff (void *handle); - -int fbdevVideoV4l2SetFormat (void *handle, - xRectangle *img, /* src->x, src->y : not used. */ - xRectangle *crop, - xRectangle *dest, - uint id, - int scn_rotate, - int hw_rotate, - int hflip, - int vflip, - int requestbuffer, - Bool sync); - -int fbdevVideoV4l2Draw (void *handle, uchar *buf, uint *phy_addrs); - -#endif diff --git a/src/xv/i386/fbdev_video_v4l2.c b/src/xv/i386/fbdev_video_v4l2.c deleted file mode 100644 index 213bbf5..0000000 --- a/src/xv/i386/fbdev_video_v4l2.c +++ /dev/null @@ -1,787 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Boram Park - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "fbdev_util.h" -#include "fbdev_video_v4l2.h" - -#include "fbdev.h" -#include "fbdev_fb.h" -#include "fbdev_util.h" -#include "fbdev_video.h" -#include "fbdev_video_fourcc.h" -#include "fbdev_pixman.h" - -#define BUF_NUM 1 - -typedef struct _DeviceInfo -{ - char *video; /* video */ - int bOpened; -} DeviceInfo; - -typedef struct _FormatInfo -{ - int id; - int type; - uint pixelformat; - FBDevV4l2Memory memory; -} FormatInfo; - -typedef struct -{ - int index; - - ScreenPtr pScreen; - - int video_fd; - - struct - { - int init; - xRectangle img; - xRectangle crop; - xRectangle dst; - int id; - int hw_rotate; - int scn_rotate; - int hflip; - int vflip; - int streamon; - int cur_idx; - - void* last_buffer; - int queued_index; - - void* backup; - Bool sync; - } status; - - int size; - unsigned int pixfmt; - FBDevV4l2FimcBuffer fimcbuf; - FBDevV4l2SrcBuffer *src_buf; - FBDevV4l2DstBuffer *dst_buf; - FBDevV4l2Memory memory; - - int re_setting; -} FBDevDispHandle; - -enum -{ - TYPE_RGB, - TYPE_YUV444, - TYPE_YUV422, - TYPE_YUV420, -}; - -static FormatInfo format_infos [] = -{ - { FOURCC_RGB565, TYPE_RGB, V4L2_PIX_FMT_RGB565, V4L2_MEMORY_MMAP }, - { FOURCC_RGB32, TYPE_RGB, V4L2_PIX_FMT_RGB32, V4L2_MEMORY_MMAP }, - { FOURCC_I420, TYPE_YUV420, V4L2_PIX_FMT_YUV420, V4L2_MEMORY_MMAP }, - { FOURCC_YUY2, TYPE_YUV422, V4L2_PIX_FMT_YUYV, V4L2_MEMORY_MMAP }, - { FOURCC_YV12, TYPE_YUV420, V4L2_PIX_FMT_YVU420, V4L2_MEMORY_MMAP }, - -}; - -static XF86ImageRec Images[] = -{ - XVIMAGE_I420, - XVIMAGE_YV12, - XVIMAGE_YUY2, - XVIMAGE_RGB32, - XVIMAGE_RGB565, -}; - -static DeviceInfo device_infos[] = -{ - { "/dev/video1", FALSE }, - { "/dev/video2", FALSE }, -}; - -#define NUM_IMAGES (sizeof(Images) / sizeof(XF86ImageRec)) -#define DEVICE_NUMS (sizeof (device_infos) / sizeof (DeviceInfo)) - -static Bool -_fbdevVideoV4l2SetDst (int fd, xRectangle *rect) -{ - struct v4l2_format format = {0,}; - int caps; - - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[SetDst] win(%d,%d %dx%d) \n", - rect->x, rect->y, rect->width, rect->height); - - caps = V4L2_CAP_VIDEO_OVERLAY; - if (!fbdev_v4l2_querycap (fd, caps)) - return FALSE; - - /* set format */ - CLEAR (format); - format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - if (!fbdev_v4l2_g_fmt (fd, &format)) - return FALSE; - - format.fmt.win.w.left = rect->x; - format.fmt.win.w.top = rect->y; - format.fmt.win.w.width = rect->width; - format.fmt.win.w.height = rect->height; - if (!fbdev_v4l2_s_fmt (fd, &format)) - return FALSE; - - return TRUE; -} - -static Bool -_fbdevVideoV4l2SetBuffer (int fd, - FBDevV4l2BufType type, - FBDevV4l2Memory memory, - int num_buf, - FBDevV4l2DstBuffer **mem_buf) -{ - struct v4l2_requestbuffers req = {0,}; - - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[SetBuffer] num_buf(%d) mem_buf(%p) memory(%d)\n", - num_buf, mem_buf, memory); - - CLEAR (req); - req.count = num_buf; - req.type = type; - req.memory = memory; - if (!fbdev_v4l2_reqbuf (fd, &req)) - return FALSE; - - if (memory == V4L2_MEMORY_MMAP) - { - FBDevV4l2DstBuffer *out_buf; - int i; - - return_val_if_fail (mem_buf != NULL, FALSE); - - out_buf = calloc (req.count, sizeof (FBDevV4l2DstBuffer)); - return_val_if_fail (out_buf != NULL, FALSE); - - for (i = 0; i < num_buf; i++) - { - struct v4l2_buffer buffer = {0,}; - - CLEAR (buffer); - buffer.index = i; - buffer.type = type; - buffer.memory = V4L2_MEMORY_MMAP; - if (!fbdev_v4l2_querybuf (fd, &buffer)) - { - free (out_buf); - return FALSE; - } - - out_buf[i].index = buffer.index; - out_buf[i].size = buffer.length; - out_buf[i].buf = mmap (NULL, buffer.length, - PROT_READ | PROT_WRITE , \ - MAP_SHARED , fd, buffer.m.offset & ~(PAGE_SIZE - 1)); - out_buf[i].buf += buffer.m.offset & (PAGE_SIZE - 1); - - if (out_buf[i].buf == MAP_FAILED) - { - xf86DrvMsg (0, X_ERROR, "[SetBuffer] mmap failed. index(%d)\n", i); - free (out_buf); - return FALSE; - } - } - - *mem_buf = out_buf; - } - - return TRUE; -} - -static Bool -_fbdevVideoV4l2ClearBuffer (int fd, - FBDevV4l2BufType type, - FBDevV4l2Memory memory, - int num_buf, - FBDevV4l2DstBuffer *mem_buf) -{ - struct v4l2_requestbuffers req = {0,}; - - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[ClearBuffer] memory(%d) num_buf(%d) mem_buf(%p)\n", - num_buf, mem_buf, memory); - - if (memory == V4L2_MEMORY_MMAP && mem_buf) - { - int i; - - for (i = 0; i < num_buf; i++) - if (mem_buf[i].buf) - if (munmap (mem_buf[i].buf, mem_buf[i].size) == -1) - xf86DrvMsg (0, X_WARNING, "[ClearBuffer] Failed to unmap v4l2 buffer at index %d\n", i); - - free (mem_buf); - } - - CLEAR (req); - req.count = 0; - req.type = type; - req.memory = memory; - if (!fbdev_v4l2_reqbuf (fd, &req)) - return FALSE; - - return TRUE; -} - -static Bool -_fbdevVideoV4l2StreamOn (int fd) -{ - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[StreamOn] \n"); - - if (!fbdev_v4l2_start_overlay (fd)) - return FALSE; - - return TRUE; -} - - -static Bool -_fbdevVideoV4l2StreamOff (int fd) -{ - return_val_if_fail (fd >= 0, FALSE); - - DRVLOG ("[StreamOff] \n"); - - if (!fbdev_v4l2_stop_overlay (fd)) - return FALSE; - - return TRUE; -} - -static int -_open_device (char *device) -{ - int fd; - - return_val_if_fail (device != NULL, -1); - - fd = open (device, O_RDWR); - if (fd < 0) - { - xf86DrvMsg (0, X_ERROR, "Cannot open '%s'. fd(%d)\n", device, fd); - return -1; - } - - DRVLOG ("'%s' opened. fd(%d) \n", device, fd); - - return fd; -} - -static void -_close_device (int fd) -{ - int ret; - - return_if_fail (fd >= 0); - - ret = close (fd); - if (ret < 0) - { - xf86DrvMsg (0, X_ERROR, "Cannot close fd(%d)\n", fd); - return; - } - - DRVLOG ("fd(%d) closed. \n", fd); -} - -static Bool -_fbdevVideoV4l2EnsureStreamOff (FBDevDispHandle *hdisp) -{ - if (!hdisp->status.streamon) - return TRUE; - - if (!_fbdevVideoV4l2StreamOff (hdisp->video_fd)) - return FALSE; - - hdisp->status.streamon = FALSE; - - return TRUE; -} - -static Bool -_fbdevVideoV4l2OpenDevice (FBDevDispHandle *hdisp, int index) -{ - if (device_infos[index].bOpened) - { - DRVLOG ("[OpenDevice, %p] Already opened : %s\n", hdisp, device_infos[index].video); - return FALSE; - } - - hdisp->video_fd = _open_device (device_infos[index].video); - if (hdisp->video_fd < 0) - return FALSE; - - device_infos[index].bOpened = TRUE; - - return TRUE; -} - -/* This function never failed. - * If failed, it means kernel has some problems. - * Then a device should be rebooted. - */ -static void -_fbdevVideoV4l2CloseDevice (FBDevDispHandle *hdisp) -{ - if (!_fbdevVideoV4l2EnsureStreamOff (hdisp)) // We will consider this as a LCD Off case. - xf86DrvMsg (0, X_WARNING, "[CloseDevice, %p] Warning : Cannot stream off!! \n", hdisp); - - if (hdisp->video_fd >= 0) - if (!_fbdevVideoV4l2ClearBuffer (hdisp->video_fd, - V4L2_BUF_TYPE_VIDEO_OVERLAY, - hdisp->memory, - BUF_NUM, - hdisp->dst_buf)) - xf86DrvMsg (0, X_WARNING, "[CloseDevice, %p] Warning : Cannot clear buffer!! \n", hdisp); - - hdisp->dst_buf = NULL; - - if (hdisp->video_fd >= 0) - { - _close_device (hdisp->video_fd); - hdisp->video_fd = -1; - } - - device_infos[hdisp->index].bOpened = FALSE; -} - -int -fbdevVideoV4l2GetHandleNums (void) -{ - return DEVICE_NUMS; -} - -Bool -fbdevVideoV4l2HandleOpened (int index) -{ - return_val_if_fail (index < DEVICE_NUMS, FALSE); - - return device_infos[index].bOpened; -} - -void * -fbdevVideoV4l2OpenHandle (ScreenPtr pScreen, int index, int requestbuffer) -{ - FBDevDispHandle *handle; - - return_val_if_fail (pScreen != NULL, NULL); - return_val_if_fail (index < DEVICE_NUMS, NULL); - - handle = (FBDevDispHandle*)calloc (sizeof (FBDevDispHandle), 1); - - return_val_if_fail (handle != NULL, NULL); - - handle->pScreen = pScreen; - handle->index = index; - handle->status.hw_rotate = -1; - handle->status.id = 0; - handle->status.cur_idx = -1; - handle->status.init = 0; - handle->memory = V4L2_MEMORY_MMAP; - handle->video_fd = -1; - - if (!_fbdevVideoV4l2OpenDevice (handle, index)) - { - free (handle); - return NULL; - } - - DRVLOG ("[OpenHandle, %p] Handle(%d) opened. \n", handle, index); - - return handle; -} - -void -fbdevVideoV4l2CloseHandle (void *handle) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - - return_if_fail (handle != NULL); - - _fbdevVideoV4l2CloseDevice ((FBDevDispHandle*)handle); - - if (hdisp->status.backup) - { - free (hdisp->status.backup); - hdisp->status.backup = NULL; - } - - DRVLOG ("[CloseHandle, %p] Handle(%d) closed. \n", hdisp, hdisp->index); - - free (handle); -} - -Bool -fbdevVideoV4l2StreamOn (void *handle) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - uint phy_addrs[3]; - - return_val_if_fail (hdisp != NULL, FALSE); - - hdisp->re_setting = TRUE; - - if (!_fbdevVideoV4l2OpenDevice (hdisp, hdisp->index)) - return FALSE; - - fbdevVideoV4l2SetFormat (handle, - &hdisp->status.img, - &hdisp->status.crop, - &hdisp->status.dst, - hdisp->status.id, - hdisp->status.scn_rotate, - hdisp->status.hw_rotate, - hdisp->status.hflip, - hdisp->status.vflip, - BUF_NUM, - hdisp->status.sync); - - phy_addrs[0] = hdisp->fimcbuf.base[0]; - phy_addrs[1] = hdisp->fimcbuf.base[1]; - phy_addrs[2] = hdisp->fimcbuf.base[2]; - - fbdevVideoV4l2Draw (handle, hdisp->status.backup, phy_addrs); - - if (hdisp->status.backup) - { - free (hdisp->status.backup); - hdisp->status.backup = NULL; - } - - hdisp->re_setting = FALSE; - - DRVLOG ("%s \n", __FUNCTION__); - - return TRUE; -} - -void -fbdevVideoV4l2StreamOff (void *handle) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - - return_if_fail (hdisp != NULL); - - if (hdisp->memory == V4L2_MEMORY_MMAP) - { - int size; - - if (hdisp->status.backup) - { - free (hdisp->status.backup); - hdisp->status.backup = NULL; - } - - size = fbdevVideoQueryImageAttributes (NULL, hdisp->status.id, - (unsigned short*)&hdisp->status.img.width, - (unsigned short*)&hdisp->status.img.height, - NULL, NULL); - - if (size > 0) - hdisp->status.backup = malloc (size); - - if (hdisp->status.backup && - hdisp->dst_buf && - hdisp->dst_buf[hdisp->status.queued_index].buf) - memcpy (hdisp->status.backup, - hdisp->dst_buf[hdisp->status.queued_index].buf, - size); - } - - _fbdevVideoV4l2CloseDevice (hdisp); - - DRVLOG ("%s \n", __FUNCTION__); -} - -/* img->x, img->y : not used. */ -Bool -fbdevVideoV4l2SetFormat (void *handle, - xRectangle *img, xRectangle *crop, xRectangle *dst, - uint id, - int scn_rotate, - int hw_rotate, - int hflip, - int vflip, - int requestbuffer, - Bool sync) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - Bool src_changed = FALSE; - Bool dst_changed = FALSE; - Bool buf_changed = FALSE; - - return_val_if_fail (handle != NULL, FALSE); - return_val_if_fail (img != NULL, FALSE); - return_val_if_fail (crop != NULL, FALSE); - return_val_if_fail (dst != NULL, FALSE); - - DRVLOG ("[SetFormat, %p] try to set : img(%d,%d %dx%d) crop(%d,%d %dx%d) dst(%d,%d %dx%d) id(%x), rot(%d), flip(%d,%d) req(%d)\n", hdisp, - img->x, img->y, img->width, img->height, - crop->x, crop->y, crop->width, crop->height, - dst->x, dst->y, dst->width, dst->height, - id, hw_rotate, hflip, vflip, requestbuffer); - - if (memcmp (&hdisp->status.img, img, sizeof (xRectangle)) || - memcmp (&hdisp->status.crop, crop, sizeof (xRectangle)) || - hdisp->status.id != id) - src_changed = TRUE; - - if (memcmp (&hdisp->status.dst, dst, sizeof (xRectangle)) || - hdisp->status.hw_rotate != hw_rotate || - hdisp->status.hflip != hflip || - hdisp->status.vflip != vflip) - dst_changed = TRUE; - - if (hdisp->status.init && (src_changed || dst_changed || buf_changed)) - { - _fbdevVideoV4l2CloseDevice (hdisp); - _fbdevVideoV4l2OpenDevice (hdisp, hdisp->index); - - DRVLOG ("[SetFormat, %p] changed : img(%d) dst(%d) buf(%d) \n", hdisp, - src_changed, dst_changed, buf_changed); - - /* After close device, below all steps should be done. */ - src_changed = dst_changed = buf_changed = TRUE; - hdisp->status.init = 0; - } - - if (hdisp->re_setting) - src_changed = dst_changed = buf_changed = TRUE; - - if (src_changed || dst_changed || buf_changed) - { - fbdevVideoV4l2GetFormatInfo (id, NULL, &hdisp->pixfmt, &hdisp->memory); - - DRVLOG ("[SetFormat, %p] id(%c%c%c%c) => pixfmt(%d) memory(%d) \n", hdisp, - id & 0xFF, (id & 0xFF00) >> 8, (id & 0xFF0000) >> 16, (id & 0xFF000000) >> 24, - hdisp->pixfmt, hdisp->memory); - - hdisp->status.img = *img; - hdisp->status.crop = *crop; - hdisp->status.id = id; - hdisp->status.sync = sync; - hdisp->status.init = 1; - - hdisp->status.cur_idx = 0; - hdisp->status.hw_rotate = hw_rotate; - hdisp->status.scn_rotate = scn_rotate; - hdisp->status.hflip = hflip; - hdisp->status.vflip = vflip; - hdisp->status.dst = *dst; - - if (!_fbdevVideoV4l2SetDst (hdisp->video_fd, dst)) - { - xf86DrvMsg (0, X_ERROR, "[SetFormat, %p] _fbdevVideoV4l2SetDst is failed. \n", hdisp); - return FALSE; - } - - if (!_fbdevVideoV4l2SetBuffer (hdisp->video_fd, - V4L2_BUF_TYPE_VIDEO_OVERLAY, - hdisp->memory, - BUF_NUM, - &hdisp->dst_buf)) - { - xf86DrvMsg (0, X_ERROR, "[SetFormat, %p] _fbdevVideoV4l2SetBuffer is failed. \n", hdisp); - return FALSE; - } - - hdisp->status.cur_idx = 0; - } - - if (!hdisp->status.streamon) - { - _fbdevVideoV4l2StreamOn (hdisp->video_fd); - hdisp->status.streamon = TRUE; - } - - return TRUE; -} - -XF86ImagePtr -fbdevVideoV4l2SupportImages (int *count) -{ - if (count) - *count = NUM_IMAGES; - - return Images; -} - -int -fbdevVideoV4l2Draw (void *handle, uchar *buf, uint *phy_addrs) -{ - FBDevDispHandle *hdisp = (FBDevDispHandle*)handle; - pixman_format_code_t src_format, dst_format; - xRectangle img = hdisp->status.img; - xRectangle src = hdisp->status.crop; - xRectangle pxm = hdisp->status.dst; - xRectangle draw = hdisp->status.dst; - xRectangle dst = hdisp->status.dst; - - pxm.x = pxm.y = draw.x = draw.y = dst.x = dst.y = 0; - - switch (hdisp->pixfmt) - { - case V4L2_PIX_FMT_YUV420: - case V4L2_PIX_FMT_YVU420: - src_format = PIXMAN_yv12; - break; - case V4L2_PIX_FMT_YUYV: - src_format = PIXMAN_yuy2; - break; - case V4L2_PIX_FMT_RGB565: - src_format = PIXMAN_r5g6b5; - break; - case V4L2_PIX_FMT_RGB24: - src_format = PIXMAN_r8g8b8; - break; - case V4L2_PIX_FMT_RGB32: - src_format = PIXMAN_a8r8g8b8; - break; - default: - return FALSE; - } - - switch (hdisp->pixfmt) - { - case V4L2_PIX_FMT_YUV420: - dst_format = PIXMAN_x8b8g8r8; - break; - default: - dst_format = PIXMAN_x8r8g8b8; - break; - } - - /* support only RGB */ - fbdev_pixman_convert_image (img.width, img.height, - buf, hdisp->dst_buf[0].buf, - src_format, dst_format, - &img, &pxm, &draw, &src, &dst, - NULL, (hdisp->status.hw_rotate + (360 - hdisp->status.scn_rotate)) % 360, - hdisp->status.hflip, hdisp->status.vflip); - - return TRUE; -} - -Bool -fbdevVideoV4l2GetFormatInfo (int id, int *type, uint *pixelformat, FBDevV4l2Memory *memory) -{ - int i; - - for (i = 0; i < sizeof (format_infos) / sizeof (FormatInfo); i++) - if (format_infos[i].id == id) - { - if (type) - *type = format_infos[i].type; - if (pixelformat) - *pixelformat = format_infos[i].pixelformat; - if (memory) - *memory = format_infos[i].memory; - return TRUE; - } - - return FALSE; -} - -/* img : original src size - * src : real src size (cropped area inside img) - * dst : real dst size - * original dst size (in case that image is drawn on opened framebuffer) - */ -Bool -fbdevVideoV4l2CheckSize (void *handle, uint pixelformat, - xRectangle *img, xRectangle *src, xRectangle *dst, - int type, int memory) -{ - /* img */ - if (img) - { - if (img->width % 16) - xf86DrvMsg (0, X_WARNING, "img's width(%d) is not multiple of 16!!!\n", img->width); - - if (type == TYPE_YUV420 && img->height % 2) - xf86DrvMsg (0, X_WARNING, "img's height(%d) is not multiple of 2!!!\n", img->height); - - return_val_if_fail (img->width >= 16, FALSE); - return_val_if_fail (img->height >= 16, FALSE); - } - - /* src */ - if (src) - { - if (type == TYPE_YUV420 || type == TYPE_YUV422) - { - src->x = src->x & (~0x1); - src->width = src->width & (~0x1); - } - - if (type == TYPE_YUV420) - src->height = src->height & (~0x1); - - return_val_if_fail (src->width >= 16, FALSE); - return_val_if_fail (src->height >= 16, FALSE); - } - - /* dst */ - if (dst) - { - dst->width = dst->width & (~0x1); - dst->height = dst->height & (~0x1); - - return_val_if_fail (dst->width >= 8, FALSE); - return_val_if_fail (dst->height >= 8, FALSE); - } - - return TRUE; -} diff --git a/src/xv/xv_types.h b/src/xv/xv_types.h deleted file mode 100644 index d8465d9..0000000 --- a/src/xv/xv_types.h +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************** - -xserver-xorg-video-emulfb - -Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: YoungHoon Jung - -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 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT 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. - -**************************************************************************/ - -/* */ -/* File name : xv_types.h */ -/* Author : YoungHoon Jung (yhoon.jung@samsung.com) */ -/* Protocol Version : 1.0.1 (Dec 16th 2009) */ -/* This file is for describing Xv APIs' buffer encoding method. */ -/* */ - -#define XV_PUTIMAGE_HEADER 0xDEADCD01 -#define XV_PUTIMAGE_VERSION 0x00010001 - -/* Return Values */ -#define XV_OK 0 -#define XV_HEADER_ERROR -1 -#define XV_VERSION_MISMATCH -2 - -/* Data structure for XvPutImage / XvShmPutImage */ -typedef struct { - unsigned int _header; /* for internal use only */ - unsigned int _version; /* for internal use only */ - - unsigned int YPhyAddr; - unsigned int CbPhyAddr; - unsigned int CrPhyAddr; - unsigned int RotAngle; - unsigned int VideoMode; -} XV_PUTIMAGE_DATA, * XV_PUTIMAGE_DATA_PTR; - -static void -#ifdef __GNUC__ -__attribute__ ((unused)) -#endif -XV_PUTIMAGE_INIT_DATA(XV_PUTIMAGE_DATA_PTR data) -{ - data->_header = XV_PUTIMAGE_HEADER; - data->_version = XV_PUTIMAGE_VERSION; -} - - -static int -#ifdef __GNUC__ -__attribute__ ((unused)) -#endif -XV_PUTIMAGE_VALIDATE_DATA(XV_PUTIMAGE_DATA_PTR data) -{ - if (data->_header != XV_PUTIMAGE_HEADER) - return XV_HEADER_ERROR; - if (data->_version != XV_PUTIMAGE_VERSION) - return XV_VERSION_MISMATCH; - return XV_OK; -} -- 2.7.4