Re: [PATCH 1/2] _XDefaultIOError: Reformat to be less ugly

2017-03-24 Thread Alan Coopersmith

On 03/24/17 08:07 AM, Adam Jackson wrote:

Signed-off-by: Adam Jackson 


Reviewed-by: Alan Coopersmith 
for the series.

--
-Alan Coopersmith-  alan.coopersm...@oracle.com
 Oracle Solaris Engineering - http://blogs.oracle.com/alanc
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH rendercheck 0/5] Convert to meson.

2017-03-24 Thread Kenneth Graunke
On Friday, March 24, 2017 2:13:38 PM PDT Mark Kettenis wrote:
> > From: Eric Anholt 
> > Date: Fri, 24 Mar 2017 13:17:45 -0700
> > 
> > Having bitten off a bit more than I can chew in 3 days with the X
> > Server (hw/xfree86/sdksyms.c is the worst), I decided to take a quick
> > pass at converting a project that's my own fault.
> 
> Seems I missed some discussion somewhere...
> 
> While I understand your frustrations with autoconf, moving to build
> infrastructure that relies on tools like Python and Ninja would have
> serious consequences for the way we integrate X into OpenBSD.  We
> build the entire base OS, which includes X, with tools that are part
> of the base OS.  That would become pretty much impossible if various X
> projects go this way.

For what it's worth, there are build system conversions in progress for
the X server, Weston, libinput, libdrm, and rendercheck.  GNOME is also
moving to Meson for a great many things.  So that's a very real
possibility, and one you may well have to deal with as more and more
projects consider this.  Perhaps you could include the necessary build
tool in future versions of your base OS.

> This is the first I've heard about Meson.  That in itself doesn't fill
> me with confidence.  But the Meson documentation doesn't really
> mentioned how you'd do configure-style checks like checking whether a
> particular header file is present or whether a library defines a
> certain function.
> 
> I suspect the answer is that people using Meson don't do such tests
> and don't feel the need to do such tests because they just check
> whether you're running on Windows, MacOS X or Linux and make
> assumptions that things are present based on just that.

Meson certainly can do such checks, and people do.  It would be a pretty
lousy replacement for autoconf if it couldn't do that, and nobody would
be seriously proposing using it.  Frankly, a system with no such checks
would not even be feasible for Linux alone.  Plus, that would be a level
of bad faith that I would be surprised to see in the X community.

> Your new meson build system doesn't check whether the err.h file
> exists or whether the C compiler supports the -Wshadow option for
> example.

Sounds like you found a mistake that should be fixed. :)

> It's not really surprising that Meson is much faster if you
> cut out all those checks.  Unfortunately this approach tends to yield
> rather unportable software.
> 
> You can probably cut quite a bit of time from the autoconf configure
> script run time by removing silly checks like checking for standard C
> headers and such.

Meson is massively faster, and inherently so.  It's not a matter of
deleting a few checks - even a crippled autoconf would be slower than
a fully functional Meson build.  There are other advantages as well...


signature.asc
Description: This is a digitally signed message part.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH rendercheck 0/5] Convert to meson.

2017-03-24 Thread Matt Turner
On Fri, Mar 24, 2017 at 2:13 PM, Mark Kettenis  wrote:
>> From: Eric Anholt 
>> Date: Fri, 24 Mar 2017 13:17:45 -0700
>>
>> Having bitten off a bit more than I can chew in 3 days with the X
>> Server (hw/xfree86/sdksyms.c is the worst), I decided to take a quick
>> pass at converting a project that's my own fault.
>
> Seems I missed some discussion somewhere...
>
> While I understand your frustrations with autoconf, moving to build
> infrastructure that relies on tools like Python and Ninja would have
> serious consequences for the way we integrate X into OpenBSD.  We
> build the entire base OS, which includes X, with tools that are part
> of the base OS.  That would become pretty much impossible if various X
> projects go this way.

Yes, there's a thread on mesa-dev about switching to Meson that's
approaching 100 mails. A lot of it revolves the limitations OpenBSD
has placed on itself by putting Mesa (and X) into its core.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH rendercheck 0/5] Convert to meson.

2017-03-24 Thread Mark Kettenis
> From: Eric Anholt 
> Date: Fri, 24 Mar 2017 13:17:45 -0700
> 
> Having bitten off a bit more than I can chew in 3 days with the X
> Server (hw/xfree86/sdksyms.c is the worst), I decided to take a quick
> pass at converting a project that's my own fault.

Seems I missed some discussion somewhere...

While I understand your frustrations with autoconf, moving to build
infrastructure that relies on tools like Python and Ninja would have
serious consequences for the way we integrate X into OpenBSD.  We
build the entire base OS, which includes X, with tools that are part
of the base OS.  That would become pretty much impossible if various X
projects go this way.

This is the first I've heard about Meson.  That in itself doesn't fill
me with confidence.  But the Meson documentation doesn't really
mentioned how you'd do configure-style checks like checking whether a
particular header file is present or whether a library defines a
certain function.  I suspect the answer is that people using Meson
don't do such tests and don't feel the need to do such tests because
they just check whether you're running on Windows, MacOS X or Linux
and make assumptions that things are present based on just that.  Your
new meson build system doesn't check whether the err.h file exists or
whether the C compiler supports the -Wshadow option for example.  It's
not really surprising that Meson is much faster if you cut out all
those checks.  Unfortunately this approach tends to yield rather
unportable software.

You can probably cut quite a bit of time from the autoconf configure
script run time by removing silly checks like checking for standard C
headers and such.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 3/3] kdrive: Remove dead slots from KdCardFuncs

2017-03-24 Thread Eric Anholt
Adam Jackson  writes:

> @@ -645,34 +614,7 @@ KdCloseScreen(ScreenPtr pScreen)
>  static Bool
>  KdSaveScreen(ScreenPtr pScreen, int on)
>  {
> -KdScreenPriv(pScreen);
> -int dpmsState;
> -
> -if (!pScreenPriv->card->cfuncs->dpms)
> -return FALSE;
> -
> -dpmsState = pScreenPriv->dpmsState;
> -switch (on) {
> -case SCREEN_SAVER_OFF:
> -dpmsState = KD_DPMS_NORMAL;
> -break;
> -case SCREEN_SAVER_ON:
> -if (dpmsState == KD_DPMS_NORMAL)
> -dpmsState = KD_DPMS_NORMAL + 1;
> -break;
> -case SCREEN_SAVER_CYCLE:
> -if (dpmsState < KD_DPMS_MAX)
> -dpmsState++;
> -break;
> -case SCREEN_SAVER_FORCER:
> -break;
> -}
> -if (dpmsState != pScreenPriv->dpmsState) {
> -if (pScreenPriv->enabled)
> -(*pScreenPriv->card->cfuncs->dpms) (pScreen, dpmsState);
> -pScreenPriv->dpmsState = dpmsState;
> -}
> -return TRUE;
> +return FALSE;
>  }

This is the only functional change I spotted: SaveScreen is now going to
return FALSE instead of TRUE.  Given that we haven't actually blanked
the screen, this seems like an appropriate return value.

With a note in the commit message about this behavior change (or, even
better, if DPMS was pulled into a separate commit), the series will be:

Reviewed-by: Eric Anholt 

While doing the meson stuff, I had the thought that we sure do have a
lot of probably-dead kdrive code left.  Thanks for taking care of some
of it.


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 1/3] xfree86: Clean up DPMS support

2017-03-24 Thread Eric Anholt
Adam Jackson  writes:

