[PATCH xserver 3/4] glamor: Remove #if 0-ed picture dumping code.

2016-09-28 Thread Eric Anholt
I don't think anybody has run this code since it was pulled into the
server.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_render.c |   5 -
 glamor/glamor_utils.h  | 379 -
 2 files changed, 384 deletions(-)

diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 9aca75061639..e04dd2141f7c 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -1334,11 +1334,6 @@ glamor_convert_gradient_picture(ScreenPtr screen,
 }
 
 if (dst) {
-#if 0   /* Debug to compare it to pixman, Enable it if 
needed. */
-glamor_compare_pictures(screen, source,
-dst, x_source, y_source, width, height,
-0, 3);
-#endif
 return dst;
 }
 }
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index e6398692e3d6..6b88527e6a94 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -721,385 +721,6 @@ glamor_is_large_pixmap(PixmapPtr pixmap)
 }
 
 static inline void
-_glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-int i, j;
-unsigned char *p = (pixmap)->devPrivate.ptr;
-int stride = (pixmap)->devKind;
-
-p = p + y * stride + x;
-
-for (i = 0; i < h; i++) {
-ErrorF("line %3d: ", i);
-for (j = 0; j < w; j++)
-ErrorF("%2d ", (p[j / 8] & (1 << (j % 8))) >> (j % 8));
-p += stride;
-ErrorF("\n");
-}
-}
-
-static inline void
-_glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-int i, j;
-unsigned char *p = (pixmap)->devPrivate.ptr;
-int stride = (pixmap)->devKind;
-
-p = p + y * stride + x;
-
-for (i = 0; i < h; i++) {
-ErrorF("line %3d: ", i);
-for (j = 0; j < w; j++)
-ErrorF("%2x ", p[j]);
-p += stride;
-ErrorF("\n");
-}
-}
-
-static inline void
-_glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-int i, j;
-unsigned short *p = (pixmap)->devPrivate.ptr;
-int stride = (pixmap)->devKind / 2;
-
-p = p + y * stride + x;
-
-for (i = 0; i < h; i++) {
-ErrorF("line %3d: ", i);
-for (j = 0; j < w; j++)
-ErrorF("%2x ", p[j]);
-p += stride;
-ErrorF("\n");
-}
-}
-
-static inline void
-_glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-int i, j;
-unsigned int *p = (pixmap)->devPrivate.ptr;
-int stride = (pixmap)->devKind / 4;
-
-p = p + y * stride + x;
-
-for (i = 0; i < h; i++) {
-ErrorF("line %3d: ", i);
-for (j = 0; j < w; j++)
-ErrorF("%2x ", p[j]);
-p += stride;
-ErrorF("\n");
-}
-}
-
-static inline void
-glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-w = ((x + w) > (pixmap)->drawable.width) ? ((pixmap)->drawable.width - x) 
: w;
-h = ((y + h) > (pixmap)->drawable.height) ? ((pixmap)->drawable.height - 
y) : h;
-
-glamor_prepare_access(&(pixmap)->drawable, GLAMOR_ACCESS_RO);
-switch ((pixmap)->drawable.depth) {
-case 8:
-_glamor_dump_pixmap_byte(pixmap, x, y, w, h);
-break;
-case 15:
-case 16:
-_glamor_dump_pixmap_sword(pixmap, x, y, w, h);
-break;
-
-case 24:
-case 32:
-_glamor_dump_pixmap_word(pixmap, x, y, w, h);
-break;
-case 1:
-_glamor_dump_pixmap_bits(pixmap, x, y, w, h);
-break;
-default:
-ErrorF("dump depth %d, not implemented.\n", (pixmap)->drawable.depth);
-}
-glamor_finish_access(&(pixmap)->drawable);
-}
-
-static inline void
-_glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2,
-int x, int y, int w, int h,
-PictFormatShort short_format, int all, int diffs)
-{
-int i, j;
-unsigned char *p1 = pixmap1->devPrivate.ptr;
-unsigned char *p2 = pixmap2->devPrivate.ptr;
-int line_need_printed = 0;
-int test_code = 0xAABBCCDD;
-int little_endian = 0;
-unsigned char *p_test;
-int bpp = pixmap1->drawable.depth == 8 ? 1 : 4;
-int stride = pixmap1->devKind;
-
-assert(pixmap1->devKind == pixmap2->devKind);
-
-ErrorF("stride:%d, width:%d, height:%d\n", stride, w, h);
-
-p1 = p1 + y * stride + x;
-p2 = p2 + y * stride + x;
-
-if (all) {
-for (i = 0; i < h; i++) {
-ErrorF("line %3d: ", i);
-
-for (j = 0; j < stride; j++) {
-if (j % bpp == 0)
-ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]);
-else
-

[PATCH xserver 4/4] glamor: Fix link failure on GLES2.

2016-09-28 Thread Eric Anholt
Current Mesa requires that the precision qualifier on uniforms matches
between stages, even if (as in this case) the uniform isn't used in
one of the stages.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_program.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c
index dec116c7558f..23c102bc30bc 100644
--- a/glamor/glamor_program.c
+++ b/glamor/glamor_program.c
@@ -122,8 +122,7 @@ static glamor_location_var location_vars[] = {
 .vs_vars = ("uniform vec2 fill_offset;\n"
 "uniform vec2 fill_size_inv;\n"
 "varying vec2 fill_pos;\n"),
-.fs_vars = ("uniform vec2 fill_size_inv;\n"
-"varying vec2 fill_pos;\n")
+.fs_vars = ("varying vec2 fill_pos;\n")
 },
 {
 .location = glamor_program_location_font,
-- 
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 xserver 1/4] glamor: Require GL_OES_texture_border_clamp for GLES2.

2016-09-28 Thread Eric Anholt
The extension came out in 2000, and all Mesa-supported hardware that
can do glamor supports it.  We were already relying on the ARB version
being present on desktop.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor.c| 19 +++
 glamor/glamor_render.c | 22 +++---
 2 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 7b395366016a..b7718325d52e 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -515,6 +515,10 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 
 gl_version = epoxy_gl_version();
 
+/* assume a core profile if we are GL 3.1 and don't have ARB_compatibility 
*/
+glamor_priv->is_core_profile =
+gl_version >= 31 && !epoxy_has_gl_extension("GL_ARB_compatibility");
+
 shading_version_string = (char *) glGetString(GL_SHADING_LANGUAGE_VERSION);
 
 if (!shading_version_string) {
@@ -569,6 +573,12 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 goto fail;
 }
 
+if (!glamor_priv->is_core_profile &&
+!epoxy_has_gl_extension("GL_ARB_texture_border_clamp")) {
+ErrorF("GL_ARB_texture_border_clamp required\n");
+goto fail;
+}
+
 if (!glamor_check_instruction_count(gl_version))
 goto fail;
 } else {
@@ -581,6 +591,11 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 ErrorF("GL_EXT_texture_format_BGRA required\n");
 goto fail;
 }
+
+if (!epoxy_has_gl_extension("GL_OES_texture_border_clamp")) {
+ErrorF("GL_OES_texture_border_clamp required\n");
+goto fail;
+}
 }
 
 glamor_priv->has_rw_pbo = FALSE;
@@ -612,10 +627,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 glamor_priv->has_dual_blend =
 epoxy_has_gl_extension("GL_ARB_blend_func_extended");
 
-/* assume a core profile if we are GL 3.1 and don't have ARB_compatibility 
*/
-glamor_priv->is_core_profile =
-gl_version >= 31 && !epoxy_has_gl_extension("GL_ARB_compatibility");
-
 glamor_priv->can_copyplane = (gl_version >= 30);
 
 glamor_setup_debug_output(screen);
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index f5651eb87e54..9aca75061639 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -533,16 +533,8 @@ glamor_set_composite_texture(glamor_screen_private 
*glamor_priv, int unit,
 repeat_type = picture->repeatType;
 switch (picture->repeatType) {
 case RepeatNone:
-if (glamor_priv->gl_flavor != GLAMOR_GL_ES2) {
-/* XXX  GLES2 doesn't support GL_CLAMP_TO_BORDER. */
-glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
-GL_CLAMP_TO_BORDER);
-glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
-GL_CLAMP_TO_BORDER);
-} else {
-glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 
GL_CLAMP_TO_EDGE);
-glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 
GL_CLAMP_TO_EDGE);
-}
+glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
+glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
 break;
 case RepeatNormal:
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@@ -573,12 +565,12 @@ glamor_set_composite_texture(glamor_screen_private 
*glamor_priv, int unit,
 break;
 }
 
-/*
- *  GLES2 doesn't support RepeatNone. We need to fix it anyway.
- *
- **/
+/* Handle RepeatNone in the shader when the source is missing the
+ * alpha channel, as GL will return an alpha for 1 if the texture
+ * is RGB (no alpha), which we use for 16bpp textures.
+ */
 if (glamor_pixmap_priv_is_large(pixmap_priv) ||
-((!PICT_FORMAT_A(picture->format) || glamor_priv->gl_flavor == 
GLAMOR_GL_ES2) &&
+(!PICT_FORMAT_A(picture->format) &&
  repeat_type == RepeatNone && picture->transform)) {
 glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, pixmap_priv);
 glUniform4fv(wh_location, 1, wh);
-- 
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 xserver 2/4] glamor: Remove many unused glamor util functions.

2016-09-28 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_utils.h | 171 --
 1 file changed, 171 deletions(-)

diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index 561761167fd8..e6398692e3d6 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -334,21 +334,6 @@
 DEBUGF("normalized tx %f ty %f \n", (texcoord)[0], (texcoord)[1]); \
   } while(0)
 
-#define glamor_set_transformed_normalize_tri_tcoords(priv, \
-matrix,\
-xscale,\
-yscale,\
-vtx,   \
-texcoords) \
-do {   \
-   glamor_set_transformed_point(priv, matrix, xscale, yscale,  \
-texcoords, (vtx)[0], (vtx)[1]);\
-   glamor_set_transformed_point(priv, matrix, xscale, yscale,  \
-texcoords+2, (vtx)[2], (vtx)[3]);  \
-   glamor_set_transformed_point(priv, matrix, xscale, yscale,  \
-texcoords+4, (vtx)[4], (vtx)[5]);  \
-} while (0)
-
 #define glamor_set_transformed_normalize_tcoords_ext( priv,\
  matrix,   \
  xscale,   \
@@ -367,38 +352,6 @@
 texcoords + 3 * stride, tx1, ty2); \
   } while (0)
 
-#define glamor_set_transformed_normalize_tcoords( priv,
\
- matrix,   \
- xscale,   \
- yscale,   \
-  tx1, ty1, tx2, ty2,   \
-  texcoords)\
-  do { \
-   glamor_set_transformed_normalize_tcoords_ext( priv, \
- matrix,   \
- xscale,   \
- yscale,   \
-  tx1, ty1, tx2, ty2,   \
-  texcoords,   \
- 2);   \
-  } while (0)
-
-#define glamor_set_normalize_tri_tcoords(xscale,   \
-yscale,\
-vtx,   \
-texcoords) \
-do {   \
-   _glamor_set_normalize_tpoint(xscale, yscale,\
-   (vtx)[0], (vtx)[1], \
-   texcoords); \
-   _glamor_set_normalize_tpoint(xscale, yscale,\
-   (vtx)[2], (vtx)[3], \
-   texcoords+2);   \
-   _glamor_set_normalize_tpoint(xscale, yscale,\
-   (vtx)[4], (vtx)[5], \
-   texcoords+4);   \
-} while (0)
-
 #define glamor_set_repeat_transformed_normalize_tcoords_ext(pixmap, priv, \
 repeat_type,   \
 matrix,\
@@ -508,15 +461,6 @@
   x2, y2, vertices, stride);\
  } while(0)
 
-#define glamor_set_normalize_tcoords(priv, xscale, yscale, \
-x1, y1, x2, y2,\
- vertices) \
-  do { \
-   glamor_set_normalize_tcoords_ext(priv, xscale, yscale,  \
-x1, y1, x2, y2,\
- vertices, 2); \
- } while(0)
-
 #define glamor_set_repeat_normalize_tcoords_ext(pixmap, priv, repeat_type, \
xscale, yscale, \
_x1_, _y1_, _x2_, _y2_, \
@@ -543,17 +487,6 @@
   stride); \
  } while(0)
 
-#define glamor_set_repeat_normal

[PATCH xserver 0/4] render cleanups

2016-09-28 Thread Eric Anholt
I started working on using sampler objects as a step toward doing
sampler views, and found I wanted to delete a bunch of code first.

Eric Anholt (4):
  glamor: Require GL_OES_texture_border_clamp for GLES2.
  glamor: Remove many unused glamor util functions.
  glamor: Remove #if 0-ed picture dumping code.
  glamor: Fix link failure on GLES2.

 glamor/glamor.c |  19 +-
 glamor/glamor_program.c |   3 +-
 glamor/glamor_render.c  |  27 +--
 glamor/glamor_utils.h   | 550 
 4 files changed, 23 insertions(+), 576 deletions(-)

-- 
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] test: Re-enable a couple of GetImage tests

2016-09-28 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Fixed in 6c6f09aac.

Reviewed-by: Eric Anholt <e...@anholt.net>


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] glamor: spans: fixup wrong count on glDrawArrays

2016-09-30 Thread Eric Anholt
Mark Yao  writes:

> since commit (9e9fcf5 glamor: Add a helper function for the common
> GL_QUADS fallback pattern.), the glDrawArrays count change to nbox,
> That is wrong, I think it maybe cause by fat finger.
>
> Signed-off-by: Mark Yao 

Thanks!  This fixes xlogo on a GL 2.1 implementation.

I need to rig up testing for 2.1 specifically -- we've had plenty of
breakage on it at this point.


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 3/3] glamor: Switch XY bitmap putimage function for small images

2016-10-03 Thread Eric Anholt
Keith Packard  writes:

> Use the glamor_put_image_xy_gl for small images as that is quite a bit
> faster.

I'd like to see some performance data in the commit messages.  With
that, this will all be r-b.  Thanks!

I'm hoping that once we do VAOs that will greatly improve our
performance for the 10x10 cases (and, related, our performance for small
numbers of primitives per call, which is to say the common case).


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 0/3] glamor: Accelerate XY format images

2016-10-03 Thread Eric Anholt
Adam Jackson  writes:

> On Fri, 2016-09-30 at 22:43 -0700, Keith Packard wrote:
>
>>    1 2 Operation
>>    -   -
>>  10900.099900.0 ( 9.165)   PutImage XY 10x10 square 
>>   1740.0 2160.0 ( 1.241)   PutImage XY 100x100 square 
>> 83.2   90.4 ( 1.087)   PutImage XY 500x500 square 
>
> 90 ops per second is still shameful. No blit should take 11ms.
>
>>  11800.0   351000.0 (29.746)   PutImage XYBitmap 10x10 square 
>>   6280.081600.0 (12.994)   PutImage XYBitmap 100x100 square 
>>    752.014300.0 (19.016)   PutImage XYBitmap 500x500 square 
>
> Where does one get a copy of x11perf that has this test?
>
> Also I assume this is measuring before the whole series vs after. Would
> be nice to see the impact between 2/3 and 3/3 too.
>
>> I'd like to know why the GPU expansion version has so much GL
>> overhead; it "should" be faster for everything as it uploads a lot
>> less data to the GPU.
>
> On i965, at least, scissor updates are an appreciable amount of gl
> driver time, so small ops get punished.

Not sure if you've seen this, but it helped i965 a ton.  Radeon already
had equivalent code.

https://lists.freedesktop.org/archives/mesa-dev/2016-September/129809.html


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] glamor: Properly handle mask formats without alpha.

2016-09-25 Thread Eric Anholt
Even if the pixmap's storage has alpha, it may have been uploaded with
garbage in the alpha channel, so we need to force the shader to set
alpha to 1.  This was broken way back in
355334fcd99e4dce62e2be1e27290c9a74ea944f.

Fixes rendercheck -t composite -f x8r8g8b8.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_render.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index b5903acb20c2..f2ef08316410 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -868,7 +868,10 @@ glamor_composite_choose_shader(CARD8 op,
 goto fail;
 }
 else {
-key.mask = SHADER_MASK_TEXTURE_ALPHA;
+if (PICT_FORMAT_A(mask->format))
+key.mask = SHADER_MASK_TEXTURE_ALPHA;
+else
+key.mask = SHADER_MASK_TEXTURE;
 }
 
 if (!mask->componentAlpha) {
-- 
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 05/18] glamor: fix spelling mistakes

2016-09-25 Thread Eric Anholt
Adam Jackson  writes:

> On Sat, 2016-04-02 at 19:53 +0100, Eric Engestrom wrote:
>
>> -   the orginal slope and the slope which is vertical to it will not 
>> be correct. */
>> +   the orignal slope and the slope which is vertical to it will not 
>> be correct. */
>
> "Original".
>
> - ajax

Fixed that and merged:
   ade315386cee..128d40b2dd0a  HEAD -> master


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: 2 patches for glamor on OpenBSD (without DRI3/XSHM_FENCE)

2016-09-25 Thread Eric Anholt
Matthieu Herrb <matth...@herrb.eu> writes:

> On Fri, Sep 23, 2016 at 04:45:37PM +0300, Hans de Goede wrote:
>> Hi,
>> 
>> On 09/23/2016 04:33 PM, Matthieu Herrb wrote:
>> > Hi
>> > 
>> > Adam, Keith, any chance to get those 2 patches merged for 1.19 ?
>> > It would reduce the number of local patches I'm maintaining outside of
>> > os/os-support.
>> > 
>> > https://patchwork.freedesktop.org/patch/64866/
>> > https://patchwork.freedesktop.org/patch/65081/
>> 
>> Both links seem to point to post + re-post of
>> the same patch, so I see only 1 patch?
>
> You're right. Sorry I mixed up my cut/paste the 2nd one is
>
> https://patchwork.freedesktop.org/patch/65444/
>
> But it could be without the renaming. so just:
>
> Make glamor_name_from_pixmap work without DRI3
>
> This function is used by the modesetting driver to implement DRI2 and
> shouldn't fail on systems that don't support DRI3.  Remove the check
> for DRI3 and rename glamor_egl_dri3_fd_name_from_tex to
> glamor_egl_fd_name_from_tex.

Updated commit message wording and fixed the warning:

commit 8bb4b11298c285d2cd1eb28e65729933ec386829
Author: Matthieu Herrb <matth...@herrb.eu>
Date:   Fri Sep 23 16:56:06 2016 +0300

glamor: Make glamor_name_from_pixmap work without DRI3

This function is used by the modesetting driver to implement DRI2 and
    shouldn't fail on systems that don't support DRI3.
    
v2: Drop stale commit message wording, fix compiler warning (by anholt)

Signed-off-by: Eric Anholt <e...@anholt.net>
Reviewed-by: Eric Anholt <e...@anholt.net>

and merged:
To git+ssh://git.freedesktop.org/git/xorg/xserver
   128d40b2dd0a..ba199cb90157  HEAD -> master


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 1/2] glamor: Add GLAMOR_ACCESS_WO

2016-09-25 Thread Eric Anholt
Michel Dänzer  writes:

