[PATCH v3 xf86-input-libinput] Add tablet tool area ratio property

2017-01-08 Thread Peter Hutterer
By default, the X server maps the tablet axes to the available screen area.
When a tablet is mapped to the screen but has a different aspect ratio than
the screen, input data is skewed. Expose an area ratio property to map the
a subsection of the available tablet area into the desired ratio.

Differences to the wacom driver: there the x/y min/max values must be
specified manually and in device coordinates. For this driver we merely
provide the area ratio (e.g. 4:3) and let the driver work out the rest.

Signed-off-by: Peter Hutterer 
Reviewed-by: Jason Gerecke 
---
Changes to v2:
- handle ratio of 0/0 without resolving to NaN, see 
  xf86libinput_set_area_ratio

 include/libinput-properties.h |   3 +
 man/libinput.man  |  30 +++
 src/xf86libinput.c| 194 --
 3 files changed, 221 insertions(+), 6 deletions(-)

diff --git a/include/libinput-properties.h b/include/libinput-properties.h
index f76500f..a701316 100644
--- a/include/libinput-properties.h
+++ b/include/libinput-properties.h
@@ -190,4 +190,7 @@
  */
 #define LIBINPUT_PROP_TABLET_TOOL_PRESSURECURVE "libinput Tablet Tool 
Pressurecurve"
 
+/* Tablet tool area ratio: CARD32, 2 values, w and h */
+#define LIBINPUT_PROP_TABLET_TOOL_AREA_RATIO "libinput Tablet Tool Area Ratio"
+
 #endif /* _LIBINPUT_PROPERTIES_H_ */
diff --git a/man/libinput.man b/man/libinput.man
index 88a0428..d717ff7 100644
--- a/man/libinput.man
+++ b/man/libinput.man
@@ -161,6 +161,14 @@ points. The respective x/y coordinate must be in the [0.0, 
1.0] range. For
 more information see section
 .B TABLET STYLUS PRESSURE CURVE.
 .TP 7
+.BI "Option \*qTabletToolAreaRatio\*q \*q" "w:h" \*q
+Sets the area ratio for a tablet tool. The area always starts at the
+origin (0/0) and expands to the largest available area with the specified
+aspect ratio. Events outside this area are cropped to the area. The special
+value "default" is used for the default mapping (i.e. the device-native
+mapping). For more information see section
+.B TABLET TOOL AREA RATIO.
+.TP 7
 .BI "Option \*qTapping\*q \*q" bool \*q
 Enables or disables tap-to-click behavior.
 .TP 7
@@ -261,6 +269,11 @@ enabled on this device.
 .BI "libinput Tablet Tool Pressurecurve"
 4 32-bit float values [0.0 to 1.0]. See section
 .B TABLET TOOL PRESSURE CURVE
+.TP7
+.BI "libinput Tablet Tool Area Ratio"
+2 32-bit values, corresponding to width and height. Special value 0, 0
+resets to the default ratio. See section
+.B TABLET TOOL AREA RATIO
 for more information.
 .TP 7
 .BI "libinput Tapping Enabled"
@@ -343,6 +356,23 @@ curve (softer) might  be "0.0/0.0 0.0/0.05 0.95/1.0 
1.0/1.0".
 .TP
 This feature is provided by this driver, not by libinput.
 
+.SH TABLET TOOL AREA RATIO
+By default, a tablet tool can access the whole sensor area and the tablet
+area is mapped to the available screen area. For external tablets like
+the Wacom Intuos series, the height:width ratio of the tablet may be
+different to that of the monitor, causing the skew of input data.
+.PP
+To avoid this skew of input data, an area ratio may be set to match the
+ratio of the screen device. For example, a ratio of 4:3 will reduce the
+available area of the tablet to the largest available area with a ratio of
+4:3. Events within this area will scale to the tablet's announced axis
+range, the area ratio is thus transparent to the X server. Any events
+outside this area will send events equal to the maximum value of that axis.
+The area always starts at the device's origin in it's current rotation, i.e.
+it takes left-handed-ness into account.
+.TP
+This feature is provided by this driver, not by libinput.
+
 .SH AUTHORS
 Peter Hutterer
 .SH "SEE ALSO"
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index d43f67f..55cfc0c 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -167,6 +167,9 @@ struct xf86libinput {
 
float rotation_angle;
struct bezier_control_point pressurecurve[4];
+   struct ratio {
+   int x, y;
+   } area;
} options;
 
struct draglock draglock;
@@ -184,6 +187,10 @@ struct xf86libinput {
int *values;
size_t sz;
} pressurecurve;
+
+   struct scale_factor {
+   double x, y;
+   } area_scale_factor;
 };
 
 enum event_handling {
@@ -418,6 +425,35 @@ xf86libinput_set_pressurecurve(struct xf86libinput 
*driver_data,
driver_data->pressurecurve.sz);
 }
 