> On Fri, 2017-03-24 at 10:34 -0700, Eric Anholt wrote:
>> > Adam Jackson  writes:
>> 
>> > Rather than setting up a per-screen private, just conditionally
>> > initialize ScrnInfoRec::DPMSSet based on the config options, and inspect
>> > that to determine whether DPMS is supported.
>> > 
>> > We also move the "turn the screen back on at CloseScreen" logic into the
>> > DPMS extension's (new) reset hook. This would be a behavior change for
>> > the non-xfree86 servers, if any of them had non-stub DPMS support.
>> 
>> Doesn't this move when the DPMSSet(On) happens in the CloseScreen
>> sequence for xorg?  Is that going to be OK?
>
> It does move it, and I expect it to be okay. It moves the DPMS-on
> earlier, because CloseDownExtensions happens way before CloseScreen.
> CDE is so close to Dispatch that this should be indistinguishable from
> "the last request processed was a DPMS on", and if we can't CloseScreen
> in that scenario then we're already in a world of hurt.

That's basically what I was looking for.  Thanks.


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH rendercheck 4/5] Convert the manpage for Meson's configure script.

2017-03-24 Thread Eric Anholt
---
 man/rendercheck.man | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/rendercheck.man b/man/rendercheck.man
index b7be417d5c37..8b7dccab7725 100644
--- a/man/rendercheck.man
+++ b/man/rendercheck.man
@@ -1,5 +1,5 @@
 .ds q \N'34'
-.TH rendercheck 1 __xorgversion__
+.TH rendercheck 1 "rendercheck @rendercheckversion@" "X Version 11"
 .SH NAME
 rendercheck \- simple tests of the X Render extension.
 .SH SYNOPSIS
-- 
2.11.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH rendercheck 5/5] Explain how to build using meson in the README.

2017-03-24 Thread Eric Anholt
---
 README | 8 
 1 file changed, 8 insertions(+)

diff --git a/README b/README
index f5af0b0c64eb..2f8ec1ab0e46 100644
--- a/README
+++ b/README
@@ -10,3 +10,11 @@ Tests currently include:
 - Linear gradients
 - Repeating sources/masks at POT and non-POT sizes
 - Some regression tests for bugs from freedesktop.org bugzilla.
+
+rendercheck uses the Meson build system, which uses the "ninja" build
+backend on Linux.  The three commands to configure (building into the
+build/ directory), build, and install are:
+
+meson build
+ninja -C build
+sudo ninja -C build install
-- 
2.11.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH rendercheck 1/5] Fix a printf format warning.

2017-03-24 Thread Eric Anholt
---
 rendercheck.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rendercheck.h b/rendercheck.h
index 1c392e8d69fd..7dc9dc95c38d 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -37,7 +37,7 @@ static inline void errx(int eval, const char *fmt, ...) {
 va_start(args, fmt);
 fprintf(stderr, "Fatal Error: ");
 fprintf(stderr, fmt, args);
-fprintf(stderr, "\n", args);
+fprintf(stderr, "\n");
 va_end(args);
 exit(eval);
 }
-- 
2.11.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH rendercheck 0/5] Convert to meson.

2017-03-24 Thread Eric Anholt
Having bitten off a bit more than I can chew in 3 days with the X
Server (hw/xfree86/sdksyms.c is the worst), I decided to take a quick
pass at converting a project that's my own fault.

rendercheck is the best case scenario for autotools, and meson still
cuts its build time to practically nothing: I can do a git clean -fdx;
meson build; ninja -C build; ninja -C build install in about half a
second.  And, as you can see from the diffstat, the build time isn't
the only reason to love it.

My motivation in starting this process is to convert the dependencies
of my travis-ci xserver branch over to meson.  I ended up not
finishing the travis-ci work because the build time of running 17
autogen.sh's on travis was so long that I got bored.

Eric Anholt (5):
  Fix a printf format warning.
  Add a meson build system.
  Remove the autotools build system.
  Convert the manpage for Meson's configure script.
  Explain how to build using meson in the README.

Eric Anholt (5):
  Fix a printf format warning.
  Add a meson build system.
  Remove the autotools build system.
  Convert the manpage for Meson's configure script.
  Explain how to build using meson in the README.

 .gitignore  | 80 +
 Makefile.am | 43 
 README  |  8 ++
 autogen.sh  | 17 
 configure.ac| 29 ---
 main.c  |  3 +-
 man/Makefile.am | 38 -
 man/rendercheck.man |  2 +-
 meson.build | 55 
 rendercheck.h   |  2 +-
 10 files changed, 68 insertions(+), 209 deletions(-)
 delete mode 100644 Makefile.am
 delete mode 100755 autogen.sh
 delete mode 100644 configure.ac
 delete mode 100644 man/Makefile.am
 create mode 100644 meson.build

-- 
2.11.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH rendercheck 2/5] Add a meson build system.

2017-03-24 Thread Eric Anholt
Meson allows the configure step to be run faster (.3 seconds compared to
autogen.sh's 3.9 seconds on my system) and a full rebuild (touch
rendercheck.h; make) to run faster (.05s instead of .07s).

Rendercheck is pretty much the best case scenario for autotools, with
limited configure-time autodetection, non-recursive make, and no
libtool, so it seems like an interesting test-case to start with for
meson conversion.
---
 .gitignore  |  1 +
 main.c  |  7 +++
 meson.build | 55 +++
 3 files changed, 63 insertions(+)
 create mode 100644 meson.build

diff --git a/.gitignore b/.gitignore
index 0c428075e54f..009669fbff0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,3 +77,4 @@ core
 # For example, !report.pc overrides *.pc. See 'man gitignore'
 # 
 rendercheck
+version.h
diff --git a/main.c b/main.c
index 0d3d14637aaa..9ace44dc9a67 100644
--- a/main.c
+++ b/main.c
@@ -26,6 +26,9 @@
 #include 
 #include 
 #include 
+#ifdef HAVE_VERSION_H
+#include "version.h"
+#endif
 
 bool is_verbose = false, minimalrendering = false;
 int enabled_tests = ~0;/* Enable all tests by default */
@@ -289,7 +292,11 @@ int main(int argc, char **argv)
/* Print the version string.  Bail out if --version was requested and
 * continue otherwise.
 */
+#ifdef HAVE_VERSION_H
+   printf("rendercheck %s", VERSION);
+#else
puts(PACKAGE_STRING);
+#endif
if (print_version)
return 0;
 
diff --git a/meson.build b/meson.build
new file mode 100644
index ..efd21dea07d1
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,55 @@
+project('rendercheck', 'c')
+project_version = '1.5'
+
+add_project_arguments('-D_GNU_SOURCE', language: 'c')
+add_project_arguments('-DHAVE_VERSION_H', language: 'c')
+
+srcs = [
+'main.c',
+'ops.c',
+'tests.c',
+'t_blend.c',
+'t_bug7366.c',
+'t_composite.c',
+'t_dstcoords.c',
+'t_fill.c',
+'t_gradient.c',
+'t_gtk_argb_xbgr.c',
+'t_libreoffice_xrgb.c',
+'t_repeat.c',
+'t_shmblend.c',
+'t_srccoords.c',
+'t_tsrccoords.c',
+'t_tsrccoords2.c',
+'t_triangles.c',
+]
+
+version_config = configuration_data()
+version_config.set_quoted('VERSION', project_version)
+
+configure_file(
+output: 'version.h',
+configuration: version_config,
+)
+
+executable(
+'rendercheck',
+srcs,
+dependencies: [
+dependency('xrender'),
+dependency('xext'),
+dependency('x11'),
+dependency('xproto', version: '>= 7.0.17'),
+],
+install: true,
+)
+
+man_config = configuration_data()
+man_config.set_quoted('__xorg_version__', project_version)
+rendercheck_man = configure_file(
+output: 'rendercheck.1',
+input: 'man/rendercheck.man',
+configuration: man_config,
+)
+
+install_man(join_paths(meson.current_build_dir(), 'rendercheck.1'))
-- 
2.11.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH rendercheck 3/5] Remove the autotools build system.