> Adding Marek and Nicolai, maybe they have some feedback from a GL
> (driver) perspective.
>
>
> On 23/08/16 10:41 AM, Dave Airlie wrote:
>> From: Michel Dänzer 
>> 
>> [airlied: rebased onto master -
>> I left WO alone as it's more like the GL interface
>> review suggested changing it to bits.]
>
> After realizing that patch 2 can only affect the !ZPixmap case, I tested
> this series with
>
>  x11perf -putimagexy{10,100,500} -shmputxy{10,100,500}
>
> and to my surprise, all of the numbers went down by around an order of
> magnitude (using radeonsi on Kaveri). I investigated a little bit what's
> going on:

I should have replied before.  Based on the performance numbers, I've
considered these patches rejected.


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 rendercheck] Report results on a per-test basis

2016-10-27 Thread Eric Anholt
Martin Peres <martin.pe...@linux.intel.com> writes:

> On 21/10/16 19:18, Eric Anholt wrote:
>> Martin Peres <martin.pe...@linux.intel.com> writes:
>>
>>> This allows a runner such as EzBench to track each test individually
>>> and not limit the resolution to groups.
>>>
>>> This feature can be triggered by using the -r parameter.
>>
>> I don't really see the point of this -- you need an external runner to
>> be choosing a specific test subset to run per rendercheck call, since
>> the full matrix of composite tests is too long.  Once you have an
>> external runner calling rendercheck per test group, all you would be
>> able to do using this patch would be save a few spawns of the process,
>> which doesn't seem worth it.
>
> Just to be sure, are you suggesting I do something like this instead?
>
> for format in "a8r8g8b8 x8r8g8b8 ... more formats"; do
>   ./rendercheck -f $format
>   # parse the successful groups and store them, prefixed by $format so as 
> I can identify regressions per format?
> done

You should probably look at piglit for subsetting of the tests.
Actually, I'd say you should probably just use piglit.  Given that
piglit is what X developers are going to be using, if we're going to
lock rendercheck into specific output formats I'd like to see the piglit
patches included with it.
___
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 warning - non-void function DoLayout should return a value

2016-10-27 Thread Eric Anholt
Echelon9  writes:

> From: Rhys Kidd 
>
> Box.c:245:7: error: non-void function 'DoLayout' should return a value
>   [-Wreturn-type]
> return;
> ^
> Box.c:285:6: error: non-void function 'DoLayout' should return a value
>   [-Wreturn-type]
> return;
> ^
>
> Signed-off-by: Rhys Kidd 

Applied.  Thanks!
___
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] glamor: restore vfunc handlers on init failure

2016-11-07 Thread Eric Anholt
Olivier Fourdan <ofour...@redhat.com> writes:

> In glamor_init(), if the minimum requirements are not met, glamor may
> fail after setting up its own CloseScreen() and DestroyPixmap()
> routines, leading to a crash when either of the two routines is called
> if glamor failed to complete its initialization, e.g:
>
>   (EE) Backtrace:
>   (EE) 0:  Xwayland (OsSigHandler+0x29)
>   (EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0)
>   (EE) 2: Xwayland (glamor_sync_close+0x2a)
>   (EE) 3: Xwayland (glamor_close_screen+0x52)
>   (EE) 4: Xwayland (CursorCloseScreen+0x88)
>   (EE) 5: Xwayland (AnimCurCloseScreen+0xa4)
>   (EE) 6: Xwayland (present_close_screen+0x42)
>   (EE) 7: Xwayland (dix_main+0x4f9)
>   (EE) 8: /lib64/libc.so.6 (__libc_start_main+0xf1)
>   (EE) 9:  Xwayland (_start+0x2a)
>
> Restore the previous CloseScreen() and DestroyPixmap() vfunc handlers in
> case of failure when checking for the minimum requirements, so that if
> any of the requirement is not met we don't leave the CloseScreen() and
> DestroyPixmap() from glamor handlers in place.
>
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1390018

Reviewed-by: Eric Anholt <e...@anholt.net>

Keith, can we fit it in during the freeze?


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] glamor: Isolate GLX client code to its own library

2016-10-18 Thread Eric Anholt
Adam Jackson  writes:

> This is a step towards making libglamor_egl and Xwayland not link
> against libGL (which brings in client-side libraries, which is just
> icky).

Is it actually necessary?  Given that the epoxy GLX symbols always
exist, and we're linking against epoxy, it seems like we could just drop
our -lGL.

libglamor_egl should pretty clearly not be linking to libGL, though, so
I'm in favor of following where this leads.


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] configure.ac: bump epoxy requirement to 1.2

2016-10-25 Thread Eric Anholt
Adam Jackson  writes:

> On Mon, 2016-10-24 at 12:19 -0700, Matt Turner wrote:
>> On Mon, Oct 24, 2016 at 2:39 AM, Emil Velikov  
>> wrote:
>> > > > From: Emil Velikov 
>> > 
>> > As pointed out in the ABI tracker[1], epoxy has gone through a few
>> > non-backwards compatible ABI changes, yet preserved the DSO name.
>
> I don't particularly object to bumping the required version, but...
>
>> > Most noticeable of which, from xserver POV, in epoxy_has_egl_extension()
>> > - s/EGLDisplay */EGLDisplay/.
>
> This happens not to matter. If you read the corresponding commit you'll
> see that the parameter was always treated as an opaque pointer anyway:
>
> https://github.com/anholt/libepoxy/commit/e20b3ce6c7895f355fd1bad81b45341d98b5ee76
>
>> > Eric, iirc Dave had some ideas about moving libepoxy to fd.o [+ making
>> > it the canonical/upstream source] and was looking for your blessing.
>> > 
>> > How is that going ? The state of the github repo looks tragic.
>> 
>> ajax and anholt were talking about epoxy's status at XDC. Cc'ing ajax.
>
> I'm honestly on anholt's side here about leaving upstream on github.
> fdo is lovely and all but the contribution model for people not already
> in posession of an fdo account is terrible. Moving epoxy to fdo would
> be a step backwards, and we should continue to hold out on that front
> until fdo grows better collaborative hosting.
>
> The more serious issue to me is that epoxy needs a release, and that
> release should involve merging up the various forks on github. (This is
> an argument _in favor_ of github: not only was it easy for people to
> create their forks, but we can track them all down easily.) I'm sure
> epoxy isn't Eric's first priority (which is entirely reasonable) so
> it's kind of up to him how to proceed here.

I've said it before a couple of times, but it stands: The next step for
epoxy is that someone needs to look into YaronCT's fork and decide if we
should just bless it as the maintained upstream.


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 rendercheck] Report results on a per-test basis

2016-10-21 Thread Eric Anholt
Martin Peres  writes:

> This allows a runner such as EzBench to track each test individually
> and not limit the resolution to groups.
>
> This feature can be triggered by using the -r parameter.

I don't really see the point of this -- you need an external runner to
be choosing a specific test subset to run per rendercheck call, since
the full matrix of composite tests is too long.  Once you have an
external runner calling rendercheck per test group, all you would be
able to do using this patch would be save a few spawns of the process,
which doesn't seem worth 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: [Bug] arm64: glamor: display abnormal when rotate screen

2016-11-14 Thread Eric Anholt
Mark yao  writes:

> Hi Eric
>
> We found some display problem when rotate the screen.
>
> You can see the abnormal display picture on attachment.
>
> Bug reproduce step:
> 1, run lubuntu session.
> 2, rotate screen: xrandr --output eDP-1 --rotate right
> 3, run lxterminal, enter some message, move the lxterminal, then you
> can find font become abnormal.
>
> We try that:
> 1, disable glamor, looks good, no problem.
> 2, use screenshot to catch abnormal display, the screenshot picture is
> normal, no problem.
> 3, use x86 desktop pc(OpenGL), run same display with glamor, no
> problem.
>
> Our testing environment:
> rk3399 board:
> CPU: arm64
> GPU: mali t86x(mali ddk r9p0, EGL 1.4, opengles 2.x)
>
> Eric, seem this problem only happen on EGL context, do you see this
> problem before? I don't know how to debug for it,
> Can you help us to analysis it?

glamor has never worked correctly on GLES2 that I know of.  Have you run
the X Test suite on the X Server master branch against your stack to
validate it?  The texture transfers were broken, in my experience, and
would need wrappers to format-convert inside of X.

With proper open source drivers we get desktop GL, so nobody else has
been working on GLES support.


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: [Bug] arm64: glamor: display abnormal when rotate screen

2016-11-21 Thread Eric Anholt
Mark yao <mark@rock-chips.com> writes:

> On 2016年11月15日 02:32, Eric Anholt wrote:
>> Mark yao <mark@rock-chips.com> writes:
>>
>>> Hi Eric
>>>
>>> We found some display problem when rotate the screen.
>>>
>>> You can see the abnormal display picture on attachment.
>>>
>>> Bug reproduce step:
>>> 1, run lubuntu session.
>>> 2, rotate screen: xrandr --output eDP-1 --rotate right
>>> 3, run lxterminal, enter some message, move the lxterminal, then you
>>> can find font become abnormal.
>>>
>>> We try that:
>>> 1, disable glamor, looks good, no problem.
>>> 2, use screenshot to catch abnormal display, the screenshot picture is
>>> normal, no problem.
>>> 3, use x86 desktop pc(OpenGL), run same display with glamor, no
>>> problem.
>>>
>>> Our testing environment:
>>> rk3399 board:
>>> CPU: arm64
>>> GPU: mali t86x(mali ddk r9p0, EGL 1.4, opengles 2.x)
>>>
>>> Eric, seem this problem only happen on EGL context, do you see this
>>> problem before? I don't know how to debug for it,
>>> Can you help us to analysis it?
>> glamor has never worked correctly on GLES2 that I know of.  Have you run
>> the X Test suite on the X Server master branch against your stack to
>> validate it?  The texture transfers were broken, in my experience, and
>> would need wrappers to format-convert inside of X.
>>
>> With proper open source drivers we get desktop GL, so nobody else has
>> been working on GLES support.
> Sadly hear this, I found gles is support on glamor source code, how does 
> the gles develop?
>
> With some hack, Currently Now glamor works mostly fine on our boards, so 
> we want to use glamor
> on our project, but we have few experience about it, about the rotate 
> bug, maybe something wrong
> on the texture transfers, but we don't know to debug it, can you give 
> some guide about it.

I was going to suggest trying to reproduce under Xephyr -glamor_gles2 so
that you could take an apitrace and try to track down if there's a draw
call going wrong and whether it's your driver for glamor at fault.
However, xrandr -x under Xephyr -glamor is crashing for me.

I still highly recommend running the test suite in your environment as
the first step in validating that your stack works.


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] configure: Enable glamor when building just Xwayland

2016-11-22 Thread Eric Anholt
Adam Jackson  writes:

> Signed-off-by: Adam Jackson 
> ---
>  configure.ac | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 6fd853b..93c81a6 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2138,10 +2138,7 @@ AM_CONDITIONAL([XORG_DRIVER_MODESETTING], [test 
> "x$XORG_DRIVER_MODESETTING" = xy
>  
>  dnl glamor
>  if test "x$GLAMOR" = xauto; then
> - if test "x$XORG" = xyes; then
> - GLAMOR=yes
> - fi
> - if test "x$XEPHYR" = xyes; then
> + if echo "$XORG" "$XEPHYR" "$XWAYLAND" | grep -q yes ; then
>   GLAMOR=yes
>   fi
>  fi

Doesn't that want a "> /dev/null" to not spit the 'yes' into the
configure output?  Other than that, this is great.


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] configure: Enable glamor when building just Xwayland

2016-11-23 Thread Eric Anholt
Alan Coopersmith <alan.coopersm...@oracle.com> writes:

> On 11/22/16 04:58 PM, Eric Anholt wrote:
>> Adam Jackson <a...@redhat.com> writes:
>>
>>> Signed-off-by: Adam Jackson <a...@redhat.com>
>>> ---
>>>  configure.ac | 5 +
>>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index 6fd853b..93c81a6 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -2138,10 +2138,7 @@ AM_CONDITIONAL([XORG_DRIVER_MODESETTING], [test 
>>> "x$XORG_DRIVER_MODESETTING" = xy
>>>
>>>  dnl glamor
>>>  if test "x$GLAMOR" = xauto; then
>>> -   if test "x$XORG" = xyes; then
>>> -   GLAMOR=yes
>>> -   fi
>>> -   if test "x$XEPHYR" = xyes; then
>>> +   if echo "$XORG" "$XEPHYR" "$XWAYLAND" | grep -q yes ; then
>>> GLAMOR=yes
>>> fi
>>>  fi
>>
>> Doesn't that want a "> /dev/null" to not spit the 'yes' into the
>> configure output?  Other than that, this is great.
>
> Isn't that what the -q option to grep does?

Missed that.  In that case,

Reviewed-by: Eric Anholt <e...@anholt.net>



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 xts] Don't sleep(2) at the beginning of Xt test setup

2016-11-02 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Regeneration is fast enough these days, we can skip this. This
> eliminates about 40 minutes of wall time from a full xts run.

If not sleeping is a problem, we should figure out a way to make
regeneration not racy.  Sleeps aren't OK.

Reviewed-by: Eric Anholt <e...@anholt.net>


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] glproto: Fix typo in X_GLXSetClientInfo2ARB definition

2017-03-22 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Signed-off-by: Adam Jackson <a...@redhat.com>
> ---
>  glxproto.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/glxproto.h b/glxproto.h
> index b4629c7..b207d93 100644
> --- a/glxproto.h
> +++ b/glxproto.h
> @@ -2158,7 +2158,7 @@ typedef struct {
>  #define X_GLXDestroyWindow   32
>  #define X_GLXSetClientInfoARB33
>  #define X_GLXCreateContextAttribsARB 34
> -#define X_GLXSetConfigInfo2ARB   35
> +#define X_GLXSetClientInfo2ARB   35

Mesa and xserver don't seem to rely on the typoed name.

Reviewed-by: Eric Anholt <e...@anholt.net>


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:

> 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

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

2017-03-27 Thread Eric Anholt
Mark Kettenis <mark.kette...@xs4all.nl> writes:

>> From: Eric Anholt <e...@anholt.net>
>> 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.

While I understand your frustrations with new build infrastructure
requiring changes in your OS to integrate new versions of software, it
has serious consequences for projects (as I mentioned, CI has been
intractable with autoconf) to be stuck with bad tools because of your
OS's choices.

> 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 don't need to check for -Wshadow because it's not on by default
(it's a bad warning).  If you want conditional cflags, they're easy.

The err.h check I apparently just mis-grepped when seeing if HAVE_ERR_H
was used.  v2 has the trivial fix (timing is indistinguishable without
rigging up compare-perf).

> 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.

As I said in the cover letter, rendercheck is the best possible case I
know of for autotools, and autotools sucks at 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-27 Thread Eric Anholt
Adam Jackson <a...@redhat.com> 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.
>
> Signed-off-by: Adam Jackson <a...@redhat.com>

I took another look today, and this series is:

Reviewed-by: Eric Anholt <e...@anholt.net>


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 2/5 v2] Add a meson build system.

2017-03-27 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.

v2: Add missing check for err.h
---
 .gitignore  |  1 +
 main.c  |  7 +++
 meson.build | 60 
 3 files changed, 68 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 ..ae3c25463157
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,60 @@
+project('rendercheck', 'c')
+project_version = '1.5'
+cc = meson.get_compiler('c')
+
+if cc.has_header('err.h')
+add_project_arguments('-DHAVE_ERR_H', language: 'c')
+endif
+
+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

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

2017-03-27 Thread Eric Anholt
Adam Jackson <a...@nwnk.net> writes:

> On Mon, 2017-03-27 at 12:35 -0400, Adam Jackson wrote:
>> On Fri, 2017-03-24 at 13:44 -0700, Eric Anholt wrote:
>> 
>> > 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.
>> 
>> I don't think this is a functional change:
>> 
>> > > @@ -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;
>> > > -
>> 
>> ->dpms was always null so we were always returning false anyway.
>
> I am a filthy dirty liar. It was set to a stub that returned TRUE.
>
> TRUE appears to be what the rest of the DPMS stubs do, so how about I
> change KdSaveScreen to match?

Sounds good to me.  No behavior change in refactor code is the best.


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] xfree86: Remove driver entity hooks and private

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

> No driver is using these, as far as I know.

If we're going to leave the args in place for xf86ConfigPciEntity, could
we assert that init/enter/leave are NULL, to catch if a driver *did*
exist that used them?

The docs for xf86ConfigPciEntity() should probably also note that
enter/init/leave are unused.  The docs for xf86ConfigIsaEntity(), on the
other hand, should probably be deleted :)


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 3/2] Rewrite the byte swapping macros.

2017-03-28 Thread Eric Anholt
Peter Hutterer <peter.hutte...@who-t.net> writes:

> On Mon, Mar 27, 2017 at 03:11:03PM -0700, Eric Anholt wrote:
>> The clever pointer tricks were actually not working, and we were doing
>> the byte-by-byte moves in general.  By just doing the memcpy and
>> obvious byte swap code, we end up generating actual byte swap
>> instructions, thanks to optimizing compilers.
>> 
>>  text   data bss dec hex filename
>> before: 224193251584  132016 2425532  2502bc hw/xfree86/Xorg
>> after:  221627651584  132016 2399876  249e84 hw/xfree86/Xorg
>> ---
>>  doc/Xserver-spec.xml |  2 +-
>>  glx/glxbyteorder.h   | 21 
>>  include/misc.h   | 97 
>> ++--
>>  os/io.c  |  4 +--
>>  4 files changed, 37 insertions(+), 87 deletions(-)
>> 
>> diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
>> index 7867544e48a9..3dde65178b7f 100644
>> --- a/doc/Xserver-spec.xml
>> +++ b/doc/Xserver-spec.xml
>> @@ -600,7 +600,7 @@ are: REQUEST, REQUEST_SIZE_MATCH, REQUEST_AT_LEAST_SIZE,
>>  REQUEST_FIXED_SIZE, LEGAL_NEW_RESOURCE, and
>>  VALIDATE_DRAWABLE_AND_GC. Useful byte swapping macros can be found
>>  in Xserver/include/dix.h: WriteReplyToClient and WriteSwappedDataToClient; 
>> and
>> -in Xserver/include/misc.h: lswapl, lswaps, LengthRestB, LengthRestS,
>> +in Xserver/include/misc.h: bswap_64, bswap_32, bswap_16, LengthRestB, 
>> LengthRestS,
>>  LengthRestL, SwapRestS, SwapRestL, swapl, swaps, cpswapl, and 
>> cpswaps.
>>  
>>  
>> diff --git a/glx/glxbyteorder.h b/glx/glxbyteorder.h
>> index 5e94e8626e66..8f0cd8a4b0d7 100644
>> --- a/glx/glxbyteorder.h
>> +++ b/glx/glxbyteorder.h
>> @@ -37,25 +37,4 @@
>>  
>>  #include "misc.h"
>>  
>> -static inline uint16_t
>> -bswap_16(uint16_t val)
>> -{
>> -swap_uint16();
>> -return val;
>> -}
>> -
>> -static inline uint32_t
>> -bswap_32(uint32_t val)
>> -{
>> -swap_uint32();
>> -return val;
>> -}
>> -
>> -static inline uint64_t
>> -bswap_64(uint64_t val)
>> -{
>> -swap_uint64();
>> -return val;
>> -}
>> -
>>  #endif  /* !defined(__GLXBYTEORDER_H__) */
>> diff --git a/include/misc.h b/include/misc.h
>> index 01747fd38339..a75eb617c642 100644
>> --- a/include/misc.h
>> +++ b/include/misc.h
>> @@ -128,21 +128,6 @@ typedef struct _xReq *xReqPtr;
>>  #define USE_BACKGROUND_PIXEL 3
>>  #define USE_BORDER_PIXEL 3
>>  
>> -/* byte swap a 32-bit literal */
>> -static inline uint32_t
>> -lswapl(uint32_t x)
>> -{
>> -return ((x & 0xff) << 24) |
>> -((x & 0xff00) << 8) | ((x & 0xff) >> 8) | ((x >> 24) & 0xff);
>> -}
>> -
>> -/* byte swap a 16-bit literal */
>> -static inline uint16_t
>> -lswaps(uint16_t x)
>> -{
>> -return (uint16_t)((x & 0xff) << 8) | ((x >> 8) & 0xff);
>> -}
>> -
>>  #undef min
>>  #undef max
>>  
>> @@ -311,88 +296,74 @@ __builtin_constant_p(int x)
>>  }
>>  #endif
>>  
>> -/* byte swap a 64-bit value */
>> -static inline void
>> -swap_uint64(uint64_t *x)
>> +static inline uint64_t
>> +bswap_64(uint64_t x)
>>  {
>> -char n;
>> -
>> -n = ((char *) x)[0];
>> -((char *) x)[0] = ((char *) x)[7];
>> -((char *) x)[7] = n;
>> -
>> -n = ((char *) x)[1];
>> -((char *) x)[1] = ((char *) x)[6];
>> -((char *) x)[6] = n;
>> -
>> -n = ((char *) x)[2];
>> -((char *) x)[2] = ((char *) x)[5];
>> -((char *) x)[5] = n;
>> -
>> -n = ((char *) x)[3];
>> -((char *) x)[3] = ((char *) x)[4];
>> -((char *) x)[4] = n;
>> +return (((x & 0xFF00ull) >> 56) |
>> +((x & 0x00FFull) >> 40) |
>> +((x & 0xFF00ull) >> 24) |
>> +((x & 0x00FFull) >>  8) |
>> +((x & 0xFF00ull) <<  8) |
>> +((x & 0x00FFull) << 24) |
>> +((x & 0xFF00ull) << 40) |
>> +((x & 0x00FFull) << 56));
>>  }
>>  
>>  #define swapll(x) do { \
>> +uint64_t temp; \
>>  if (sizeof(*(x)) != 8) \
>&g

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