+static inline void
+xf86libinput_set_area_ratio(struct xf86libinput *driver_data,
+   const struct ratio *ratio)
+{
+   double f;
+   double w, h;
+
+   if (libinput_device_get_size(driver_data->shared_device->device, , 
) != 0)
+   return;
+
+   driver_data->options.area = *ratio;
+
+   if (ratio->y == 0) {
+   

Re: [PATCH v2 xf86-input-libinput] Add tablet tool area ratio property

2017-01-08 Thread Peter Hutterer
On Fri, Jan 06, 2017 at 11:49:52AM -0800, Jason Gerecke wrote:
> On 01/03/2017 08:38 PM, Peter Hutterer wrote:
> > By default, the X server maps the tablet axes to the available screen area.
> > When a tablet is mapped to the screen but has a different aspect ratio than
> > the screen, input data is skewed. Expose an area ratio property to map the
> > a subsection of the available tablet area into the desired ratio.
> > 
> > Differences to the wacom driver: there the x/y min/max values must be
> > specified manually and in device coordinates. For this driver we merely
> > provide the area ratio (e.g. 4:3) and let the driver work out the rest.
> > 
> > Signed-off-by: Peter Hutterer 
> > ---
> > Changes to v1:
> > - link up the tools so the ratio applies to all tools
> > - only init the area property for non-builtin tablets, for the built-in ones
> >   we don't use the area but the calibration matrix in case they're off
> > 
> >  include/libinput-properties.h |   3 +
> >  man/libinput.man  |  30 +++
> >  src/xf86libinput.c| 188 
> > --
> >  3 files changed, 215 insertions(+), 6 deletions(-)
> > 
> > diff --git a/include/libinput-properties.h b/include/libinput-properties.h
> > index f76500f..a701316 100644
> > --- a/include/libinput-properties.h
> > +++ b/include/libinput-properties.h
[...]
> > @@ -418,6 +425,29 @@ xf86libinput_set_pressurecurve(struct xf86libinput 
> > *driver_data,
> > driver_data->pressurecurve.sz);
> >  }
> >  
> > +static inline void
> > +xf86libinput_set_area_ratio(struct xf86libinput *driver_data,
> > +   const struct ratio *ratio)
> > +{
> > +   double f;
> > +   double w, h;
> > +
> > +   if (libinput_device_get_size(driver_data->shared_device->device, , 
> > ) != 0)
> > +   return;
> > +
> > +   f = 1.0 * (ratio->x * h)/(ratio->y * w);
> > +
> > +   if (f <= 1.0) {
> > +   driver_data->area_scale_factor.x = 1.0/f;
> > +   driver_data->area_scale_factor.y = 1.0;
> > +   } else {
> > +   driver_data->area_scale_factor.x = 1.0;
> > +   driver_data->area_scale_factor.y = f;
> > +   }
> > +
> > +   driver_data->options.area = *ratio;
> > +}
> 
> This function sets my Spidey-sense tingling. I don't like how
> ratio={0,0} is treated like any other valid value, causing the function
> to store an NaN in area_scale_factor. I want to say that we should
> explicitly handle the {0,0} case and set area_scale_factor to {1.0,1.0}
> so that other functions don't have to tiptoe around bogus values that
> may appear. However, area_scale_factor doesn't always have a valid value
> anyway (its initial value is {0,0} until a ratio is set) so maybe it
> doesn't really matter.

the second part is intentional: if there's some bug in the setup code, scale
factor means the pointer won't move, so it's immediately obvious. But you're
right, the NaN bit here isn't acceptable, I've amended this in v3.

[...]

> > @@ -4078,6 +4176,62 @@ LibinputSetPropertyPressureCurve(DeviceIntPtr dev,
> > return Success;
> >  }
> >  
> > +static inline int
> > +LibinputSetPropertyAreaRatio(DeviceIntPtr dev,
> > +Atom atom,
> > +XIPropertyValuePtr val,
> > +BOOL checkonly)
> > +{
> > +   InputInfoPtr pInfo = dev->public.devicePrivate;
> > +   struct xf86libinput *driver_data = pInfo->private;
> > +   uint32_t *vals;
> > +   struct ratio area = { 0, 0 };
> > +
> > +   if (val->format != 32 || val->size != 2 || val->type != XA_CARDINAL)
> > +   return BadMatch;
> 
> I was tripped up by this in testing so I might as dig out my newbie hat
> and ask... Why XA_CARDINAL? What's the difference between XA_CARDINAL
> and XA_INTEGER? Are cardinals related to the CARD{n} types, or is that
> just a naming coincidence? Is there any way to set cardinal properties
> with xinput set-prop?

32-bit XA_CARDINAL == uint32_t
32-bit XA_INTEGER == int32_t

that's all there is to it. We don't use XA_CARDINAL consistently in the
various drivers (not even within each driver, sorry). But the way the
properties work no-one ever really cares about the type anyway, everyone
just fetches the property and overwrites the values. that's what xinput
set-prop does too, it doesn't care about the type.

There's one other property in this driver that already uses it (the scroll
button) and it's documented as CARD8. So yeah, not ideal, but sticking to
the expected data type does make sense. All the others are integers because
they're either numbers or BOOL which is an integer.

Thanks for the review, much appreciated.

Cheers,
   Peter

___
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/6] tests: Convert test/xi2/ to single binary

2017-01-08 Thread Peter Hutterer
On Wed, Jan 04, 2017 at 11:31:41AM +0500, Mihail Konev wrote:
> Part of refactoring the tests into a single binary,
> to make partial rebuild slightly faster and less verbose.
> 
> Signed-off-by: Mihail Konev 
> ---
>  test/tests.h| 19 
>  test/xi2/.gitignore | 12 +
>  test/xi2/Makefile.am| 84 
> +
>  test/xi2/protocol-common.c  |  4 ++
>  test/xi2/protocol-eventconvert.c|  2 +-
>  test/xi2/protocol-xigetclientpointer.c  |  2 +-
>  test/xi2/protocol-xigetselectedevents.c |  4 +-
>  test/xi2/protocol-xipassivegrabdevice.c |  9 +++-
>  test/xi2/protocol-xiquerydevice.c   |  2 +-
>  test/xi2/protocol-xiquerypointer.c  |  2 +-
>  test/xi2/protocol-xiqueryversion.c  |  2 +-
>  test/xi2/protocol-xiselectevents.c  |  9 +++-
>  test/xi2/protocol-xisetclientpointer.c  |  2 +-
>  test/xi2/protocol-xiwarppointer.c   |  2 +-
>  test/xi2/tests.c| 21 +
>  test/xi2/xi2.c  |  2 +-
>  16 files changed, 106 insertions(+), 72 deletions(-)
>  create mode 100644 test/xi2/tests.c
> 
> diff --git a/test/tests.h b/test/tests.h
> index 8a42aa0da592..0b673ee7ae79 100644
> --- a/test/tests.h
> +++ b/test/tests.h
> @@ -3,5 +3,24 @@
>  
>  int protocol_xchangedevicecontrol_test(void);
>  
> +int protocol_xiqueryversion_test(void);
> +int protocol_xiquerydevice_test(void);
> +int protocol_xiselectevents_test(void);
> +int protocol_xigetselectedevents_test(void);
> +int protocol_xisetclientpointer_test(void);
> +int protocol_xigetclientpointer_test(void);
> +int protocol_xipassivegrabdevice_test(void);
> +int protocol_xiquerypointer_test(void);
> +int protocol_xiwarppointer_test(void);
> +int protocol_eventconvert_test(void);
> +int xi2_test(void);
> +
> +#ifndef INSIDE_PROTOCOL_COMMON
> +
> +extern int enable_XISetEventMask_wrap;
> +extern int enable_GrabButton_wrap;
> +
> +#endif /* INSIDE_PROTOCOL_COMMON */

something tells me this woudl be nicer solved by just having a header that
applies to all tests vs a header that applies to the protocol-common bits
only. Would be nice as follow-up.

Unfortunately, this breaks make check.

_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
XTEST_DIR must be set to the directory of the xtest repository.
SKIP scripts/xephyr-glamor-piglit.sh (exit status: 77)

1/6 still passes it but 2/6 doesn't build, so it's one of those two patches.
Please fix this and re-send the series (with a v3 subjectprefix). Test suite
failures really shouldn't happen during a test suite refactoring, that's the
one time all the attention is on the test suite ;)

Cheers,
   Peter

> +
>  #endif /* TESTS_H */
>  
> diff --git a/test/xi2/.gitignore b/test/xi2/.gitignore
> index 817aa7b6b83b..2b29f27645f8 100644
> --- a/test/xi2/.gitignore
> +++ b/test/xi2/.gitignore
> @@ -1,11 +1 @@
> -protocol-eventconvert
> -protocol-xigetclientpointer
> -protocol-xigetselectedevents
> -protocol-xipassivegrabdevice
> -protocol-xiquerydevice
> -protocol-xiquerypointer
> -protocol-xiqueryversion
> -protocol-xiselectevents
> -protocol-xisetclientpointer
> -protocol-xiwarppointer
> -xi2
> +tests
> diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
> index 6b9679872b48..a7f9831a93cd 100644
> --- a/test/xi2/Makefile.am
> +++ b/test/xi2/Makefile.am
> @@ -1,64 +1,48 @@
>  if ENABLE_UNIT_TESTS
>  if HAVE_LD_WRAP
> -noinst_PROGRAMS =  \
> - protocol-xiqueryversion \
> - protocol-xiquerydevice \
> - protocol-xiselectevents \
> - protocol-xigetselectedevents \
> -protocol-xisetclientpointer \
> -protocol-xigetclientpointer \
> -protocol-xipassivegrabdevice \
> -protocol-xiquerypointer \
> -protocol-xiwarppointer \
> -protocol-eventconvert \
> -xi2
> +noinst_PROGRAMS = tests
> +
> +TESTS = tests
>  
> -TESTS=$(noinst_PROGRAMS)
>  TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
>  
> -AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
> -AM_CPPFLAGS = @XORG_INCS@
> -TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
> $(GLX_SYS_LIBS)
> -COMMON_SOURCES=protocol-common.h protocol-common.c
> -COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
> +tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
> +
> +tests_CPPFLAGS = \
> + @XORG_INCS@ \
> + -I$(srcdir)/..
> +
> +tests_LDADD = ../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
> $(GLX_SYS_LIBS)
>  
>  if SPECIAL_DTRACE_OBJECTS
> -TEST_LDADD += $(OS_LIB) $(DIX_LIB)
> +tests_LDADD += $(OS_LIB) $(DIX_LIB)
>  endif
>  
> -protocol_xiqueryversion_LDADD=$(TEST_LDADD)
> -protocol_xiquerydevice_LDADD=$(TEST_LDADD)
> -protocol_xiselectevents_LDADD=$(TEST_LDADD)
> -protocol_xigetselectedevents_LDADD=$(TEST_LDADD)
> -protocol_xisetclientpointer_LDADD=$(TEST_LDADD)
> -protocol_xigetclientpointer_LDADD=$(TEST_LDADD)