2017-03-24 Thread Eric Anholt
---
 .gitignore  | 79 -
 Makefile.am | 43 ---
 autogen.sh  | 17 -
 configure.ac| 29 -
 main.c  |  6 -
 man/Makefile.am | 38 ---
 6 files changed, 212 deletions(-)
 delete mode 100644 Makefile.am
 delete mode 100755 autogen.sh
 delete mode 100644 configure.ac
 delete mode 100644 man/Makefile.am

diff --git a/.gitignore b/.gitignore
index 009669fbff0e..67020331ba6e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,80 +1 @@
-#
-#  X.Org module default exclusion patterns
-#  The next section if for module specific patterns
-#
-#  Do not edit the following section
-#  GNU Build System (Autotools)
-aclocal.m4
-autom4te.cache/
-autoscan.log
-ChangeLog
-compile
-config.guess
-config.h
-config.h.in
-config.log
-config-ml.in
-config.py
-config.status
-config.status.lineno
-config.sub
-configure
-configure.scan
-depcomp
-.deps/
-INSTALL
-install-sh
-.libs/
-libtool
-libtool.m4
-ltmain.sh
-lt~obsolete.m4
-ltoptions.m4
-ltsugar.m4
-ltversion.m4
-Makefile
-Makefile.in
-mdate-sh
-missing
-mkinstalldirs
-*.pc
-py-compile
-stamp-h?
-symlink-tree
-texinfo.tex
-ylwrap
-
-#  Do not edit the following section
-#  Edit Compile Debug Document Distribute
-*~
-*.[0-9]
-*.[0-9]x
-*.bak
-*.bin
-core
-*.dll
-*.exe
-*-ISO*.bdf
-*-JIS*.bdf
-*-KOI8*.bdf
-*.kld
-*.ko
-*.ko.cmd
-*.lai
-*.l[oa]
-*.[oa]
-*.obj
-*.patch
-*.so
-*.pcf.gz
-*.pdb
-*.tar.bz2
-*.tar.gz
-#
-#  Add & Override patterns for rendercheck 
-#
-#  Edit the following section as needed
-# For example, !report.pc overrides *.pc. See 'man gitignore'
-# 
-rendercheck
 version.h
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index f77cb4f2a651..
--- a/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-SUBDIRS = man
-
-bin_PROGRAMS = rendercheck
-
-rendercheck_SOURCES = \
-   main.c \
-   ops.c \
-   rendercheck.h \
-   tests.c \
-   t_blend.c \
-   t_bug7366.c \
-   t_composite.c \
-   t_dstcoords.c \
-   t_fill.c \
-   t_gradient.c \
-   t_gtk_argb_xbgr.c \
-   t_libreoffice_xrgb.c \
-   t_repeat.c \
-   t_shmblend.c \
-   t_srccoords.c \
-   t_tsrccoords.c \
-   t_tsrccoords2.c \
-   t_triangles.c
-
-AM_CFLAGS = $(RC_CFLAGS) $(CWARNFLAGS)
-AM_CPPFLAGS = -D_GNU_SOURCE
-rendercheck_LDADD = $(RC_LIBS)
-
-MAINTAINERCLEANFILES = ChangeLog INSTALL
-EXTRA_DIST = \
-   doc/AddingNewTests \
-   doc/TODO \
-autogen.sh
-
-.PHONY: ChangeLog INSTALL
-
-INSTALL:
-   $(INSTALL_CMD)
-
-ChangeLog:
-   $(CHANGELOG_CMD)
-
-dist-hook: ChangeLog INSTALL
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 5b20136d3e79..
--- a/autogen.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#! /bin/sh
-
-srcdir=`dirname "$0"`
-test -z "$srcdir" && srcdir=.
-
-ORIGDIR=`pwd`
-cd "$srcdir"
-
-autoreconf -v --install || exit 1
-cd "$ORIGDIR" || exit $?
-
-git config --local --get format.subjectPrefix ||
-git config --local format.subjectPrefix "PATCH rendercheck"
-
-if test -z "$NOCONFIGURE"; then
-exec "$srcdir"/configure "$@"
-fi
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 2a427934d70c..
--- a/configure.ac
+++ /dev/null
@@ -1,29 +0,0 @@
-#   -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.60)
-AC_INIT([rendercheck],
-[1.5],
-[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
-[rendercheck])
-
-AC_CONFIG_SRCDIR([Makefile.am])
-AM_INIT_AUTOMAKE([foreign dist-bzip2])
-
-# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
-m4_ifndef([XORG_MACROS_VERSION],
-  [m4_fatal([must install xorg-macros 1.8 or later before running 
autoconf/autogen])])
-XORG_MACROS_VERSION(1.8)
-XORG_DEFAULT_OPTIONS
-XORG_TESTSET_CFLAG(CWARNFLAGS, [-Wno-shadow])
-
-# Checks for header files.
-AC_CHECK_HEADERS([err.h])
-
-# Checks for pkg-config packages
-PKG_CHECK_MODULES(RC, [xrender xext x11 xproto >= 7.0.17])
-
-AC_CONFIG_FILES([Makefile
- man/Makefile])
-
-AC_OUTPUT
diff --git a/main.c b/main.c
index 9ace44dc9a67..20f550299400 100644
--- a/main.c
+++ b/main.c
@@ -26,9 +26,7 @@
 #include 
 #include 
 #include 
-#ifdef HAVE_VERSION_H
 #include "version.h"
-#endif
 
 bool is_verbose = false, minimalrendering = false;
 int enabled_tests = ~0;/* Enable all tests by default */
@@ -292,11 +290,7 @@ int main(int argc, char **argv)
/* Print the version string.  Bail out if --version was requested and
 * continue otherwise.
 */
-#ifdef HAVE_VERSION_H
printf("rendercheck %s", VERSION);
-#else
-   puts(PACKAGE_STRING);
-#endif
if (print_version)
return 0;
 
diff --git a/man/Makefile.am 

[PATCH xserver 2/3] kdrive: Remove KdOsFuncs

2017-03-24 Thread Adam Jackson
Only the Init slot was used, and Xephyr can just as easily do that
initialization directly.

Signed-off-by: Adam Jackson 
---
 hw/kdrive/ephyr/Makefile.am |  1 -
 hw/kdrive/ephyr/ephyr.h |  2 --
 hw/kdrive/ephyr/ephyrinit.c |  5 -
 hw/kdrive/ephyr/os.c| 48 ---
 hw/kdrive/src/kdrive.c  | 50 +++--
 hw/kdrive/src/kdrive.h  | 14 -
 hw/kdrive/src/kinput.c  | 16 +++
 7 files changed, 10 insertions(+), 126 deletions(-)
 delete mode 100644 hw/kdrive/ephyr/os.c

diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index f4bd060..d12559b 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -54,7 +54,6 @@ Xephyr_SOURCES = \
ephyr.h \
ephyrlog.h \
ephyr_draw.c \
-   os.c \
ephyrinit.c \
ephyrcursor.c \
hostx.c \
diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index b48a21c..d44dbc1 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -192,8 +192,6 @@ extern KdPointerDriver EphyrMouseDriver;
 
 extern KdKeyboardDriver EphyrKeyboardDriver;
 
-extern KdOsFuncs EphyrOsFuncs;
-
 extern Bool ephyrCursorInit(ScreenPtr pScreen);
 
 extern int ephyrBufferHeight(KdScreenInfo * screen);
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 383fa9f..4870f16 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -374,7 +374,10 @@ OsVendorInit(void)
 if (hostx_want_host_cursor())
 ephyrFuncs.initCursor = 
 
-KdOsInit();
+if (!KdCardInfoLast()) {
+processScreenArg("640x480", NULL);
+}
+hostx_init();
 }
 
 KdCardFuncs ephyrFuncs = {
diff --git a/hw/kdrive/ephyr/os.c b/hw/kdrive/ephyr/os.c
deleted file mode 100644
index 12bbc54..000
--- a/hw/kdrive/ephyr/os.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- *  Authored by Matthew Allum 
- *
- * Copyright © 2004 Nokia
- *
- * 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 name of Nokia not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Nokia makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL NOKIA 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_DIX_CONFIG_H
-#include 
-#endif
-#include "ephyr.h"
-
-extern void processScreenArg(const char *screen_size, char *parent_id);
-
-static int
-EphyrInit(void)
-{
-/*
- * make sure at least one screen
- * has been added to the system.
- */
-if (!KdCardInfoLast()) {
-processScreenArg("640x480", NULL);
-}
-return hostx_init();
-}
-
-KdOsFuncs EphyrOsFuncs = {
-.Init = EphyrInit,
-};
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index e746f3a..cd46556 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -90,13 +90,6 @@ const char *kdGlobalXkbOptions = NULL;
 
 static Bool kdCaughtSignal = FALSE;
 
-/*
- * Carry arguments from InitOutput through driver initialization
- * to KdScreenInit
- */
-
-KdOsFuncs *kdOsFuncs;
-
 void
 KdDisableScreen(ScreenPtr pScreen)
 {
@@ -162,11 +155,7 @@ static void
 KdDisableScreens(void)
 {
 KdSuspend();
-if (kdEnabled) {
-if (kdOsFuncs->Disable)
-(*kdOsFuncs->Disable) ();
-kdEnabled = FALSE;
-}
+kdEnabled = FALSE;
 }
 
 Bool
@@ -198,13 +187,6 @@ void
 AbortDDX(enum ExitCode error)
 {
 KdDisableScreens();
-if (kdOsFuncs) {
-if (kdEnabled && kdOsFuncs->Disable)
-(*kdOsFuncs->Disable) ();
-if (kdOsFuncs->Fini)
-(*kdOsFuncs->Fini) ();
-KdDoSwitchCmd("stop");
-}
 
 if (kdCaughtSignal)
 OsAbort();
@@ -560,24 +542,6 @@ KdProcessArgument(int argc, char **argv, int i)
 return 0;
 }
 
-/*
- * These are getting tossed in here until I can think of where
- * they really belong
- */
-
-void
-KdOsInit(KdOsFuncs * pOsFuncs)
-{
-kdOsFuncs = pOsFuncs;
-if (pOsFuncs) {
-if (serverGeneration == 1) {
-

[PATCH xserver 3/3] kdrive: Remove dead slots from KdCardFuncs

2017-03-24 Thread Adam Jackson
Signed-off-by: Adam Jackson 
---
 hw/kdrive/ephyr/ephyr.c | 27 --
 hw/kdrive/ephyr/ephyrinit.c |  9 --
 hw/kdrive/src/kcmap.c   |  9 --
 hw/kdrive/src/kdrive.c  | 67 +
 hw/kdrive/src/kdrive.h  |  9 --
 5 files changed, 1 insertion(+), 120 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 546a76c..d064f51 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -735,33 +735,6 @@ ephyrCreateResources(ScreenPtr pScreen)
 }
 
 void
-ephyrPreserve(KdCardInfo * card)
-{
-}
-
-Bool
-ephyrEnable(ScreenPtr pScreen)
-{
-return TRUE;
-}
-
-Bool
-ephyrDPMS(ScreenPtr pScreen, int mode)
-{
-return TRUE;
-}
-
-void
-ephyrDisable(ScreenPtr pScreen)
-{
-}
-
-void
-ephyrRestore(KdCardInfo * card)
-{
-}
-
-void
 ephyrScreenFini(KdScreenInfo * screen)
 {
 EphyrScrPriv *scrpriv = screen->driver;
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 4870f16..8a4e3a3 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -386,19 +386,10 @@ KdCardFuncs ephyrFuncs = {
 ephyrInitScreen,/* initScreen */
 ephyrFinishInitScreen,  /* finishInitScreen */
 ephyrCreateResources,   /* createRes */
-ephyrPreserve,  /* preserve */
-ephyrEnable,/* enable */
-ephyrDPMS,  /* dpms */
-ephyrDisable,   /* disable */
-ephyrRestore,   /* restore */
 ephyrScreenFini,/* scrfini */
 ephyrCardFini,  /* cardfini */
 
 0,  /* initCursor */
-0,  /* enableCursor */
-0,  /* disableCursor */
-0,  /* finiCursor */
-0,  /* recolorCursor */
 
 0,  /* initAccel */
 0,  /* enableAccel */
diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c
index 455e877..b8697ca 100644
--- a/hw/kdrive/src/kcmap.c
+++ b/hw/kdrive/src/kcmap.c
@@ -72,10 +72,6 @@ KdSetColormap(ScreenPtr pScreen)
 (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen,
  (1 << pScreenPriv->screen->fb.
   depth), defs);
-
-/* recolor hardware cursor */
-if (pScreenPriv->card->cfuncs->recolorCursor)
-(*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, 0, 0);
 }
 
 /*
@@ -235,9 +231,4 @@ KdStoreColors(ColormapPtr pCmap, int ndef, xColorItem * 
pdefs)
 }
 
 (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, ndef, pdefs);
-
-/* recolor hardware cursor */
-if (pScreenPriv->card->cfuncs->recolorCursor)
-(*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, ndef,
- pdefs);
 }
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index cd46556..8912a38 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -102,14 +102,7 @@ KdDisableScreen(ScreenPtr pScreen)
 KdDisableColormap(pScreen);
 if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
 (*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
-if (!pScreenPriv->screen->softCursor &&
-pScreenPriv->card->cfuncs->disableCursor)
-(*pScreenPriv->card->cfuncs->disableCursor) (pScreen);
-if (pScreenPriv->card->cfuncs->dpms)
-(*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
 pScreenPriv->enabled = FALSE;
-if (pScreenPriv->card->cfuncs->disable)
-(*pScreenPriv->card->cfuncs->disable) (pScreen);
 }
 
 static void
@@ -143,8 +136,6 @@ KdSuspend(void)
 for (screen = card->screenList; screen; screen = screen->next)
 if (screen->mynum == card->selected && screen->pScreen)
 KdDisableScreen(screen->pScreen);
-if (card->driver && card->cfuncs->restore)
-(*card->cfuncs->restore) (card);
 }
 KdDisableInput();
 KdDoSwitchCmd("suspend");
@@ -165,21 +156,13 @@ KdEnableScreen(ScreenPtr pScreen)
 
 if (pScreenPriv->enabled)
 return TRUE;
-if (pScreenPriv->card->cfuncs->enable)
-if (!(*pScreenPriv->card->cfuncs->enable) (pScreen))
-return FALSE;
 pScreenPriv->enabled = TRUE;
 pScreenPriv->dpmsState = KD_DPMS_NORMAL;
 pScreenPriv->card->selected = pScreenPriv->screen->mynum;
-if (!pScreenPriv->screen->softCursor &&
-pScreenPriv->card->cfuncs->enableCursor)
-(*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
 if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
 (*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
 KdEnableColormap(pScreen);
 SetRootClip(pScreen, ROOT_CLIP_FULL);
-if 

[PATCH xserver 1/3] kdrive: static and dead code cleanup

2017-03-24 Thread Adam Jackson
Signed-off-by: Adam Jackson 
---
 hw/kdrive/src/Makefile.am |   1 -
 hw/kdrive/src/kcmap.c |   2 +-
 hw/kdrive/src/kdrive.c| 116 ++
 hw/kdrive/src/kdrive.h| 127 
 hw/kdrive/src/kinput.c| 253 ---
 hw/kdrive/src/kmode.c | 378 --
 hw/kdrive/src/kxv.c   | 232 
 hw/kdrive/src/kxv.h   |  21 ---
 8 files changed, 50 insertions(+), 1080 deletions(-)
 delete mode 100644 hw/kdrive/src/kmode.c

diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am
index b7f94b0..0833150 100644
--- a/hw/kdrive/src/Makefile.am
+++ b/hw/kdrive/src/Makefile.am
@@ -19,7 +19,6 @@ libkdrive_la_SOURCES =\
kdrive.h\
kinfo.c \
kinput.c\
-   kmode.c \
kshadow.c   \
$(KDRIVE_XV_SOURCES) \
 $(top_srcdir)/mi/miinitext.c
diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c
index 4fe4545..455e877 100644
--- a/hw/kdrive/src/kcmap.c
+++ b/hw/kdrive/src/kcmap.c
@@ -29,7 +29,7 @@
  * Put the entire colormap into the DAC
  */
 
-void
+static void
 KdSetColormap(ScreenPtr pScreen)
 {
 KdScreenPriv(pScreen);
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index b2b4996..e746f3a 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -71,20 +71,15 @@ KdDepths kdDepths[] = {
 #define KD_DEFAULT_BUTTONS 5
 
 DevPrivateKeyRec kdScreenPrivateKeyRec;
-unsigned long kdGeneration;
+static unsigned long kdGeneration;
 
-Bool kdVideoTest;
-unsigned long kdVideoTestTime;
 Bool kdEmulateMiddleButton;
 Bool kdRawPointerCoordinates;
 Bool kdDisableZaphod;
-Bool kdAllowZap;
-Bool kdEnabled;
-int kdSubpixelOrder;
-int kdVirtualTerminal = -1;
-Bool kdSwitchPending;
-char *kdSwitchCmd;
-DDXPointRec kdOrigin;
+static Bool kdEnabled;
+static int kdSubpixelOrder;
+static char *kdSwitchCmd;
+static DDXPointRec kdOrigin;
 Bool kdHasPointer = FALSE;
 Bool kdHasKbd = FALSE;
 const char *kdGlobalXkbRules = NULL;
@@ -144,7 +139,7 @@ KdDoSwitchCmd(const char *reason)
 }
 }
 
-void
+static void
 KdSuspend(void)
 {
 KdCardInfo *card;
@@ -163,7 +158,7 @@ KdSuspend(void)
 }
 }
 
-void
+static void
 KdDisableScreens(void)
 {
 KdSuspend();
@@ -200,46 +195,6 @@ KdEnableScreen(ScreenPtr pScreen)
 }
 
 void
-KdResume(void)
-{
-KdCardInfo *card;
-KdScreenInfo *screen;
-
-if (kdEnabled) {
-KdDoSwitchCmd("resume");
-for (card = kdCardInfo; card; card = card->next) {
-if (card->cfuncs->preserve)
-(*card->cfuncs->preserve) (card);
-for (screen = card->screenList; screen; screen = screen->next)
-if (screen->mynum == card->selected && screen->pScreen)
-KdEnableScreen(screen->pScreen);
-}
-KdEnableInput();
-KdReleaseAllKeys();
-}
-}
-
-void
-KdEnableScreens(void)
-{
-if (!kdEnabled) {
-kdEnabled = TRUE;
-if (kdOsFuncs->Enable)
-(*kdOsFuncs->Enable) ();
-}
-KdResume();
-}
-
-void
-KdProcessSwitch(void)
-{
-if (kdEnabled)
-KdDisableScreens();
-else
-KdEnableScreens();
-}
-
-void
 AbortDDX(enum ExitCode error)
 {
 KdDisableScreens();
@@ -261,8 +216,8 @@ ddxGiveUp(enum ExitCode error)
 AbortDDX(error);
 }
 
-Bool kdDumbDriver;
-Bool kdSoftCursor;
+static Bool kdDumbDriver;
+static Bool kdSoftCursor;
 
 const char *
 KdParseFindNext(const char *cur, const char *delim, char *save, char *last)
@@ -418,18 +373,7 @@ KdParseScreen(KdScreenInfo * screen, const char *arg)
 }
 }
 
-/*
- * Mouse argument syntax:
- *
- *  device,protocol,options...
- *
- *  Options are any of:
- * 1-5 n button mouse
- * 2button emulate middle button
- * {NMO}   Reorder buttons
- */
-
-void
+static void
 KdParseRgba(char *rgba)
 {
 if (!strcmp(rgba, "rgb"))
@@ -474,7 +418,6 @@ KdUseMsg(void)
 ErrorF
 ("-origin X,Y  Locates the next screen in the the virtual screen 
(Xinerama)\n");
 ErrorF("-switchCmd   Command to execute on vt switch\n");
-ErrorF("-zap Terminate server on Ctrl+Alt+Backspace\n");
 ErrorF
 ("vtxx Use virtual terminal xx instead of the next 
available\n");
 }
@@ -507,10 +450,6 @@ KdProcessArgument(int argc, char **argv, int i)
 kdDisableZaphod = TRUE;
 return 1;
 }
-if (!strcmp(argv[i], "-zap")) {
-kdAllowZap = TRUE;
-return 1;
-}
 if (!strcmp(argv[i], "-3button")) {
 kdEmulateMiddleButton = FALSE;
 return 1;
@@ -531,10 +470,6 @@ KdProcessArgument(int argc, char **argv, int i)
 kdSoftCursor = TRUE;
 return 1;
 }
-if (!strcmp(argv[i], "-videoTest")) {
-kdVideoTest = TRUE;
-return 1;
-}
 if (!strcmp(argv[i], "-origin")) {
 if ((i + 1) < argc) {
 char *x = argv[i + 

[PATCH xserver 0/3] Continue gutting kdrive

2017-03-24 Thread Adam Jackson
Having surreptitiously removed all the hardware backends from kdrive, there's
some midlayer junk that can go too. I'd like to see the "kdrive" code proper
split into either dix or xephyr as appropriate, and eventually rename the
directory as hw/xephyr once we're happy with the split.

One (arguable) functional change here is that -switchCmd goes away. I think
this is okay? Xephyr doesn't really have the concept of a vt switch so I'm
not sure how you'd intentionally trigger it.

13 files changed, 61 insertions(+), 1326 deletions(-)

- ajax

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 1/3] xfree86: Clean up DPMS support

2017-03-24 Thread Adam Jackson
On Fri, 2017-03-24 at 10:34 -0700, Eric Anholt wrote:
> > Adam Jackson  writes:
> 
> > Rather than setting up a per-screen private, just conditionally
> > initialize ScrnInfoRec::DPMSSet based on the config options, and inspect
> > that to determine whether DPMS is supported.
> > 
> > We also move the "turn the screen back on at CloseScreen" logic into the
> > DPMS extension's (new) reset hook. This would be a behavior change for
> > the non-xfree86 servers, if any of them had non-stub DPMS support.
> 
> Doesn't this move when the DPMSSet(On) happens in the CloseScreen
> sequence for xorg?  Is that going to be OK?

It does move it, and I expect it to be okay. It moves the DPMS-on
earlier, because CloseDownExtensions happens way before CloseScreen.
CDE is so close to Dispatch that this should be indistinguishable from
"the last request processed was a DPMS on", and if we can't CloseScreen
in that scenario then we're already in a world of hurt.

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 1/3] xfree86: Clean up DPMS support

2017-03-24 Thread Eric Anholt
Adam Jackson  writes:

> Rather than setting up a per-screen private, just conditionally
> initialize ScrnInfoRec::DPMSSet based on the config options, and inspect
> that to determine whether DPMS is supported.
>
> We also move the "turn the screen back on at CloseScreen" logic into the
> DPMS extension's (new) reset hook. This would be a behavior change for
> the non-xfree86 servers, if any of them had non-stub DPMS support.

Doesn't this move when the DPMSSet(On) happens in the CloseScreen
sequence for xorg?  Is that going to be OK?

I'm pretty sure the motivation of this call is for UMS drivers to try to
successfully restore back to the console (for KMS, this is the kernel's
job, not ours), but I think UMS drivers should all be doing that already
and the close-time call should probably just be removed instead.


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 1/3] xfree86: Clean up DPMS support

2017-03-24 Thread Adam Jackson
Rather than setting up a per-screen private, just conditionally
initialize ScrnInfoRec::DPMSSet based on the config options, and inspect
that to determine whether DPMS is supported.

We also move the "turn the screen back on at CloseScreen" logic into the
DPMS extension's (new) reset hook. This would be a behavior change for
the non-xfree86 servers, if any of them had non-stub DPMS support.

Signed-off-by: Adam Jackson 
---
 Xext/dpms.c |  8 +++-
 hw/xfree86/common/xf86DPMS.c| 84 +
 hw/xfree86/common/xf86Privstr.h |  9 -
 3 files changed, 16 insertions(+), 85 deletions(-)

diff --git a/Xext/dpms.c b/Xext/dpms.c
index 4b620d5..291dad0 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -354,10 +354,16 @@ SProcDPMSDispatch(ClientPtr client)
 }
 }
 
+static void
+DPMSCloseDownExtension(ExtensionEntry *e)
+{
+DPMSSet(serverClient, DPMSModeOn);
+}
+
 void
 DPMSExtensionInit(void)
 {
 AddExtension(DPMSExtensionName, 0, 0,
  ProcDPMSDispatch, SProcDPMSDispatch,
- NULL, StandardMinorOpcode);
+ DPMSCloseDownExtension, StandardMinorOpcode);
 }
diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
index 2b5a3ed..a5324e0 100644
--- a/hw/xfree86/common/xf86DPMS.c
+++ b/hw/xfree86/common/xf86DPMS.c
@@ -47,50 +47,29 @@
 #include "xf86VGAarbiter.h"
 #endif
 
-#ifdef DPMSExtension
-static DevPrivateKeyRec DPMSKeyRec;
-static DevPrivateKey DPMSKey;
-static Bool DPMSClose(ScreenPtr pScreen);
-static int DPMSCount = 0;
-#endif
-
 Bool
 xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
 {
 #ifdef DPMSExtension
 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-DPMSPtr pDPMS;
 void *DPMSOpt;
-MessageType enabled_from;
+MessageType enabled_from = X_DEFAULT;
+Bool enabled = TRUE;
 
-DPMSKey = 
-
-if (!dixRegisterPrivateKey(, PRIVATE_SCREEN, sizeof(DPMSRec)))
-return FALSE;
-
-pDPMS = dixLookupPrivate(>devPrivates, DPMSKey);
-pScrn->DPMSSet = set;
-pDPMS->Flags = flags;
 DPMSOpt = xf86FindOption(pScrn->options, "dpms");
 if (DPMSDisabledSwitch) {
 enabled_from = X_CMDLINE;
-DPMSEnabled = FALSE;
+enabled = FALSE;
 }
 else if (DPMSOpt) {
 enabled_from = X_CONFIG;
-DPMSEnabled = xf86CheckBoolOption(pScrn->options, "dpms", FALSE);
+enabled = xf86CheckBoolOption(pScrn->options, "dpms", FALSE);
 xf86MarkOptionUsed(DPMSOpt);
 }
-else {
-enabled_from = X_DEFAULT;
-DPMSEnabled = TRUE;
-}
-if (DPMSEnabled)
+if (enabled) {
 xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n");
-pDPMS->Enabled = DPMSEnabled;
-pDPMS->CloseScreen = pScreen->CloseScreen;
-pScreen->CloseScreen = DPMSClose;
-DPMSCount++;
+pScrn->DPMSSet = set;
+}
 return TRUE;
 #else
 return FALSE;
@@ -99,45 +78,10 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int 
flags)
 
 #ifdef DPMSExtension
 
-static Bool
-DPMSClose(ScreenPtr pScreen)
-{
-DPMSPtr pDPMS;
-ScrnInfoPtr pScrn;
-/* This shouldn't happen */
-if (DPMSKey == NULL)
-return FALSE;
-
-pDPMS = dixLookupPrivate(>devPrivates, DPMSKey);
-
-/* This shouldn't happen */
-if (!pDPMS)
-return FALSE;
-
-pScreen->CloseScreen = pDPMS->CloseScreen;
-pScrn = xf86ScreenToScrn(pScreen);
-/*
- * Turn on DPMS when shutting down. If this function can be used
- * depends on the order the driver wraps things. If this is called
- * after the driver has shut down everything the driver will have
- * to deal with this internally.
- */
-if (pScrn->vtSema && pScrn->DPMSSet) {
-pScrn->DPMSSet(pScrn, DPMSModeOn, 0);
-}
-
-if (--DPMSCount == 0)
-DPMSKey = NULL;
-return pScreen->CloseScreen(pScreen);
-}
-
 static void
 DPMSSetScreen(ScrnInfoPtr pScrn, int level)
 {
-ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
-DPMSPtr pDPMS = dixLookupPrivate(>devPrivates, DPMSKey);
-
-if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
+if (pScrn->DPMSSet && pScrn->vtSema) {
 xf86VGAarbiterLock(pScrn);
 pScrn->DPMSSet(pScrn, level, 0);
 xf86VGAarbiterUnlock(pScrn);
@@ -156,9 +100,6 @@ DPMSSet(ClientPtr client, int level)
 
 DPMSPowerLevel = level;
 
-if (DPMSKey == NULL)
-return Success;
-
 if (level != DPMSModeOn) {
 if (xf86IsUnblank(screenIsSaved)) {
 rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, 
ScreenSaverActive);
@@ -184,10 +125,7 @@ DPMSSet(ClientPtr client, int level)
 static Bool
 DPMSSupportedOnScreen(ScrnInfoPtr pScrn)
 {
-ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
-DPMSPtr pDPMS = dixLookupPrivate(>devPrivates, DPMSKey);
-
-return pDPMS && pScrn->DPMSSet;
+return pScrn->DPMSSet != NULL;
 }
 
 /*
@@ -199,10 +137,6 @@ DPMSSupported(void)
 {
 int i;
 

[PATCH xserver 3/3] dpms: Consolidate a bunch of stuff into Xext/dpms.c

2017-03-24 Thread Adam Jackson
Most of this is a legacy of the old "extmod" design where you could load
_some_ extensions dynamically but only if the server had been built with
support for them in the first place.

Note that since we now only initialize the DPMS extension if at least
one screen supports it, we no longer need DPMSCapableFlag: if it would
be false, we would never read its value.

Signed-off-by: Adam Jackson 
---
 Xext/dpms.c| 28 +++-
 Xext/dpmsproc.h| 11 +--
 Xext/saver.c   |  1 +
 dix/globals.c  | 10 --
 dix/main.c | 13 +
 hw/xfree86/common/xf86Config.c |  4 +++-
 include/globals.h  | 10 --
 os/utils.c |  1 +
 8 files changed, 34 insertions(+), 44 deletions(-)

diff --git a/Xext/dpms.c b/Xext/dpms.c
index abc67ef..efa7154 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -43,6 +43,13 @@ Equipment Corporation.
 #include "scrnintstr.h"
 #include "windowstr.h"
 
+CARD16 DPMSPowerLevel = 0;
+Bool DPMSDisabledSwitch = FALSE;
+CARD32 DPMSStandbyTime;
+CARD32 DPMSSuspendTime;
+CARD32 DPMSOffTime;
+Bool DPMSEnabled;
+
 Bool
 DPMSSupported(void)
 {
@@ -136,7 +143,7 @@ ProcDPMSCapable(ClientPtr client)
 .type = X_Reply,
 .sequenceNumber = client->sequence,
 .length = 0,
-.capable = DPMSCapableFlag
+.capable = TRUE
 };
 
 REQUEST_SIZE_MATCH(xDPMSCapableReq);
@@ -204,11 +211,9 @@ ProcDPMSEnable(ClientPtr client)
 
 REQUEST_SIZE_MATCH(xDPMSEnableReq);
 
-if (DPMSCapableFlag) {
-DPMSEnabled = TRUE;
-if (!was_enabled)
-SetScreenSaverTimer();
-}
+DPMSEnabled = TRUE;
+if (!was_enabled)
+SetScreenSaverTimer();
 
 return Success;
 }
@@ -427,7 +432,12 @@ DPMSCloseDownExtension(ExtensionEntry *e)
 void
 DPMSExtensionInit(void)
 {
-AddExtension(DPMSExtensionName, 0, 0,
- ProcDPMSDispatch, SProcDPMSDispatch,
- DPMSCloseDownExtension, StandardMinorOpcode);
+DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
+DPMSPowerLevel = DPMSModeOn;
+DPMSEnabled = DPMSSupported();
+
+if (DPMSEnabled)
+AddExtension(DPMSExtensionName, 0, 0,
+ ProcDPMSDispatch, SProcDPMSDispatch,
+ DPMSCloseDownExtension, StandardMinorOpcode);
 }
diff --git a/Xext/dpmsproc.h b/Xext/dpmsproc.h
index 82dccbd..1e24f1f 100644
--- a/Xext/dpmsproc.h
+++ b/Xext/dpmsproc.h
@@ -9,7 +9,14 @@
 
 #include "dixstruct.h"
 
-int _X_EXPORT DPMSSet(ClientPtr client, int level);
-Bool _X_EXPORT DPMSSupported(void);
+extern int DPMSSet(ClientPtr client, int level);
+extern Bool DPMSSupported(void);
+
+extern CARD32 DPMSStandbyTime;
+extern CARD32 DPMSSuspendTime;
+extern CARD32 DPMSOffTime;
+extern CARD16 DPMSPowerLevel;
+extern Bool DPMSEnabled;
+extern Bool DPMSDisabledSwitch;
 
 #endif
diff --git a/Xext/saver.c b/Xext/saver.c
index bf3a23d..0949761 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -53,6 +53,7 @@ in this Software without prior written authorization from the 
X Consortium.
 #endif
 #ifdef DPMSExtension
 #include 
+#include "dpmsproc.h"
 #endif
 #include "protocol-versions.h"
 
diff --git a/dix/globals.c b/dix/globals.c
index f36a938..acd5c44 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -93,16 +93,6 @@ CARD32 ScreenSaverInterval;
 int ScreenSaverBlanking;
 int ScreenSaverAllowExposures;
 
-#ifdef DPMSExtension
-CARD16 DPMSPowerLevel = 0;
-Bool DPMSDisabledSwitch = FALSE;
-Bool DPMSCapableFlag = FALSE;
-CARD32 DPMSStandbyTime;
-CARD32 DPMSSuspendTime;
-CARD32 DPMSOffTime;
-Bool DPMSEnabled;
-#endif
-
 CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
 CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL;
 int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING;
diff --git a/dix/main.c b/dix/main.c
index 4947062..f98643a 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -148,11 +148,7 @@ dix_main(int argc, char *argv[], char *envp[])
 ScreenSaverInterval = defaultScreenSaverInterval;
 ScreenSaverBlanking = defaultScreenSaverBlanking;
 ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
-#ifdef DPMSExtension
-DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
-DPMSEnabled = TRUE;
-DPMSPowerLevel = 0;
-#endif
+
 InitBlockAndWakeupHandlers();
 /* Perform any operating system dependent initializations you'd like */
 OsInit();
@@ -239,13 +235,6 @@ dix_main(int argc, char *argv[], char *envp[])
defaultCursorFont);
 }
 
-#ifdef DPMSExtension
-/* check all screens, looking for DPMS Capabilities */
-DPMSCapableFlag = DPMSSupported();
-if (!DPMSCapableFlag)
-DPMSEnabled = FALSE;
-#endif
-
 #ifdef PANORAMIX
 /*
  * Consolidate window and colourmap information for each screen

[PATCH xserver 2/3] dix: Lift DPMS to a screen hook

2017-03-24 Thread Adam Jackson
Following on from the previous change, this adds a DPMS hook to the
ScreenRec and uses that to infer DPMS support. As a result we can drop
the dpms stub code from Xext.

Signed-off-by: Adam Jackson 
---
 Xext/Makefile.am |  4 +-
 Xext/dpms.c  | 64 +++
 Xext/dpmsstubs.c | 47 ---
 hw/dmx/dmxdpms.c | 69 +-
 hw/dmx/dmxdpms.h |  3 +-
 hw/dmx/dmxscrinit.c  | 14 ++-
 hw/kdrive/src/kdrive.c   | 12 --
 hw/vfb/Makefile.am   |  1 -
 hw/xfree86/common/xf86DPMS.c | 89 +++-
 hw/xnest/Makefile.am |  6 ---
 hw/xwayland/Makefile.am  |  1 -
 hw/xwin/Makefile.am  |  1 -
 include/scrnintstr.h |  3 ++
 13 files changed, 114 insertions(+), 200 deletions(-)
 delete mode 100644 Xext/dpmsstubs.c

diff --git a/Xext/Makefile.am b/Xext/Makefile.am
index 1ceb980..32a27eb 100644
--- a/Xext/Makefile.am
+++ b/Xext/Makefile.am
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libXext.la libXextdpmsstubs.la libXvidmode.la
+noinst_LTLIBRARIES = libXext.la libXvidmode.la
 
 AM_CFLAGS = $(DIX_CFLAGS)
 
@@ -96,8 +96,6 @@ endif
 libXext_la_SOURCES =   $(BUILTIN_SRCS)
 libXext_la_LIBADD =$(BUILTIN_LIBS)
 
-libXextdpmsstubs_la_SOURCES = dpmsstubs.c
-
 # XVidMode extension
 libXvidmode_la_SOURCES = vidmode.c
 
diff --git a/Xext/dpms.c b/Xext/dpms.c
index 291dad0..abc67ef 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -40,6 +40,70 @@ Equipment Corporation.
 #include 
 #include "dpmsproc.h"
 #include "extinit.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+Bool
+DPMSSupported(void)
+{
+int i;
+
+/* For each screen, check if DPMS is supported */
+for (i = 0; i < screenInfo.numScreens; i++)
+if (screenInfo.screens[i]->DPMS != NULL)
+return TRUE;
+
+for (i = 0; i < screenInfo.numGPUScreens; i++)
+if (screenInfo.gpuscreens[i]->DPMS != NULL)
+return TRUE;
+
+return FALSE;
+}
+
+static Bool
+isUnblank(int mode)
+{
+switch (mode) {
+case SCREEN_SAVER_OFF:
+case SCREEN_SAVER_FORCER:
+return TRUE;
+case SCREEN_SAVER_ON:
+case SCREEN_SAVER_CYCLE:
+return FALSE;
+default:
+return TRUE;
+}
+}
+
+int
+DPMSSet(ClientPtr client, int level)
+{
+int rc, i;
+
+DPMSPowerLevel = level;
+
+if (level != DPMSModeOn) {
+if (isUnblank(screenIsSaved)) {
+rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, 
ScreenSaverActive);
+if (rc != Success)
+return rc;
+}
+} else if (!isUnblank(screenIsSaved)) {
+rc = dixSaveScreens(client, SCREEN_SAVER_OFF, ScreenSaverReset);
+if (rc != Success)
+return rc;
+}
+
+for (i = 0; i < screenInfo.numScreens; i++)
+if (screenInfo.screens[i]->DPMS != NULL)
+screenInfo.screens[i]->DPMS(screenInfo.screens[i], level);
+
+for (i = 0; i < screenInfo.numGPUScreens; i++)
+if (screenInfo.gpuscreens[i]->DPMS != NULL)
+screenInfo.gpuscreens[i]->DPMS(screenInfo.gpuscreens[i], level);
+
+return Success;
+}
 
 static int
 ProcDPMSGetVersion(ClientPtr client)