2017-03-24 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> On Fri, 2017-03-24 at 10:34 -0700, Eric Anholt wrote:
>> > Adam Jackson <a...@redhat.com> 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 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 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 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 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

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

2017-03-24 Thread Eric Anholt
Adam Jackson <a...@redhat.com> 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 <e...@anholt.net>

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 3/2] Rewrite the byte swapping macros.

2017-03-30 Thread Eric Anholt
Keith Packard <kei...@keithp.com> writes:

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>> Unaligned accesses trap on some platforms, and I don't think we're
>> guaranteed that the caller has the pointer aligned (at least, the
>> previous code seemed pretty clearly to be trying to work around that, as
>> well).
>
> If it's protocol, then everything is aligned as long as the start of the
> request is aligned.

I've taken a look through the tree, and everything I've looked at
*looks* safe.  Still, I'd like to relax the alignment requirement after
this patch, in case we have to revert.


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 2/7] kdrive: Remove vestiges of TSLIB support.

2017-03-22 Thread Eric Anholt
The actual code was gone in 27819950e4158326e0f83a30f2e8968b932625ef,
but some checks remained.
---
 configure.ac   | 5 ++---
 include/dix-config.h.in| 6 --
 include/kdrive-config.h.in | 3 ---
 include/xorg-server.h.in   | 3 ---
 4 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index ac11e65728e8..705119859183 100644