Re: [PATCH xserver 2/6] tests: Convert test/xi1/ to single binary

2017-01-08 Thread Peter Hutterer
On Wed, Jan 04, 2017 at 11:31:40AM +0500, Mihail Konev wrote:
> Part of refactoring the tests into a single binary,
> to make partial rebuild slightly faster and less verbose.
> 
> Signed-off-by: Mihail Konev 

protocol-common.h:33:19: fatal error: tests.h: No such file or directory

hint:
  git rebase -i origin/master --exec make 

to run make on all commits to avoid this situation. Or write a little script
that calls make && make check and use that as argument to --exec.

quick skim shows that you're missing the  updated CFLAGS/CPPFLAGS in the
xi2/Makefile.am

Also, when you're sending out updated versions, please give a quick summary
of what changed since the previous version, it makes reviews a lot easier.

Cheers,
   Peter


> ---
>  test/tests-common.c  | 33 
>  test/tests-common.h  |  9 
>  test/tests.h |  7 ++
>  test/xi1/.gitignore  |  2 +-
>  test/xi1/Makefile.am | 37 
> 
>  test/xi1/protocol-xchangedevicecontrol.c |  2 +-
>  test/xi1/tests.c | 11 ++
>  test/xi2/protocol-common.h   |  2 ++
>  8 files changed, 87 insertions(+), 16 deletions(-)
>  create mode 100644 test/tests-common.c
>  create mode 100644 test/tests-common.h
>  create mode 100644 test/tests.h
>  create mode 100644 test/xi1/tests.c
> 
> diff --git a/test/tests-common.c b/test/tests-common.c
> new file mode 100644
> index ..686852827765
> --- /dev/null
> +++ b/test/tests-common.c
> @@ -0,0 +1,33 @@
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "tests-common.h"
> +
> +void
> +run_test_in_child(int (*func)(void), const char *funcname)
> +{
> +int cpid;
> +int csts;
> +int exit_code = -1;
> +
> +printf("\n-\n%s...\n", funcname);
> +cpid = fork();
> +if (cpid) {
> +waitpid(cpid, , 0);
> +if (!WIFEXITED(csts))
> +goto child_failed;
> +exit_code = WEXITSTATUS(csts);
> +if (exit_code == 0)
> +printf(" Pass\n");
> +else {
> +child_failed:
> +printf(" FAIL\n");
> +exit(exit_code);
> +}
> +} else {
> +exit(func());
> +}
> +}
> diff --git a/test/tests-common.h b/test/tests-common.h
> new file mode 100644
> index ..b02f746f6f56
> --- /dev/null
> +++ b/test/tests-common.h
> @@ -0,0 +1,9 @@
> +#ifndef TESTS_COMMON_H
> +#define TESTS_COMMON_H
> +
> +#define run_test(func) run_test_in_child(func, #func)
> +
> +void run_test_in_child(int (*func)(void), const char *funcname);
> +
> +#endif /* TESTS_COMMON_H */
> +
> diff --git a/test/tests.h b/test/tests.h
> new file mode 100644
> index ..8a42aa0da592
> --- /dev/null
> +++ b/test/tests.h
> @@ -0,0 +1,7 @@
> +#ifndef TESTS_H
> +#define TESTS_H
> +
> +int protocol_xchangedevicecontrol_test(void);
> +
> +#endif /* TESTS_H */
> +
> diff --git a/test/xi1/.gitignore b/test/xi1/.gitignore
> index c1b9024ee958..2b29f27645f8 100644
> --- a/test/xi1/.gitignore
> +++ b/test/xi1/.gitignore
> @@ -1 +1 @@
> -protocol-xchangedevicecontrol
> +tests
> diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
> index 813241c0aeed..7a054dd80966 100644
> --- a/test/xi1/Makefile.am
> +++ b/test/xi1/Makefile.am
> @@ -1,26 +1,35 @@
>  if ENABLE_UNIT_TESTS
>  if HAVE_LD_WRAP
> -noinst_PROGRAMS =  \
> - protocol-xchangedevicecontrol
> +noinst_PROGRAMS = tests
> +
> +TESTS = tests
>  
> -TESTS=$(noinst_PROGRAMS)
>  TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
>  
> -AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
> -AM_CPPFLAGS = @XORG_INCS@ -I$(srcdir)/../xi2
> -TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
> $(GLX_SYS_LIBS)
> -COMMON_SOURCES=$(srcdir)/../xi2/protocol-common.c
> -COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
> +tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
> +tests_CPPFLAGS = \
> + @XORG_INCS@ \
> + -I$(srcdir)/.. \
> + -I$(srcdir)/../xi2 \
> + $()
>  
> -if SPECIAL_DTRACE_OBJECTS
> -TEST_LDADD += $(OS_LIB) $(DIX_LIB)
> -endif
> +tests_LDFLAGS = \
> + -Wl,-wrap,dixLookupWindow \
> + -Wl,-wrap,dixLookupClient \
> + -Wl,-wrap,WriteToClient \
> + $()
>  
> -protocol_xchangedevicecontrol_LDADD=$(TEST_LDADD)
> +tests_LDADD =../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
> $(GLX_SYS_LIBS)
>  
> -protocol_xchangedevicecontrol_LDFLAGS=$(COMMON_LDFLAGS) 
> -Wl,-wrap,WriteToClient
> +tests_SOURCES = \
> + $(srcdir)/../tests-common.c \
> + $(srcdir)/../xi2/protocol-common.c \
> + protocol-xchangedevicecontrol.c \
> + tests.c
>  
> -protocol_xchangedevicecontrol_SOURCES=$(COMMON_SOURCES) 
> protocol-xchangedevicecontrol.c
> +if SPECIAL_DTRACE_OBJECTS
> +tests_LDADD += $(OS_LIB) $(DIX_LIB)
> +endif
>  
>  else
>  # Print that xi1-tests were skipped (exit code 77 for 

Re: [PATCH xserver 1/6] tests: Refactor wraps into protocol-common.c