diff --git a/Xext/dpmsstubs.c b/Xext/dpmsstubs.c
deleted file mode 100644
index f05d1e9..000
--- a/Xext/dpmsstubs.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-
-Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
-
-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.
-
-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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-**/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include 
-#endif
-
-#include "dpmsproc.h"

Re: [PATCH xrandr] xrandr: suppress misleading indentation warning

2017-03-24 Thread Adam Jackson
On Wed, 2017-01-18 at 08:52 +0100, Giuseppe Bilotta wrote:
> When printing out rotations, we print a space before any item other than
> the first, and set `first = False` in each block where we print.
> However, this is done in the same line as the conditional that checks if
> first is set, which may give the impression that the assignment is also
> under the conditional. This is not the case, and recent GCC warns about
> this.
> 
> Move the assignment to after we print the value we want to print, which
> (1) doesn't mislead about the indentation, and
> (2) makes logical sense as the _next_ entry is what won't be the first.

Merged this and the --dpi documentation patch, thanks!

remote: I: patch #133793 updated using rev 
85e95db7120da3bdaf9efb3033be5f9338e6c328.
remote: I: patch #133794 updated using rev 
215a01f1513f918e7295a8a477d4674f7b8085f0.
remote: I: 2 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/xorg/app/xrandr
   1b561d2..215a01f  master -> master

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 2/2] _XDefaultIOError: Do better at detecting explicit shutdown