--- a/configure.ac
+++ b/configure.ac
@@ -624,7 +624,6 @@ AC_ARG_ENABLE(xf86vidmode,
AS_HELP_STRING([--disable-xf86vidmode], [Build XF8
 AC_ARG_ENABLE(xace,   AS_HELP_STRING([--disable-xace], [Build X-ACE 
extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
 AC_ARG_ENABLE(xselinux,   AS_HELP_STRING([--enable-xselinux], [Build 
SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
 AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--enable-xcsecurity], [Build 
Security extension (default: disabled)]), [XCSECURITY=$enableval], 
[XCSECURITY=no])
-AC_ARG_ENABLE(tslib,  AS_HELP_STRING([--enable-tslib], [Build kdrive 
tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
 AC_ARG_ENABLE(dbe,AS_HELP_STRING([--disable-dbe], [Build DBE 
extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
 AC_ARG_ENABLE(xf86bigfont,AS_HELP_STRING([--enable-xf86bigfont], [Build 
XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], 
[XF86BIGFONT=no])
 AC_ARG_ENABLE(dpms,   AS_HELP_STRING([--disable-dpms], [Build DPMS 
extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
@@ -2399,7 +2398,7 @@ if test "$KDRIVE" = yes; then
 KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
 KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
 
-KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
+KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H"
 
 KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB 
$RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB 
$MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB 
$XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
 KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
@@ -2407,7 +2406,7 @@ if test "$KDRIVE" = yes; then
 KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_LIB"
 KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
 KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
-KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS 
$DLOPEN_LIBS $TSLIB_LIBS"
+KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS 
$DLOPEN_LIBS"
 
 AC_SUBST([XEPHYR_LIBS])
 AC_SUBST([XEPHYR_INCS])
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index c3f956d67a02..a59d441bb641 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -247,9 +247,6 @@
 /* Define to 1 if you have the `timingsafe_memcmp' function. */
 #undef HAVE_TIMINGSAFE_MEMCMP
 
-/* Define to 1 if you have the  header file. */
-#undef HAVE_TSLIB_H
-
 /* Define to 1 if you have the  header file. */
 #undef HAVE_UNISTD_H
 
@@ -322,9 +319,6 @@
 /* Support TCP socket connections */
 #undef TCPCONN
 
-/* Support tslib touchscreen abstraction library */
-#undef TSLIB
-
 /* Support UNIX socket connections */
 #undef UNIXCONN
 
diff --git a/include/kdrive-config.h.in b/include/kdrive-config.h.in
index 2d3aedf856fc..59c754be562f 100644
--- a/include/kdrive-config.h.in
+++ b/include/kdrive-config.h.in
@@ -13,9 +13,6 @@
 /* Include framebuffer support in X servers */
 #undef KDRIVEFBDEV
 
-/* Support tslib touchscreen abstraction library */
-#undef TSLIB
-
 /* Verbose debugging output hilarity */
 #undef DEBUG
 
diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
index e46ccecf7136..dafc27f4ae79 100644
--- a/include/xorg-server.h.in
+++ b/include/xorg-server.h.in
@@ -101,9 +101,6 @@
 /* Support TCP socket connections */
 #undef TCPCONN
 
-/* Support tslib touchscreen abstraction library */
-#undef TSLIB
-
 /* Support UNIX socket connections */
 #undef UNIXCONN
 
-- 
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 xserver 6/7] xserver: Unifdef HAVE_CONFIG_H

2017-03-22 Thread Eric Anholt
The X Server never generates a global config.h, and instead all these
paths are including dix-config.h or xorg-config.h.
---
 hw/xfree86/modes/xf86Crtc.c  | 3 ---
 hw/xfree86/modes/xf86Cursors.c   | 3 ---
 hw/xfree86/modes/xf86DiDGA.c | 3 ---
 hw/xfree86/modes/xf86EdidModes.c | 3 ---
 hw/xfree86/modes/xf86Modes.c | 3 ---
 hw/xfree86/modes/xf86RandR12.c   | 3 ---
 hw/xfree86/modes/xf86Rotate.c| 3 ---
 hw/xfree86/modes/xf86cvt.c   | 3 ---
 hw/xfree86/modes/xf86gtf.c   | 3 ---
 xkb/XKBMAlloc.c  | 2 --
 xkb/XKBMisc.c| 2 --
 11 files changed, 31 deletions(-)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 966a1689103f..fcf8343d1439 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -24,9 +24,6 @@
 #ifdef HAVE_XORG_CONFIG_H
 #include 
 #else
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
 #endif
 
 #include 
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 9543eedb3996..095bf3e9138b 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -24,9 +24,6 @@
 #ifdef HAVE_XORG_CONFIG_H
 #include 
 #else
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
 #endif
 
 #include 
diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c
index 645727441c19..ece94bbe04e7 100644
--- a/hw/xfree86/modes/xf86DiDGA.c
+++ b/hw/xfree86/modes/xf86DiDGA.c
@@ -23,9 +23,6 @@
 #ifdef HAVE_XORG_CONFIG_H
 #include 
 #else
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
 #endif
 
 #include "xf86.h"
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index b4ab14fc59ad..b29d95d16da1 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -30,9 +30,6 @@
 #ifdef HAVE_XORG_CONFIG_H
 #include 
 #else
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
 #endif
 
 #define _PARSE_EDID_
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 43b223307e8c..439fefd63b26 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -28,9 +28,6 @@
 #ifdef HAVE_XORG_CONFIG_H
 #include 
 #else
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
 #endif
 
 #include "xf86Modes.h"
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index d83461997409..0a670266378e 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -23,9 +23,6 @@
 #ifdef HAVE_XORG_CONFIG_H
 #include 
 #else
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
 #endif
 
 #include "xf86.h"
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 13e5a50596b7..4a2d2f3b0b06 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -24,9 +24,6 @@
 #ifdef HAVE_XORG_CONFIG_H
 #include 
 #else
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
 #endif
 
 #include 
diff --git a/hw/xfree86/modes/xf86cvt.c b/hw/xfree86/modes/xf86cvt.c
index b6c1bc81ce43..585ef804d636 100644
--- a/hw/xfree86/modes/xf86cvt.c
+++ b/hw/xfree86/modes/xf86cvt.c
@@ -29,9 +29,6 @@
 #ifdef HAVE_XORG_CONFIG_H
 #include 
 #else
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
 #endif
 
 #include "xf86.h"
diff --git a/hw/xfree86/modes/xf86gtf.c b/hw/xfree86/modes/xf86gtf.c
index 17c2f3255527..bd329a00ce52 100644
--- a/hw/xfree86/modes/xf86gtf.c
+++ b/hw/xfree86/modes/xf86gtf.c
@@ -63,9 +63,6 @@
 #ifdef HAVE_XORG_CONFIG_H
 #include 
 #else
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
 #endif
 
 #include "xf86.h"
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index dbc1389e683c..3e380a8ea633 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -26,8 +26,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 #ifdef HAVE_DIX_CONFIG_H
 #include 
-#elif defined(HAVE_CONFIG_H)
-#include 
 #endif
 
 #include 
diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index df268b5835a3..f17194528aa7 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -26,8 +26,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 #ifdef HAVE_DIX_CONFIG_H
 #include 
-#elif defined(HAVE_CONFIG_H)
-#include 
 #endif
 
 #include 
-- 
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 xserver 7/7] ephyr: Remove the -fakexa option.

2017-03-22 Thread Eric Anholt
It fatal errors at startup, I haven't used it in 5 years, and I don't
think anyone else has either.
---
 hw/kdrive/ephyr/Makefile.am  |   5 +-
 hw/kdrive/ephyr/ephyr.h  |  15 --
 hw/kdrive/ephyr/ephyr_draw.c | 531 ---
 hw/kdrive/ephyr/ephyrinit.c  |   9 -
 4 files changed, 1 insertion(+), 559 deletions(-)
 delete mode 100644 hw/kdrive/ephyr/ephyr_draw.c

diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index f4bd060f816d..4d3711a80b22 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -28,8 +28,7 @@ AM_CPPFLAGS = \
@XEPHYR_CFLAGS@ \
-DHAVE_DIX_CONFIG_H \
-I$(top_srcdir) \
-   -I$(top_srcdir)/glamor  \
-   -I$(top_srcdir)/exa
+   -I$(top_srcdir)/glamor
 
 if XV
 XV_SRCS = ephyrvideo.c
@@ -53,7 +52,6 @@ Xephyr_SOURCES = \
ephyr.c \
ephyr.h \
ephyrlog.h \
-   ephyr_draw.c \
os.c \
ephyrinit.c \
ephyrcursor.c \
@@ -72,7 +70,6 @@ XEPHYR_GLAMOR_LIB = \
 endif
 
 Xephyr_LDADD = \
-   $(top_builddir)/exa/libexa.la   \
$(XEPHYR_GLAMOR_LIB)\
@KDRIVE_LIBS@   \
@XEPHYR_LIBS@
diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index b48a21ce2f93..d0a2f3dcab63 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -46,26 +46,11 @@ typedef struct _ephyrPriv {
 int bytes_per_line;
 } EphyrPriv;
 
-typedef struct _ephyrFakexaPriv {
-ExaDriverPtr exa;
-Bool is_synced;
-
-/* The following are arguments and other information from Prepare* calls
- * which are stored for use in the inner calls.
- */
-int op;
-PicturePtr pSrcPicture, pMaskPicture, pDstPicture;
-void *saved_ptrs[3];
-PixmapPtr pDst, pSrc, pMask;
-GCPtr pGC;
-} EphyrFakexaPriv;
-
 typedef struct _ephyrScrPriv {
 /* ephyr server info */
 Rotation randr;
 Bool shadow;
 DamagePtr pDamage;
-EphyrFakexaPriv *fakexa;
 
 /* Host X window info */
 xcb_window_t win;
diff --git a/hw/kdrive/ephyr/ephyr_draw.c b/hw/kdrive/ephyr/ephyr_draw.c
deleted file mode 100644
index 0b467860a170..
--- a/hw/kdrive/ephyr/ephyr_draw.c
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Copyright © 2006 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
- * SOFTWARE.
- *
- * Authors:
- *Eric Anholt <e...@anholt.net>
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include 
-#endif
-
-#include "ephyr.h"
-#include "exa_priv.h"
-#include "fbpict.h"
-
-#define EPHYR_TRACE_DRAW 0
-
-#if EPHYR_TRACE_DRAW
-#define TRACE_DRAW() ErrorF("%s\n", __FUNCTION__);
-#else
-#define TRACE_DRAW() do { } while (0)
-#endif
-
-/* Use some oddball alignments, to expose issues in alignment handling in EXA. 
*/
-#define EPHYR_OFFSET_ALIGN 24
-#define EPHYR_PITCH_ALIGN  24
-
-#define EPHYR_OFFSCREEN_SIZE   (16 * 1024 * 1024)
-#define EPHYR_OFFSCREEN_BASE   (1 * 1024 * 1024)
-
-/**
- * Forces a real devPrivate.ptr for hidden pixmaps, so that we can call down to
- * fb functions.
- */
-static void
-ephyrPreparePipelinedAccess(PixmapPtr pPix, int index)
-{
-KdScreenPriv(pPix->drawable.pScreen);
-KdScreenInfo *screen = pScreenPriv->screen;
-EphyrScrPriv *scrpriv = screen->driver;
-EphyrFakexaPriv *fakexa = scrpriv->fakexa;
-
-assert(fakexa->saved_ptrs[index] == NULL);
-fakexa->saved_ptrs[index] = pPix->devPrivate.ptr;
-
-if (pPix->devPrivate.ptr != NULL)
-return;
-
-pPix->devPrivate.ptr = fakexa->exa->memoryBase + exaGetPixmapOffset(pPix);
-}
-
-/**
- * Restores the original devPrivate.ptr of the pixmap from before we messed 
with
- * it.

[PATCH xserver 3/7] kdrive: Drop kdrive-config.h.

2017-03-22 Thread Eric Anholt
It had nothing left in it that was used but wasn't in dix-config.h.
---
 configure.ac  |  7 +--
 hw/kdrive/ephyr/Makefile.am   |  1 +
 hw/kdrive/ephyr/ephyr.c   |  4 ++--
 hw/kdrive/ephyr/ephyr_draw.c  |  4 ++--
 hw/kdrive/ephyr/ephyr_glamor_xv.c |  4 ++--
 hw/kdrive/ephyr/ephyrcursor.c |  4 ++--
 hw/kdrive/ephyr/ephyrinit.c   |  4 ++--
 hw/kdrive/ephyr/ephyrvideo.c  |  4 ++--
 hw/kdrive/ephyr/hostx.c   |  4 ++--
 hw/kdrive/ephyr/os.c  |  4 ++--
 hw/kdrive/src/kcmap.c |  4 ++--
 hw/kdrive/src/kdrive.c|  4 ++--
 hw/kdrive/src/kinfo.c |  4 ++--
 hw/kdrive/src/kinput.c|  5 +++--
 hw/kdrive/src/kmode.c |  4 ++--
 hw/kdrive/src/kshadow.c   |  4 ++--
 hw/kdrive/src/kxv.c   |  4 ++--
 include/kdrive-config.h.in| 25 -
 mi/miinitext.c|  4 
 19 files changed, 33 insertions(+), 65 deletions(-)
 delete mode 100644 include/kdrive-config.h.in

diff --git a/configure.ac b/configure.ac
index 705119859183..c0e40ad96dba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,8 +67,6 @@ dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
 AC_CONFIG_HEADERS(include/xkb-config.h)
 dnl xwin-config.h covers the XWin DDX.
 AC_CONFIG_HEADERS(include/xwin-config.h)
-dnl kdrive-config.h covers the kdrive DDX
-AC_CONFIG_HEADERS(include/kdrive-config.h)
 dnl version-config.h covers the version numbers so they can be bumped without
 dnl forcing an entire recompile.x
 AC_CONFIG_HEADERS(include/version-config.h)
@@ -2368,9 +2366,6 @@ XEPHYR_INCS=
 AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])
 
 if test "$KDRIVE" = yes; then
-AC_DEFINE(KDRIVESERVER,1,[Build Kdrive X server])
-AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx])
-
 XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-render xcb-renderutil 
xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms xcb-randr xcb-xkb"
 if test "x$XV" = xyes; then
 XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xcb-xv"
@@ -2398,7 +2393,7 @@ if test "$KDRIVE" = yes; then
 KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
 KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
 
-KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H"
+KDRIVE_CFLAGS="$XSERVER_CFLAGS"
 
 KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB 
$RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB 
$MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB 
$XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
 KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 6ce0d6fa0a7b..f4bd060f816d 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -26,6 +26,7 @@ AM_CPPFLAGS = \
@KDRIVE_CFLAGS@ \
@XEPHYR_INCS@   \
@XEPHYR_CFLAGS@ \
+   -DHAVE_DIX_CONFIG_H \
-I$(top_srcdir) \
-I$(top_srcdir)/glamor  \
-I$(top_srcdir)/exa
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index ef5350e1884e..546a76c249d4 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -23,8 +23,8 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include 
+#ifdef HAVE_DIX_CONFIG_H
+#include 
 #endif
 
 #include 
diff --git a/hw/kdrive/ephyr/ephyr_draw.c b/hw/kdrive/ephyr/ephyr_draw.c
index 5b8a1d504721..0b467860a170 100644
--- a/hw/kdrive/ephyr/ephyr_draw.c
+++ b/hw/kdrive/ephyr/ephyr_draw.c
@@ -25,8 +25,8 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include 
+#ifdef HAVE_DIX_CONFIG_H
+#include 
 #endif
 
 #include "ephyr.h"
diff --git a/hw/kdrive/ephyr/ephyr_glamor_xv.c 
b/hw/kdrive/ephyr/ephyr_glamor_xv.c
index b9c3464d8c78..4dd15cf4170c 100644
--- a/hw/kdrive/ephyr/ephyr_glamor_xv.c
+++ b/hw/kdrive/ephyr/ephyr_glamor_xv.c
@@ -21,8 +21,8 @@
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include 
+#ifdef HAVE_DIX_CONFIG_H
+#include 
 #endif
 
 #include "kdrive.h"
diff --git a/hw/kdrive/ephyr/ephyrcursor.c b/hw/kdrive/ephyr/ephyrcursor.c
index 808b3c72ccc6..f991899c502f 100644
--- a/hw/kdrive/ephyr/ephyrcursor.c
+++ b/hw/kdrive/ephyr/ephyrcursor.c
@@ -24,8 +24,8 @@
  *  Adam Jackson 
  */
 
-#ifdef HAVE_CONFIG_H
-#include 
+#ifdef HAVE_DIX_CONFIG_H
+#include 
 #endif
 #include "ephyr.h"
 #include "ephyrlog.h"
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 9794cecc96dd..383fa9f7c72a 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -23,8 +23,8 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include 
+#ifdef HAVE_DIX_CONFIG_H
+#include 
 #endif
 #include "ephyr.h"
 #include "ephyrlog.h"
diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
index 31b1eee31a30..9c9c78d11348 100644
--- a/hw/kdrive/ephyr/ephyrvideo.c
+++ 

[PATCH xserver 0/7] meson prep work

2017-03-22 Thread Eric Anholt
As I've mentioned in IRC, I'm in the process of converting the X
Server to Meson.  It's proved to be a delight to work with, with a
helpful IRC community for when you get stuck.  The build system will
probably be half the size when meson is done, and I'm doing full
rebuilds in a tiny fraction of the time it takes to ./configure.

In the process, I've run into some silly stuff in our tree that could
be cleaned up independently of whether we go with meson.

Eric Anholt (7):
  kdrive: Unifdef KDRIVE_EVDEV.
  kdrive: Remove vestiges of TSLIB support.
  kdrive: Drop kdrive-config.h.
  xserver: Check the right HAVE_*_CONFIG_H.
  glamor: Fix some formatting that confused the unifdef command.
  xserver: Unifdef HAVE_CONFIG_H
  ephyr: Remove the -fakexa option.

 configure.ac  |  10 +-
 glamor/glamor_priv.h  |   2 +-
 hw/kdrive/ephyr/Makefile.am   |   6 +-
 hw/kdrive/ephyr/ephyr.c   |   4 +-
 hw/kdrive/ephyr/ephyr.h   |  15 --
 hw/kdrive/ephyr/ephyr_draw.c  | 531 --
 hw/kdrive/ephyr/ephyr_glamor_xv.c |   4 +-
 hw/kdrive/ephyr/ephyrcursor.c |   4 +-
 hw/kdrive/ephyr/ephyrinit.c   |  23 +-
 hw/kdrive/ephyr/ephyrvideo.c  |   4 +-
 hw/kdrive/ephyr/hostx.c   |   4 +-
 hw/kdrive/ephyr/os.c  |   4 +-
 hw/kdrive/src/kcmap.c |   4 +-
 hw/kdrive/src/kdrive.c|   4 +-
 hw/kdrive/src/kinfo.c |   4 +-
 hw/kdrive/src/kinput.c|  30 +--
 hw/kdrive/src/kmode.c |   4 +-
 hw/kdrive/src/kshadow.c   |   4 +-
 hw/kdrive/src/kxv.c   |   4 +-
 hw/xfree86/exa/examodule.c|   2 +-
 hw/xfree86/modes/xf86Crtc.c   |   3 -
 hw/xfree86/modes/xf86Cursors.c|   3 -
 hw/xfree86/modes/xf86DiDGA.c  |   3 -
 hw/xfree86/modes/xf86EdidModes.c  |   3 -
 hw/xfree86/modes/xf86Modes.c  |   3 -
 hw/xfree86/modes/xf86RandR12.c|   3 -
 hw/xfree86/modes/xf86Rotate.c |   3 -
 hw/xfree86/modes/xf86cvt.c|   3 -
 hw/xfree86/modes/xf86gtf.c|   3 -
 hw/xwayland/xwayland-shm.c|   2 +-
 include/dix-config.h.in   |   6 -
 include/kdrive-config.h.in|  31 ---
 include/xorg-server.h.in  |   3 -
 mi/miinitext.c|   4 -
 xkb/XKBMAlloc.c   |   2 -
 xkb/XKBMisc.c |   2 -
 36 files changed, 36 insertions(+), 708 deletions(-)
 delete mode 100644 hw/kdrive/ephyr/ephyr_draw.c
 delete mode 100644 include/kdrive-config.h.in

-- 
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 xserver 5/7] glamor: Fix some formatting that confused the unifdef command.

2017-03-22 Thread Eric Anholt
---
 glamor/glamor_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 27f95521dd3d..7b92f35705f4 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -910,7 +910,7 @@ int glamor_xv_put_image(glamor_port_private *port_priv,
 void glamor_xv_core_init(ScreenPtr screen);
 void glamor_xv_render(glamor_port_private *port_priv);
 
-#include"glamor_utils.h"
+#include "glamor_utils.h"
 
 /* Dynamic pixmap upload to texture if needed.
  * Sometimes, the target is a gl texture pixmap/picture,
-- 
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 xserver 1/7] kdrive: Unifdef KDRIVE_EVDEV.

2017-03-22 Thread Eric Anholt
ajax deleted the evdev driver in the removal of fbdev and the linux
backend.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/kdrive/ephyr/ephyrinit.c | 10 --
 hw/kdrive/src/kinput.c  | 25 -
 include/kdrive-config.h.in  |  3 ---
 3 files changed, 38 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 7632c2643210..9794cecc96dd 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -40,11 +40,6 @@ extern Bool ephyr_glamor, ephyr_glamor_gles2, 
ephyr_glamor_skip_present;
 
 extern Bool ephyrNoXV;
 
-#ifdef KDRIVE_EVDEV
-extern KdPointerDriver LinuxEvdevMouseDriver;
-extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
-#endif
-
 void processScreenOrOutputArg(const char *screen_size, const char *output, 
char *parent_id);
 void processOutputArg(const char *output, char *parent_id);
 void processScreenArg(const char *screen_size, char *parent_id);
@@ -91,11 +86,6 @@ InitInput(int argc, char **argv)
 KdKeyboardInfo *ki;
 KdPointerInfo *pi;
 
-#ifdef KDRIVE_EVDEV
-KdAddKeyboardDriver();
-KdAddPointerDriver();
-#endif
-
 if (!SeatId) {
 KdAddKeyboardDriver();
 KdAddPointerDriver();
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 8b08747a6077..b15375137af4 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -54,11 +54,6 @@
 #include 
 #endif
 
-#ifdef KDRIVE_EVDEV
-#define DEV_INPUT_EVENT_PREFIX "/dev/input/event"
-#define DEV_INPUT_EVENT_PREFIX_LEN (sizeof(DEV_INPUT_EVENT_PREFIX) - 1)
-#endif
-
 #define AtomFromName(x) MakeAtom(x, strlen(x), 1)
 
 struct KdConfigDevice {
@@ -1091,16 +1086,6 @@ KdParseKbdOptions(KdKeyboardInfo * ki)
 ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
key, value);
 }
-
-#ifdef KDRIVE_EVDEV
-if (!ki->driver && ki->path != NULL &&
-strncasecmp(ki->path,
-DEV_INPUT_EVENT_PREFIX,
-DEV_INPUT_EVENT_PREFIX_LEN) == 0) {
-ki->driver = KdFindKeyboardDriver("evdev");
-ki->options = input_option_new(ki->options, "driver", "evdev");
-}
-#endif
 }
 
 KdKeyboardInfo *
@@ -1209,16 +1194,6 @@ KdParsePointerOptions(KdPointerInfo * pi)
 ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
key, value);
 }
-
-#ifdef KDRIVE_EVDEV
-if (!pi->driver && pi->path != NULL &&
-strncasecmp(pi->path,
-DEV_INPUT_EVENT_PREFIX,
-DEV_INPUT_EVENT_PREFIX_LEN) == 0) {
-pi->driver = KdFindPointerDriver("evdev");
-pi->options = input_option_new(pi->options, "driver", "evdev");
-}
-#endif
 }
 
 KdPointerInfo *
diff --git a/include/kdrive-config.h.in b/include/kdrive-config.h.in
index f59262c417f1..2d3aedf856fc 100644
--- a/include/kdrive-config.h.in
+++ b/include/kdrive-config.h.in
@@ -16,9 +16,6 @@
 /* Support tslib touchscreen abstraction library */
 #undef TSLIB
 
-/* Support KDrive evdev driver */
-#undef KDRIVE_EVDEV
-
 /* Verbose debugging output hilarity */
 #undef DEBUG
 
-- 
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 xserver 4/7] xserver: Check the right HAVE_*_CONFIG_H.

2017-03-22 Thread Eric Anholt
---
 hw/xfree86/exa/examodule.c | 2 +-
 hw/xwayland/xwayland-shm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c
index 76f780ab6d6f..0bbd93e34015 100644
--- a/hw/xfree86/exa/examodule.c
+++ b/hw/xfree86/exa/examodule.c
@@ -25,7 +25,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
+#ifdef HAVE_XORG_CONFIG_H
 #include 
 #endif
 
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
index 452d1f509115..29732eaca23b 100644
--- a/hw/xwayland/xwayland-shm.c
+++ b/hw/xwayland/xwayland-shm.c
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
+#ifdef HAVE_DIX_CONFIG_H
 #include 
 #endif
 
-- 
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 v3 3/4] Simplify manpage variable substitution for Meson.

2017-03-29 Thread Eric Anholt
The previous code was contorting itself to do the substitution in the
same source format as the xorg automake macros.  Now that automake is
gone, we can simplify it.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 man/rendercheck.man |  2 +-
 meson.build | 15 ---
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/man/rendercheck.man b/man/rendercheck.man
index b7be417d5c37..3d0e16f16f0f 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 @version@" "X Version 11"
 .SH NAME
 rendercheck \- simple tests of the X Render extension.
 .SH SYNOPSIS
diff --git a/meson.build b/meson.build
index 25b8e4381ec1..e9f5bf45eb9a 100644
--- a/meson.build
+++ b/meson.build
@@ -48,19 +48,12 @@ executable(
 install: true,
 )
 
-man_xorgversion = '"rendercheck @0@" "X Version 11"'.format(project_version)
-
-custom_target(
-'manpage',
+man_config = configuration_data()
+man_config.set('version', project_version)
+rendercheck_man = configure_file(
 input: 'man/rendercheck.man',
 output: 'rendercheck.1',
-command: [
-'sed',
-'-e',
-   's/__xorgversion__/@0@/'.format(man_xorgversion),
-   '@INPUT@'
-],
-capture: true,
+configuration: man_config,
 install: true,
 install_dir: join_paths(get_option('mandir'), 'man1'),
 )
-- 
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 v3 4/4] Explain how to build using meson in the README.

2017-03-29 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 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 v3 2/4] Remove the autotools build system.

2017-03-29 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 .gitignore  | 79 -
 Makefile.am | 43 ---
 autogen.sh  | 17 -
 configure.ac| 29 -
 main.c  |  6 -
 man/Makefile.am | 38 ---
 meson.build |  1 -
 7 files changed, 213 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 86346f031707..5ec80901ad51 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.
 */
-

[PATCH rendercheck v3 1/4] Add a meson build system.

2017-03-29 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.

v2: Add missing check for err.h
v3: Add a linebreak after printing the version (by Peter),
fix manpage variable substitution (anholt).

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 .gitignore  |  1 +
 main.c  |  7 +++
 meson.build | 67 +
 3 files changed, 75 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..86346f031707 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\n", VERSION);
+#else
puts(PACKAGE_STRING);
+#endif
if (print_version)
return 0;
 
diff --git a/meson.build b/meson.build
new file mode 100644
index ..bb4171d598c0
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,67 @@
+project('rendercheck', 'c')
+project_version = '1.5'
+cc = meson.get_compiler('c')
+
+if cc.has_header('err.h')
+add_project_arguments('-DHAVE_ERR_H', language: 'c')
+endif
+
+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_xorgversion = '"rendercheck @0@" "X Version 11"'.format(project_version)
+
+custom_target(
+'manpage',
+input: 'man/rendercheck.man',
+output: 'rendercheck.1',
+command: [
+'sed',
+'-e',
+   's/__xorgversion__/@0@/'.format(man_xorgversion),
+   '@INPUT@'
+],
+capture: true,
+install: true,
+install_dir: join_paths(get_option('mandir'), 'man1'),
+)
-- 
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 rendercheck 4/5] Convert the manpage for Meson's configure script.

2017-03-29 Thread Eric Anholt
Peter Hutterer <peter.hutte...@who-t.net> writes:

> On Fri, Mar 24, 2017 at 01:17:49PM -0700, Eric Anholt wrote:
>> ---
>>  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"
>
> don't you need a change to the meson.build file now? It still has code for
> __xorgversion__ in it now and this one seems to be the empty string in the
> final man page.

Yeah, the manpage generation was a mess.  I'm going to send out a new
version now.


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 v2] xfree86: Remove driver entity hooks and private

2017-03-29 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> No driver is using these, as far as I know.
>
> v2: Tripwire the entity hook arguments to xf86Config*Entity, fix
> documentation (Eric Anholt)

Reviewed-by: Eric Anholt <e...@anholt.net>


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 rendercheck] Skip shmblend if SHM pixmaps aren't supported

2017-03-28 Thread Eric Anholt
Aaron Plattner  writes:

> Some drivers don't support SHM pixmaps, but rendercheck doesn't care and tries
> to use them anyway. This causes the test to abort:

Reviewed and pushed.  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 xserver] Add unit tests for the byte swapping macros.

2017-03-28 Thread Eric Anholt
Peter noted a weirdness in my new bswap code, which could use some
tests to justify it.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 test/misc.c | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/test/misc.c b/test/misc.c
index ae46bab9..c10a2b935bc4 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -192,6 +192,48 @@ dix_request_size_checks(void)
 assert(rc == Success);
 }
 
+static void
+bswap_test(void)
+{
+const uint16_t test_16 = 0xaabb;
+const uint16_t expect_16 = 0xbbaa;
+const uint32_t test_32 = 0xaabbccdd;
+const uint32_t expect_32 = 0xddccbbaa;
+const uint64_t test_64 = 0x11223344aabbccddull;
+const uint64_t expect_64 = 0xddccbbaa44332211ull;
+uint16_t result_16;
+uint32_t result_32;
+uint64_t result_64;
+unsigned buffer[sizeof(test_64) + 4];
+void *unaligned = [1];
+
+assert(bswap_16(test_16) == expect_16);
+assert(bswap_32(test_32) == expect_32);
+assert(bswap_64(test_64) == expect_64);
+
+/* Test the swapping-in-a-pointer functions, with unaligned
+ * addresses (the functions shouldn't cause traps in that case).
+ */
+for (int i = 0; i < 2; i++) {
+unaligned = buffer + i;
+if (((uintptr_t)unaligned & 1) == 1)
+break;
+}
+memcpy(unaligned, _16, sizeof(test_16));
+swaps((uint16_t *)unaligned);
+memcpy(_16, unaligned, sizeof(result_16));
+assert(result_16 == expect_16);
+
+memcpy(unaligned, _32, sizeof(test_32));
+swapl((uint32_t *)unaligned);
+memcpy(_32, unaligned, sizeof(result_32));
+assert(result_32 == expect_32);
+
+memcpy(unaligned, _64, sizeof(test_64));
+swapll((uint64_t *)unaligned);
+memcpy(_64, unaligned, sizeof(result_64));
+assert(result_64 == expect_64);
+}
 
 int
 misc_test(void)
@@ -199,6 +241,7 @@ misc_test(void)
 dix_version_compare();
 dix_update_desktop_dimensions();
 dix_request_size_checks();
+bswap_test();
 
 return 0;
 }
-- 
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 xserver 2/2] glx: Use the same endian swapping as the rest of the server.

2017-03-27 Thread Eric Anholt
This dumps a ton of configure-time checks for system endian macros.
Given that we're marking the mixed-endian fixup code as cold, getting
at the system macros is a waste of code.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 configure.ac| 60 -
 glx/glxbyteorder.h  | 40 -
 include/dix-config.h.in | 15 -
 3 files changed, 20 insertions(+), 95 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8881ec34f7cd..07c5520940a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,66 +147,6 @@ fi
 
 AC_TYPE_PID_T
 
-# Checks for headers/macros for byte swapping
-# Known variants:
-#   bswap_16, bswap_32, bswap_64  (glibc)
-#   __swap16, __swap32, __swap64 (OpenBSD)
-#   bswap16, bswap32, bswap64 (other BSD's)
-#  and a fallback to local macros if none of the above are found
-
-# if  is found, assume it's the correct version
-AC_CHECK_HEADERS([byteswap.h])
-
-# if  is found, have to check which version
-AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], 
[HAVE_SYS_ENDIAN_H="no"])
-
-if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then
-   AC_MSG_CHECKING([for __swap16 variant of  byteswapping 
macros])
-   AC_LINK_IFELSE([AC_LANG_PROGRAM([
-#include 
-#include 
- ], [
-int a = 1, b;
-b = __swap16(a);
- ])
-], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
-   AC_MSG_RESULT([$SYS_ENDIAN__SWAP])
-
-   AC_MSG_CHECKING([for bswap16 variant of  byteswapping 
macros])
-   AC_LINK_IFELSE([AC_LANG_PROGRAM([
-#include 
-#include 
- ], [
-int a = 1, b;
-b = bswap16(a);
- ])
-], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
-   AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])
-
-   if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
-   USE_SYS_ENDIAN_H=yes
-   BSWAP=bswap
-   else
-   if test "$SYS_ENDIAN__SWAP" = "yes" ; then
-   USE_SYS_ENDIAN_H=yes
-   BSWAP=__swap
-   else
-   USE_SYS_ENDIAN_H=no
-   fi
-   fi
-
-   if test "$USE_SYS_ENDIAN_H" = "yes" ; then
-   AC_DEFINE([USE_SYS_ENDIAN_H], 1, 
-   [Define to use byteswap macros from ])
-   AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, 
-   [Define to 16-bit byteswap macro])
-   AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, 
-   [Define to 32-bit byteswap macro])
-   AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, 
-   [Define to 64-bit byteswap macro])
-   fi
-fi
-
 dnl Check to see if dlopen is in default libraries (like Solaris, which
 dnl has it in libc), or if libdl is needed to get it.
 AC_CHECK_FUNC([dlopen], [],
diff --git a/glx/glxbyteorder.h b/glx/glxbyteorder.h
index aa88b44b9b24..5e94e8626e66 100644
--- a/glx/glxbyteorder.h
+++ b/glx/glxbyteorder.h
@@ -35,27 +35,27 @@
 #include 
 #endif
 
-#if HAVE_BYTESWAP_H
-#include 
-#elif defined(USE_SYS_ENDIAN_H)
-#include 
-#elif defined(__APPLE__)
-#include 
-#define bswap_16 OSSwapInt16
-#define bswap_32 OSSwapInt32
-#define bswap_64 OSSwapInt64
-#else
-#definebswap_16(value)  \
-   value) & 0xff) << 8) | ((value) >> 8))
+#include "misc.h"
 