2017-01-08 Thread Peter Hutterer
On Wed, Jan 04, 2017 at 11:31:39AM +0500, Mihail Konev wrote:
> Part of refactoring the tests into a single binary,
> to make partial rebuild slightly faster and less verbose.
> 
> Prepares for joining test/xi2/protocol-* into a single binary.
> 
> Signed-off-by: Mihail Konev 
> ---
>  test/xi1/Makefile.am |  3 ++-
>  test/xi1/protocol-xchangedevicecontrol.c |  1 +
>  test/xi2/Makefile.am | 22 ++-
>  test/xi2/protocol-common.c   | 37 
> 
>  test/xi2/protocol-eventconvert.c |  2 ++
>  test/xi2/protocol-xigetclientpointer.c   | 17 +--
>  test/xi2/protocol-xigetselectedevents.c  | 20 +
>  test/xi2/protocol-xipassivegrabdevice.c  | 16 +-
>  test/xi2/protocol-xiquerydevice.c|  2 ++
>  test/xi2/protocol-xiquerypointer.c   | 21 +-
>  test/xi2/protocol-xiqueryversion.c   |  2 ++
>  test/xi2/protocol-xiselectevents.c   | 22 ++-
>  test/xi2/protocol-xisetclientpointer.c   | 17 +--
>  test/xi2/protocol-xiwarppointer.c| 20 +
>  test/xi2/xi2.c   |  4 
>  15 files changed, 70 insertions(+), 136 deletions(-)
> 
> diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
> index 907fa7aea5f3..813241c0aeed 100644
> --- a/test/xi1/Makefile.am
> +++ b/test/xi1/Makefile.am
> @@ -10,6 +10,7 @@ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
>  AM_CPPFLAGS = @XORG_INCS@ -I$(srcdir)/../xi2
>  TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
> $(GLX_SYS_LIBS)
>  COMMON_SOURCES=$(srcdir)/../xi2/protocol-common.c
> +COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
>  
>  if SPECIAL_DTRACE_OBJECTS
>  TEST_LDADD += $(OS_LIB) $(DIX_LIB)
> @@ -17,7 +18,7 @@ endif
>  
>  protocol_xchangedevicecontrol_LDADD=$(TEST_LDADD)
>  
> -protocol_xchangedevicecontrol_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient
> +protocol_xchangedevicecontrol_LDFLAGS=$(COMMON_LDFLAGS) 
> -Wl,-wrap,WriteToClient
>  
>  protocol_xchangedevicecontrol_SOURCES=$(COMMON_SOURCES) 
> protocol-xchangedevicecontrol.c
>  
> diff --git a/test/xi1/protocol-xchangedevicecontrol.c 
> b/test/xi1/protocol-xchangedevicecontrol.c
> index 8e638b218f72..64d2ca29bb95 100644
> --- a/test/xi1/protocol-xchangedevicecontrol.c
> +++ b/test/xi1/protocol-xchangedevicecontrol.c
> @@ -37,6 +37,7 @@
>  
>  #include "protocol-common.h"
>  
> +ClientRec client_window;
>  static ClientRec client_request;
>  
>  static void
> diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
> index bfddfef133fd..6b9679872b48 100644
> --- a/test/xi2/Makefile.am
> +++ b/test/xi2/Makefile.am
> @@ -20,6 +20,7 @@ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
>  AM_CPPFLAGS = @XORG_INCS@
>  TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
> $(GLX_SYS_LIBS)
>  COMMON_SOURCES=protocol-common.h protocol-common.c
> +COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient

this adds a new warning:
test/xi2/Makefile.am:23: warning: variable 'COMMON_LDFLAGS' is defined but
no program or
test/xi2/Makefile.am:23: library has 'COMMON' as canonical name (possible
typo)

Rename it to COMMON_LIBFLAGS or so to get rid of it, it's just cosmetic.

same for the xi1 directory.

Cheers,
   Peter


>  
>  if SPECIAL_DTRACE_OBJECTS
>  TEST_LDADD += $(OS_LIB) $(DIX_LIB)
> @@ -37,16 +38,16 @@ protocol_xiwarppointer_LDADD=$(TEST_LDADD)
>  protocol_eventconvert_LDADD=$(TEST_LDADD)
>  xi2_LDADD=$(TEST_LDADD)
>  
> -protocol_xiqueryversion_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient
> -protocol_xiquerydevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient
> -protocol_xiselectevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupWindow 
> -Wl,-wrap,XISetEventMask
> -protocol_xigetselectedevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient 
> -Wl,-wrap,dixLookupWindow -Wl,-wrap,AddResource
> -protocol_xisetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupClient
> -protocol_xigetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient 
> -Wl,-wrap,dixLookupClient
> -protocol_xipassivegrabdevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,GrabButton 
> -Wl,-wrap,dixLookupWindow -Wl,-wrap,WriteToClient
> -protocol_xiquerypointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient 
> -Wl,-wrap,dixLookupWindow
> -protocol_xiwarppointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient 
> -Wl,-wrap,dixLookupWindow
> -xi2_LDFLAGS=$(AM_LDFLAGS)
> +protocol_xiqueryversion_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
> +protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
> +protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask
> +protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) 
> -Wl,-wrap,WriteToClient -Wl,-wrap,AddResource
> +protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) 
> -Wl,-wrap,dixLookupClient
> +protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) 
> 

[PATCH] cache glyphs in the destination format requested to make sure the hardware can use the cached glyphs

2017-01-08 Thread Michael Lorenz
From: Michael Lorenz 