2017-03-24 Thread Adam Jackson
Currently, when the X server crashes or a client is disconnected with
XKillClient, you get a somewhat confusing error message from libX11
along the lines of:

XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
  after 98 requests (40 known processed) with 0 events remaining.

What's happening here is the previous recvmsg has thrown EAGAIN, since
the socket is non-blocking. In this case, check whether the socket has
any more data to read, and if not treat it like EPIPE.

Signed-off-by: Adam Jackson 
---
 src/XlibInt.c | 29 -
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/XlibInt.c b/src/XlibInt.c
index d5946bd..4984764 100644
--- a/src/XlibInt.c
+++ b/src/XlibInt.c
@@ -49,6 +49,8 @@ from The Open Group.
 #ifdef XTHREADS
 #include "locking.h"
 
+#include 
+
 /* these pointers get initialized by XInitThreads */
 LockInfoPtr _Xglobal_lock = NULL;
 void (*_XCreateMutex_fn)(LockInfoPtr) = NULL;
@@ -1233,6 +1235,21 @@ _XWireToEvent(
return(True);
 }
 
+static int
+SocketBytesReadable(Display *dpy)
+{
+int bytes = 0, last_error;
+#ifdef WIN32
+last_error = WSAGetLastError();
+ioctlsocket(ConnectionNumber(dpy), FIONREAD, );
+WSASetLastError(last_error);
+#else
+last_error = errno;
+ioctl(ConnectionNumber(dpy), FIONREAD, );
+errno = last_error;
+#endif
+return bytes;
+}
 
 /*
  * _XDefaultIOError - Default fatal system error reporting routine.  Called
@@ -1241,7 +1258,17 @@ _XWireToEvent(
 int _XDefaultIOError(
Display *dpy)
 {
-   if (ECHECK(EPIPE)) {
+   int killed = ECHECK(EPIPE);
+
+   /*
+* If the socket was closed on the far end, the final recvmsg in
+* xcb will have thrown EAGAIN because we're non-blocking. Detect
+* this to get the more informative error message.
+*/
+   if (ECHECK(EAGAIN) && SocketBytesReadable(dpy) <= 0)
+   killed = True;
+
+   if (killed) {
fprintf (stderr,
  "X connection to %s broken (explicit kill or server 
shutdown).\r\n",
  DisplayString (dpy));
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/2] _XDefaultIOError: Reformat to be less ugly