-#definebswap_32(value) \
-   (((uint32_t)bswap_16((uint16_t)((value) & 0x)) << 16) | \
-   (uint32_t)bswap_16((uint16_t)((value) >> 16)))
+static inline uint16_t
+bswap_16(uint16_t val)
+{
+swap_uint16();
+return val;
+}
 
-#definebswap_64(value) \
-   (((uint64_t)bswap_32((uint32_t)((value) & 0x)) \
-   << 32) | \
-   (uint64_t)bswap_32((uint32_t)((value) >> 32)))
-#endif
+static inline uint32_t
+bswap_32(uint32_t val)
+{
+swap_uint32();
+return val;
+}
+
+static inline uint64_t
+bswap_64(uint64_t val)
+{
+swap_uint64();
+return val;
+}
 
 #endif  /* !defined(__GLXBYTEORDER_H__) */
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index a59d441bb641..ad1ab20a6f06 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -63,9 +63,6 @@
 /* Has libunwind support */
 #undef HAVE_LIBUNWIND
 
-/* Define to 1 if you have the  header file. */
-#undef HAVE_BYTESWAP_H
-
 /* Define to 1 if you have the `cbrt' function. */
 #undef HAVE_CBRT
 
@@ -322,9 +319,6 @@
 /* Support UNIX socket connections */
 #undef UNIXCONN
 
-/* Define to use byteswap macros from  */
-#undef USE_SYS_ENDIAN_H
-
 /* unaligned word accesses behave as expected */
 #undef WORKING_UNALIGNED_INT
 
@@ -454,15 +448,6 @@
 /* Define to 1 if the DTrace Xserver provider probes should be built in */
 #undef XSERVER_DTRACE
 
-/* Define to 16-bit byteswap macro */
-#undef bswap_16
-
-/* Define to 32-bit byteswap macro */

[PATCH xserver 1/2] configure: Stop checking for XdmcpWrap

2017-03-27 Thread Eric Anholt
As far back as the initial import, it seems to have been exposed, and
there's no explanation why the test happened in the initial xserver
import.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 configure.ac | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3bc15a81a263..8881ec34f7cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1500,9 +1500,6 @@ XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
 REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
 
 PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], 
[have_libxdmcp="no"])
-if test "x$have_libxdmcp" = xyes; then
-   AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], 
[have_xdmcpwrap="no"], [$XDMCP_LIBS])
-fi
 if test "x$XDMCP" = xauto; then
if test "x$have_libxdmcp" = xyes; then
XDMCP=yes
@@ -1511,7 +1508,7 @@ if test "x$XDMCP" = xauto; then
fi
 fi
 if test "x$XDMAUTH" = xauto; then
-   if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then
+   if test "x$have_libxdmcp" = xyes; then
XDMAUTH=yes
else
XDMAUTH=no
-- 
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 xserver 3/2] Rewrite the byte swapping macros.

2017-03-27 Thread Eric Anholt
The clever pointer tricks were actually not working, and we were doing
the byte-by-byte moves in general.  By just doing the memcpy and
obvious byte swap code, we end up generating actual byte swap
instructions, thanks to optimizing compilers.

 text  data bss dec hex filename
before: 2241932   51584  132016 2425532  2502bc hw/xfree86/Xorg
after:  2216276   51584  132016 2399876  249e84 hw/xfree86/Xorg
---
 doc/Xserver-spec.xml |  2 +-
 glx/glxbyteorder.h   | 21 
 include/misc.h   | 97 ++--
 os/io.c  |  4 +--
 4 files changed, 37 insertions(+), 87 deletions(-)

diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index 7867544e48a9..3dde65178b7f 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -600,7 +600,7 @@ are: REQUEST, REQUEST_SIZE_MATCH, REQUEST_AT_LEAST_SIZE,
 REQUEST_FIXED_SIZE, LEGAL_NEW_RESOURCE, and
 VALIDATE_DRAWABLE_AND_GC. Useful byte swapping macros can be found
 in Xserver/include/dix.h: WriteReplyToClient and WriteSwappedDataToClient; and
-in Xserver/include/misc.h: lswapl, lswaps, LengthRestB, LengthRestS,
+in Xserver/include/misc.h: bswap_64, bswap_32, bswap_16, LengthRestB, 
LengthRestS,
 LengthRestL, SwapRestS, SwapRestL, swapl, swaps, cpswapl, and cpswaps.
 
 
diff --git a/glx/glxbyteorder.h b/glx/glxbyteorder.h
index 5e94e8626e66..8f0cd8a4b0d7 100644
--- a/glx/glxbyteorder.h
+++ b/glx/glxbyteorder.h
@@ -37,25 +37,4 @@
 
 #include "misc.h"
 
-static inline uint16_t
-bswap_16(uint16_t val)
-{
-swap_uint16();
-return val;
-}
-
-static inline uint32_t
-bswap_32(uint32_t val)
-{
-swap_uint32();
-return val;
-}
-
-static inline uint64_t
-bswap_64(uint64_t val)
-{
-swap_uint64();
-return val;
-}
-
 #endif  /* !defined(__GLXBYTEORDER_H__) */
diff --git a/include/misc.h b/include/misc.h
index 01747fd38339..a75eb617c642 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -128,21 +128,6 @@ typedef struct _xReq *xReqPtr;
 #define USE_BACKGROUND_PIXEL 3
 #define USE_BORDER_PIXEL 3
 
-/* byte swap a 32-bit literal */
-static inline uint32_t
-lswapl(uint32_t x)
-{
-return ((x & 0xff) << 24) |
-((x & 0xff00) << 8) | ((x & 0xff) >> 8) | ((x >> 24) & 0xff);
-}
-
-/* byte swap a 16-bit literal */
-static inline uint16_t
-lswaps(uint16_t x)
-{
-return (uint16_t)((x & 0xff) << 8) | ((x >> 8) & 0xff);
-}
-
 #undef min
 #undef max
 
@@ -311,88 +296,74 @@ __builtin_constant_p(int x)
 }
 #endif
 
-/* byte swap a 64-bit value */
-static inline void
-swap_uint64(uint64_t *x)
+static inline uint64_t
+bswap_64(uint64_t x)
 {
-char n;
-
-n = ((char *) x)[0];
-((char *) x)[0] = ((char *) x)[7];
-((char *) x)[7] = n;
-
-n = ((char *) x)[1];
-((char *) x)[1] = ((char *) x)[6];
-((char *) x)[6] = n;
-
-n = ((char *) x)[2];
-((char *) x)[2] = ((char *) x)[5];
-((char *) x)[5] = n;
-
-n = ((char *) x)[3];
-((char *) x)[3] = ((char *) x)[4];
-((char *) x)[4] = n;
+return (((x & 0xFF00ull) >> 56) |
+((x & 0x00FFull) >> 40) |
+((x & 0xFF00ull) >> 24) |
+((x & 0x00FFull) >>  8) |
+((x & 0xFF00ull) <<  8) |
+((x & 0x00FFull) << 24) |
+((x & 0xFF00ull) << 40) |
+((x & 0x00FFull) << 56));
 }
 
 #define swapll(x) do { \
+   uint64_t temp; \
if (sizeof(*(x)) != 8) \
wrong_size(); \
-swap_uint64((uint64_t *)(x));   \
+   memcpy(, x, 8); \
+   temp = bswap_64(temp); \
+   memcpy(x, , 8); \
} while (0)
 
-/* byte swap a 32-bit value */
-static inline void
-swap_uint32(uint32_t * x)
+static inline uint32_t
+bswap_32(uint32_t x)
 {
-char n = ((char *) x)[0];
-
-((char *) x)[0] = ((char *) x)[3];
-((char *) x)[3] = n;
-n = ((char *) x)[1];
-((char *) x)[1] = ((char *) x)[2];
-((char *) x)[2] = n;
+return (((x & 0xFF00) >> 24) |
+((x & 0x00FF) >> 8) |
+((x & 0xFF00) << 8) |
+((x & 0x00FF) << 24));
 }
 
 #define swapl(x) do { \
+   uint32_t temp; \
if (sizeof(*(x)) != 4) \
wrong_size(); \
-   if (__builtin_constant_p((uintptr_t)(x) & 3) && ((uintptr_t)(x) 
& 3) == 0) \
-   *(x) = lswapl(*(x)); \
-   else \
-   swap_uint32((uint32_t *)(x)); \
+   memcpy(, x, 4); \
+   temp = bswap_32(temp); \
+   memcpy(x, , 4); \
} while (0)
 
-/* byte swap a 16-bit value */
-static inline void
-swap_uint16(uint16_t * x)
+static inline uint16_t
+bswap_16(uint16_t x)
 {
-char n = ((char *) x)[0];
-
-((char *) x)[0] = ((char *) x)[1];
-((char *) x)[1] = n;
+return (((x & 

Re: [RFC PATCH xserver] modesetting: re-set the crtc's mode when link-status goes BAD

2017-03-30 Thread Eric Anholt
Martin Peres  writes:

> On 26/01/17 14:37, Martin Peres wrote:
>> Despite all the careful planing of the kernel, a link may become
>> insufficient to handle the currently-set mode. At this point, the
>> kernel should mark this particular configuration as being broken
>> and potentially prune the mode before setting the offending connector's
>> link-status to BAD and send the userspace a hotplug event. This may
>> happen right after a modeset or later on.
>>
>> When available, we should use the link-status information to reset
>> the wanted mode.
>>
>> Signed-off-by: Martin Peres 
>
> The relevant kernel patches have landed in drm-tip about a month ago.
>
> Eric, would you mind providing feedback on or merging this patch?

The later discussion has sounded like the kernel will (always) prune the
mode when we re-query, meaning that it doesn't make any sense to try to
re-set to the old mode.  Is this not the case?


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: [RFC PATCH xserver] modesetting: re-set the crtc's mode when link-status goes BAD

2017-03-31 Thread Eric Anholt
Manasi Navare <manasi.d.nav...@intel.com> writes:

> On Thu, Mar 30, 2017 at 05:37:55PM -0700, Eric Anholt wrote:
>> Martin Peres <martin.pe...@linux.intel.com> writes:
>> 
>> > On 26/01/17 14:37, Martin Peres wrote:
>> >> Despite all the careful planing of the kernel, a link may become
>> >> insufficient to handle the currently-set mode. At this point, the
>> >> kernel should mark this particular configuration as being broken
>> >> and potentially prune the mode before setting the offending connector's
>> >> link-status to BAD and send the userspace a hotplug event. This may
>> >> happen right after a modeset or later on.
>> >>
>> >> When available, we should use the link-status information to reset
>> >> the wanted mode.
>> >>
>> >> Signed-off-by: Martin Peres <martin.pe...@linux.intel.com>
>> >
>> > The relevant kernel patches have landed in drm-tip about a month ago.
>> >
>> > Eric, would you mind providing feedback on or merging this patch?
>> 
>> The later discussion has sounded like the kernel will (always) prune the
>> mode when we re-query, meaning that it doesn't make any sense to try to
>> re-set to the old mode.  Is this not the case?
>
>
> No the kernel will simply send a hotplug with link status as bad
> and then after that point its userspace driver's responsibility
> to check if link status is BAD, retry the same mode and if it fails
> then re probe.

So the kernel will sometimes allow the same mode to be re-set with the
same bpp?


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] glamor: Fix dashed line rendering.

2017-03-16 Thread Eric Anholt
Eric Anholt <e...@anholt.net> writes:

> We were binding the screen pixmap as the dash and sampling its alpha,
> which is usually just 1.0 (no dashing at all).
>
> Please cherry-pick this to active stable branches.

Pushed.  Thanks everyone!


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] glamor: Fix dashed line rendering.

2017-03-16 Thread Eric Anholt
Keith Packard <kei...@keithp.com> writes:

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>> We were binding the screen pixmap as the dash and sampling its alpha,
>> which is usually just 1.0 (no dashing at all).
>>
>> Please cherry-pick this to active stable branches.
>>
>> Signed-off-by: Eric Anholt <e...@anholt.net>
>
> Thank you for finding this!
>
> Reviewed-by: Keith Packard <kei...@keithp.com>
>
> Now, can you explain why it ever did anything reasonable at all?

I'm sure that was just some pre-refactor version.  Sadly, xts doesn't
actually test dashes at all.


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] glamor: avoid a crash if texture allocation failed

2017-03-17 Thread Eric Anholt
Olivier Fourdan  writes:

> Texture creation in _glamor_create_tex() can fail if a GL_OUT_OF_MEMORY
> is raised, in which case the texture returned is zero.
>
> But the texture value is not checked in glamor_create_fbo() and glamor
> will abort in glamor_pixmap_ensure_fb() because the fbo->tex is 0:

Reviewed, tagged for stable, and pushed.  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

Re: [PATCH] dri2: Sync i965_pci_ids.h from Mesa.

2017-03-17 Thread Eric Anholt
Kenneth Graunke <kenn...@whitecape.org> writes:

> Copied from Mesa with no modifications.  Gives us Geminilake PCI IDs.
>
> Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>

Acked-by: Eric Anholt <e...@anholt.net>


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 v3] autobind GPUs to the screen

2017-03-17 Thread Eric Anholt
Hans de Goede <hdego...@redhat.com> writes:

> From: Dave Airlie <airl...@redhat.com>
>
> This is a modified version of a patch we've been carry-ing in Fedora and

"carrying"

> RHEL for years now. This patch automatically adds secondary GPUs to the
> master as output sink / offload source making e.g. the use of
> slave-outputs just work, with requiring the user to manually run
> "xrandr --setprovideroutputsource" before he can hookup an external
> monitor to his hybrid graphics laptop.
>
> There is one problem with this patch, which is why it was not upstreamed
> before. What to do when a secondary GPU gets detected really is a policy
> decission (e.g. one may want to autobind PCI GPUs but not USB ones) and
> as such should be under control of the Desktop Environment.
>
> Unconditionally adding autobinding support to the xserver will result
> in races between the DE dealing with the hotplug of a secondary GPU
> and the server itself dealing with it.

Will there actually be races?  In the current patch, at least, doesn't
the new GPU get autoconfigured before the randr change notification goes
out?

> However we've waited for years for any Desktop Environments to actually
> start doing some sort of autoconfiguration of secondary GPUs and there
> is still not a single DE dealing with this, so I believe that it is
> time to upstream this now.
>
> To avoid potential future problems if any DEs get support for doing
> secondary GPU configuration themselves, the new autobind functionality
> is made optional. Since no DEs currently support doing this themselves it
> is enabled by default. When DEs grow support for doing this themselves
> they can disable the servers autobinding through the servers cmdline or a
> xorg.conf snippet.

I think this is a sensible default.  It also helped with getting X up on
my VC4 + CLCD platform.

Reviewed-by: Eric Anholt <e...@anholt.net>


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] dix: Remove PRIVATE_DAMAGE

2017-03-20 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> None of this is actually wired up to anything, so we can also remove the
> devPrivates from the DamageRec. The DamageExtRec is what would need
> devPrivates for selinux labeling, in principle.

Reviewed-by: Eric Anholt <e...@anholt.net>


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] glamor: Paint first and last pixel of lines

2017-03-15 Thread Eric Anholt
Keith Packard  writes:

> [ Unknown signature status ]
> Adam Jackson  writes:
>
>> Is there some reason you believe GL's rasterisation rules for lines
>> match fb's zero-width lines? Section 14.5.1 of the 4.5 spec looks quite
>> a bit looser than fb to me.
>
> I think they're 'good enough'; there aren't any rules requiring
> particular rasterization for either, the only thing X requests is that
> 'not last' cap mode not draw the last pixel. afaict, GL suggests 'not
> last' as the only option. It sounds like some drivers are doing both
> 'not last' and 'not first' though?

By "some drivers" we mean i965, it seems.  The problem is that we're not
getting 0-width, specified-under-DirectX lines.  We've got glLineWidth
== 1, so we're getting the garbage "let's turn it into a polygon with
major-axis-aligned ends!" behavior.  Thanks to glamor's +0.5 translation
based on the assumption that we were drawing 0-width lines, we now have
a polygon whose start and end lie on pixel centers (other than float
rounding), for bonus unstable behavior.  If you go into i965 and program
line width to 0, everything's great.

And, if you read the GL spec, it talks a bunch about the diamond exit
rule, which would only make sense if you could actually ask for 0-width
lines.  Thanks, Khronos.

Looking at vc4, it doesn't even have 0-width line behavior, and does
even worse at this testcase.

I'm thinking we need to specify an extension allowing glLineWidth(0) for
diamond exit rule, maybe with a hint to choose between the dx9 and dx10
modes.  Then glamor could check for it and use GL, and fall back to mi
otherwise.


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] glamor: Fix dashed line rendering.

2017-03-15 Thread Eric Anholt
We were binding the screen pixmap as the dash and sampling its alpha,
which is usually just 1.0 (no dashing at all).

Please cherry-pick this to active stable branches.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_dash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/glamor/glamor_dash.c b/glamor/glamor_dash.c
index 3c19dba323c7..f3cf749a6785 100644
--- a/glamor/glamor_dash.c
+++ b/glamor/glamor_dash.c
@@ -146,7 +146,7 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
 goto bail;
 
 dash_pixmap = glamor_get_dash_pixmap(gc);
-dash_priv = glamor_get_pixmap_private(pixmap);
+dash_priv = glamor_get_pixmap_private(dash_pixmap);
 
 if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dash_priv))
 goto bail;
-- 
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 xdriinfo] Fix xdriinfo not working with glvnd

2017-03-15 Thread Eric Anholt
Hans de Goede <hdego...@redhat.com> writes:

> For glx calls to work on libglvnd as glx provider we must first call
> glXGetClientString. This also means that we can no longer take the
> shortcut to not open the Display when a driver name is past to options.

This seems sensible.  Hopefully nothing is relying on this working
without an X connection being possible.

Reviewed-by: Eric Anholt <e...@anholt.net>


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/4] xfree86: Remove 24bpp pixmap format support (v2)

2017-03-15 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> There's really no reason to pretend to support this, apps hate it, all
> we're doing is giving people a way to injure themselves. It doesn't work
> anyway with any Radeon, any NVIDIA chip, or any Intel chip since i810.
> Rip out all the logic for handling 24bpp pixmaps and framebuffers, and
> silently ignore the old options that would ask for it.
>
> The cirrus alpine driver has been updated to default to 16bpp, and both
> it and the i810 driver can now use the 32->24 conversion code in shadow
> if they want. All other drivers support 32bpp. Configurations that
> explicitly request 24bpp in order to fit in VRAM will be broken now
> though.

I am so happy to see all this ugly code gone.  Series is:

Reviewed-by: Eric Anholt <e...@anholt.net>


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 2/2] glamor: Avoid software fallback for planemasked ZPixmap GetImage

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

> Same trick as in fb: just do a normal GetImage and deal with the
> planemask on the CPU if you have to. Since the software fallback hit for
> glamor is pretty brutal, this is a much more impressive win for glamor
> than it was for fb:
>
>   11100.0  87700.0 (7.901) (copy 0x) ShmGetImage 10x10 square
>9840.0  47800.0 (4.858) (copy 0x) ShmGetImage 100x100 square
>1550.0   4240.0 (2.735) (copy 0x) ShmGetImage 500x500 square
>9450.0  78900.0 (8.349) (0x) GetImage 10x10 square
>6910.0  30900.0 (4.472) (0x) GetImage 100x100 square
> 431.0   2020.0 (4.687) (0x) GetImage 500x500 square
>
> Measured with Xephyr -glamor on Skylake GT3e.
>
> Signed-off-by: Adam Jackson 
> ---
>  glamor/glamor_image.c | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/glamor/glamor_image.c b/glamor/glamor_image.c
> index 3158749..7e17961 100644
> --- a/glamor/glamor_image.c
> +++ b/glamor/glamor_image.c
> @@ -116,7 +116,7 @@ glamor_get_image_gl(DrawablePtr drawable, int x, int y, 
> int w, int h,
>  if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
>  goto bail;
>  
> -if (format != ZPixmap || !glamor_pm_is_solid(drawable->depth, 
> plane_mask))
> +if (format != ZPixmap)
>  goto bail;
>  
>  glamor_get_drawable_deltas(drawable, pixmap, _x, _y);
> @@ -128,6 +128,16 @@ glamor_get_image_gl(DrawablePtr drawable, int x, int y, 
> int w, int h,
>drawable->x + off_x, drawable->y + off_y,
>-x, -y,
>(uint8_t *) d, byte_stride);
> +
> +if (!glamor_pm_is_solid(drawable->depth, plane_mask)) {
> +FbStip pm = fbReplicatePixel(plane_mask, drawable->bitsPerPixel);
> +FbStip *dst = (void *)d;
> +uint32_t dstStride = byte_stride /= sizeof(FbStip);

I don't think you want the second '=' here.  Harmless, but looked weird.

Other than that, r-b.

> +
> +for (int i = 0; i < dstStride * h; i++)
> +dst[i] &= pm;
> +}
> +
>  return TRUE;
>  bail:
>  return FALSE;
> -- 
> 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


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/2] fb: Handle ZPixmap planemask in GetImage the other way around

2017-03-20 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Formerly we'd zero the image data and then pull out a plane at a time.
> It's faster to apply the planemask after the fact, since that turns the
> GetImage into a memcpy:
>
>   10.0  101000.0 (1.010) (copy 0x) ShmGetImage 10x10 square
>42400.0   59400.0 (1.401) (copy 0x) ShmGetImage 100x100 square
> 3040.05280.0 (1.737) (copy 0x) ShmGetImage 500x500 square
>96100.0   95200.0 (0.991) (0x) GetImage 10x10 square
>29600.0   36800.0 (1.243) (0x) GetImage 100x100 square
> 1850.02620.0 (1.416) (0x) GetImage 500x500 square
>
> Measured with Xvfb at depth 24 on Skylake i7-6560U.
>
> Signed-off-by: Adam Jackson <a...@redhat.com>

It's a bit surprising that trading a memset and a pass of dword access
for a memcpy and a pass of dword access is a win, but then the MergeRop
isn't just a single & operation.

Reviewed-by: Eric Anholt <e...@anholt.net>


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] modesetting: re-set the crtc's mode when link-status goes BAD

2017-04-10 Thread Eric Anholt
Martin Peres  writes:

> Despite all the careful planing of the kernel, a link may become
> insufficient to handle the currently-set mode. At this point, the
> kernel should mark this particular configuration as being broken
> and potentially prune the mode before setting the offending connector's
> link-status to BAD and send the userspace a hotplug event. This may
> happen right after a modeset or later on.
>
> Upon receiving a hot-plug event, we iterate through the connectors to
> re-apply the currently-set mode on all the connectors that have a
> link-status property set to BAD. This modeset may fail immediatly if
> the kernel has already pruned the mode we are trying to set but it
> does not matter as -modesetting has no business picking another
> mode if the modeset did fail. To make users aware of this problem

I think I'd like to replace the "This modeset" sentence with "The kernel
may be able to get the link to work by dropping to using a lower link
bpp (with the same display bpp).  However, the modeset may fail if the
kernel has pruned the mode, so to make users aware..."  Does that sound
good to you?

I'll give this patch a day or two for anyone else to complain, then I'll
push.

> a warning is outputed in the logs to warn about having a
> potentially-black display.
>
> This patch does not modify the current behaviour of always propagating
> the events to the randr clients. This allows desktop environments to
> re-probe the connectors and select a new resolution based on the new
> (currated) mode list if a mode disapeared. This behaviour is expected in
> order to pass the Display Port compliance tests.
>
> Signed-off-by: Martin Peres 



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: [RFC PATCH xserver] modesetting: re-set the crtc's mode when link-status goes BAD

2017-03-31 Thread Eric Anholt
Manasi Navare <manasi.d.nav...@intel.com> writes:

> On Fri, Mar 31, 2017 at 01:08:41PM -0700, Eric Anholt wrote:
>> Manasi Navare <manasi.d.nav...@intel.com> writes:
>> 
>> > On Thu, Mar 30, 2017 at 05:37:55PM -0700, Eric Anholt wrote:
>> >> Martin Peres <martin.pe...@linux.intel.com> writes:
>> >> 
>> >> > On 26/01/17 14:37, Martin Peres wrote:
>> >> >> Despite all the careful planing of the kernel, a link may become
>> >> >> insufficient to handle the currently-set mode. At this point, the
>> >> >> kernel should mark this particular configuration as being broken
>> >> >> and potentially prune the mode before setting the offending connector's
>> >> >> link-status to BAD and send the userspace a hotplug event. This may
>> >> >> happen right after a modeset or later on.
>> >> >>
>> >> >> When available, we should use the link-status information to reset
>> >> >> the wanted mode.
>> >> >>
>> >> >> Signed-off-by: Martin Peres <martin.pe...@linux.intel.com>
>> >> >
>> >> > The relevant kernel patches have landed in drm-tip about a month ago.
>> >> >
>> >> > Eric, would you mind providing feedback on or merging this patch?
>> >> 
>> >> The later discussion has sounded like the kernel will (always) prune the
>> >> mode when we re-query, meaning that it doesn't make any sense to try to
>> >> re-set to the old mode.  Is this not the case?
>> >
>> >
>> > No the kernel will simply send a hotplug with link status as bad
>> > and then after that point its userspace driver's responsibility
>> > to check if link status is BAD, retry the same mode and if it fails
>> > then re probe.
>> 
>> So the kernel will sometimes allow the same mode to be re-set with the
>> same bpp?
>
> So when userspace driver re-sets the same mode, the kernel will call the
> mode valid function where it will see it can allow the sam mode perhaps
> at a lower bpp now since the link parameters are lowered.
> So the mode which failed at 30 bpp, might still work at 18bpp and is
> better going to a lower resolution.

The question was whether the kernel will ever allow the same mode at the
same bpp, since that's what this patch tries to do.


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] modesetting: re-set the crtc's mode when link-status goes BAD

2017-04-12 Thread Eric Anholt
Martin Peres <martin.pe...@linux.intel.com> writes:

> On 11/04/17 04:47, Eric Anholt wrote:
>> Martin Peres <martin.pe...@linux.intel.com> writes:
>>
>>> Despite all the careful planing of the kernel, a link may become
>>> insufficient to handle the currently-set mode. At this point, the
>>> kernel should mark this particular configuration as being broken
>>> and potentially prune the mode before setting the offending connector's
>>> link-status to BAD and send the userspace a hotplug event. This may
>>> happen right after a modeset or later on.
>>>
>>> Upon receiving a hot-plug event, we iterate through the connectors to
>>> re-apply the currently-set mode on all the connectors that have a
>>> link-status property set to BAD. This modeset may fail immediatly if
>>> the kernel has already pruned the mode we are trying to set but it
>>> does not matter as -modesetting has no business picking another
>>> mode if the modeset did fail. To make users aware of this problem
>>
>> I think I'd like to replace the "This modeset" sentence with "The kernel
>> may be able to get the link to work by dropping to using a lower link
>> bpp (with the same display bpp).  However, the modeset may fail if the
>> kernel has pruned the mode, so to make users aware..."  Does that sound
>> good to you?
>
> Yep, nice improvement. Thanks!

Pushed.  Thanks, and sorry this took *so* long.


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 util/modular] xorg.modules: Update for mesonic rendercheck

2017-04-06 Thread Eric Anholt
Jon Turney  writes:

> Signed-off-by: Jon Turney 

Tested and pushed.  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

Re: [PATCH xserver 5/5] glamor: Use GL_RGBA format for 8-bit depth

2017-04-20 Thread Eric Anholt
Olivier Fourdan  writes:

> For some hardware, GL_RGBA is the safest option for textures to bind to
> an FBO for depth 8 as GL_ALPHA might be unsupported.
>
> This allows using glamor-xv on hardware that don't support GL_ALPHA
> textures attaching to an FBO, such as nouveau on nv30.
>
> Newer hardware use GL_RED and texture swizzle anyway, so this change is
> of limited impact.

Does nv30 not support *any* 8-bit render target?

Also, blowing up our XV textures to 32-bit can't be good for its
performance.  Could we just use GLAMOR_CREATE_FBO_NO_FBO (worst name) to
have our XV pixmaps not actually create an FBO?  We already use
glamor_upload_boxes(), so I think that would work.


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] glamor: an FBO is not needed for Xv pixmaps

2017-04-21 Thread Eric Anholt
Olivier Fourdan <ofour...@redhat.com> writes:

> It appears that on some hardware/diver combo such as nv30/nouveau, using
> GL_ALPHA as format for 8-bit depth will cause an incomplete attachment
> error (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT) when trying to bind the
> texture.
>
> As a result, the FBO is NULL and glamor segfaults when trying to access
> the FBO width/height in pixmap_priv_get_scale() in glamor_xv_render().
>
> This happens with glamor-xv which uses 8-bit pixmaps, meaning that on
> such hardware/driver, trying to play a video using Xv will lead to a
> crash of the Xserver. This affects Xwayland, Xephyr, modesetting driver
> with glamor accel.
>
> But the use of an FBO is not actually needed for glamox-xv, so by
> disabling FBO at pixmap creation, we can avoid the issue entirely.
>
> Fix suggested by Eric Anholt <e...@anholt.net>
>
> Signed-off-by: Olivier Fourdan <ofour...@redhat.com>
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100710
> Fixes: https://bugzilla.redhat.com/1412814

Reviewed and pushed.  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 xserver 1/2] xorg: Change __XCONFIGFILE__ to XCONFIGFILE (and DIR) to fix scan.c.

2017-04-21 Thread Eric Anholt
parser/scan.c was checking for #ifdef XCONFIGFILE and XCONFIGDIR and
defaulting to "xorg.conf", and "xorg.conf.d", so if you had changed
__XCONFIGFILE__ to anything else, it would have got out of sync.
Settle on the name without gratuitous underscores.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 configure.ac | 4 ++--
 hw/xfree86/common/xf86Init.c | 6 +++---
 include/xorg-config.h.in | 4 ++--
 include/xorg-server.h.in | 2 +-
 manpages.am  | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 07c5520940a1..4ee43d2d064b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2024,9 +2024,9 @@ if test "x$XORG" = xyes; then
AC_DEFINE(NEED_XF86_TYPES, 1, [Need XFree86 typedefs])
AC_DEFINE(NEED_XF86_PROTOTYPES, 1, [Need XFree86 helper functions])
AC_DEFINE(__XSERVERNAME__, "Xorg", [Name of X server])
-   AC_DEFINE_DIR(__XCONFIGFILE__, XF86CONFIGFILE, [Name of configuration 
file])
+   AC_DEFINE_DIR(XCONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration 
file])
-   AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration 
directory])
+   AC_DEFINE_DIR(XCONFIGDIR, XF86CONFIGDIR, [Name of configuration 
directory])
AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search 
path])
AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install 
path])
AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 88f99ac5ecc0..d3c7c47b01e2 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1359,17 +1359,17 @@ ddxUseMsg(void)
 ErrorF("-modulepath paths  specify the module search path\n");
 ErrorF("-logfile file  specify a log file name\n");
 ErrorF("-configure probe for devices and write an "
-   __XCONFIGFILE__ "\n");
+   XCONFIGFILE "\n");
 ErrorF
 ("-showopts  print available options for all installed 
drivers\n");
 }
 ErrorF
 ("-config file   specify a configuration file, relative to 
the\n");
-ErrorF("   " __XCONFIGFILE__
+ErrorF("   " XCONFIGFILE
" search path, only root can use absolute\n");
 ErrorF
 ("-configdir dir specify a configuration directory, relative 
to the\n");
-ErrorF("   " __XCONFIGDIR__
+ErrorF("   " XCONFIGDIR
" search path, only root can use absolute\n");
 ErrorF("-verbose [n]   verbose startup messages\n");
 ErrorF("-logverbose [n]verbose log messages\n");
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index a7d80b5afbf6..b8d6a87a3363 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -34,10 +34,10 @@
 #undef XF86CONFIGFILE
 
 /* Path to configuration file. */
-#undef __XCONFIGFILE__
+#undef XCONFIGFILE
 
 /* Name of configuration directory. */
-#undef __XCONFIGDIR__
+#undef XCONFIGDIR
 
 /* Path to loadable modules. */
 #undef DEFAULT_MODULE_PATH
diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
index dafc27f4ae79..570893e34bb1 100644
--- a/include/xorg-server.h.in
+++ b/include/xorg-server.h.in
@@ -180,7 +180,7 @@
 #undef __VENDORDWEBSUPPORT__
 
 /* Location of configuration file */
-#undef __XCONFIGFILE__
+#undef XCONFIGFILE
 
 /* Name of X server */
 #undef __XSERVERNAME__
diff --git a/manpages.am b/manpages.am
index 648210b4efbd..124bb557551f 100644
--- a/manpages.am
+++ b/manpages.am
@@ -22,7 +22,7 @@ MAN_SUBSTS += -e 's|__logdir__|$(logdir)|g' \
-e 's|__datadir__|$(datadir)|g' \
-e 's|__mandir__|$(mandir)|g' \
-e 's|__sysconfdir__|$(sysconfdir)|g' \
-   -e 's|__xconfigdir__|$(__XCONFIGDIR__)|g' \
+   -e 's|__xconfigdir__|$(XCONFIGDIR)|g' \
-e 's|__xkbdir__|$(XKB_BASE_DIRECTORY)|g' \
-e 's|__XKB_DFLT_RULES__|$(XKB_DFLT_RULES)|g' \
-e 's|__XKB_DFLT_MODEL__|$(XKB_DFLT_MODEL)|g' \
-- 
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 xserver 2/2] Remove default defines of some directories.

2017-04-21 Thread Eric Anholt
The build defines these, so having the defaults is just a way for the
build system's configuration to get out of sync with the code.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xfree86/parser/Makefile.am |  1 -
 hw/xfree86/parser/scan.c  | 15 ---
 xkb/ddxLoad.c | 12 
 3 files changed, 28 deletions(-)

diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am
index 9aa8cfefbd2b..2e4c6afdb21e 100644
--- a/hw/xfree86/parser/Makefile.am
+++ b/hw/xfree86/parser/Makefile.am
@@ -24,7 +24,6 @@ libxf86config_la_SOURCES = \
$(INTERNAL_SOURCES)
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \
-   -DSYSCONFDIR=\"$(sysconfdir)\" \
-DDATADIR=\"$(datadir)\"
 
 EXTRA_DIST = \
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 3356224ce061..64a6274634ea 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -542,24 +542,9 @@ xf86pathIsSafe(const char *path)
  *%%%
  */
 
-#ifndef XCONFIGFILE
-#define XCONFIGFILE"xorg.conf"
-#endif
-#ifndef XCONFIGDIR
-#define XCONFIGDIR "xorg.conf.d"
-#endif
 #ifndef XCONFIGSUFFIX
 #define XCONFIGSUFFIX  ".conf"
 #endif
-#ifndef PROJECTROOT
-#define PROJECTROOT"/usr/X11R6"
-#endif
-#ifndef SYSCONFDIR
-#define SYSCONFDIR PROJECTROOT "/etc"
-#endif
-#ifndef DATADIR
-#define DATADIRPROJECTROOT "/share"
-#endif
 #ifndef XCONFENV
 #define XCONFENV   "XORGCONFIG"
 #endif
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index f71815aa814b..a1a0fd3a28be 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -45,18 +45,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include 
 #include "xkb.h"
 
-/*
- * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
- * relative to the top-level XKB configuration directory.
- * Making the server write to a subdirectory of that directory
- * requires some work in the general case (install procedure
- * has to create links to /var or somesuch on many machines),
- * so we just compile into /usr/tmp for now.
- */
-#ifndef XKM_OUTPUT_DIR
-#defineXKM_OUTPUT_DIR  "compiled/"
-#endif
-
 #definePRE_ERROR_MSG "\"The XKEYBOARD keymap compiler (xkbcomp) 
reports:\""
 #defineERROR_PREFIX"\"> \""
 #definePOST_ERROR_MSG1 "\"Errors from xkbcomp are not fatal to the X 
server\""
-- 
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 xserver 2/3] Add unit tests for the byte swapping macros.

2017-04-21 Thread Eric Anholt
Peter noted a weirdness in my new bswap code, which could use some
tests to justify it.

Signed-off-by: Eric Anholt <e...@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 test/misc.c | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/test/misc.c b/test/misc.c
index ae46bab9..c10a2b935bc4 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -192,6 +192,48 @@ dix_request_size_checks(void)
 assert(rc == Success);
 }
 
+static void
+bswap_test(void)
+{
+const uint16_t test_16 = 0xaabb;
+const uint16_t expect_16 = 0xbbaa;
+const uint32_t test_32 = 0xaabbccdd;
+const uint32_t expect_32 = 0xddccbbaa;
+const uint64_t test_64 = 0x11223344aabbccddull;
+const uint64_t expect_64 = 0xddccbbaa44332211ull;
+uint16_t result_16;
+uint32_t result_32;
+uint64_t result_64;
+unsigned buffer[sizeof(test_64) + 4];
+void *unaligned = [1];
+
+assert(bswap_16(test_16) == expect_16);
+assert(bswap_32(test_32) == expect_32);
+assert(bswap_64(test_64) == expect_64);
+
+/* Test the swapping-in-a-pointer functions, with unaligned
+ * addresses (the functions shouldn't cause traps in that case).
+ */
+for (int i = 0; i < 2; i++) {
+unaligned = buffer + i;
+if (((uintptr_t)unaligned & 1) == 1)
+break;
+}
+memcpy(unaligned, _16, sizeof(test_16));
+swaps((uint16_t *)unaligned);
+memcpy(_16, unaligned, sizeof(result_16));
+assert(result_16 == expect_16);
+
+memcpy(unaligned, _32, sizeof(test_32));
+swapl((uint32_t *)unaligned);
+memcpy(_32, unaligned, sizeof(result_32));
+assert(result_32 == expect_32);
+
+memcpy(unaligned, _64, sizeof(test_64));
+swapll((uint64_t *)unaligned);
+memcpy(_64, unaligned, sizeof(result_64));
+assert(result_64 == expect_64);
+}
 
 int
 misc_test(void)
@@ -199,6 +241,7 @@ misc_test(void)
 dix_version_compare();
 dix_update_desktop_dimensions();
 dix_request_size_checks();
+bswap_test();
 
 return 0;
 }
-- 
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 xserver 1/3] Rewrite the byte swapping macros.

2017-04-21 Thread Eric Anholt
The clever pointer tricks were actually not working, and we were doing
the byte-by-byte moves in general.  By just doing the memcpy and
obvious byte swap code, we end up generating actual byte swap
instructions, thanks to optimizing compilers.

 text  data bss dec hex filename
before: 2240807   51552  132016 2424375  24fe37 hw/xfree86/Xorg
after:  2215167   51552  132016 2398735  249a0f hw/xfree86/Xorg

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 doc/Xserver-spec.xml |  2 +-
 glx/glxbyteorder.h   | 21 
 include/misc.h   | 97 ++--
 os/io.c  |  4 +--
 4 files changed, 37 insertions(+), 87 deletions(-)

diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index 7867544e48a9..3dde65178b7f 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -600,7 +600,7 @@ are: REQUEST, REQUEST_SIZE_MATCH, REQUEST_AT_LEAST_SIZE,
 REQUEST_FIXED_SIZE, LEGAL_NEW_RESOURCE, and
 VALIDATE_DRAWABLE_AND_GC. Useful byte swapping macros can be found
 in Xserver/include/dix.h: WriteReplyToClient and WriteSwappedDataToClient; and
-in Xserver/include/misc.h: lswapl, lswaps, LengthRestB, LengthRestS,
+in Xserver/include/misc.h: bswap_64, bswap_32, bswap_16, LengthRestB, 
LengthRestS,
 LengthRestL, SwapRestS, SwapRestL, swapl, swaps, cpswapl, and cpswaps.
 
 
diff --git a/glx/glxbyteorder.h b/glx/glxbyteorder.h
index 5e94e8626e66..8f0cd8a4b0d7 100644
--- a/glx/glxbyteorder.h
+++ b/glx/glxbyteorder.h
@@ -37,25 +37,4 @@
 
 #include "misc.h"
 
-static inline uint16_t
-bswap_16(uint16_t val)
-{
-swap_uint16();
-return val;
-}
-
-static inline uint32_t
-bswap_32(uint32_t val)
-{
-swap_uint32();
-return val;
-}
-
-static inline uint64_t
-bswap_64(uint64_t val)
-{
-swap_uint64();
-return val;
-}
-
 #endif  /* !defined(__GLXBYTEORDER_H__) */
diff --git a/include/misc.h b/include/misc.h
index 01747fd38339..a75eb617c642 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -128,21 +128,6 @@ typedef struct _xReq *xReqPtr;
 #define USE_BACKGROUND_PIXEL 3
 #define USE_BORDER_PIXEL 3
 
-/* byte swap a 32-bit literal */
-static inline uint32_t
-lswapl(uint32_t x)
-{
-return ((x & 0xff) << 24) |
-((x & 0xff00) << 8) | ((x & 0xff) >> 8) | ((x >> 24) & 0xff);
-}
-
-/* byte swap a 16-bit literal */
-static inline uint16_t
-lswaps(uint16_t x)
-{
-return (uint16_t)((x & 0xff) << 8) | ((x >> 8) & 0xff);
-}
-
 #undef min
 #undef max
 
@@ -311,88 +296,74 @@ __builtin_constant_p(int x)
 }
 #endif
 
-/* byte swap a 64-bit value */
-static inline void
-swap_uint64(uint64_t *x)
+static inline uint64_t
+bswap_64(uint64_t x)
 {
-char n;
-
-n = ((char *) x)[0];
-((char *) x)[0] = ((char *) x)[7];
-((char *) x)[7] = n;
-
-n = ((char *) x)[1];
-((char *) x)[1] = ((char *) x)[6];
-((char *) x)[6] = n;
-
-n = ((char *) x)[2];
-((char *) x)[2] = ((char *) x)[5];
-((char *) x)[5] = n;
-
-n = ((char *) x)[3];
-((char *) x)[3] = ((char *) x)[4];
-((char *) x)[4] = n;
+return (((x & 0xFF00ull) >> 56) |
+((x & 0x00FFull) >> 40) |
+((x & 0xFF00ull) >> 24) |
+((x & 0x00FFull) >>  8) |
+((x & 0xFF00ull) <<  8) |
+((x & 0x00FFull) << 24) |
+((x & 0xFF00ull) << 40) |
+((x & 0x00FFull) << 56));
 }
 
 #define swapll(x) do { \
+   uint64_t temp; \
if (sizeof(*(x)) != 8) \
wrong_size(); \
-swap_uint64((uint64_t *)(x));   \
+   memcpy(, x, 8); \
+   temp = bswap_64(temp); \
+   memcpy(x, , 8); \
} while (0)
 
-/* byte swap a 32-bit value */
-static inline void
-swap_uint32(uint32_t * x)
+static inline uint32_t
+bswap_32(uint32_t x)
 {
-char n = ((char *) x)[0];
-
-((char *) x)[0] = ((char *) x)[3];
-((char *) x)[3] = n;
-n = ((char *) x)[1];
-((char *) x)[1] = ((char *) x)[2];
-((char *) x)[2] = n;
+return (((x & 0xFF00) >> 24) |
+((x & 0x00FF) >> 8) |
+((x & 0xFF00) << 8) |
+((x & 0x00FF) << 24));
 }
 
 #define swapl(x) do { \
+   uint32_t temp; \
if (sizeof(*(x)) != 4) \
wrong_size(); \
-   if (__builtin_constant_p((uintptr_t)(x) & 3) && ((uintptr_t)(x) 
& 3) == 0) \
-   *(x) = lswapl(*(x)); \
-   else \
-   swap_uint32((uint32_t *)(x)); \
+   memcpy(, x, 4); \
+   temp = bswap_32(temp); \
+   memcpy(x, , 4); \

[PATCH xserver 3/3] Remove support for unaligned swaps.

2017-04-21 Thread Eric Anholt
The previous misc.h code went out of its way to allow swapping of
unaligned pointers to values.  However, the members of an X
request/response are always naturally aligned within the struct, and
the buffers containing a request/response will also be aligned to at
least 8 bytes, so we can just drop it.

text  data   bssdec  hexfilename
before: 2215167   51552  132016 2398735  249a0f hw/xfree86/Xorg
after:  2214919   51552  132016 2398487  249917 hw/xfree86/Xorg

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 include/misc.h | 15 +++
 test/misc.c| 25 ++---
 2 files changed, 9 insertions(+), 31 deletions(-)

diff --git a/include/misc.h b/include/misc.h
index a75eb617c642..38af70ff9e89 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -310,12 +310,9 @@ bswap_64(uint64_t x)
 }
 
 #define swapll(x) do { \
-   uint64_t temp; \
if (sizeof(*(x)) != 8) \
wrong_size(); \
-   memcpy(, x, 8); \
-   temp = bswap_64(temp); \
-   memcpy(x, , 8); \
+   *(x) = bswap_64(*(x));  \
} while (0)
 
 static inline uint32_t
@@ -328,12 +325,9 @@ bswap_32(uint32_t x)
 }
 
 #define swapl(x) do { \
-   uint32_t temp; \
if (sizeof(*(x)) != 4) \
wrong_size(); \
-   memcpy(, x, 4); \
-   temp = bswap_32(temp); \
-   memcpy(x, , 4); \
+   *(x) = bswap_32(*(x)); \
} while (0)
 
 static inline uint16_t
@@ -344,12 +338,9 @@ bswap_16(uint16_t x)
 }
 
 #define swaps(x) do { \
-   uint16_t temp; \
if (sizeof(*(x)) != 2) \
wrong_size(); \
-   memcpy(, x, 2); \
-   temp = bswap_16(temp); \
-   memcpy(x, , 2); \
+   *(x) = bswap_16(*(x)); \
} while (0)
 
 /* copy 32-bit value from src to dst byteswapping on the way */
diff --git a/test/misc.c b/test/misc.c
index c10a2b935bc4..3c669b6776ff 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -204,34 +204,21 @@ bswap_test(void)
 uint16_t result_16;
 uint32_t result_32;
 uint64_t result_64;
-unsigned buffer[sizeof(test_64) + 4];
-void *unaligned = [1];
 
 assert(bswap_16(test_16) == expect_16);
 assert(bswap_32(test_32) == expect_32);
 assert(bswap_64(test_64) == expect_64);
 
-/* Test the swapping-in-a-pointer functions, with unaligned
- * addresses (the functions shouldn't cause traps in that case).
- */
-for (int i = 0; i < 2; i++) {
-unaligned = buffer + i;
-if (((uintptr_t)unaligned & 1) == 1)
-break;
-}
-memcpy(unaligned, _16, sizeof(test_16));
-swaps((uint16_t *)unaligned);
-memcpy(_16, unaligned, sizeof(result_16));
+result_16 = test_16;
+swaps(_16);
 assert(result_16 == expect_16);
 
-memcpy(unaligned, _32, sizeof(test_32));
-swapl((uint32_t *)unaligned);
-memcpy(_32, unaligned, sizeof(result_32));
+result_32 = test_32;
+swapl(_32);
 assert(result_32 == expect_32);
 
-memcpy(unaligned, _64, sizeof(test_64));
-swapll((uint64_t *)unaligned);
-memcpy(_64, unaligned, sizeof(result_64));
+result_64 = test_64;
+swapll(_64);
 assert(result_64 == expect_64);
 }
 
-- 
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 xserver 2/2] glamor: Always purge the FBO cache in BlockHandler

2017-03-06 Thread Eric Anholt
Michel Dänzer  writes:

> From: Michel Dänzer 
>
> Or if the cache watermark is reached, whichever comes earlier.
>
> This slightly simplifies the FBO cache management, and prevents it from
> potentially holding entries for a long time, while preserving the main
> benefit of the cache for bursts of drawing operations.
>
> Signed-off-by: Michel Dänzer 

For re-adding an FBO cache, I would need to see that we have
APPLE_object_purgeable used so that the FBO cache can be evicted, and
use proper timers to garbage collect the FBOs instead of waiting for N
blockhandlers, which is only vaguely related to wall time.


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] vfb: Bump default depth to 24

2017-02-28 Thread Eric Anholt
Adam Jackson <a...@nwnk.net> writes:

> On Mon, 2017-02-20 at 10:24 -0500, Adam Jackson wrote:
>> Signed-off-by: Adam Jackson <a...@redhat.com>
>
> Pretty please? Nobody on earth thinks 8bpp is a reasonable default
> anymore. Should I just assume I have carte blanche to push trivial
> things like this? I'm happy to have literally anybody revert anything I
> push that causes problems if we go that route.
>
> For that matter, I'm happy to have pretty much anybody pushing code if
> they're confident in it, with the same "anybody can revert too" caveat.

I would be pretty OK with that plan, but for this patch, at least:

Reviewed-by: Eric Anholt <e...@anholt.net>


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: [RFC PATCH xserver] modesetting: re-set the crtc's mode when link-status goes BAD

2017-04-02 Thread Eric Anholt
Daniel Vetter <dan...@ffwll.ch> writes:

> On Fri, Mar 31, 2017 at 05:22:09PM -0700, Eric Anholt wrote:
>> Manasi Navare <manasi.d.nav...@intel.com> writes:
>> 
>> > On Fri, Mar 31, 2017 at 01:08:41PM -0700, Eric Anholt wrote:
>> >> Manasi Navare <manasi.d.nav...@intel.com> writes:
>> >> 
>> >> > On Thu, Mar 30, 2017 at 05:37:55PM -0700, Eric Anholt wrote:
>> >> >> Martin Peres <martin.pe...@linux.intel.com> writes:
>> >> >> 
>> >> >> > On 26/01/17 14:37, Martin Peres wrote:
>> >> >> >> Despite all the careful planing of the kernel, a link may become
>> >> >> >> insufficient to handle the currently-set mode. At this point, the
>> >> >> >> kernel should mark this particular configuration as being broken
>> >> >> >> and potentially prune the mode before setting the offending 
>> >> >> >> connector's
>> >> >> >> link-status to BAD and send the userspace a hotplug event. This may
>> >> >> >> happen right after a modeset or later on.
>> >> >> >>
>> >> >> >> When available, we should use the link-status information to reset
>> >> >> >> the wanted mode.
>> >> >> >>
>> >> >> >> Signed-off-by: Martin Peres <martin.pe...@linux.intel.com>
>> >> >> >
>> >> >> > The relevant kernel patches have landed in drm-tip about a month ago.
>> >> >> >
>> >> >> > Eric, would you mind providing feedback on or merging this patch?
>> >> >> 
>> >> >> The later discussion has sounded like the kernel will (always) prune 
>> >> >> the
>> >> >> mode when we re-query, meaning that it doesn't make any sense to try to
>> >> >> re-set to the old mode.  Is this not the case?
>> >> >
>> >> >
>> >> > No the kernel will simply send a hotplug with link status as bad
>> >> > and then after that point its userspace driver's responsibility
>> >> > to check if link status is BAD, retry the same mode and if it fails
>> >> > then re probe.
>> >> 
>> >> So the kernel will sometimes allow the same mode to be re-set with the
>> >> same bpp?
>> >
>> > So when userspace driver re-sets the same mode, the kernel will call the
>> > mode valid function where it will see it can allow the sam mode perhaps
>> > at a lower bpp now since the link parameters are lowered.
>> > So the mode which failed at 30 bpp, might still work at 18bpp and is
>> > better going to a lower resolution.
>> 
>> The question was whether the kernel will ever allow the same mode at the
>> same bpp, since that's what this patch tries to do.
>
> Yes, this can happen. Doing a full modeset with recomputing clocks and
> everything behind userspace's back might not be something the kernel
> driver can pull of with a reasonable amount of effort, hence why we punt
> to userspace. The interface spec makes this a CAN, not WILL, to allow less
> unreasonable hw to handle these cases directly in the kernel driver. E.g.
> plain link-retraining is handled in i915.ko still.

So in that case you do need userspace to re-request the same mode at the
same bpp?


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] xephyr: Check for host XVideo support before trying to use it

2017-04-07 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Otherwise xcb will treat our attempt to send xv requests as a connection
> error (quite reasonably: we're asking it to emit a request for which
> there is no defined major opcode), and we'll die quietly the first time
> we hit KdBlockhandler.

Reviewed-by: Eric Anholt <e...@anholt.net>


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] glx: Remove enter/leave server API

2017-04-07 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Dead code since:
>
> commit 8aacf47e1778d8b72811b025a82452b933d3c1f2
> Author: Adam Jackson <a...@redhat.com>
> Date:   Fri Oct 4 12:58:19 2013 -0400
>
> glx: Remove DRI1 AIGLX (v2)
>
> Signed-off-by: Adam Jackson <a...@redhat.com>

Reviewed-by: Eric Anholt <e...@anholt.net>


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] Rewrite the byte swapping macros.

2017-04-24 Thread Eric Anholt
Keith Packard <kei...@keithp.com> writes:

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>> It doesn't find anything.
>
> Sounds like we can just remove the memcpy then.

So, is that a reviewed-by for #1, since #3 removes the memcpy?


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] glx: Allow arbitrary context attributes for direct contexts

2017-07-28 Thread Eric Anholt
Adam Jackson  writes:

> For direct contexts, most context attributes don't require any
> particular awareness on the part of the server. Examples include
> GLX_ARB_create_context_no_error and GLX_ARB_context_flush_control, where
> all of the behavior change lives in the renderer; since that's on the
> client side for a direct context, there's no reason for the X server to
> validate the attribute.
>
> The context attributes will still be validated on the client side, and
> we still validate attributes for indirect contexts since the server
> implementation might need to handle them. For example, the indirect
> code might internally use ARB_context_flush_control for all contexts, in
> which case it would need to manually emit glFlush when the client
> switches between two indirect contexts that didn't request the no-flush
> attribute.
>
> Signed-off-by: Adam Jackson 

Does the client side even need to send the client-side attributes for
direct contexts?


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] glamor: Scissor rectangle drawing to the bounds of the rects.

2017-08-01 Thread Eric Anholt
Scissors provide a critical hint to tiled renderers as to what tiles
need to be load/stored because they could be modified by the
rendering.

The bounds calculation here is limited to when we have a small number
of rects (large enough to cover rounded window corners, but probably
not xeyes) to avoid overhead on desktop GL.

No performance difference on i965 with x11perf -rect1 -repeat 1 -reps
1 (n=50)

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_rects.c | 26 ++
 glamor/glamor_utils.h | 35 +++
 2 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/glamor/glamor_rects.c b/glamor/glamor_rects.c
index cc029c8c04a6..6cbb040c18ea 100644
--- a/glamor/glamor_rects.c
+++ b/glamor/glamor_rects.c
@@ -53,6 +53,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
 char *vbo_offset;
 int box_index;
 Bool ret = FALSE;
+BoxRec bounds = glamor_no_rendering_bounds();
 
 pixmap_priv = glamor_get_pixmap_private(pixmap);
 if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
@@ -60,6 +61,12 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
 
 glamor_make_current(glamor_priv);
 
+if (nrect < 100) {
+bounds = glamor_start_rendering_bounds();
+for (int i = 0; i < nrect; i++)
+glamor_bounds_union_rect(, [i]);
+}
+
 if (glamor_priv->glsl_version >= 130) {
 prog = glamor_use_program_fill(pixmap, gc,
_priv->poly_fill_rect_program,
@@ -121,11 +128,22 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
 goto bail;
 
 while (nbox--) {
-glScissor(box->x1 + off_x,
-  box->y1 + off_y,
-  box->x2 - box->x1,
-  box->y2 - box->y1);
+BoxRec scissor = {
+.x1 = max(box->x1, bounds.x1 + drawable->x),
+.y1 = max(box->y1, bounds.y1 + drawable->y),
+.x2 = min(box->x2, bounds.x2 + drawable->x),
+.y2 = min(box->y2, bounds.y2 + drawable->y),
+};
+
 box++;
+
+if (scissor.x1 >= scissor.x2 || scissor.y1 >= scissor.y2)
+continue;
+
+glScissor(scissor.x1 + off_x,
+  scissor.y1 + off_y,
+  scissor.x2 - scissor.x1,
+  scissor.y2 - scissor.y1);
 if (glamor_priv->glsl_version >= 130)
 glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect);
 else {
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index a35917c37a16..824be1a09338 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -729,6 +729,41 @@ glamor_make_current(glamor_screen_private *glamor_priv)
 }
 }
 
+static inline BoxRec
+glamor_no_rendering_bounds(void)
+{
+BoxRec bounds = {
+.x1 = 0,
+.y1 = 0,
+.x2 = MAXSHORT,
+.y2 = MAXSHORT,
+};
+
+return bounds;
+}
+
+static inline BoxRec
+glamor_start_rendering_bounds(void)
+{
+BoxRec bounds = {
+.x1 = MAXSHORT,
+.y1 = MAXSHORT,
+.x2 = 0,
+.y2 = 0,
+};
+
+return bounds;
+}
+
+static inline void
+glamor_bounds_union_rect(BoxPtr bounds, xRectangle *rect)
+{
+bounds->x1 = min(bounds->x1, rect->x);
+bounds->y1 = min(bounds->y1, rect->y);
+bounds->x2 = max(bounds->x2, rect->x + rect->width);
+bounds->y2 = max(bounds->y2, rect->y + rect->height);
+}
+
 /**
  * Helper function for implementing draws with GL_QUADS on GLES2,
  * where we don't have them.
-- 
2.13.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 xserver 3/3] glamor: Scissor Render composite operations to the bounds of the drawing.

2017-08-01 Thread Eric Anholt
Unlike the previous two fixes, this one introduces new GL calls and
statechanges of the scissor.  However, given that our Render drawing
already does CPU side transformation and inefficient box upload, this
shouldn't be a limiting factor for Render acceleration.

Surprisingly, it improves x11perf -comppixwin10 -repeat 1 -reps 1
on i965 by 3.21191% +/- 1.79977% (n=50).

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_render.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 52f073d0578b..413c4a7f8e8a 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -1198,6 +1198,29 @@ glamor_composite_with_shader(CARD8 op,
 
 nrect_max = MIN(nrect, GLAMOR_COMPOSITE_VBO_VERT_CNT / 4);
 
+if (nrect < 100) {
+BoxRec bounds = glamor_start_rendering_bounds();
+
+for (int i = 0; i < nrect; i++) {
+BoxRec box = {
+.x1 = rects[i].x_dst,
+.y1 = rects[i].y_dst,
+.x2 = rects[i].x_dst + rects[i].width,
+.y2 = rects[i].y_dst + rects[i].height,
+};
+glamor_bounds_union_box(, );
+}
+
+if (bounds.x1 >= bounds.x2 || bounds.y1 >= bounds.y2)
+goto disable;
+
+glEnable(GL_SCISSOR_TEST);
+glScissor(bounds.x1 + dest_x_off,
+  bounds.y1 + dest_y_off,
+  bounds.x2 - bounds.x1,
+  bounds.y2 - bounds.y1);
+}
+
 while (nrect) {
 int mrect, rect_processed;
 int vb_stride;
@@ -1279,6 +1302,8 @@ glamor_composite_with_shader(CARD8 op,
 }
 }
 
+disable:
+glDisable(GL_SCISSOR_TEST);
 glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
 glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
 glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
-- 
2.13.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 xserver 2/3] glamor: Scissor CopyArea to the bounds of the drawing.

2017-08-01 Thread Eric Anholt
Like the previous fix to rectangles, this reduces the area drawn on
tiled renderers by letting the CPU-side tile setup know what tiles
might be drawn at all.

Surprisingly, it improves x11perf -copypixwin1 -repeat 1 -reps 1
on i965 by 2.93185% +/- 1.5561% (n=90).

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_copy.c  | 27 +++
 glamor/glamor_utils.h |  9 +
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index f7d6eb163fac..3296b7b1bf75 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -351,6 +351,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
 const glamor_facet *copy_facet;
 int n;
 Bool ret = FALSE;
+BoxRec bounds = glamor_no_rendering_bounds();
 
 glamor_make_current(glamor_priv);
 
@@ -391,11 +392,20 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
 glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE,
   2 * sizeof (GLshort), vbo_offset);
 
+if (nbox < 100) {
+bounds = glamor_start_rendering_bounds();
+for (int i = 0; i < nbox; i++)
+glamor_bounds_union_box(, [i]);
+}
+
 for (n = 0; n < nbox; n++) {
 v[0] = box->x1; v[1] = box->y1;
 v[2] = box->x1; v[3] = box->y2;
 v[4] = box->x2; v[5] = box->y2;
 v[6] = box->x2; v[7] = box->y1;
+
+glamor_bounds_union_box(, box);
+
 v += 8;
 box++;
 }
@@ -417,15 +427,24 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
 goto bail_ctx;
 
 glamor_pixmap_loop(dst_priv, dst_box_index) {
+BoxRec scissor = {
+.x1 = max(-args.dx, bounds.x1),
+.y1 = max(-args.dy, bounds.y1),
+.x2 = min(-args.dx + src_box->x2 - src_box->x1, bounds.x2),
+.y2 = min(-args.dy + src_box->y2 - src_box->y1, bounds.y2),
+};
+if (scissor.x1 >= scissor.x2 || scissor.y1 >= scissor.y2)
+continue;
+
 if (!glamor_set_destination_drawable(dst, dst_box_index, FALSE, 
FALSE,
  prog->matrix_uniform,
  _off_x, _off_y))
 goto bail_ctx;
 
-glScissor(dst_off_x - args.dx,
-  dst_off_y - args.dy,
-  src_box->x2 - src_box->x1,
-  src_box->y2 - src_box->y1);
+glScissor(scissor.x1 + dst_off_x,
+  scissor.y1 + dst_off_y,
+  scissor.x2 - scissor.x1,
+  scissor.y2 - scissor.y1);
 
 glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox);
 }
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index 824be1a09338..81df944b38ba 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -764,6 +764,15 @@ glamor_bounds_union_rect(BoxPtr bounds, xRectangle *rect)
 bounds->y2 = max(bounds->y2, rect->y + rect->height);
 }
 
+static inline void
+glamor_bounds_union_box(BoxPtr bounds, BoxPtr box)
+{
+bounds->x1 = min(bounds->x1, box->x1);
+bounds->y1 = min(bounds->y1, box->y1);
+bounds->x2 = max(bounds->x2, box->x2);
+bounds->y2 = max(bounds->y2, box->y2);
+}
+
 /**
  * Helper function for implementing draws with GL_QUADS on GLES2,
  * where we don't have them.
-- 
2.13.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 xserver] meson: Fix xwayland build since xwayland-keyboard-grab.

2017-08-01 Thread Eric Anholt
The version detect was erroring out with 1.9 protos installed, and we
weren't building the new code.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xwayland/meson.build | 3 +++
 meson.build | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index d2791fe14bee..b619a66a7ce0 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -18,6 +18,7 @@ protodir = protocols_dep.get_pkgconfig_variable('pkgdatadir')
 pointer_xml = join_paths(protodir, 'unstable', 'pointer-constraints', 
'pointer-constraints-unstable-v1.xml')
 relative_xml = join_paths(protodir, 'unstable', 'relative-pointer', 
'relative-pointer-unstable-v1.xml')
 tablet_xml = join_paths(protodir, 'unstable', 'tablet', 
'tablet-unstable-v2.xml')
+kbgrab_xml = join_paths(protodir, 'unstable', 'xwayland-keyboard-grab', 
'xwayland-keyboard-grab-unstable-v1.xml')
 
 client_header = generator(scanner,
 output : '@BASENAME@-client-protocol.h',
@@ -30,9 +31,11 @@ code = generator(scanner,
 srcs += client_header.process(relative_xml)
 srcs += client_header.process(pointer_xml)
 srcs += client_header.process(tablet_xml)
+srcs += client_header.process(kbgrab_xml)
 srcs += code.process(relative_xml)
 srcs += code.process(pointer_xml)
 srcs += code.process(tablet_xml)
+srcs += code.process(kbgrab_xml)
 
 xwayland_glamor = []
 if gbm_dep.found()
diff --git a/meson.build b/meson.build
index a36ae9da7ac6..3efec0def027 100644
--- a/meson.build
+++ b/meson.build
@@ -98,7 +98,7 @@ if (host_machine.system() != 'darwin' and
 
 xwayland_dep = [
 dependency('wayland-client', version: '>= 1.3.0', required: 
xwayland_required),
-dependency('wayland-protocols', version: '>= 1.9.0', required: 
xwayland_required),
+dependency('wayland-protocols', version: '>= 1.9', required: 
xwayland_required),
 dependency('libdrm', version: '>= 2.3.1', required: 
xwayland_required),
 dependency('epoxy', required: xwayland_required),
 ]
-- 
2.13.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 xserver 6/7] sync: Convert from "CARD64" to int64_t.

2017-08-03 Thread Eric Anholt
The extension was using the name CARD64 to represent 64-bit values,
with a #define from CARD64 to XSyncValue, a struct with a pair of
32-bit values representing a signed 64-bit value.  Now that stdint.h
exists, let's just use that instead.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 Xext/sync.c | 302 +++-
 Xext/syncsrv.h  |  23 ++--
 include/misc.h  |  25 
 miext/sync/misync.c |   5 +-
 miext/sync/misyncstr.h  |  11 +-
 present/present_fence.c |   2 +-
 6 files changed, 186 insertions(+), 182 deletions(-)

diff --git a/Xext/sync.c b/Xext/sync.c
index a8db0ec22371..b16e396e6438 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -237,7 +237,7 @@ SyncAddTriggerToSyncObject(SyncTrigger * pTrigger)
  */
 
 static Bool
-SyncCheckTriggerPositiveComparison(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerPositiveComparison(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -248,12 +248,11 @@ SyncCheckTriggerPositiveComparison(SyncTrigger * 
pTrigger, CARD64 oldval)
 
 pCounter = (SyncCounter *) pTrigger->pSync;
 
-return (pCounter == NULL ||
-XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value));
+return pCounter == NULL || pCounter->value >= pTrigger->test_value;
 }
 
 static Bool
-SyncCheckTriggerNegativeComparison(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerNegativeComparison(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -264,12 +263,11 @@ SyncCheckTriggerNegativeComparison(SyncTrigger * 
pTrigger, CARD64 oldval)
 
 pCounter = (SyncCounter *) pTrigger->pSync;
 
-return (pCounter == NULL ||
-XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value));
+return pCounter == NULL || pCounter->value <= pTrigger->test_value;
 }
 
 static Bool
-SyncCheckTriggerPositiveTransition(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerPositiveTransition(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -281,12 +279,12 @@ SyncCheckTriggerPositiveTransition(SyncTrigger * 
pTrigger, CARD64 oldval)
 pCounter = (SyncCounter *) pTrigger->pSync;
 
 return (pCounter == NULL ||
-(XSyncValueLessThan(oldval, pTrigger->test_value) &&
- XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value)));
+(oldval < pTrigger->test_value &&
+ pCounter->value >= pTrigger->test_value));
 }
 
 static Bool
-SyncCheckTriggerNegativeTransition(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerNegativeTransition(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -298,12 +296,12 @@ SyncCheckTriggerNegativeTransition(SyncTrigger * 
pTrigger, CARD64 oldval)
 pCounter = (SyncCounter *) pTrigger->pSync;
 
 return (pCounter == NULL ||
-(XSyncValueGreaterThan(oldval, pTrigger->test_value) &&
- XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value)));
+(oldval > pTrigger->test_value &&
+ pCounter->value <= pTrigger->test_value));
 }
 
 static Bool
-SyncCheckTriggerFence(SyncTrigger * pTrigger, CARD64 unused)
+SyncCheckTriggerFence(SyncTrigger * pTrigger, int64_t unused)
 {
 SyncFence *pFence = (SyncFence *) pTrigger->pSync;
 
@@ -389,16 +387,15 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, 
XID syncObject,
 if (pTrigger->value_type == XSyncAbsolute)
 pTrigger->test_value = pTrigger->wait_value;
 else {  /* relative */
-
 Bool overflow;
 
 if (pCounter == NULL)
 return BadMatch;
 
-XSyncValueAdd(>test_value, pCounter->value,
-  pTrigger->wait_value, );
+overflow = checked_int64_add(>test_value,
+ pCounter->value, 
pTrigger->wait_value);
 if (overflow) {
-client->errorValue = XSyncValueHigh32(pTrigger->wait_value);
+client->errorValue = pTrigger->wait_value >> 32;
 return BadValue;
 }
 }
@@ -441,15 +438,15 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm)
 .type = SyncEventBase + XSyncAlarmNotify,
 .kind = XSyncAlarmNotify,
 .alarm = pAlarm->alarm_id,
-.alarm_value_hi = XSyncValueHigh32(pTrigger->test_value),
-.alarm_value_lo = XSyncValueLow32(pTrigger->test_value),
+.alarm_value_hi = pTrigger->test_value >> 32,
+.alarm_value_lo = pTrigger->test_value,
 .time = currentTime.milliseconds,
 .state = pAlarm->state
 };
 
 if (pTrigger->pSync && SYNC_COUNTER == pTrigger->pSync->type) {
-ane.count

[PATCH xserver 5/7] test: Add basic SYNC tests.

2017-08-03 Thread Eric Anholt
I couldn't find any, and I was modifying the implementation, so I had
to write some.  I would like the test to end with a "make sure there
weren't any stray unchecked errors", but I didn't figure out how to do
that.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/vfb/meson.build|   2 +-
 test/meson.build  |   2 +
 test/sync/meson.build |   9 ++
 test/sync/sync.c  | 237 ++
 4 files changed, 249 insertions(+), 1 deletion(-)
 create mode 100644 test/sync/meson.build
 create mode 100644 test/sync/sync.c

diff --git a/hw/vfb/meson.build b/hw/vfb/meson.build
index 6566b45907f1..89acdfacd371 100644
--- a/hw/vfb/meson.build
+++ b/hw/vfb/meson.build
@@ -4,7 +4,7 @@ srcs = [
 '../../mi/miinitext.c',
 ]
 
-executable(
+xvfb_server = executable(
 'Xvfb',
 srcs,
 include_directories: inc,
diff --git a/test/meson.build b/test/meson.build
index b71d7e24909d..3e482d6f19cd 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -22,3 +22,5 @@ if get_option('xvfb')
 )
 endif
 endif
+
+subdir('sync')
diff --git a/test/sync/meson.build b/test/sync/meson.build
new file mode 100644
index ..dfae75b1ed53
--- /dev/null
+++ b/test/sync/meson.build
@@ -0,0 +1,9 @@
+xcb_dep = dependency('xcb', required: false)
+xcb_sync_dep = dependency('xcb-sync', required: false)
+
+if get_option('xvfb')
+if xcb_dep.found() and xcb_sync_dep.found()
+sync = executable('sync', 'sync.c', dependencies: [xcb_dep, 
xcb_sync_dep])
+test('sync', simple_xinit, args: [sync, '--', xvfb_server])
+endif
+endif
diff --git a/test/sync/sync.c b/test/sync/sync.c
new file mode 100644
index ..c39774246841
--- /dev/null
+++ b/test/sync/sync.c
@@ -0,0 +1,237 @@
+/*
+ * Copyright © 2017 Broadcom
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+static const int64_t some_values[] = {
+0,
+1,
+-1,
+LLONG_MAX,
+LLONG_MIN,
+};
+
+static int64_t
+counter_value(struct xcb_connection_t *c,
+  xcb_sync_query_counter_cookie_t cookie)
+{
+xcb_sync_query_counter_reply_t *reply =
+xcb_sync_query_counter_reply(c, cookie, NULL);
+int64_t value = (((int64_t)reply->counter_value.hi << 32) |
+ reply->counter_value.lo);
+
+free(reply);
+return value;
+}
+
+static xcb_sync_int64_t
+sync_value(int64_t value)
+{
+xcb_sync_int64_t v = {
+.hi = value >> 32,
+.lo = value,
+};
+
+return v;
+}
+
+/* Initializes counters with a bunch of interesting values and makes
+ * sure it comes back the same.
+ */
+static void
+test_create_counter(xcb_connection_t *c)
+{
+xcb_sync_query_counter_cookie_t queries[ARRAY_SIZE(some_values)];
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+xcb_sync_counter_t counter = xcb_generate_id(c);
+xcb_sync_create_counter(c, counter, sync_value(some_values[i]));
+queries[i] = xcb_sync_query_counter_unchecked(c, counter);
+}
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+int64_t value = counter_value(c, queries[i]);
+
+if (value != some_values[i]) {
+fprintf(stderr, "Creating counter with %lld returned %lld\n",
+(long long)some_values[i],
+(long long)value);
+exit(1);
+}
+}
+}
+
+/* Set a single counter to a bunch of interesting values and make sure
+ * it comes the same.
+ */
+static void
+test_set_counter(xcb_connection_t *c)
+{
+xcb_sync_counter_t counter = xcb_generate_id(c);
+xcb_sync_query_counter_cookie_t queries[ARRAY_SIZE(some_values)];
+
+xcb_sync_create_counter(c, counter,

[PATCH xserver 1/7] test: Remove unused ddxstubs.c

2017-08-03 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 test/Makefile.am |  1 -
 test/ddxstubs.c  | 97 
 2 files changed, 98 deletions(-)
 delete mode 100644 test/ddxstubs.c

diff --git a/test/Makefile.am b/test/Makefile.am
index 15f0b53f03a4..2dbb2df03030 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -184,6 +184,5 @@ EXTRA_DIST = \
scripts/xephyr-glamor-piglit.sh \
scripts/xinit-piglit-session.sh \
scripts/run-piglit.sh \
-   ddxstubs.c \
$(NULL)
 
diff --git a/test/ddxstubs.c b/test/ddxstubs.c
deleted file mode 100644
index 58bc0c42825e..
--- a/test/ddxstubs.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Copyright © 2012 Apple Inc.
- *
- *  Permission is hereby granted, free of charge, to any person obtaining a
- *  copy of this software and associated documentation files (the "Software"),
- *  to deal in the Software without restriction, including without limitation
- *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
- *  and/or sell copies of the Software, and to permit persons to whom the
- *  Software is furnished to do so, subject to the following conditions:
- *
- *  The above copyright notice and this permission notice (including the next
- *  paragraph) shall be included in all copies or substantial portions of the
- *  Software.
- *
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- *  DEALINGS IN THE SOFTWARE.
- */
-
-/* This file contains stubs for some symbols which are usually provided by a
- * DDX.  These stubs should allow the unit tests to build on platforms with
- * stricter linkers (eg: darwin) when the Xorg DDX is not built.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include 
-#endif
-
-#include "input.h"
-#include "mi.h"
-
-void
-DDXRingBell(int volume, int pitch, int duration)
-{
-}
-
-void
-ProcessInputEvents(void)
-{
-mieqProcessInputEvents();
-}
-
-void
-OsVendorInit(void)
-{
-}
-
-void
-OsVendorFatalError(const char *f, va_list args)
-{
-}
-
-void
-AbortDDX(enum ExitCode error)
-{
-OsAbort();
-}
-
-void
-ddxUseMsg(void)
-{
-}
-
-int
-ddxProcessArgument(int argc, char *argv[], int i)
-{
-return 0;
-}
-
-void
-ddxGiveUp(enum ExitCode error)
-{
-}
-
-Bool
-LegalModifier(unsigned int key, DeviceIntPtr pDev)
-{
-return TRUE;
-}
-
-#ifdef XQUARTZ
-int darwinMainScreenX = 0;
-int darwinMainScreenY = 0;
-
-BOOL no_configure_window = FALSE;
-#endif
-
-#ifdef DDXBEFORERESET
-void
-ddxBeforeReset(void)
-{
-}
-#endif
-- 
2.13.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 xserver 2/7] meson: Move Xvfb build under an option.

2017-08-03 Thread Eric Anholt
Autotools also had it as an option.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/meson.build| 4 +++-
 meson_options.txt | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/meson.build b/hw/meson.build
index c0d2db3f5c85..96c1559c348b 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -6,7 +6,9 @@ if get_option('dmx')
 subdir('dmx')
 endif
 
-subdir('vfb')
+if get_option('xvfb')
+subdir('vfb')
+endif
 
 if build_xnest
 subdir('xnest')
diff --git a/meson_options.txt b/meson_options.txt
index fc66f9f08e35..b1ee6ccc5b39 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -10,6 +10,8 @@ option('xnest', type: 'combo', choices: ['yes', 'no', 
'auto'], value: 'auto',
description: 'Enable Xnest nested X server')
 option('dmx', type: 'boolean', value: false,
description: 'Enable DMX nested X server')
+option('xvfb', type: 'boolean', value: true,
+   description: 'Enable Xvfb X server')
 option('xwin', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto',
description: 'Enable XWin X server')
 
-- 
2.13.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

<    4   5   6   7   8   9   10   11   >