Signed-off-by: Michael Lorenz 
---
 exa/exa_glyphs.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index 192a643cc..7386d05e9 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -544,7 +544,6 @@ exaBufferGlyph(ScreenPtr pScreen,
INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst)
 {
 ExaScreenPriv(pScreen);
-unsigned int format = (GetGlyphPicture(pGlyph, pScreen))->format;
 int width = pGlyph->info.width;
 int height = pGlyph->info.height;
 ExaCompositeRectPtr rect;
@@ -554,13 +553,10 @@ exaBufferGlyph(ScreenPtr pScreen,
 if (buffer->count == GLYPH_BUFFER_SIZE)
 return ExaGlyphNeedFlush;
 
-if (PICT_FORMAT_BPP(format) == 1)
-format = PICT_a8;
-
 for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
 ExaGlyphCachePtr cache = >glyphCaches[i];
 
-if (format == cache->format &&
+if (pDst->format == cache->format &&
 width <= cache->glyphWidth && height <= cache->glyphHeight) {
 ExaGlyphCacheResult result = exaGlyphCacheBufferGlyph(pScreen,
   >
-- 
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

Re: [PATCH v2 xserver 00/11] modesetting: MS_ALL_IN_ONE

2017-01-08 Thread Yu, Qiang

Hi Hans,

I forgot there is another difference, PRIME solution has to copy screen once 
before display
to iGPU while MS_ALL_IN_ONE don't have to and can display what full screen app 
draws
directly by page flip (for DRI2) which may be important for embedded platforms 
with week
GPU and limited memory bandwidths.

Benefit from common interface of drm/gbm/egl, may be modesetting can play a 
bigger role
of span multi drm devices to give more optimization like this and:
1. multi render node, a single protocol screen to accept request and dispatch 
to each render
node for render
2. multi display node associate with the render node (some display node has the 
same drm
device with render node), so no need to handle bo tile-linear copy and each 
render node can
handle request of its related display node.

Regards,
Qiang
___
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 xts] xts5: Fix clang error - non-void function 'tet_main' should return a value

2017-01-08 Thread Peter Hutterer
On Sun, Jan 08, 2017 at 01:54:05PM -0500, Rhys Kidd wrote:
> On 27 December 2016 at 20:45, Rhys Kidd  wrote:
> 
> > Amongst examples:
> >
> > XDisplayString/Test1.c:151:3: error: non-void function 'tet_main' should
> > return
> >   a value [-Wreturn-type]
> > return;
> > ^
> >
> > Signed-off-by: Rhys Kidd 
> >
> 
> Gentle ping.

pushed, thanks.

   6f2e907..ea595bb  master -> master

fwiw, still complains XDisplayName/Test1.c:181:1: warning: control reaches
end of non-void function [-Wreturn-type]
but that's not caused by or related to this patch.

Cheers,
   Peter

>
> > ---
> >  xts5/Xlib12/XDisplayName/Test1.c | 3 ++-
> >  xts5/Xlib15/XSetWMProperties/Test1.c | 6 --
> >  xts5/Xlib15/XSetWMProperties/Test2.c | 6 --
> >  xts5/Xlib17/XGetDefault/Test3.c  | 3 ++-
> >  xts5/Xlib17/XGetDefault/Test4.c  | 3 ++-
> >  xts5/Xlib17/XGetDefault/Test5.c  | 6 --
> >  xts5/Xlib3/XDisplayString/Test1.c| 8 +---
> >  xts5/Xlib3/XOpenDisplay/Test1.c  | 6 --
> >  8 files changed, 27 insertions(+), 14 deletions(-)
> >
> > diff --git a/xts5/Xlib12/XDisplayName/Test1.c b/xts5/Xlib12/XDisplayName/
> > Test1.c
> > index a1bb851..e54d926 100644
> > --- a/xts5/Xlib12/XDisplayName/Test1.c
> > +++ b/xts5/Xlib12/XDisplayName/Test1.c
> > @@ -156,7 +156,8 @@ char*str;
> >
> > if((dispstr = getenv("DISPLAY")) == NULL) {
> > delete("Environment variable DISPLAY is not set.");
> > -   return;
> > +   UNRESOLVED;
> > +   return(False);
> > } else
> > CHECK;
> >
> > diff --git a/xts5/Xlib15/XSetWMProperties/Test1.c b/xts5/Xlib15/
> > XSetWMProperties/Test1.c
> > index 7c2cf28..6825f2c 100644
> > --- a/xts5/Xlib15/XSetWMProperties/Test1.c
> > +++ b/xts5/Xlib15/XSetWMProperties/Test1.c
> > @@ -156,7 +156,8 @@ XClassHint  rclass_hints;
> >
> > if( (res_name = getenv("RESOURCE_NAME")) == NULL) {
> > delete("RESOURCE_NAME environment variable is not set.");
> > -   return;
> > +   UNRESOLVED;
> > +   return(False);
> > } else
> > CHECK;
> >
> > @@ -172,7 +173,8 @@ XClassHint  rclass_hints;
> >
> > if( XGetClassHint(Dsp, win, _hints) == 0 ) {
> > delete("XGetClassHints returned zero.");
> > -   return;
> > +   UNRESOLVED;
> > +   return(False);
> > } else
> > CHECK;
> >
> > diff --git a/xts5/Xlib15/XSetWMProperties/Test2.c b/xts5/Xlib15/
> > XSetWMProperties/Test2.c
> > index d52cef3..f94f239 100644
> > --- a/xts5/Xlib15/XSetWMProperties/Test2.c
> > +++ b/xts5/Xlib15/XSetWMProperties/Test2.c
> > @@ -156,7 +156,8 @@ XClassHint  rclass_hints;
> >
> > if( getenv("RESOURCE_NAME") != (char *)NULL) {
> > delete("RESOURCE_NAME environment variable was set to
> > \"%s\" instead of being undefined.");
> > -   return;
> > +   UNRESOLVED;
> > +   return(False);
> > } else
> > CHECK;
> >
> > @@ -172,7 +173,8 @@ XClassHint  rclass_hints;
> >
> > if( XGetClassHint(Dsp, win, _hints) == 0 ) {
> > delete("XGetClassHints returned zero.");
> > -   return;
> > +   UNRESOLVED;
> > +   return(False);
> > } else
> > CHECK;
> >
> > diff --git a/xts5/Xlib17/XGetDefault/Test3.c b/xts5/Xlib17/XGetDefault/
> > Test3.c
> > index 05ba128..14542b6 100644
> > --- a/xts5/Xlib17/XGetDefault/Test3.c
> > +++ b/xts5/Xlib17/XGetDefault/Test3.c
> > @@ -151,7 +151,8 @@ char*pval="XTest.testval31:pval_a\
> > nXTest.testval32:pval_b\nXTest.testval33:pva
> >
> > if(getenv("HOME") == NULL) {
> > delete("Environment variable \"HOME\" is not set.");
> > -   return;
> > +   UNRESOLVED;
> > +   return(False);
> > } else
> > CHECK;
> >
> > diff --git a/xts5/Xlib17/XGetDefault/Test4.c b/xts5/Xlib17/XGetDefault/
> > Test4.c
> > index 958fa91..5c53dd7 100644
> > --- a/xts5/Xlib17/XGetDefault/Test4.c
> > +++ b/xts5/Xlib17/XGetDefault/Test4.c
> > @@ -154,7 +154,8 @@ static  char*result[]  = { "pVAL_1",
> > "eVAL_5","eVAL_6" };
> >
> > if(getenv("XENVIRONMENT") == NULL) {
> > delete("XENVIRONMENT environment variable not set.");
> > -   return;
> > +   UNRESOLVED;
> > +   return(False);
> > } else
> > CHECK;
> >
> > diff --git a/xts5/Xlib17/XGetDefault/Test5.c b/xts5/Xlib17/XGetDefault/
> > Test5.c
> > index 628ba7d..5e506ae 100644
> > --- a/xts5/Xlib17/XGetDefault/Test5.c
> > +++ b/xts5/Xlib17/XGetDefault/Test5.c
> > @@ -157,13 +157,15 @@ staticchar*result[]  = { "pVAL_1",
> > "hVAL_5","hVAL_6" , "hVAL_7"};
> >
> > if(getenv("XENVIRONMENT") 

Re: Create a 32-bit root window

2017-01-08 Thread The Rasterman
On Sat, 7 Jan 2017 15:29:41 -0700 SRC SRC  said:

> Hi,
> 
> This is my first email to this mailing list and I was wondering if anyone
> could tell me how to draw a root window on the display using xlib with a
> 32-bit color depth so that I can use RGBA colors on the child windows. As far
> as I know, I could be wrong though, the child window cannot use the alpha
> channel if it is not a 32-bit color depth window, and for it to be a 32-bit
> depth window it's parent has to also be a 32-bit depth window. Basically what
> I'm trying  to do is I'm trying to set a root window with a color depth of
> 32-bit that has a scaled 24-bit image loaded as the background, and I want
> another window that will be the child of this parent, or root, window, which
> will have a translucent effect similar to the window borders in Microsoft
> windows 7. if you need more details I have posted a similar question on stack
> overflow with more details on the code that I'm using to create the root
> window. Hopefully I was clear on my question.

no. you don't have to have root window be depth 32 to have children be depth 32
too. otherwise how on earth do you think windows can have alpha channels in a
compositor? how do you think this:

http://www.enlightenment.org/ss/e-5872c6ec3ddce1.54730231.png

is possible without 2 of those windows having 32bit depth? (the 2 on the left -
clock and translucent terminal). :)

the way translucency WORKS is a compositor intervenes (these days usually your
window manager) and is composites the 32bit windows on top (also possibly deals
with redrawing root window too at the bottom - it may depend though).

so what you want really is a compositor AND 32bit windows. :) either use a
compositing window manager and then create 32bit windows, OR run a separate
compositor and your existing wm, or write your own compositor... (not going to
be much fun to get this right AND fast)...

> Thanks!
> Sajeeb Roy
> 
> Stack overflow link:
> http://stackoverflow.com/questions/41524843/create-a-32-bit-root-window-in-xlib

-- 
- Codito, ergo sum - "I code, therefore I am" --
The Rasterman (Carsten Haitzler)ras...@rasterman.com

___
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 libX11] Fix wrong Xfree in XListFonts failure path

2017-01-08 Thread Peter Hutterer
On Sat, Jan 07, 2017 at 09:55:34AM -0800, Alan Coopersmith wrote:
> Reviewed-by: Alan Coopersmith 
> 
> Looks like this bug was introduced just after the 1.6.4 release and hasn't
> made it out into a libX11 release yet - thanks for catching it in time.
> 
>   -alan-

   663f470..c74b070  master -> master


thanks

Cheers,
   Peter

> 
> On 01/ 7/17 07:20 AM, Julien Cristau wrote:
> > 'ch' gets moved inside the allocated buffer as we're looping through
> > fonts, so keep a reference to the start of the buffer so we can pass
> > that to Xfree in the failure case.
> > 
> > Fixes: commit 20a3f99eba5001925b8b313da3accb7900eb1927 "Plug a memory leak"
> > 
> > Signed-off-by: Julien Cristau 
> > ---
> >  src/FontNames.c | 6 --
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/FontNames.c b/src/FontNames.c
> > index 3e23b5f4..9ffdfd29 100644
> > --- a/src/FontNames.c
> > +++ b/src/FontNames.c
> > @@ -43,6 +43,7 @@ int *actualCount) /* RETURN */
> >  register int length;
> >  char **flist = NULL;
> >  char *ch = NULL;
> > +char *chstart;
> >  char *chend;
> >  int count = 0;
> >  xListFontsReply rep;
> > @@ -86,6 +87,7 @@ int *actualCount) /* RETURN */
> > /*
> >  * unpack into null terminated strings.
> >  */
> > +   chstart = ch;
> > chend = ch + (rlen + 1);
> > length = *(unsigned char *)ch;
> > *ch = 1; /* make sure it is non-zero for XFreeFontNames */
> > @@ -98,14 +100,14 @@ int *actualCount)  /* RETURN */
> > *ch = '\0';  /* and replace with null-termination */
> > count++;
> > } else {
> > -Xfree(ch);
> > +Xfree(chstart);
> >  Xfree(flist);
> >  flist = NULL;
> >  count = 0;
> >  break;
> > }
> > } else {
> > -Xfree(ch);
> > +Xfree(chstart);
> >  Xfree(flist);
> >  flist = NULL;
> >  count = 0;
> > 
> 
> 
> -- 
>   -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
> 
___
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 xts] xts5: Fix clang error - non-void function 'tet_main' should return a value

2017-01-08 Thread Rhys Kidd
On 27 December 2016 at 20:45, Rhys Kidd  wrote:

> Amongst examples:
>
> XDisplayString/Test1.c:151:3: error: non-void function 'tet_main' should
> return
>   a value [-Wreturn-type]
> return;
> ^
>
> Signed-off-by: Rhys Kidd 
>

Gentle ping.


> ---
>  xts5/Xlib12/XDisplayName/Test1.c | 3 ++-
>  xts5/Xlib15/XSetWMProperties/Test1.c | 6 --
>  xts5/Xlib15/XSetWMProperties/Test2.c | 6 --
>  xts5/Xlib17/XGetDefault/Test3.c  | 3 ++-
>  xts5/Xlib17/XGetDefault/Test4.c  | 3 ++-
>  xts5/Xlib17/XGetDefault/Test5.c  | 6 --
>  xts5/Xlib3/XDisplayString/Test1.c| 8 +---
>  xts5/Xlib3/XOpenDisplay/Test1.c  | 6 --
>  8 files changed, 27 insertions(+), 14 deletions(-)
>
> diff --git a/xts5/Xlib12/XDisplayName/Test1.c b/xts5/Xlib12/XDisplayName/
> Test1.c
> index a1bb851..e54d926 100644
> --- a/xts5/Xlib12/XDisplayName/Test1.c
> +++ b/xts5/Xlib12/XDisplayName/Test1.c
> @@ -156,7 +156,8 @@ char*str;
>
> if((dispstr = getenv("DISPLAY")) == NULL) {
> delete("Environment variable DISPLAY is not set.");
> -   return;
> +   UNRESOLVED;
> +   return(False);
> } else
> CHECK;
>
> diff --git a/xts5/Xlib15/XSetWMProperties/Test1.c b/xts5/Xlib15/
> XSetWMProperties/Test1.c
> index 7c2cf28..6825f2c 100644
> --- a/xts5/Xlib15/XSetWMProperties/Test1.c
> +++ b/xts5/Xlib15/XSetWMProperties/Test1.c
> @@ -156,7 +156,8 @@ XClassHint  rclass_hints;
>
> if( (res_name = getenv("RESOURCE_NAME")) == NULL) {
> delete("RESOURCE_NAME environment variable is not set.");
> -   return;
> +   UNRESOLVED;
> +   return(False);
> } else
> CHECK;
>
> @@ -172,7 +173,8 @@ XClassHint  rclass_hints;
>
> if( XGetClassHint(Dsp, win, _hints) == 0 ) {
> delete("XGetClassHints returned zero.");
> -   return;
> +   UNRESOLVED;
> +   return(False);
> } else
> CHECK;
>
> diff --git a/xts5/Xlib15/XSetWMProperties/Test2.c b/xts5/Xlib15/
> XSetWMProperties/Test2.c
> index d52cef3..f94f239 100644
> --- a/xts5/Xlib15/XSetWMProperties/Test2.c
> +++ b/xts5/Xlib15/XSetWMProperties/Test2.c
> @@ -156,7 +156,8 @@ XClassHint  rclass_hints;
>
> if( getenv("RESOURCE_NAME") != (char *)NULL) {
> delete("RESOURCE_NAME environment variable was set to
> \"%s\" instead of being undefined.");
> -   return;
> +   UNRESOLVED;
> +   return(False);
> } else
> CHECK;
>
> @@ -172,7 +173,8 @@ XClassHint  rclass_hints;
>
> if( XGetClassHint(Dsp, win, _hints) == 0 ) {
> delete("XGetClassHints returned zero.");
> -   return;
> +   UNRESOLVED;
> +   return(False);
> } else
> CHECK;
>
> diff --git a/xts5/Xlib17/XGetDefault/Test3.c b/xts5/Xlib17/XGetDefault/
> Test3.c
> index 05ba128..14542b6 100644
> --- a/xts5/Xlib17/XGetDefault/Test3.c
> +++ b/xts5/Xlib17/XGetDefault/Test3.c
> @@ -151,7 +151,8 @@ char*pval="XTest.testval31:pval_a\
> nXTest.testval32:pval_b\nXTest.testval33:pva
>
> if(getenv("HOME") == NULL) {
> delete("Environment variable \"HOME\" is not set.");
> -   return;
> +   UNRESOLVED;
> +   return(False);
> } else
> CHECK;
>
> diff --git a/xts5/Xlib17/XGetDefault/Test4.c b/xts5/Xlib17/XGetDefault/
> Test4.c
> index 958fa91..5c53dd7 100644
> --- a/xts5/Xlib17/XGetDefault/Test4.c
> +++ b/xts5/Xlib17/XGetDefault/Test4.c
> @@ -154,7 +154,8 @@ static  char*result[]  = { "pVAL_1",
> "eVAL_5","eVAL_6" };
>
> if(getenv("XENVIRONMENT") == NULL) {
> delete("XENVIRONMENT environment variable not set.");
> -   return;
> +   UNRESOLVED;
> +   return(False);
> } else
> CHECK;
>
> diff --git a/xts5/Xlib17/XGetDefault/Test5.c b/xts5/Xlib17/XGetDefault/
> Test5.c
> index 628ba7d..5e506ae 100644
> --- a/xts5/Xlib17/XGetDefault/Test5.c
> +++ b/xts5/Xlib17/XGetDefault/Test5.c
> @@ -157,13 +157,15 @@ staticchar*result[]  = { "pVAL_1",
> "hVAL_5","hVAL_6" , "hVAL_7"};
>
> if(getenv("XENVIRONMENT") != NULL) {
> delete("XENVIRONMENT environment variable was set.");
> -   return;
> +   UNRESOLVED;
> +   return(False);
> } else
> CHECK;
>
> if(getenv("HOME") == NULL) {
> delete("HOME environment variable was not set.");
> -   return;
> +   UNRESOLVED;
> +   return(False);
> } else
> CHECK;
>
> diff --git a/xts5/Xlib3/XDisplayString/Test1.c
> b/xts5/Xlib3/XDisplayString/Test1.c
> index 

Create a 32-bit root window

2017-01-08 Thread SRC SRC
Hi,

This is my first email to this mailing list and I was wondering if anyone could 
tell me how to draw a root window on the display using xlib with a 32-bit color 
depth so that I can use RGBA colors on the child windows. As far as I know, I 
could be wrong though, the child window cannot use the alpha channel if it is 
not a 32-bit color depth window, and for it to be a 32-bit depth window it's 
parent has to also be a 32-bit depth window. Basically what I'm trying  to do 
is I'm trying to set a root window with a color depth of 32-bit that has a 
scaled 24-bit image loaded as the background, and I want another window that 
will be the child of this parent, or root, window, which will have a 
translucent effect similar to the window borders in Microsoft windows 7. if you 
need more details I have posted a similar question on stack overflow with more 
details on the code that I'm using to create the root window. Hopefully I was 
clear on my question.

Thanks!
Sajeeb Roy

Stack overflow link: 
http://stackoverflow.com/questions/41524843/create-a-32-bit-root-window-in-xlib___
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 v2 xserver 00/11] modesetting: MS_ALL_IN_ONE

2017-01-08 Thread Yu, Qiang

Hi Hans,

Thanks for your info, I give it a quick try:
Section "OutputClass"
Identifier "amd"
MatchDriver "amdgpu"
Driver "modesetting"
Option "PrimaryGPU" "yes"
EndSection

Section "OutputClass"
Identifier "intel"
MatchDriver "i915_bpo"
Driver "modesetting"
EndSection

Seems indeed some bugs in it, xserver start as expected with amdgpu as master
and i915 as slave (Xorg.0.log attached), but the screen is black, and run 
xrandr:
1. "xrandr --setprovideroutputsource 1 0" won't add any iGPU's output (0 is 
amdgpu, 1 is intel)
2. "xrandr --setprovideroutputsource 0 1" crash the xserver:
Xorg: ../../../xserver/dix/dispatch.c:4018: AttachOutputGPU: Assertion 
`new->isGPU' failed.
But I believe it can be fixed.

MS_ALL_IN_ONE method is my previous work when xserver has no proper PRIME sync.
And I find it's also useful for embedded platforms like iMX6/etnaviv. So 
published here.
As the MS_ALL_IN_ONE environment variable, I can change it to be an option of 
modesetting.

Now as the PRIME sync is upstreamed, I think they can achieve nearly same 
effect in theory,
but still minor difference when implementation in each DDX like modesetting 
need a proper
implementation of PresentSharedPixmap() for “OpenGL Syncing To VBlank”. I just 
provide
another way.

Regards,
Qiang




From: Hans de Goede 
Sent: Sunday, January 8, 2017 6:45:36 PM
To: Yu, Qiang; xorg-devel@lists.x.org
Subject: Re: [PATCH v2 xserver 00/11] modesetting: MS_ALL_IN_ONE

Hi,

On 07-01-17 09:01, Qiang Yu wrote:
> V2: add PATCH 11 to support GPUScreen capable of display
>
> This is for hybrid drm device use case that one drm device
> is only capable of display and the other is only capable of
> rendering.
>
> Usage: start xserver with MS_ALL_IN_ONE=1, and configure both
> the display (Screen) and render (GPUScreen) drm devices using
> modesetting DDX, it will use Screen as display, GPUScreen as
> render and create one screen for them. If the render device
> is also capable of display, create a GPUScreen for it in
> addition.
>
> Client see only the render device and load render device's DRI
> driver. Server side render is also accelerated by the render
> device. Display device only display what render device draws.
>
> There is still one problem: DRI3 can't support page flip because
> client doesn't know when to create a linear pixmap for flip.

I've recently more or less made the same thing work for the
nvidia binary driver, but in a much simpler way. If you
write a xorg.conf which sets the render-only GPU as primary
then no changes to the modesetting driver are necessary
at all. Specifically some patches of mine were recently
merged to master allowing to do this without needing to
specify bus-ids, a xorg.conf snippet like this one is
sufficient:

https://fedorapeople.org/~jwrdegoede/10-nvidia-driver.conf

The trick here is these 2 lines:

MatchDriver "nvidia-drm"
Option "PrimaryGPU" "yes"

Which make any GPU which has the nvidia-drm kernel driver
be seen as primary, overriding the default primary detection
which looks at which GPU has its vga registers mmio mapped.

At least this works with the nvidia binary driver, it may be
that some small changes are needed when using the modesetting
driver on the render GPU.

I wonder if you can do something similar for your use case
without needing all these changes.

Eitherway depending on an environment variable for this
behavior is unacceptable IMHO, this really should be configured
through a xorg.conf snippet.

 > Tested on a laptop with Intel iGPU and AMD dGPU.

On such a setup you should be able to get things to work using
master + a config snippet similar to:

https://fedorapeople.org/~jwrdegoede/10-nvidia-driver.conf

Without needing a patches modesetting driver at all.

Regards,

Hans








>
> Qiang Yu (11):
>   modesetting: add MS_ALL_IN_ONE handling
>   modesetting: add is_primary to mark entity type
>   modesetting: remove unused PciInfo in modesettingRec
>   modesetting: add render entity init and free
>   Revert "modesetting: Delete dead drmmode_bo_for_pixmap function."
>   dri2: refine dri2_probe_driver_name
>   modesetting: separate render and display
>   modesetting: use drmmode_bo_for_pixmap in ms_do_pageflip
>   modesetting: dri2 allocate linear backbuffer
>   modesetting: allow display node has no gbm support
>   modesetting: still create GPUScreen when it's capable of display
>
>  hw/xfree86/dri2/dri2.c   |  35 +--
>  hw/xfree86/drivers/modesetting/dri2.c|  33 ++-
>  hw/xfree86/drivers/modesetting/driver.c  | 265 
> ---
>  hw/xfree86/drivers/modesetting/driver.h  |   9 +-
>  hw/xfree86/drivers/modesetting/drmmode_display.c | 128 ++-
>  hw/xfree86/drivers/modesetting/drmmode_display.h |   3 +
>  hw/xfree86/drivers/modesetting/dumb_bo.c |  11 +
>  hw/xfree86/drivers/modesetting/dumb_bo.h |   1 

Re: [PATCH v2 xserver 00/11] modesetting: MS_ALL_IN_ONE

2017-01-08 Thread Hans de Goede

Hi,

On 08-01-17 15:04, Yu, Qiang wrote:


Hi Hans,

Thanks for your info, I give it a quick try:
Section "OutputClass"
Identifier "amd"
MatchDriver "amdgpu"
Driver "modesetting"
Option "PrimaryGPU" "yes"
EndSection

Section "OutputClass"
Identifier "intel"
MatchDriver "i915_bpo"
Driver "modesetting"
EndSection

Seems indeed some bugs in it, xserver start as expected with amdgpu as master
and i915 as slave (Xorg.0.log attached), but the screen is black, and run 
xrandr:
1. "xrandr --setprovideroutputsource 1 0" won't add any iGPU's output (0 is 
amdgpu, 1 is intel)
2. "xrandr --setprovideroutputsource 0 1" crash the xserver:
Xorg: ../../../xserver/dix/dispatch.c:4018: AttachOutputGPU: Assertion 
`new->isGPU' failed.
But I believe it can be fixed.

MS_ALL_IN_ONE method is my previous work when xserver has no proper PRIME sync.
And I find it's also useful for embedded platforms like iMX6/etnaviv.


I agree that it would be great to have a solution to have things just work
on iMX6/etnaviv, but we should be able to autodetect things on such a setup
without needing a special environment variable. Just an xorg.conf Outputclass 
snippet
matching the drm driver and marking that with Option "PrimaryGPU" "yes" should 
suffice.

> So published here.

As the MS_ALL_IN_ONE environment variable, I can change it to be an option of 
modesetting.


I think we don't really need another option, the Option "PrimaryGPU" "yes" 
should be
sufficient, combined with bug-fixes to the modesetting driver for cases where 
that
does not work.


Now as the PRIME sync is upstreamed, I think they can achieve nearly same 
effect in theory,


Right, so we really should use that and not add a second code path implementing 
in essence
the same thing.

If you could look into this and fix the modesetting driver to support this that 
would be
great.


but still minor difference when implementation in each DDX like modesetting 
need a proper
implementation of PresentSharedPixmap() for “OpenGL Syncing To VBlank”.


I think we should just fix things for the modesetting driver now, AFAICT most 
other
drivers are becoming more or less obsolete (or at least the should). Besides 
since your
original solution modifies the modesetting driver, it too has the drawback of 
only
working with the modesetting driver.

Regards,

Hans
___
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 v2 xserver 00/11] modesetting: MS_ALL_IN_ONE

2017-01-08 Thread Hans de Goede

Hi,

On 07-01-17 09:01, Qiang Yu wrote:

V2: add PATCH 11 to support GPUScreen capable of display

This is for hybrid drm device use case that one drm device
is only capable of display and the other is only capable of
rendering.

Usage: start xserver with MS_ALL_IN_ONE=1, and configure both
the display (Screen) and render (GPUScreen) drm devices using
modesetting DDX, it will use Screen as display, GPUScreen as
render and create one screen for them. If the render device
is also capable of display, create a GPUScreen for it in
addition.

Client see only the render device and load render device's DRI
driver. Server side render is also accelerated by the render
device. Display device only display what render device draws.

There is still one problem: DRI3 can't support page flip because
client doesn't know when to create a linear pixmap for flip.


I've recently more or less made the same thing work for the
nvidia binary driver, but in a much simpler way. If you
write a xorg.conf which sets the render-only GPU as primary
then no changes to the modesetting driver are necessary
at all. Specifically some patches of mine were recently
merged to master allowing to do this without needing to
specify bus-ids, a xorg.conf snippet like this one is
sufficient:

https://fedorapeople.org/~jwrdegoede/10-nvidia-driver.conf

The trick here is these 2 lines:

MatchDriver "nvidia-drm"
Option "PrimaryGPU" "yes"

Which make any GPU which has the nvidia-drm kernel driver
be seen as primary, overriding the default primary detection
which looks at which GPU has its vga registers mmio mapped.

At least this works with the nvidia binary driver, it may be
that some small changes are needed when using the modesetting
driver on the render GPU.

I wonder if you can do something similar for your use case
without needing all these changes.

Eitherway depending on an environment variable for this
behavior is unacceptable IMHO, this really should be configured
through a xorg.conf snippet.

> Tested on a laptop with Intel iGPU and AMD dGPU.

On such a setup you should be able to get things to work using
master + a config snippet similar to:

https://fedorapeople.org/~jwrdegoede/10-nvidia-driver.conf

Without needing a patches modesetting driver at all.

Regards,

Hans










Qiang Yu (11):
  modesetting: add MS_ALL_IN_ONE handling
  modesetting: add is_primary to mark entity type
  modesetting: remove unused PciInfo in modesettingRec
  modesetting: add render entity init and free
  Revert "modesetting: Delete dead drmmode_bo_for_pixmap function."
  dri2: refine dri2_probe_driver_name
  modesetting: separate render and display
  modesetting: use drmmode_bo_for_pixmap in ms_do_pageflip
  modesetting: dri2 allocate linear backbuffer
  modesetting: allow display node has no gbm support
  modesetting: still create GPUScreen when it's capable of display

 hw/xfree86/dri2/dri2.c   |  35 +--
 hw/xfree86/drivers/modesetting/dri2.c|  33 ++-
 hw/xfree86/drivers/modesetting/driver.c  | 265 ---
 hw/xfree86/drivers/modesetting/driver.h  |   9 +-
 hw/xfree86/drivers/modesetting/drmmode_display.c | 128 ++-
 hw/xfree86/drivers/modesetting/drmmode_display.h |   3 +
 hw/xfree86/drivers/modesetting/dumb_bo.c |  11 +
 hw/xfree86/drivers/modesetting/dumb_bo.h |   1 +
 hw/xfree86/drivers/modesetting/pageflip.c|   4 +-
 hw/xfree86/drivers/modesetting/present.c |   6 +
 10 files changed, 385 insertions(+), 110 deletions(-)


___
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