2017-03-24 Thread Adam Jackson
Signed-off-by: Adam Jackson 
---
 src/XlibInt.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/XlibInt.c b/src/XlibInt.c
index 4c8eaeb..d5946bd 100644
--- a/src/XlibInt.c
+++ b/src/XlibInt.c
@@ -1242,24 +1242,24 @@ int _XDefaultIOError(
Display *dpy)
 {
if (ECHECK(EPIPE)) {
-   (void) fprintf (stderr,
-   "X connection to %s broken (explicit kill or server shutdown).\r\n",
-   DisplayString (dpy));
+   fprintf (stderr,
+ "X connection to %s broken (explicit kill or server 
shutdown).\r\n",
+ DisplayString (dpy));
} else {
-   (void) fprintf (stderr,
-   "XIO:  fatal IO error %d (%s) on X server \"%s\"\r\n",
+fprintf (stderr,
+ "XIO:  fatal IO error %d (%s) on X server \"%s\"\r\n",
 #ifdef WIN32
-   WSAGetLastError(), strerror(WSAGetLastError()),
+  WSAGetLastError(), strerror(WSAGetLastError()),
 #else
-   errno, strerror (errno),
+  errno, strerror (errno),
 #endif
-   DisplayString (dpy));
-   (void) fprintf (stderr,
-"  after %lu requests (%lu known processed) with %d events 
remaining.\r\n",
-   NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy),
-   QLength(dpy));
+  DisplayString (dpy));
+   fprintf (stderr,
+"  after %lu requests (%lu known processed) with %d 
events remaining.\r\n",
+NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy),
+QLength(dpy));
+}
 
-   }
exit(1);
/*NOTREACHED*/
 }
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] xf86: dri2: Use va_gl as vdpau_driver for Intel i965 GPUs

2017-03-24 Thread Emil Velikov
Hi Hans,

On 23 March 2017 at 12:31, Hans de Goede  wrote:
> The modesetting driver (which now often is used with Intel GPUs),
> relies on dri2_probe_driver_name() to get the dri and vdpau driver
> names, before this commit it would always assign the same name to
> the 2 names. But the vdpau driver for i965 GPUs should be va_gl
> (i915 does not support vdpau at all).
>
> This commit modifies the used lookup table and dri2_probe_driver_name()
> to set the vdpau_driver to va_gl for i965 GPUs, it leaves the 2
> names the same for all other GPUs.
>
Mostly thinking out loud here:

Perhaps it's worth having the vdpau-va-gl as fallback across the
board? We can do that via:

- Pass more than one name via the DRI2 protocol - will need a protocol update.
- Have the VDPAU library report failure and request another name - we
seem to be missing protocol for that.
- Handle the fallback in the VDPAU loader/frontend library - might
seem a bit hacky.

Pretty much all suggestions are a bit moot. I'm just throwing it out
there - in case anyone likes them.

-Emil
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel