[PATCH xserver 6/7 v2] sync: Convert from "CARD64" to int64_t.

2017-08-04 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.  This interfered
with protocol headers using CARD64 to try to actually store a
uint64_t.  Now that stdint.h exists, let's just use that here,
instead.

v2: Fix alarm delta changes.

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

[PATCH xserver 5.5/7] test: Extend sync tests to cover alarm delta and waitvalue changes.

2017-08-04 Thread Eric Anholt
This would be squashed into the other tests.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 test/sync/sync.c | 71 ++--
 1 file changed, 69 insertions(+), 2 deletions(-)

diff --git a/test/sync/sync.c b/test/sync/sync.c
index c39774246841..f25d3fa3774a 100644
--- a/test/sync/sync.c
+++ b/test/sync/sync.c
@@ -38,13 +38,18 @@ static const int64_t some_values[] = {
 };
 
 static int64_t
+pack_sync_value(xcb_sync_int64_t val)
+{
+return ((int64_t)val.hi << 32) | val.lo;
+}
+
+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);
+int64_t value = pack_sync_value(reply->counter_value);
 
 free(reply);
 return value;
@@ -216,6 +221,66 @@ test_change_counter_overflow(xcb_connection_t *c)
 }
 }
 
+static void
+test_change_alarm_value(xcb_connection_t *c)
+{
+xcb_sync_alarm_t alarm = xcb_generate_id(c);
+xcb_sync_query_alarm_cookie_t queries[ARRAY_SIZE(some_values)];
+
+xcb_sync_create_alarm(c, alarm, 0, NULL);
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+uint32_t values[] = { some_values[i] >> 32, some_values[i] };
+
+xcb_sync_change_alarm(c, alarm, XCB_SYNC_CA_VALUE, values);
+queries[i] = xcb_sync_query_alarm_unchecked(c, alarm);
+}
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+xcb_sync_query_alarm_reply_t *reply =
+xcb_sync_query_alarm_reply(c, queries[i], NULL);
+int64_t value = pack_sync_value(reply->trigger.wait_value);
+
+if (value != some_values[i]) {
+fprintf(stderr, "Setting alarm value to %lld returned %lld\n",
+(long long)some_values[i],
+(long long)value);
+exit(1);
+}
+free(reply);
+}
+}
+
+static void
+test_change_alarm_delta(xcb_connection_t *c)
+{
+xcb_sync_alarm_t alarm = xcb_generate_id(c);
+xcb_sync_query_alarm_cookie_t queries[ARRAY_SIZE(some_values)];
+
+xcb_sync_create_alarm(c, alarm, 0, NULL);
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+uint32_t values[] = { some_values[i] >> 32, some_values[i] };
+
+xcb_sync_change_alarm(c, alarm, XCB_SYNC_CA_DELTA, values);
+queries[i] = xcb_sync_query_alarm_unchecked(c, alarm);
+}
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+xcb_sync_query_alarm_reply_t *reply =
+xcb_sync_query_alarm_reply(c, queries[i], NULL);
+int64_t value = pack_sync_value(reply->delta);
+
+if (value != some_values[i]) {
+fprintf(stderr, "Setting alarm delta to %lld returned %lld\n",
+(long long)some_values[i],
+(long long)value);
+exit(1);
+}
+free(reply);
+}
+}
+
 int main(int argc, char **argv)
 {
 int screen;
@@ -231,6 +296,8 @@ int main(int argc, char **argv)
 test_set_counter(c);
 test_change_counter_basic(c);
 test_change_counter_overflow(c);
+test_change_alarm_value(c);
+test_change_alarm_delta(c);
 
 xcb_disconnect(c);
 exit(0);
-- 
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 1/2] travis: Set prefix to /usr, so we find xkbcomp.

2017-08-04 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 test/scripts/build-travis-deps.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/scripts/build-travis-deps.sh 
b/test/scripts/build-travis-deps.sh
index 213b51f6f161..b87c65d3e397 100755
--- a/test/scripts/build-travis-deps.sh
+++ b/test/scripts/build-travis-deps.sh
@@ -7,6 +7,6 @@ export XTEST_DIR=$TRAVIS_BUILD_DIR/xtest
 
 set -e
 
-meson build/
+meson --prefix=/usr build/
 ninja -C build/ install
 ninja -C build/ test
-- 
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/2] travis: Request a new docker image with xkb-data and xkbcomp installed.

2017-08-04 Thread Eric Anholt
Xvfb was erroring out with:

XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect
setup of xkeyboard-config.
(EE) Fatal server error:
(EE) Failed to activate virtual core keyboard: 2(EE)

With this change, we can now run my xsync regression test on Travis.

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

diff --git a/.travis.yml b/.travis.yml
index 00d7a485a29f..edeed0d90972 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ before_install:
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull 
anholt/xserver-travis ; fi
 
 before_script:
-  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM 
anholt/xserver-travis:v4 > Dockerfile ; fi
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM 
anholt/xserver-travis:v6 > Dockerfile ; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile 
; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit . ; fi
 
-- 
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

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

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

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>> 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.
>
> Xlib used XSync for this, which just does GetInputFocus to make sure
> that all requests have been processed and replies and errors
> retrieved. Is that not sufficient here?

So I GetInputFocus, force the reply, free the reply, then poll for
events in a little loop that's basically "if anything happened,
exit(1)"?


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 6/7] sync: Convert from "CARD64" to int64_t.

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

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>> 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.
>
> Really, CARD64 was a *signed* value?

Right?!


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 3/3] glamor: Scissor Render composite operations to the bounds of the drawing.

2017-08-03 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).

v2: Make the jump to the exit land after scissor disable.

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..3f982a2d2221 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_va;
+
+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,
 }
 }
 
+glDisable(GL_SCISSOR_TEST);
+disable_va:
 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 1/3] glamor: Scissor rectangle drawing to the bounds of the rects.

2017-08-03 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)

v2: Clamp rectangle bounds addition.

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..f1f8f5633a1a 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 = min(SHRT_MAX, max(bounds->x2, rect->x + rect->width));
+bounds->y2 = min(SHRT_MAX, 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 2/3] glamor: Scissor CopyArea to the bounds of the drawing.

2017-08-03 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 f1f8f5633a1a..6e9d88674738 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 = min(SHRT_MAX, 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

Re: [PATCH dri3proto v2] Add modifier/multi-plane requests, bump to v1.1

2017-08-03 Thread Eric Anholt
Daniel Stone  writes:

> On 28 July 2017 at 16:51, Keith Packard  wrote:
>> Michel Dänzer  writes:
>>> Declaring where? Once a pixmap is created, it only has a depth, no
>>> format, so there's nothing to base on that e.g. CopyArea between two
>>> pixmaps of the same depth is undefined.
>>
>> I think we'd need some extension request which provides the format data
>> and other attributes. We can define the transformation of underlying
>> data into depth-based pixel data to match core drawing.
>>
>>> I'm getting less and less convinced that any reference at all to formats
>>> in the context of pixmaps in the DRI3 specification is a good idea.
>>
>> Well, if we want to deal with YUV or compressed data, then we'd better
>> find a way to describe the contents of the buffer returned by
>> DRI3BufferFromPixmap.
>>
>> However, it would also be 'nice' if the underlying raw data could be
>> accessed over the wire (ala PutImage/GetImage). Perhaps a different
>> extension which talks about new formats (including deep color?) and
>> provides for Get/Put semantics?
>
> Yeah. Support for YUV in all its varied and wonderful forms, extended
> RGB primaries/encodings (DCI.P3/etc/etc) would sure be nice to have at
> some stage, but conflating it with a specific buffer-creation
> mechanism seems to be the wrong place to do it. (See, e.g. the HDR
> work.)
>
> I think Michel is right here, and we're best off keeping the DRI3
> extensions as a very pure addition of the buffer storage details
> (tiling/compression). How to then interpret the Pixmap that creates
> can be a separate extension which deals with colourspaces, in a way
> which also works for SHM content, works for NVIDIA, etc.

If we can successfully talk modifiers and the aux planes just using
depth and bpp without a fourcc, I agree that this is the right way to go
for now.

VC4's modifier is fine and well-defined based just on bpp (and this
should be the case for VC5 as well).


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 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 7/7] sync: Clean up a bit of header formatting.

2017-08-03 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 miext/sync/misyncstr.h | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/miext/sync/misyncstr.h b/miext/sync/misyncstr.h
index 084ca4c82d9d..a0a0a98146b4 100644
--- a/miext/sync/misyncstr.h
+++ b/miext/sync/misyncstr.h
@@ -49,7 +49,7 @@ typedef struct _SyncObject {
 typedef struct _SyncCounter {
 SyncObject sync;/* Common sync object data */
 int64_t value;  /* counter value */
-struct _SysCounterInfo *pSysCounterInfo;/* NULL if not a system 
counter */
+struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
 } SyncCounter;
 
 struct _SyncFence {
@@ -66,13 +66,10 @@ struct _SyncTrigger {
 unsigned int value_type;/* Absolute or Relative */
 unsigned int test_type; /* transition or Comparision type */
 int64_t test_value; /* trigger event threshold value */
-Bool (*CheckTrigger) (struct _SyncTrigger * /*pTrigger */ ,
-  int64_t/*newval */
-);
-void (*TriggerFired) (struct _SyncTrigger * /*pTrigger */
-);
-void (*CounterDestroyed) (struct _SyncTrigger * /*pTrigger */
-);
+Bool (*CheckTrigger)(struct _SyncTrigger *pTrigger,
+  int64_t newval);
+void (*TriggerFired)(struct _SyncTrigger *pTrigger);
+void (*CounterDestroyed)(struct _SyncTrigger *pTrigger);
 };
 
 typedef struct _SyncTriggerList {
-- 
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

[PATCH xserver 4/7] test: Return error from simple-xinit if the client crashes.

2017-08-03 Thread Eric Anholt
I want to be able to call client tests with simple-xinit, so assertion
failures should be an error.

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

diff --git a/test/simple-xinit.c b/test/simple-xinit.c
index 89189a609c19..78d546c71e49 100644
--- a/test/simple-xinit.c
+++ b/test/simple-xinit.c
@@ -25,6 +25,7 @@
 #include 
 #endif
 
+#include 
 #include 
 #include 
 #include 
@@ -133,6 +134,13 @@ start_client(char *const *client_args, int display)
 return 1;
 }
 
+if (WIFSIGNALED(wstatus))
+return 1;
+
+if (WCOREDUMP(wstatus))
+return 1;
+
+assert(WIFEXITED(wstatus));
 return WEXITSTATUS(wstatus);
 } else {
 execvp(client_args[0], client_args);
-- 
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/7] meson: Add Xvfb and Xephyr-glamor testing.

2017-08-03 Thread Eric Anholt
The Xvfb tests are passing and Xephyr-glamor is failing for me, but it
fails identically on autotools.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 meson.build  |  1 +
 test/meson.build | 24 
 test/scripts/xephyr-glamor-piglit.sh |  7 +++
 test/scripts/xvfb-piglit.sh  |  2 ++
 4 files changed, 34 insertions(+)
 create mode 100644 test/meson.build

diff --git a/meson.build b/meson.build
index 3efec0def027..ea2a01520eaa 100644
--- a/meson.build
+++ b/meson.build
@@ -426,3 +426,4 @@ libxserver = [
 libxserver += libxserver_dri3
 
 subdir('hw')
+subdir('test')
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index ..b71d7e24909d
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,24 @@
+simple_xinit = executable(
+'simple-xinit',
+'simple-xinit.c',
+include_directories: inc,
+)
+
+piglit_env = environment()
+piglit_env.set('XSERVER_DIR', meson.source_root())
+piglit_env.set('XSERVER_BUILDDIR', meson.build_root())
+
+if get_option('xvfb')
+test('xvfb-piglit', find_program('scripts/xvfb-piglit.sh'),
+env: piglit_env,
+timeout: 1200,
+)
+
+if get_option('xephyr') and build_glamor
+test('xephyr-glamor',
+find_program('scripts/xephyr-glamor-piglit.sh'),
+env: piglit_env,
+timeout: 1200,
+)
+endif
+endif
diff --git a/test/scripts/xephyr-glamor-piglit.sh 
b/test/scripts/xephyr-glamor-piglit.sh
index 51d42c313643..e38a3276d590 100755
--- a/test/scripts/xephyr-glamor-piglit.sh
+++ b/test/scripts/xephyr-glamor-piglit.sh
@@ -1,3 +1,10 @@
+#!/bin/sh
+
+# this times out on Travis, because the tests take too long.
+if test "x$TRAVIS_ROOT" != "x"; then
+exit 77
+fi
+
 # Start a Xephyr server using glamor.  Since the test environment is
 # headless, we start an Xvfb first to host the Xephyr.
 export PIGLIT_RESULTS_DIR=$XSERVER_BUILDDIR/test/piglit-results/xephyr-glamor
diff --git a/test/scripts/xvfb-piglit.sh b/test/scripts/xvfb-piglit.sh
index 763599ef4ce9..a3aa663b50a1 100755
--- a/test/scripts/xvfb-piglit.sh
+++ b/test/scripts/xvfb-piglit.sh
@@ -1,3 +1,5 @@
+#!/bin/sh
+
 export SERVER_COMMAND="$XSERVER_BUILDDIR/hw/vfb/Xvfb \
 -noreset \
 -screen scrn 1280x1024x24"
-- 
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 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 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,

Re: [PATCH xserver 1/3] glamor: Scissor rectangle drawing to the bounds of the rects.

2017-08-02 Thread Eric Anholt
Michel Dänzer <mic...@daenzer.net> writes:

> On 02/08/17 05:59 AM, Eric Anholt wrote:
>> 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]);
>> +}
>
> Did your testing hit the nrect == 99 cases? I'd expect those to have the
> most potential impact on throughput.

No, I didn't.  However, the other two patches were nrect=1 cases in
x11perf, which I think would be even more impacted than nrect=99, and
they showed improvements.


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

Re: [PATCH xserver] glx: Allow arbitrary context attributes for direct contexts

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

> On Fri, 2017-07-28 at 09:56 -0700, Eric Anholt wrote:
>> Adam Jackson <a...@redhat.com> 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 <a...@redhat.com>
>> 
>> Does the client side even need to send the client-side attributes for
>> direct contexts?
>
> It would probably be legal for it to not? The ARB_create_context spec,
> discussing why direct/indirect is a parameter not an attribute, says
> "... different paths to the server may be taken for creating direct
> contexts, and parsing the attribute list in the client should not be
> required". One could read that to mean that creating the server-side of
> a direct context needn't be exactly like creating an indirect context,
> that you could send only those attributes the server needs to be aware
> of (although doing this would mean parsing the attribute list in the
> client, which the issue is otherwise trying to avoid...)
>
> However, none of the GLX extensions that define new context attributes
> seem to define whether that attrib is client or server state, and
> Mesa's glXCreateContextAttribsARB does not edit the attribute list
> before sending it to the server. It seems simpler to me for the server
> ignore unknown attribs for direct contexts than for Mesa to grow a list
> of attributes to censor, because e.g. ARB_create_context_no_error would
> then be exactly as easy to wire up for direct GLX as for EGL.

My thinking was: if we do it client side, then new Mesa works even with
old X.  That said, the fix here is trivial, so let's do it anyway.

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

Re: [PATCH dri3proto v2] Add modifier/multi-plane requests, bump to v1.1

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

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>> That's what both patch 5 of this series and pixman say the depth is for
>> bgrx.  I think things have only worked because nobody uses bgrx
>> with Render and also tries to do core operations with those contents,
>> but I think we should figure out what we actually want the behavior to
>> be here.
>
> The core protocol uses the low bits in a pixel; is there actually
> translation code which shifts things around as necessary to make this
> work?

Ah, I was misled by looking at Pixman.  Render handles the depth of
formats in an interesting way.  From a quick hack of rendercheck:

Found server-supported format: a8 8 depth
Found server-supported format: a4 4 depth
Found server-supported format: a8r8g8b8 32 depth
Found server-supported format: x8r8g8b8 32 depth
Found server-supported format: b8g8r8a8 32 depth
Found server-supported format: b8g8r8x8 32 depth
Found server-supported format: r8g8b8 24 depth
Found server-supported format: b8g8r8 24 depth
Found server-supported format: x3r4g4b4 15 depth
Found server-supported format: x3b4g4r4 15 depth
Found server-supported format: r5g5b5 15 depth
Found server-supported format: b5g5r5 15 depth
Found server-supported format: x4r4g4b4 16 depth
Found server-supported format: x4b4g4r4 16 depth
Found server-supported format: x1r5g5b5 16 depth
Found server-supported format: x1b5g5r5 16 depth
Found server-supported format: r5g6b5 16 depth
Found server-supported format: b5g6r5 16 depth
Found server-supported format: a4r4g4b4 16 depth
Found server-supported format: a4b4g4r4 16 depth
Found server-supported format: x8b8g8r8 32 depth
Found server-supported format: x2r10g10b10 32 depth
Found server-supported format: x2b10g10r10 32 depth

Note here that b8g8r8x8 couldn't be used with a depth 24 pixmap -- it's
only advertised under 32 depth.  The r8g8b8 and x8r8g8b8 I believe
internally are the same PictFormat, it's just advertised under both 24
and 32bpp.  (picture.c's PictureCreateDefaultFormats() for reference)

>> I don't think we want to define that CopyArea from XRGB to BGRX
>> shifts the 24 bits of depth up by 8 within the 32bpp pixels.
>
> I don't think you have a choice if you actually report BGRX as depth
> 24 -- you're going to have depth 24 pixmaps and they'll have to work
> with both.

I think one option would be to have this extension create pixmaps with a
depth equal to the highest populated bit of the fourcc plus one.  Sure,
it's weird that rgbx and xrgb888 have a different depth, but "depth"
is a pretty awful concept 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: [RFC xserver 05/16] DRI3/Glamor: Implement PixmapFromBuffers request

2017-07-27 Thread Eric Anholt
Daniel Stone  writes:

> From: Louis-Francis Ratté-Boulianne 
>
> Signed-off-by: Louis-Francis Ratté-Boulianne 
> Signed-off-by: Daniel Stone 
> ---

> +{ .format = DRM_FORMAT_ARGB2101010, .depth = 30, .bpp = 32 },
> +{ .format = DRM_FORMAT_ABGR2101010, .depth = 30, .bpp = 32 },
> +{ .format = DRM_FORMAT_RGBA1010102, .depth = 30, .bpp = 32 },
> +{ .format = DRM_FORMAT_BGRA1010102, .depth = 30, .bpp = 32 },

Regardless of the resolution of the core rendering/depth/etc discussion
elsewhere, these 4 would be depth 32.


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 dri3proto v2] Add modifier/multi-plane requests, bump to v1.1

2017-07-27 Thread Eric Anholt
Michel Dänzer <mic...@daenzer.net> writes:

> [ Unknown signature status ]
> On 27/07/17 07:38 AM, Eric Anholt wrote:
>> Michel Dänzer <mic...@daenzer.net> writes:
>> 
>>> [ Unknown signature status ]
>>> On 26/07/17 06:20 AM, Eric Anholt wrote:
>>>> Daniel Stone <dani...@collabora.com> writes:
>>>>
>>>>> DRI3 version 1.1 adds support for explicit format modifiers, including
>>>>> multi-planar buffers.
>>>>
>>>> I still want proper 64-bit values, and I don't think the little XSync
>>>> mess will be much of a blocker.
>>>>
>>>>> Signed-off-by: Daniel Stone <dani...@collabora.com>
>>>
>>> [...]
>>>
>>>>> + combined to specify a single logical source for pixel
>>>>> + sampling: 'num_buffers' may be set from 1 (single buffer,
>>>>> + akin to PixmapFromBuffer) to 4. This is the number of file
>>>>> + descriptors which will be sent with this request; one per
>>>>> + buffer.
>>>>> + 
>>>>> + The exact configuration of the buffer is specified by 'format',
>>>>> + a DRM FourCC format token as defined in that project's
>>>>> + drm_fourcc.h header, in combination with the modifier.
>>>>> +
>>>>> + Modifiers allow explicit specification of non-linear sources,
>>>>> + such as tiled or compressed buffers. 'modifier_hi' (the most
>>>>> + significant 32 bits of a 64-bit value) and 'modifier_lo' are
>>>>> + combined to produce a single DRM format modifier token, again
>>>>> + as defined in drm_fourcc.h. The combination of format and
>>>>> + modifier allows unambiguous declaration of the buffer layout
>>>>> + in a manner defined by the DRM tokens.
>>>>> +
>>>>> + DRM_FORMAT_MOD_INVALID may be passed for 'modifier', in which
>>>>> + case the driver may make its own inference as to the exact
>>>>> + layout of the buffer(s).
>>>>> +
>>>>> + 'width' and 'height' describe the geometry (in pixels) of the
>>>>> + logical pixel-sample source.
>>>>> +
>>>>> + 'strideN' and 'offsetN' define the number of bytes per logical
>>>>> + scanline, and the distance in bytes from the beginning of the
>>>>> + buffer passed for that plane until the start of the sample
>>>>> + source for that plane, respectively for plane N. If the plane
>>>>> + is not used according to the format and modifier specification,
>>>>> + both values for that plane must be zero.
>>>>> +
>>>>> + Precisely how any additional information about the buffer is
>>>>> + shared is outside the scope of this extension.
>>>>> +
>>>>> + If the buffer(s) cannot be used with the screen associated with
>>>>> + 'pixmap', a Match error is returned.
>>>>> +
>>>>> + If the format and modifier combination is not supported by the
>>>>> + screen, a Value error is returned.
>>>>
>>>> Should we be specifying how the depth of the Pixmap is determined from
>>>> the fourcc?  Should we be specifying if X11 rendering works on various
>>>> fourccs, and between pixmaps of different fourccs?  It's not clear to me
>>>> what glamor would need to be able to do with these pixmaps (can I
>>>> CopyArea between XRGB888 and BGRX?  What does that even mean?)
>>>
>>> X11 pixmaps provide storage for n bits per pixel, where n is the pixmap
>>> depth. CopyArea between pixmaps just copies the bits in the source to
>>> the destination verbatim. Note that this is only possible if both
>>> pixmaps have the same depth.
>> 
>> Right.  So is the plan that XRGB888 to BGRX (both depth 24)
>
> I don't see how those can both be depth 24.

That's what both patch 5 of this series and pixman say the depth is for
bgrx.  I think things have only worked because nobody uses bgrx
with Render and also tries to do core operations with those contents,
but I think we should figure out what we actually want the behavior to
be here.

I don't think we want to define that CopyArea from XRGB to BGRX
shifts the 24 bits of depth up by 8 within the 32bpp pixels.  One of the
options might be to say something along the lines of "core rendering
between pixmaps of different drm_fourccs is undefined".  I think
figuring out what the exact requirement would be takes a bit more
thought, though.


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 dri3proto v2] Add modifier/multi-plane requests, bump to v1.1

2017-07-26 Thread Eric Anholt
Michel Dänzer <mic...@daenzer.net> writes:

> [ Unknown signature status ]
> On 26/07/17 06:20 AM, Eric Anholt wrote:
>> Daniel Stone <dani...@collabora.com> writes:
>> 
>>> DRI3 version 1.1 adds support for explicit format modifiers, including
>>> multi-planar buffers.
>> 
>> I still want proper 64-bit values, and I don't think the little XSync
>> mess will be much of a blocker.
>> 
>>> Signed-off-by: Daniel Stone <dani...@collabora.com>
>
> [...]
>
>>> +   combined to specify a single logical source for pixel
>>> +   sampling: 'num_buffers' may be set from 1 (single buffer,
>>> +   akin to PixmapFromBuffer) to 4. This is the number of file
>>> +   descriptors which will be sent with this request; one per
>>> +   buffer.
>>> +   
>>> +   The exact configuration of the buffer is specified by 'format',
>>> +   a DRM FourCC format token as defined in that project's
>>> +   drm_fourcc.h header, in combination with the modifier.
>>> +
>>> +   Modifiers allow explicit specification of non-linear sources,
>>> +   such as tiled or compressed buffers. 'modifier_hi' (the most
>>> +   significant 32 bits of a 64-bit value) and 'modifier_lo' are
>>> +   combined to produce a single DRM format modifier token, again
>>> +   as defined in drm_fourcc.h. The combination of format and
>>> +   modifier allows unambiguous declaration of the buffer layout
>>> +   in a manner defined by the DRM tokens.
>>> +
>>> +   DRM_FORMAT_MOD_INVALID may be passed for 'modifier', in which
>>> +   case the driver may make its own inference as to the exact
>>> +   layout of the buffer(s).
>>> +
>>> +   'width' and 'height' describe the geometry (in pixels) of the
>>> +   logical pixel-sample source.
>>> +
>>> +   'strideN' and 'offsetN' define the number of bytes per logical
>>> +   scanline, and the distance in bytes from the beginning of the
>>> +   buffer passed for that plane until the start of the sample
>>> +   source for that plane, respectively for plane N. If the plane
>>> +   is not used according to the format and modifier specification,
>>> +   both values for that plane must be zero.
>>> +
>>> +   Precisely how any additional information about the buffer is
>>> +   shared is outside the scope of this extension.
>>> +
>>> +   If the buffer(s) cannot be used with the screen associated with
>>> +   'pixmap', a Match error is returned.
>>> +
>>> +   If the format and modifier combination is not supported by the
>>> +   screen, a Value error is returned.
>> 
>> Should we be specifying how the depth of the Pixmap is determined from
>> the fourcc?  Should we be specifying if X11 rendering works on various
>> fourccs, and between pixmaps of different fourccs?  It's not clear to me
>> what glamor would need to be able to do with these pixmaps (can I
>> CopyArea between XRGB888 and BGRX?  What does that even mean?)
>
> X11 pixmaps provide storage for n bits per pixel, where n is the pixmap
> depth. CopyArea between pixmaps just copies the bits in the source to
> the destination verbatim. Note that this is only possible if both
> pixmaps have the same depth.

Right.  So is the plan that XRGB888 to BGRX (both depth 24) will
actually shift around the bits during the copy?


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 dri3proto v2] Add modifier/multi-plane requests, bump to v1.1

2017-07-25 Thread Eric Anholt
Daniel Stone  writes:

> DRI3 version 1.1 adds support for explicit format modifiers, including
> multi-planar buffers.

I still want proper 64-bit values, and I don't think the little XSync
mess will be much of a blocker.

> Signed-off-by: Daniel Stone 
> ---
>  dri3proto.h   | 142 ++-
>  dri3proto.txt | 300 
> +-
>  2 files changed, 438 insertions(+), 4 deletions(-)
>
> Sorry, this was supposed to get sent out with the revised patchset.
>
> Now with actual descriptive text.
>
> diff --git a/dri3proto.h b/dri3proto.h
> index ceddee8..442b714 100644
> --- a/dri3proto.h
> +++ b/dri3proto.h
> @@ -25,7 +25,7 @@
>  
>  #define DRI3_NAME"DRI3"
>  #define DRI3_MAJOR   1
> -#define DRI3_MINOR   0
> +#define DRI3_MINOR   1
>  
>  #define DRI3NumberErrors 0
>  #define DRI3NumberEvents 0
> @@ -37,7 +37,15 @@
>  #define X_DRI3FenceFromFD   4
>  #define X_DRI3FDFromFence   5
>  
> -#define DRI3NumberRequests   6
> +/* v1.1 */
> +#define xDRI3GetSupportedFormats 6
> +#define xDRI3GetSupportedModifiers   7
> +#define xDRI3PixmapFromBuffers   8
> +#define xDRI3BuffersFromPixmap   9
> +#define xDRI3FenceFromDMAFenceFD10
> +#define xDRI3DMAFenceFDFromFrence   11
> +
> +#define DRI3NumberRequests   12
>  
>  typedef struct {
>  CARD8   reqType;
> @@ -164,4 +172,134 @@ typedef struct {
>  
>  #define sz_xDRI3FDFromFenceReply   32
>  
> +/* v1.1 */
> +
> +typedef struct {
> +CARD8   reqType;
> +CARD8   dri3ReqType;
> +CARD16  length B16;
> +CARD32  window B32;
> +} xDRI3GetSupportedFormatsReq;
> +#define sz_xDRI3GetSupportedFormatsReq 8
> +
> +typedef struct {
> +BYTEtype;   /* X_Reply */
> +CARD8   pad1;
> +CARD16  sequenceNumber B16;
> +CARD32  length B32;
> +CARD32  numFormats B32;
> +CARD32  pad12 B32;
> +CARD32  pad16 B32;
> +CARD32  pad20 B32;
> +CARD32  pad24 B32;
> +CARD32  pad28 B32;
> +} xDRI3GetSupportedFormatsReply;
> +#define sz_xDRI3GetSupportedFormatsReply   32
> +
> +typedef struct {
> +CARD8   reqType;
> +CARD8   dri3ReqType;
> +CARD16  length B16;
> +CARD32  window B32;
> +CARD32  format B32;
> +} xDRI3GetSupportedModifiersReq;
> +#define sz_xDRI3GetSupportedModifiersReq 12
> +
> +typedef struct {
> +BYTEtype;   /* X_Reply */
> +CARD8   pad1;
> +CARD16  sequenceNumber B16;
> +CARD32  length B32;
> +CARD32  format B32;
> +CARD32  numModifiers B32;
> +CARD32  pad16 B32;
> +CARD32  pad20 B32;
> +CARD32  pad24 B32;
> +CARD32  pad28 B32;
> +} xDRI3GetSupportedModifiersReply;
> +#define sz_xDRI3GetSupportedModifiersReply   32
> +
> +typedef struct {
> +CARD8   reqType;
> +CARD8   dri3ReqType;
> +CARD16  length B16;
> +CARD32  pixmap B32;
> +CARD32  drawable B32;
> +CARD8   num_buffers; /* Number of file descriptors passed */
> +CARD8   pad13;
> +CARD16  pad14 B16;
> +CARD16  width B16;
> +CARD16  height B16;
> +CARD32  stride0 B32;
> +CARD32  offset0 B32;
> +CARD32  stride1 B32;
> +CARD32  offset1 B32;
> +CARD32  stride2 B32;
> +CARD32  offset2 B32;
> +CARD32  stride3 B32;
> +CARD32  offset3 B32;
> +CARD32  format B32;
> +CARD32  modifier_hi B32;
> +CARD32  modifier_lo B32;
> +} xDRI3PixmapFromBuffersReq;
> +#define sz_xDRI3PixmapFromBuffersReq 64
> +
> +typedef struct {
> +CARD8   reqType;
> +CARD8   dri3ReqType;
> +CARD16  length B16;
> +CARD32  pixmap B32;
> +} xDRI3BuffersFromPixmapReq;
> +#define sz_xDRI3BuffersFromPixmapReq 8
> +
> +typedef struct {
> +BYTEtype;   /* X_Reply */
> +CARD8   nfd;/* Number of file descriptors returned */
> +CARD16  sequenceNumber B16;
> +CARD32  length B32;
> +CARD16  width B16;
> +CARD16  height B16;
> +CARD32  format B32;
> +CARD32  modifier_hi B32;
> +CARD32  modifier_lo B32;
> +CARD32  pad24 B32;
> +CARD32  pad28 B32;
> +} xDRI3BuffersFromPixmapReply;
> +#define sz_xDRI3BuffersFromPixmapReply   32
> +
> +typedef struct {
> +CARD8   reqType;
> +CARD8   dri3ReqType;
> +CARD16  length B16;
> +CARD32  drawable B32;
> +CARD32  fence B32;
> +} xDRI3FenceFromDMAFenceFDReq;
> +
> +#define sz_xDRI3FenceFromDMAFenceFDReq  12
> +
> +typedef struct {
> +CARD8   reqType;
> +CARD8   dri3ReqType;
> +CARD16  length B16;
> +CARD32  drawable B32;
> +CARD32  fence B32;
> +} xDRI3DMAFenceFDFromFenceReq;
> +
> +#define sz_xDRI3DMAFenceFDFromFenceReq  12
> +
> +typedef struct {
> +BYTEtype;   /* X_Reply */
> +CARD8   nfd;/* Number of file descriptors returned (1) */
> +CARD16  sequenceNumber B16;
> +CARD32  length B32;
> +CARD32  pad08 B32;
> +

Re: [RFC dri3proto 01/16] Add modifier/multi-plane requests, bump to v1.1

2017-07-25 Thread Eric Anholt
Daniel Stone <dan...@fooishbar.org> writes:

> On 17 June 2017 at 02:21, Eric Anholt <e...@anholt.net> wrote:
>> With the Present extension, we started putting CARD64s on the wire.
>> Let's use them here, too.
>
> Mm, we did have that originally, but anyone including XSync headers
> very helpfully gets #define CARD64 XSyncValue, which blows up into int
> + unsigned int. This includes dri3_request.c, which pulls in syncsrv.h
> -> misyncstr.h:
> ../../dri3/dri3_request.c: In function ‘proc_dri3_get_supported_modifiers’:
> ../../dri3/dri3_request.c:407:23: error: invalid initializer
>  CARD64 modifier = 0;
>^
> ../../dri3/dri3_request.c:431:6: error: conversion to non-scalar type 
> requested
>   modifier = (CARD64) (modifiers_hi[i] << 32);
>   ^~~~
>
> I'd originally thought that came from the server-only part of
> xexxtproto/syncstr.h, but turns out it's actually just in
> miext/sync/misyncstr.h. So I guess we could run s/CARD64/XSyncValue/
> across sync, but it would (at least theoretically) be an API break.

I took a look at that, and it seems like a good plan.  Would you be up
for taking care of it, or should I put it on my list?

(Though, really, I wish CARD* would die in a fire.  We have stdint 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] glamor: remove no longer needed KHR_gl_texture_2D_image requirement

2017-06-29 Thread Eric Anholt
Emil Velikov  writes:

> From: Emil Velikov 
>
> The code that needed it was introduced with commit 7cfd9cc2327 ("Add
> DRI3 support to glamor") back in 2013. And was nuked a couple of years
> ago with commit 51984dddfcc ("glamor: Delay making pixmaps shareable
> until we need to.")

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

Re: [PATCH xserver 2/2] meson: Make VBE and VGAHW modules optional

2017-06-19 Thread Eric Anholt
Jon Turney <jon.tur...@dronecode.org.uk> writes:

> Don't build them on platforms where they aren't meaningful.
>
> Note that autoconf defines WITH_VGAHW when building the VGAHW module, but
> that doesn't seem to be used anywhere, so we just drop that.

both patches are:

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 dri3proto 01/16] Add modifier/multi-plane requests, bump to v1.1

2017-06-16 Thread Eric Anholt
Daniel Stone  writes:

> DRI3 version 1.1 adds support for explicit format modifiers, including
> multi-planar buffers.
>
> Signed-off-by: Daniel Stone 
> ---
>  dri3proto.h | 142 
> +++-
>  1 file changed, 140 insertions(+), 2 deletions(-)
>
> diff --git a/dri3proto.h b/dri3proto.h
> index ceddee8..767f420 100644
> --- a/dri3proto.h
> +++ b/dri3proto.h
> @@ -25,7 +25,7 @@
>  
>  #define DRI3_NAME"DRI3"
>  #define DRI3_MAJOR   1
> -#define DRI3_MINOR   0
> +#define DRI3_MINOR   1
>  
>  #define DRI3NumberErrors 0
>  #define DRI3NumberEvents 0
> @@ -37,7 +37,15 @@
>  #define X_DRI3FenceFromFD   4
>  #define X_DRI3FDFromFence   5
>  
> -#define DRI3NumberRequests   6
> +/* v1.1 */
> +#define xDRI3GetSupportedFormats 6
> +#define xDRI3GetSupportedModifiers   7
> +#define xDRI3PixmapFromBuffers   8
> +#define xDRI3BuffersFromPixmap   9
> +#define xDRI3FenceFromDMAFenceFD10
> +#define xDRI3DMAFenceFDFromFrence   11
> +
> +#define DRI3NumberRequests   12
>  
>  typedef struct {
>  CARD8   reqType;
> @@ -164,4 +172,134 @@ typedef struct {
>  
>  #define sz_xDRI3FDFromFenceReply   32
>  
> +/* v1.1 */
> +
> +typedef struct {
> +CARD8   reqType;
> +CARD8   dri3ReqType;
> +CARD16  length B16;
> +CARD32  window B32;
> +} xDRI3GetSupportedFormatsReq;
> +#define sz_xDRI3GetSupportedFormatsReq 8
> +
> +typedef struct {
> +BYTEtype;   /* X_Reply */
> +CARD8   pad1;
> +CARD16  sequenceNumber B16;
> +CARD32  length B32;
> +CARD32  numFormats B32;
> +CARD32  pad12 B32;
> +CARD32  pad16 B32;
> +CARD32  pad20 B32;
> +CARD32  pad24 B32;
> +CARD32  pad28 B32;
> +} xDRI3GetSupportedFormatsReply;
> +#define sz_xDRI3GetSupportedFormatsReply   32
> +
> +typedef struct {
> +CARD8   reqType;
> +CARD8   dri3ReqType;
> +CARD16  length B16;
> +CARD32  window B32;
> +CARD32  format B32;
> +} xDRI3GetSupportedModifiersReq;
> +#define sz_xDRI3GetSupportedModifiersReq 12
> +
> +typedef struct {
> +BYTEtype;   /* X_Reply */
> +CARD8   pad1;
> +CARD16  sequenceNumber B16;
> +CARD32  length B32;
> +CARD32  format B32;
> +CARD32  numModifiers B32;
> +CARD32  pad16 B32;
> +CARD32  pad20 B32;
> +CARD32  pad24 B32;
> +CARD32  pad28 B32;
> +} xDRI3GetSupportedModifiersReply;
> +#define sz_xDRI3GetSupportedModifiersReply   32
> +
> +typedef struct {
> +CARD8   reqType;
> +CARD8   dri3ReqType;
> +CARD16  length B16;
> +CARD32  pixmap B32;
> +CARD32  drawable B32;
> +CARD8   num_buffers; /* Number of file descriptors passed */
> +CARD8   pad13;
> +CARD16  pad14 B16;
> +CARD16  width B16;
> +CARD16  height B16;
> +CARD32  stride0 B32;
> +CARD32  offset0 B32;
> +CARD32  stride1 B32;
> +CARD32  offset1 B32;
> +CARD32  stride2 B32;
> +CARD32  offset2 B32;
> +CARD32  stride3 B32;
> +CARD32  offset3 B32;
> +CARD32  format B32;
> +CARD32  modifier_hi B32;
> +CARD32  modifier_lo B32;

With the Present extension, we started putting CARD64s on the wire.
Let's use them here, too.

I don't really have other comments about the protocol yet, without the
documentation.


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/4] glamor: Drop glamor_set_screen_pixmap().

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

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>> All that was left here was updating the FBO's size.  However, the FBO
>> size was always set correctly already through
>> glamor_set_pixmap_texture() from whoever had attached a new BO to the
>> pixmap.

>
> For the series:
>
> Reviewed-by: Keith Packard <kei...@keithp.com>

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] dmx: Remove includes of glxtokens.h

2017-06-02 Thread Eric Anholt
Our top-level glx.h include already provides all of the tokens we use,
and fixes redefinition warnings in the meson build.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/dmx/glxProxy/glxcmds.c | 1 -
 hw/dmx/glxProxy/glxcmdsswap.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index a77d556dbbda..330d5c4adb51 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -39,7 +39,6 @@
 #include "dmxsync.h"
 
 #include "glxserver.h"
-#include 
 #include "g_disptab.h"
 #include 
 #include 
diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index 5b1722d573c2..92ca512a724b 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -30,7 +30,6 @@
 
 #include "glxserver.h"
 #include "glxutil.h"
-#include 
 #include 
 #include 
 #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

Re: [PATCH 3/2 xserver] travis: Enable ccache.

2017-06-02 Thread Eric Anholt
Aaron Plattner <aplatt...@nvidia.com> writes:

> On 06/01/2017 01:59 PM, Eric Anholt wrote:
>> We bind-mount the cache directory into the container.  Cuts build time
>> from about 4 minutes to 2.
>> 
>> Signed-off-by: Eric Anholt <e...@anholt.net>
>> ---
>>   .travis.yml | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/.travis.yml b/.travis.yml
>> index e10cfe1e134f..0a136b23dd80 100644
>> --- a/.travis.yml
>> +++ b/.travis.yml
>> @@ -1,4 +1,5 @@
>>   language: c
>> +cache: ccache
>>   dist: trusty
>>   services: docker
>>   
>> @@ -6,9 +7,9 @@ before_install:
>> - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull 
>> anholt/xserver-travis ; fi
>>   
>>   before_script:
>> -  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM 
>> anholt/xserver-travis:v3 > Dockerfile ; fi
>> +  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM 
>> anholt/xserver-travis:v4 > Dockerfile ; fi
>> - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> 
>> Dockerfile ; fi
>> - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit . 
>> ; fi
>>   
>>   script:
>> -  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh 
>> -c "cd /root && ./test/scripts/travis-test.sh" ; fi
>> +  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run --volume 
>> $HOME/.ccache:/root/.ccache withgit /bin/sh -c "cd /root && 
>> ./test/scripts/travis-test.sh" ; fi
>
> This doesn't apply cleanly because the previous patch names it 
> build-travis-deps.sh rather than travis-test.sh. But with that fixed, 
> and running the commands manually, this series seems to work.
>
> With ccache, this took a whopping 17s on my medium-speed non-SSD 
> workstation.

Yeah, I missed the commit --amend of the previous patch (we're not
building deps any more, so I renamed it).

I hadn't considered using this scripting locally, but it may be an
interesting way to go, once we have xts hooked up in meson.


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] meson: Fix enabling of xshmfence.

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

> On Thu, Jun 01, 2017 at 04:48:07PM -0700, Eric Anholt wrote:
>> I misspelled the enable flag, so DRI3 would throw BadImplementation
>> when you tried to start any GL app.  Same as in
>> c7be7a688a78a34f61b90c0d95914e14b90b0cdc, we also convert it to #ifdef
>> for consistency.
>> 
>> Signed-off-by: Eric Anholt <e...@anholt.net>
>
> Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net>

Merged.  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] meson: Fix enabling of xshmfence.

2017-06-01 Thread Eric Anholt
I misspelled the enable flag, so DRI3 would throw BadImplementation
when you tried to start any GL app.  Same as in
c7be7a688a78a34f61b90c0d95914e14b90b0cdc, we also convert it to #ifdef
for consistency.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 Xext/sync.c | 4 ++--
 include/meson.build | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Xext/sync.c b/Xext/sync.c
index 4c4835929bfb..a8db0ec22371 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -919,7 +919,7 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
 int
 SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, 
BOOL initially_triggered)
 {
-#if HAVE_XSHMFENCE
+#ifdef HAVE_XSHMFENCE
 SyncFence  *pFence;
 int status;
 
@@ -945,7 +945,7 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, 
XID id, int fd, BOOL
 int
 SyncFDFromFence(ClientPtr client, DrawablePtr pDraw, SyncFence *pFence)
 {
-#if HAVE_XSHMFENCE
+#ifdef HAVE_XSHMFENCE
 return miSyncFDFromFence(pDraw, pFence);
 #else
 return BadImplementation;
diff --git a/include/meson.build b/include/meson.build
index 2f88828035a7..ef3163d1f106 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -62,7 +62,7 @@ conf_data.set('CONFIG_WSCONS', host_machine.system() == 
'openbsd')
 # that just uses whatever directory works?
 conf_data.set_quoted('SHMDIR', '/tmp')
 
-conf_data.set('XSHMFENCE', xshmfence_dep.found())
+conf_data.set('HAVE_XSHMFENCE', xshmfence_dep.found())
 conf_data.set('WITH_LIBDRM', libdrm_dep.found())
 conf_data.set('GLAMOR_HAS_DRM_NAME_FROM_FD_2',
   dependency('libdrm', version: '>= 2.4.74', required: 
false).found())
-- 
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/4] glamor: Drop glamor_set_screen_pixmap().

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

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>> All that was left here was updating the FBO's size.  However, the FBO
>> size was always set correctly already through
>> glamor_set_pixmap_texture() from whoever had attached a new BO to the
>> pixmap.
>
> I remember desperately needing this code at some point; do you have any
> idea what has changed which makes that no longer true?
>
> The key path to understand is when the screen is resized; I think
> server start up is at least easier to validate. My brain is starting to
> hurt from tracing this by hand

Basically I traced that we were currently calling set_pixmap_texture()
and decided that that was complicated enough to prove.  I'm betting that
my various other glamoregl cleanups happened to make this be true (there
are more cleanups in the pipeline, too)


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 3/2 xserver] travis: Enable ccache.

2017-06-01 Thread Eric Anholt
We bind-mount the cache directory into the container.  Cuts build time
from about 4 minutes to 2.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 .travis.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index e10cfe1e134f..0a136b23dd80 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,5 @@
 language: c
+cache: ccache
 dist: trusty
 services: docker
 
@@ -6,9 +7,9 @@ before_install:
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull 
anholt/xserver-travis ; fi
 
 before_script:
-  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM 
anholt/xserver-travis:v3 > Dockerfile ; fi
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM 
anholt/xserver-travis:v4 > Dockerfile ; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile 
; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit . ; fi
 
 script:
-  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c 
"cd /root && ./test/scripts/travis-test.sh" ; fi
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run --volume 
$HOME/.ccache:/root/.ccache withgit /bin/sh -c "cd /root && 
./test/scripts/travis-test.sh" ; fi
-- 
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] travis: Add a build script for Travis CI.

2017-06-01 Thread Eric Anholt
This currently does a meson build using a docker image I've prepared.
The Dockerfile source is at:

https://github.com/anholt/xserver-travis

Docker proved to be necessary to cut the build time per Travis push.
If some day we end up using meson in more of the X stack, we may be
able to move more dependencies out of the docker image and into the CI
build (putting the I in CI).  Until then, we'll have to do docker
image rebuilds when dependencies are added/updated.

To enable Travis CI on your github repository, see the first two steps
of the docs at:

https://docs.travis-ci.com/user/getting-started/

Once you do that, pushing branches to your github repo will trigger
builds, which will send you email if they fail.  Current build status
can be veiewed your account on travis-ci.org:

https://travis-ci.org/anholt/xserver
---
 .travis.yml   | 14 ++
 test/scripts/build-travis-deps.sh | 12 
 2 files changed, 26 insertions(+)
 create mode 100644 .travis.yml
 create mode 100755 test/scripts/build-travis-deps.sh

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index ..d7379ab7817e
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,14 @@
+language: c
+dist: trusty
+services: docker
+
+before_install:
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull 
anholt/xserver-travis ; fi
+
+before_script:
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM 
anholt/xserver-travis:v3 > Dockerfile ; fi
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile 
; fi
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit . ; fi
+
+script:
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c 
"cd /root && ./test/scripts/build-travis-deps.sh" ; fi
diff --git a/test/scripts/build-travis-deps.sh 
b/test/scripts/build-travis-deps.sh
new file mode 100755
index ..213b51f6f161
--- /dev/null
+++ b/test/scripts/build-travis-deps.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+export PREFIX=/usr
+export TRAVIS_BUILD_DIR=/root
+export PIGLIT_DIR=$TRAVIS_BUILD_DIR/piglit
+export XTEST_DIR=$TRAVIS_BUILD_DIR/xtest
+
+set -e
+
+meson build/
+ninja -C build/ install
+ninja -C build/ test
-- 
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/2] meson: Fix test for whether we've built glamor-EGL.

2017-06-01 Thread Eric Anholt
This matches the test we use for going into the glamor_egl subdir in
../../meson.build.
---
 hw/xfree86/drivers/modesetting/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xfree86/drivers/modesetting/meson.build 
b/hw/xfree86/drivers/modesetting/meson.build
index ab3227605bb2..c1546f62d783 100644
--- a/hw/xfree86/drivers/modesetting/meson.build
+++ b/hw/xfree86/drivers/modesetting/meson.build
@@ -31,7 +31,7 @@ symbol_test_args = []
 symbol_test_args += join_paths(xorg_build_root, 'libxorgserver.so')
 symbol_test_args += join_paths(xorg_build_root, 'dixmods', 'libfb.so')
 symbol_test_args += join_paths(xorg_build_root, 'dixmods', 'libshadow.so')
-if build_glamor
+if gbm_dep.found()
 symbol_test_args += join_paths(xorg_build_root, 'glamor_egl', 
'libglamoregl.so')
 endif
 symbol_test_args += join_paths(xorg_build_root, 'drivers', 'modesetting', 
'modesetting_drv.so')
-- 
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] glamor: Store the actual EGL/GLX context pointer in lastGLContext

2017-06-01 Thread Eric Anholt
Michel Dänzer <mic...@daenzer.net> writes:

> [ Unknown signature status ]
> On 01/06/17 03:00 AM, Eric Anholt wrote:
>> Michel Dänzer <mic...@daenzer.net> writes:
>> 
>>> From: Michel Dänzer <michel.daen...@amd.com>
>>>
>>> Fixes subtle breakage which could sometimes trigger after a server reset
>>> with multiple screens using glamor:
>>>
>>> Screen A enters glamor_close_screen last and calls various cleanup
>>> functions, which at some point call glamor_make_current to make sure
>>> screen x's GL context is current. This sets lastGLContext to screen A's
>>> _priv->ctx. Finally, glamor_close_screen calls
>>> glamor_release_screen_priv, which calls free(glamor_priv).
>>>
>>> Later, screen B enters glamor_init, which allocates a new glamor_priv.
>>> With bad luck, this can return the same pointer which was previously
>>> used for screen A's glamor_priv. So when screen B's glamor_init calls
>>> glamor_make_current, lastGLContext == _priv->ctx, so MakeCurrent
>>> isn't called for screen B's GL context, and the following OpenGL API
>>> calls triggered by glamor_init mess up screen A's GL context.
>>>
>>> The observeed end result of this was a crash in glamor_get_vbo_space
>>> because glamor_priv->vbo didn't match the GL context, though there might
>>> be other possible outcomes.
>>>
>>> Assigning the actual GL context pointer to lastGLContext prevents this
>>> by preventing the false negative test in glamor_make_current.
>> 
>> Thanks for debugging -- this sounds like a pain.
>
> Indeed, it was. :}
>
>
>> After this patch, don't we have a similar problem where we've freed the
>> old GL context, and the new GL context gets allocated at the old
>> address?  Shouldn't we just null out lastGLContext once we've destroyed
>> our old context in closescreen?
>
> The GL context isn't destroyed in CloseScreen, only in FreeScreen, which
> is only called when the server shuts down (if at all).
>
> Setting lastGLContext = NULL from CloseScreen would also prevent the
> problem; I considered doing that instead of or in addition to the fix in
> glamor_make_current, but finally decided against it because it would be
> more of a workaround than a fix for the actual problem (and could
> unnecessarily force a MakeCurrent call after a server reset in some cases).

I see now.  r-b.


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 3/4] glamor: Drop glamor_set_screen_pixmap().

2017-06-01 Thread Eric Anholt
All that was left here was updating the FBO's size.  However, the FBO
size was always set correctly already through
glamor_set_pixmap_texture() from whoever had attached a new BO to the
pixmap.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor.c  | 13 -
 glamor/glamor.h  |  6 --
 glamor/glamor_egl.c  |  1 -
 hw/xfree86/drivers/modesetting/drmmode_display.c |  5 -
 hw/xwayland/xwayland-glamor.c|  2 --
 5 files changed, 27 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 1cdc23e0b919..91236e29ce67 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -114,19 +114,6 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int 
tex)
 glamor_pixmap_attach_fbo(pixmap, fbo);
 }
 
-void
-glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap)
-{
-glamor_pixmap_private *pixmap_priv;
-glamor_screen_private *glamor_priv;
-
-glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
-pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
-
-pixmap_priv->fbo->width = screen_pixmap->drawable.width;
-pixmap_priv->fbo->height = screen_pixmap->drawable.height;
-}
-
 uint32_t
 glamor_get_pixmap_texture(PixmapPtr pixmap)
 {
diff --git a/glamor/glamor.h b/glamor/glamor.h
index b4fd76a6a46d..4ad28df17480 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -103,12 +103,6 @@ extern _X_EXPORT void glamor_fini(ScreenPtr screen);
  * Otherwise, the glamor internal structure will not be freed.*/
 extern _X_EXPORT Bool glamor_close_screen(ScreenPtr screen);
 
-/* Let glamor to know the screen's fbo. The low level
- * driver should already assign a tex
- * to this pixmap through the set_pixmap_texture. */
-extern _X_EXPORT void glamor_set_screen_pixmap(PixmapPtr screen_pixmap,
-   PixmapPtr *back_pixmap);
-
 extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap);
 
 extern _X_EXPORT void glamor_set_pixmap_texture(PixmapPtr pixmap,
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 193a04409ee8..b0d3e9efe2ee 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -144,7 +144,6 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int 
handle, int stride)
"Failed to create textured screen.");
 return FALSE;
 }
-glamor_set_screen_pixmap(screen_pixmap, NULL);
 return TRUE;
 }
 
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c 
b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 850888c94cf3..aa6baae09871 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1919,11 +1919,6 @@ drmmode_glamor_handle_new_screen_pixmap(drmmode_ptr 
drmmode)
 if (!drmmode_set_pixmap_bo(drmmode, screen_pixmap, >front_bo))
 return FALSE;
 
-#ifdef GLAMOR_HAS_GBM
-if (drmmode->glamor)
-glamor_set_screen_pixmap(screen_pixmap, NULL);
-#endif
-
 return TRUE;
 }
 
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index 63f230369df5..87622839eaf5 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -243,8 +243,6 @@ xwl_glamor_create_screen_resources(ScreenPtr screen)
 xwl_glamor_create_pixmap(screen, screen->width, screen->height,
  screen->rootDepth,
  CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
-if (screen->devPrivate)
-glamor_set_screen_pixmap(screen->devPrivate, NULL);
 }
 
 SetRootClip(screen, xwl_screen->root_clip_mode);
-- 
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/4] glamor: Remove the "delayed fallback" code.

2017-06-01 Thread Eric Anholt
The usage of this died with the old core rendering code.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_debug.h | 29 -
 glamor/glamor_priv.h  |  2 --
 2 files changed, 31 deletions(-)

diff --git a/glamor/glamor_debug.h b/glamor/glamor_debug.h
index 638bee20c400..f64c4483238a 100644
--- a/glamor/glamor_debug.h
+++ b/glamor/glamor_debug.h
@@ -29,8 +29,6 @@
 #ifndef __GLAMOR_DEBUG_H__
 #define __GLAMOR_DEBUG_H__
 
-#define GLAMOR_DELAYED_STRING_MAX 64
-
 #define GLAMOR_DEBUG_NONE 0
 #define GLAMOR_DEBUG_UNIMPL   0
 #define GLAMOR_DEBUG_FALLBACK 1
@@ -72,33 +70,6 @@ AbortServer(void)
 "Glamor fallback", \
 ##__VA_ARGS__);} while(0)
 
-#define glamor_delayed_fallback(_screen_, _format_,...)
\
-  do { \
-if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK)  {
\
-  glamor_screen_private *_glamor_priv_;\
-  _glamor_priv_ = glamor_get_screen_private(_screen_); \
-  _glamor_priv_->delayed_fallback_pending = 1; \
-  snprintf(_glamor_priv_->delayed_fallback_string, \
-  GLAMOR_DELAYED_STRING_MAX,   \
-  "glamor delayed fallback: \t%s " _format_ ,  \
-   __FUNCTION__, ##__VA_ARGS__); } } while(0)
-
-#define glamor_clear_delayed_fallbacks(_screen_)   \
-  do { \
-if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \
-  glamor_screen_private *_glamor_priv_;\
-   _glamor_priv_ = glamor_get_screen_private(_screen_);\
-  _glamor_priv_->delayed_fallback_pending = 0;  } } while(0)
-
-#define glamor_report_delayed_fallbacks(_screen_)  \
-  do { \
-if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \
-  glamor_screen_private *_glamor_priv_;\
-  _glamor_priv_ = glamor_get_screen_private(_screen_); \
-  LogMessageVerb(X_INFO, 0, "%s",  \
-_glamor_priv_->delayed_fallback_string);   \
-  _glamor_priv_->delayed_fallback_pending = 0;  } } while(0)
-
 #define DEBUGF(str, ...)  do {} while(0)
 //#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__)
 #define DEBUGRegionPrint(x) do {} while (0)
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 79962a5c1972..07a98efeb467 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -282,8 +282,6 @@ typedef struct glamor_screen_private {
 int radial_max_nstops;
 
 struct glamor_saved_procs saved_procs;
-char delayed_fallback_string[GLAMOR_DELAYED_STRING_MAX + 1];
-int delayed_fallback_pending;
 int flags;
 ScreenPtr screen;
 int dri3_enabled;
-- 
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/4] glamor_egl: Stop saving the EGL major/minor version.

2017-06-01 Thread Eric Anholt
We don't use them for anything.

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

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 354c30f68ea5..193a04409ee8 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -50,7 +50,6 @@
 struct glamor_egl_screen_private {
 EGLDisplay display;
 EGLContext context;
-EGLint major, minor;
 char *device_path;
 
 CreateScreenResourcesProcPtr CreateScreenResources;
@@ -648,8 +647,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 goto error;
 }
 
-if (!eglInitialize
-(glamor_egl->display, _egl->major, _egl->minor)) {
+if (!eglInitialize(glamor_egl->display, NULL, NULL)) {
 xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglInitialize() failed\n");
 glamor_egl->display = EGL_NO_DISPLAY;
 goto error;
-- 
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/4] glamor: Stop tracking the screen_fbo.

2017-06-01 Thread Eric Anholt
This means we no longer get "s" for on-screen drawing in glamor_debug,
and there's only "m" (CPU memory) or "f" (Any GPU memory, aka FBOs).
That seems fine to me.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor.c  | 1 -
 glamor/glamor_core.c | 5 +
 glamor/glamor_priv.h | 1 -
 3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 2467443e03af..1cdc23e0b919 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -122,7 +122,6 @@ glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr 
*back_pixmap)
 
 glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
 pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
-glamor_priv->screen_fbo = pixmap_priv->fbo->fb;
 
 pixmap_priv->fbo->width = screen_pixmap->drawable.width;
 pixmap_priv->fbo->height = screen_pixmap->drawable.height;
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index 610ae71f310b..cb315e2d1b90 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -40,12 +40,9 @@ glamor_get_drawable_location(const DrawablePtr drawable)
 {
 PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
 glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
-glamor_screen_private *glamor_priv =
-glamor_get_screen_private(drawable->pScreen);
+
 if (pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED)
 return 'm';
-if (pixmap_priv->fbo->fb == glamor_priv->screen_fbo)
-return 's';
 else
 return 'f';
 }
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index a90879a7bbfd..79962a5c1972 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -281,7 +281,6 @@ typedef struct glamor_screen_private {
 int linear_max_nstops;
 int radial_max_nstops;
 
-int screen_fbo;
 struct glamor_saved_procs saved_procs;
 char delayed_fallback_string[GLAMOR_DELAYED_STRING_MAX + 1];
 int delayed_fallback_pending;
-- 
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] Add meson.build for XWin server

2017-05-31 Thread Eric Anholt
Jon Turney <jon.tur...@dronecode.org.uk> writes:

> On 23/05/2017 00:17, Eric Anholt wrote:
>> Jon Turney <jon.tur...@dronecode.org.uk> writes:
>> 
>>> This needs a meson with PRs #1784, #1792 and #1794
>>>
>>> Future work: remove conditionals which are always on, and simplify redundant
>>> CYGDEBUG conditionals
>> 
>> This looks pretty good!  Just a few little cleanups I see.
>
> Thanks for taking a look.

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

I'm assuming you'll be committing this series.


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: Store the actual EGL/GLX context pointer in lastGLContext

2017-05-31 Thread Eric Anholt
Michel Dänzer  writes:

> From: Michel Dänzer 
>
> Fixes subtle breakage which could sometimes trigger after a server reset
> with multiple screens using glamor:
>
> Screen A enters glamor_close_screen last and calls various cleanup
> functions, which at some point call glamor_make_current to make sure
> screen x's GL context is current. This sets lastGLContext to screen A's
> _priv->ctx. Finally, glamor_close_screen calls
> glamor_release_screen_priv, which calls free(glamor_priv).
>
> Later, screen B enters glamor_init, which allocates a new glamor_priv.
> With bad luck, this can return the same pointer which was previously
> used for screen A's glamor_priv. So when screen B's glamor_init calls
> glamor_make_current, lastGLContext == _priv->ctx, so MakeCurrent
> isn't called for screen B's GL context, and the following OpenGL API
> calls triggered by glamor_init mess up screen A's GL context.
>
> The observeed end result of this was a crash in glamor_get_vbo_space
> because glamor_priv->vbo didn't match the GL context, though there might
> be other possible outcomes.
>
> Assigning the actual GL context pointer to lastGLContext prevents this
> by preventing the false negative test in glamor_make_current.

Thanks for debugging -- this sounds like a pain.

After this patch, don't we have a similar problem where we've freed the
old GL context, and the new GL context gets allocated at the old
address?  Shouldn't we just null out lastGLContext once we've destroyed
our old context in closescreen?

> Signed-off-by: Michel Dänzer 
> ---
>  glamor/glamor_utils.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
> index 6b88527e6..a35917c37 100644
> --- a/glamor/glamor_utils.h
> +++ b/glamor/glamor_utils.h
> @@ -723,8 +723,8 @@ glamor_is_large_pixmap(PixmapPtr pixmap)
>  static inline void
>  glamor_make_current(glamor_screen_private *glamor_priv)
>  {
> -if (lastGLContext != _priv->ctx) {
> -lastGLContext = _priv->ctx;
> +if (lastGLContext != glamor_priv->ctx.ctx) {
> +lastGLContext = glamor_priv->ctx.ctx;
>  glamor_priv->ctx.make_current(_priv->ctx);
>  }
>  }
> -- 
> 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


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] Add meson.build for XWin server

2017-05-22 Thread Eric Anholt
Jon Turney  writes:

> This needs a meson with PRs #1784, #1792 and #1794
>
> Future work: remove conditionals which are always on, and simplify redundant
> CYGDEBUG conditionals

This looks pretty good!  Just a few little cleanups I see.

> ---
>  hw/meson.build   |   4 +
>  hw/xwin/dri/meson.build  |  14 
>  hw/xwin/glx/meson.build  | 101 +++
>  hw/xwin/meson.build  | 170 
> +++
>  hw/xwin/winclipboard/meson.build |  31 +++
>  include/meson.build  |  35 ++--
>  include/xwin-config.h.meson.in   |  27 +++
>  meson.build  |  13 ++-
>  meson_options.txt|   5 ++
>  9 files changed, 393 insertions(+), 7 deletions(-)
>  create mode 100644 hw/xwin/dri/meson.build
>  create mode 100644 hw/xwin/glx/meson.build
>  create mode 100644 hw/xwin/meson.build
>  create mode 100644 hw/xwin/winclipboard/meson.build
>  create mode 100644 include/xwin-config.h.meson.in
>
> diff --git a/hw/meson.build b/hw/meson.build
> index c389a995b..c0d2db3f5 100644
> --- a/hw/meson.build
> +++ b/hw/meson.build
> @@ -23,3 +23,7 @@ endif
>  if build_xwayland
>  subdir('xwayland')
>  endif
> +
> +if build_xwin
> +subdir('xwin')
> +endif
> diff --git a/hw/xwin/dri/meson.build b/hw/xwin/dri/meson.build
> new file mode 100644
> index 0..0d8703c38
> --- /dev/null
> +++ b/hw/xwin/dri/meson.build
> @@ -0,0 +1,14 @@
> +srcs_windows_dri = [
> +'windowsdri.c',
> +'windowsdri.h',
> +]
> +
> +xwin_windowsdri = static_library(
> +'WindowsDRI',
> +srcs_windows_dri,
> +include_directories: [ inc, include_directories('../') ],
> +dependencies: [
> +windowsdri_dep,
> +pixman_dep,
> +],
> +)
> diff --git a/hw/xwin/glx/meson.build b/hw/xwin/glx/meson.build
> new file mode 100644
> index 0..5ce593c2b
> --- /dev/null
> +++ b/hw/xwin/glx/meson.build
> @@ -0,0 +1,101 @@
> +python3 = import('python3')
> +
> +# XWin requires OpenGL spec files in order to generate wrapper code for 
> native GL functions
> +py3 = python3.find_python()
> +if run_command(py3, '-c', 'import lxml;').returncode() != 0
> +error('python3 lxml module not found')
> +endif
> +
> +khronos_spec_dir = 
> dependency('khronos-opengl-registry').get_pkgconfig_variable('specdir')
> +
> +gen_gl_wrappers_opts= ['-nodebug']
> +gen_gl_wrappers_cmd = ['env', 'PYTHONPATH=' + khronos_spec_dir, py3, 
> files('./gen_gl_wrappers.py'), gen_gl_wrappers_opts]
> +
> +wgl_wrappers = custom_target(
> +'gen_wgl_wrappers',
> +command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-prefix', 'wgl', 
> '-wrapper', '-preresolve', '-outfile', '@OUTPUT@'],
> +input: join_paths(khronos_spec_dir, 'wgl.xml'),
> +output: 'generated_wgl_wrappers.c',
> +depend_files: join_paths(khronos_spec_dir, 'reg.py'),
> +)
> +
> +gl_shim = custom_target(
> +'gen_gl_shim',
> +command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-shim', 
> '-outfile', '@OUTPUT@'],
> +input: join_paths(khronos_spec_dir, 'gl.xml'),
> +output: 'generated_gl_shim.c',
> +depend_files: join_paths(khronos_spec_dir, 'reg.py'),
> +)
> +
> +gl_thunks = custom_target(
> +'gen_gl_thunks',
> +command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunk', 
> '-outfile', '@OUTPUT@'],
> +input: join_paths(khronos_spec_dir, 'gl.xml'),
> +output: 'generated_gl_thunks.c',
> +depend_files: join_paths(khronos_spec_dir, 'reg.py'),
> +)
> +
> +gl_thunks_def = custom_target(
> +'gen_gl_thunks_def',
> +command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunkdefs', 
> '-outfile', '@OUTPUT@'],
> +input: join_paths(khronos_spec_dir, 'gl.xml'),
> +output: 'generated_gl_thunks.def',
> +depend_files: join_paths(khronos_spec_dir, 'reg.py'),
> +)
> +
> +#

There seem to be some stray comment markers in this file.

> +srcs_windows_glx = [
> +'winpriv.c',
> +'winpriv.h',
> +'glwindows.h',
> +'glshim.c',
> +'indirect.c',
> +'indirect.h',
> +'wgl_ext_api.c',
> +'wgl_ext_api.h',
> +]
> +
> +if build_windowsdri
> +srcs_windows_glx += [
> +'dri_helpers.c',
> +'dri_helpers.h',
> +]
> +endif
> +
> +xwin_glx_c_args = []
> +xwin_glx_c_args += '-DXWIN_MULTIWINDOW'
> +xwin_glx_c_args += '-DXWIN_GLX_WINDOWS'

This variable seems to be dead.

> +xwin_glx = static_library(
> +'XwinGLX',
> +srcs_windows_glx,
> +include_directories: [
> +inc,
> +top_srcdir_inc,
> +include_directories('../'),
> +],
> +dependencies: pixman_dep,
> +c_args: xwin_c_args,
> +)
> +
> +#
> +srcs_wgl_thunk = [
> +'glthunk.c',
> +]

Optional: just put this string in place of srcs_wgl_thunk.

> +
> +WGLthunk = shared_library(
> +'nativeGLthunk',
> +srcs_wgl_thunk,
> +include_directories: [
> +inc,
> +top_srcdir_inc,
> +],
> +c_args: [
> +  

Re: [PATCH xserver 2/3] hw/xwin: Remove pretense of Xv support

2017-05-22 Thread Eric Anholt
Jon Turney <jon.tur...@dronecode.org.uk> writes:

That's some seriously unhelpful stub code!

These first two are:

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/2] misprite: Remove some dead cache variables

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

> Unused since Keith ported misprite to damage in '04.

Nice.  Both patches are:

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 xserver 1/2] glamor_egl: Remove check for KHR_surfaceless_context_*

2017-05-17 Thread Eric Anholt
Those extensions don't exist.  There's only surfaceless_context.

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

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index a82c1f790997..9527caad2b37 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -699,12 +699,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
}
 
 GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_texture_2D_image);
-#ifdef GLAMOR_GLES2
-GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context, 
KHR_surfaceless_gles2);
-#else
-GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context,
-KHR_surfaceless_opengl);
-#endif
+GLAMOR_CHECK_EGL_EXTENSION(KHR_surfaceless_context);
 
 #ifndef GLAMOR_GLES2
 glamor_egl->context = eglCreateContext(glamor_egl->display,
-- 
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] glamor_egl: Automatically choose a GLES2 context if desktop GL fails.

2017-05-17 Thread Eric Anholt
GLES2 support has been requested multiple times, and we've had this
code laying around trying to implement it.  The GLES2 implementation
is not quite there yet (some pixel transfer failures), but it
shouldn't take much fixing at this point.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_egl.c | 72 +
 1 file changed, 39 insertions(+), 33 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 9527caad2b37..4043dcfe8a09 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -635,22 +635,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 {
 struct glamor_egl_screen_private *glamor_egl;
 
-EGLint config_attribs[] = {
-#ifdef GLAMOR_GLES2
-EGL_CONTEXT_CLIENT_VERSION, 2,
-#endif
-EGL_NONE
-};
-static const EGLint config_attribs_core[] = {
-EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR,
-EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
-EGL_CONTEXT_MAJOR_VERSION_KHR,
-GLAMOR_GL_CORE_VER_MAJOR,
-EGL_CONTEXT_MINOR_VERSION_KHR,
-GLAMOR_GL_CORE_VER_MINOR,
-EGL_NONE
-};
-
 glamor_egl = calloc(sizeof(*glamor_egl), 1);
 if (glamor_egl == NULL)
 return FALSE;
@@ -679,12 +663,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 goto error;
 }
 
-#ifndef GLAMOR_GLES2
-eglBindAPI(EGL_OPENGL_API);
-#else
-eglBindAPI(EGL_OPENGL_ES_API);
-#endif
-
 #define GLAMOR_CHECK_EGL_EXTENSION(EXT)  \
if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT)) {  \
ErrorF("EGL_" #EXT " required.\n");  \
@@ -701,21 +679,49 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_texture_2D_image);
 GLAMOR_CHECK_EGL_EXTENSION(KHR_surfaceless_context);
 
-#ifndef GLAMOR_GLES2
-glamor_egl->context = eglCreateContext(glamor_egl->display,
-   NULL, EGL_NO_CONTEXT,
-   config_attribs_core);
-#else
-glamor_egl->context = NULL;
-#endif
-if (!glamor_egl->context) {
+if (eglBindAPI(EGL_OPENGL_API)) {
+static const EGLint config_attribs_core[] = {
+EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR,
+EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
+EGL_CONTEXT_MAJOR_VERSION_KHR,
+GLAMOR_GL_CORE_VER_MAJOR,
+EGL_CONTEXT_MINOR_VERSION_KHR,
+GLAMOR_GL_CORE_VER_MINOR,
+EGL_NONE
+};
+static const EGLint config_attribs[] = {
+EGL_NONE
+};
+
 glamor_egl->context = eglCreateContext(glamor_egl->display,
NULL, EGL_NO_CONTEXT,
-   config_attribs);
-if (glamor_egl->context == EGL_NO_CONTEXT) {
-xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create EGL 
context\n");
+   config_attribs_core);
+
+if (glamor_egl->context == EGL_NO_CONTEXT)
+glamor_egl->context = eglCreateContext(glamor_egl->display,
+   NULL, EGL_NO_CONTEXT,
+   config_attribs);
+}
+
+if (glamor_egl->context == EGL_NO_CONTEXT) {
+static const EGLint config_attribs[] = {
+EGL_CONTEXT_CLIENT_VERSION, 2,
+EGL_NONE
+};
+if (!eglBindAPI(EGL_OPENGL_ES_API)) {
+xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+   "glamor: Failed to bind either GL or GLES APIs.\n");
 goto error;
 }
+
+glamor_egl->context = eglCreateContext(glamor_egl->display,
+   NULL, EGL_NO_CONTEXT,
+   config_attribs);
+}
+if (glamor_egl->context == EGL_NO_CONTEXT) {
+xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+   "glamor: Failed to create GL or GLES2 contexts\n");
+goto error;
 }
 
 if (!eglMakeCurrent(glamor_egl->display,
-- 
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 xf86-video-ati] Use plain glamor_egl_create_textured_screen().

2017-05-17 Thread Eric Anholt
Michel Dänzer <mic...@daenzer.net> writes:

> On 17/05/17 03:04 AM, Eric Anholt wrote:
>> Since 5064ffab631 (2014), glamor's implementation of _ext just drops the
>> back_pixmap arg, which we were passing NULL (the default) to anyway.
>> 
>> Signed-off-by: Eric Anholt <e...@anholt.net>
>
> Thanks Eric! Reviewed and pushed to -ati, and ported to -amdgpu:
> https://patchwork.freedesktop.org/patch/156741/
>
>
> P.S. xf86-video-ati and -amdgpu patches are normally reviewed on the
> amd-gfx mailing list.

I thought you had a list, so I looked at the README but it didn't
mention a special list. :)


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 06/12] glamor_egl: Drop unnecessary check for KHR_gl_renderbuffer_image.

2017-05-16 Thread Eric Anholt
I couldn't find it being used anywhere in the history of the code.

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

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 21cf3c801242..c59aaa832f63 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -742,7 +742,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
}
 
 GLAMOR_CHECK_EGL_EXTENSION(MESA_drm_image);
-GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_renderbuffer_image);
 GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_texture_2D_image);
 #ifdef GLAMOR_GLES2
 GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context, 
KHR_surfaceless_gles2);
-- 
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 09/12] glamor_egl: Avoid flink names in glamor_egl_create_textured_pixmap().

2017-05-16 Thread Eric Anholt
Using flink is banned on render nodes, and they needlessly expose our
screen pixmap contents to any authenticated client.  This also
incidentally drops the dependency on EGL_MESA_drm_image.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_egl.c | 84 ++---
 1 file changed, 21 insertions(+), 63 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index ea047b4c422e..6bc9b5383f08 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -92,38 +92,6 @@ glamor_egl_make_current(struct glamor_context *glamor_ctx)
 }
 }
 
-static EGLImageKHR
-_glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl,
- int width, int height, int stride, int name, int 
depth)
-{
-EGLImageKHR image;
-
-EGLint attribs[] = {
-EGL_WIDTH, 0,
-EGL_HEIGHT, 0,
-EGL_DRM_BUFFER_STRIDE_MESA, 0,
-EGL_DRM_BUFFER_FORMAT_MESA,
-EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
-EGL_DRM_BUFFER_USE_MESA,
-EGL_DRM_BUFFER_USE_SHARE_MESA | EGL_DRM_BUFFER_USE_SCANOUT_MESA,
-EGL_NONE
-};
-attribs[1] = width;
-attribs[3] = height;
-attribs[5] = stride;
-if (depth != 32 && depth != 24)
-return EGL_NO_IMAGE_KHR;
-image = eglCreateImageKHR(glamor_egl->display,
-  glamor_egl->context,
-  EGL_DRM_BUFFER_MESA,
-  (void *) (uintptr_t) name,
-  attribs);
-if (image == EGL_NO_IMAGE_KHR)
-return EGL_NO_IMAGE_KHR;
-
-return image;
-}
-
 static int
 glamor_get_flink_name(int fd, int handle, int *name)
 {
@@ -212,43 +180,34 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int 
handle, int stride)
 {
 ScreenPtr screen = pixmap->drawable.pScreen;
 ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-struct glamor_screen_private *glamor_priv =
-glamor_get_screen_private(screen);
-struct glamor_egl_screen_private *glamor_egl;
-EGLImageKHR image;
-GLuint texture;
-int name;
-Bool ret = FALSE;
-
-glamor_egl = glamor_egl_get_screen_private(scrn);
+struct glamor_egl_screen_private *glamor_egl =
+glamor_egl_get_screen_private(scrn);
+int ret, fd;
 
-glamor_make_current(glamor_priv);
-if (!glamor_get_flink_name(glamor_egl->fd, handle, )) {
+/* GBM doesn't have an import path from handles, so we make a
+ * dma-buf fd from it and then go through that.
+ */
+ret = drmPrimeHandleToFD(glamor_egl->fd, handle, O_CLOEXEC, );
+if (ret) {
 xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-   "Couldn't flink pixmap handle\n");
-glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
-assert(0);
+   "Failed to make prime FD for handle: %d\n", errno);
 return FALSE;
 }
 
-image = _glamor_egl_create_image(glamor_egl,
- pixmap->drawable.width,
- pixmap->drawable.height,
- ((stride * 8 +
-   7) / pixmap->drawable.bitsPerPixel),
- name, pixmap->drawable.depth);
-if (image == EGL_NO_IMAGE_KHR) {
-glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
-goto done;
+if (!glamor_back_pixmap_from_fd(pixmap, fd,
+pixmap->drawable.width,
+pixmap->drawable.height,
+stride,
+pixmap->drawable.depth,
+pixmap->drawable.bitsPerPixel)) {
+xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+   "Failed to make import prime FD as pixmap: %d\n", errno);
+close(fd);
+return FALSE;
 }
-glamor_create_texture_from_image(screen, image, );
-glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
-glamor_set_pixmap_texture(pixmap, texture);
-glamor_egl_set_pixmap_image(pixmap, image);
-ret = TRUE;
 
- done:
-return ret;
+close(fd);
+return TRUE;
 }
 
 Bool
@@ -739,7 +698,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
goto error;  \
}
 
-GLAMOR_CHECK_EGL_EXTENSION(MESA_drm_image);
 GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_texture_2D_image);
 #ifdef GLAMOR_GLES2
 GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context, 
KHR_surfaceless_gles2);
-- 
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 12/12] glamor_egl: Drop glamor_egl_create_textured_screen_ext().

2017-05-16 Thread Eric Anholt
The function hasn't been doing anything useful since keithp's resource
freeing fixes in 2014.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor.h | 14 --
 glamor/glamor_egl.c |  8 
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/glamor/glamor.h b/glamor/glamor.h
index bdd2374cf071..b4fd76a6a46d 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -299,17 +299,11 @@ extern _X_EXPORT Bool 
glamor_egl_init_textured_pixmap(ScreenPtr screen);
 extern _X_EXPORT Bool glamor_egl_create_textured_screen(ScreenPtr screen,
 int handle, int 
stride);
 
-/* @glamor_egl_create_textured_screen_ext:
- *
- * extent one parameter to track the pointer of the DDX layer's back pixmap.
- * We need this pointer during the closing screen stage. As before back to
- * the DDX's close screen, we have to free all the glamor related resources.
+/* Obsolete entrypoint, temporarily left here for API compatibility
+ * for xf86-video-ati.
  */
-extern _X_EXPORT Bool glamor_egl_create_textured_screen_ext(ScreenPtr screen,
-int handle,
-int stride,
-PixmapPtr
-*back_pixmap);
+#define glamor_egl_create_textured_screen_ext(a, b, c, d) \
+glamor_egl_create_textured_screen(a, b, c)
 
 /*
  * @glamor_egl_create_textured_pixmap: Try to create a textured pixmap from
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 647d2efae189..5830eebff6fe 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -149,14 +149,6 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int 
handle, int stride)
 return TRUE;
 }
 
-Bool
-glamor_egl_create_textured_screen_ext(ScreenPtr screen,
-  int handle,
-  int stride, PixmapPtr *back_pixmap)
-{
-return glamor_egl_create_textured_screen(screen, handle, stride);
-}
-
 static void
 glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image)
 {
-- 
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 08/12] glamor_egl: Drop dead "cpp" field

2017-05-16 Thread Eric Anholt
It's been unused since the initial import.

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

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index abfdbf2a3129..ea047b4c422e 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -56,7 +56,6 @@ struct glamor_egl_screen_private {
 CreateScreenResourcesProcPtr CreateScreenResources;
 CloseScreenProcPtr CloseScreen;
 int fd;
-int cpp;
 struct gbm_device *gbm;
 
 CloseScreenProcPtr saved_close_screen;
-- 
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 07/12] glamor_egl: Drop dead gl_context_depth.

2017-05-16 Thread Eric Anholt
This was replaced in 4afe15d8bfd575c010ed1868697a7922a37ab378, but not
deleted.

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

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index c59aaa832f63..abfdbf2a3129 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -58,7 +58,6 @@ struct glamor_egl_screen_private {
 int fd;
 int cpp;
 struct gbm_device *gbm;
-int gl_context_depth;
 
 CloseScreenProcPtr saved_close_screen;
 DestroyPixmapProcPtr saved_destroy_pixmap;
-- 
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 05/12] glamor_egl: Always require the gbm-based image import path.

2017-05-16 Thread Eric Anholt
This has been associated with dri3 for now, but we need to use it
elsewhere in order to avoid flink.  The extensions have been
implemented for long enough that I couldn't find when it was that we
turned them on.  Oddly, we already required renderbuffer import
support, which is basically as hard to implement as texture import.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_egl.c | 55 ++---
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index bf23dc8ed16c..21cf3c801242 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -59,7 +59,6 @@ struct glamor_egl_screen_private {
 int cpp;
 struct gbm_device *gbm;
 int gl_context_depth;
-int dri3_capable;
 
 CloseScreenProcPtr saved_close_screen;
 DestroyPixmapProcPtr saved_destroy_pixmap;
@@ -430,9 +429,6 @@ glamor_back_pixmap_from_fd(PixmapPtr pixmap,
 
 glamor_egl = glamor_egl_get_screen_private(scrn);
 
-if (!glamor_egl->dri3_capable)
-return FALSE;
-
 if (bpp != 32 || !(depth == 24 || depth == 32) || width == 0 || height == 
0)
 return FALSE;
 
@@ -602,6 +598,9 @@ glamor_egl_screen_init(ScreenPtr screen, struct 
glamor_context *glamor_ctx)
 ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 struct glamor_egl_screen_private *glamor_egl =
 glamor_egl_get_screen_private(scrn);
+#ifdef DRI3
+glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+#endif
 
 glamor_egl->saved_close_screen = screen->CloseScreen;
 screen->CloseScreen = glamor_egl_close_screen;
@@ -615,32 +614,29 @@ glamor_egl_screen_init(ScreenPtr screen, struct 
glamor_context *glamor_ctx)
 glamor_ctx->make_current = glamor_egl_make_current;
 
 #ifdef DRI3
-if (glamor_egl->dri3_capable) {
-   glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
-/* Tell the core that we have the interfaces for import/export
- * of pixmaps.
- */
-glamor_enable_dri3(screen);
+/* Tell the core that we have the interfaces for import/export
+ * of pixmaps.
+ */
+glamor_enable_dri3(screen);
 
-/* If the driver wants to do its own auth dance (e.g. Xwayland
- * on pre-3.15 kernels that don't have render nodes and thus
- * has the wayland compositor as a master), then it needs us
- * to stay out of the way and let it init DRI3 on its own.
+/* If the driver wants to do its own auth dance (e.g. Xwayland
+ * on pre-3.15 kernels that don't have render nodes and thus
+ * has the wayland compositor as a master), then it needs us
+ * to stay out of the way and let it init DRI3 on its own.
+ */
+if (!(glamor_priv->flags & GLAMOR_NO_DRI3)) {
+/* To do DRI3 device FD generation, we need to open a new fd
+ * to the same device we were handed in originally.
  */
-if (!(glamor_priv->flags & GLAMOR_NO_DRI3)) {
-/* To do DRI3 device FD generation, we need to open a new fd
- * to the same device we were handed in originally.
- */
 #ifdef GLAMOR_HAS_DRM_NAME_FROM_FD_2
-glamor_egl->device_path = drmGetDeviceNameFromFd2(glamor_egl->fd);
+glamor_egl->device_path = drmGetDeviceNameFromFd2(glamor_egl->fd);
 #else
-glamor_egl->device_path = drmGetDeviceNameFromFd(glamor_egl->fd);
+glamor_egl->device_path = drmGetDeviceNameFromFd(glamor_egl->fd);
 #endif
 
-if (!dri3_screen_init(screen, _dri3_info)) {
-xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-   "Failed to initialize DRI3.\n");
-}
+if (!dri3_screen_init(screen, _dri3_info)) {
+xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+   "Failed to initialize DRI3.\n");
 }
 }
 #endif
@@ -747,6 +743,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 
 GLAMOR_CHECK_EGL_EXTENSION(MESA_drm_image);
 GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_renderbuffer_image);
+GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_texture_2D_image);
 #ifdef GLAMOR_GLES2
 GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context, 
KHR_surfaceless_gles2);
 #else
@@ -782,10 +779,12 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
  * (in case of multiple GPUs using glamor)
  */
 lastGLContext = NULL;
-if (epoxy_has_egl_extension(glamor_egl->display,
-"EGL_KHR_gl_texture_2D_image") &&
-epoxy_has_gl_extension("GL_OES_EGL_image"))
-glamor_egl->dri3_capable = TRUE;
+
+if (!epoxy_has_gl_extension("GL_OES_EGL_image")) {
+xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+   "glamor acceleration requires GL_OES_EGL_image\n");
+goto error;

[PATCH xserver 11/12] glamor_egl: Automatically choose a GLES2 context if desktop GL fails.

2017-05-16 Thread Eric Anholt
GLES2 support has been requested multiple times, and we've had this
code laying around trying to implement it.  The GLES2 implementation
is not quite there yet (some pixel transfer failures), but it
shouldn't take much fixing at this point.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_egl.c | 85 +
 1 file changed, 46 insertions(+), 39 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index a82c1f790997..647d2efae189 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -635,22 +635,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 {
 struct glamor_egl_screen_private *glamor_egl;
 
-EGLint config_attribs[] = {
-#ifdef GLAMOR_GLES2
-EGL_CONTEXT_CLIENT_VERSION, 2,
-#endif
-EGL_NONE
-};
-static const EGLint config_attribs_core[] = {
-EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR,
-EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
-EGL_CONTEXT_MAJOR_VERSION_KHR,
-GLAMOR_GL_CORE_VER_MAJOR,
-EGL_CONTEXT_MINOR_VERSION_KHR,
-GLAMOR_GL_CORE_VER_MINOR,
-EGL_NONE
-};
-
 glamor_egl = calloc(sizeof(*glamor_egl), 1);
 if (glamor_egl == NULL)
 return FALSE;
@@ -679,12 +663,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 goto error;
 }
 
-#ifndef GLAMOR_GLES2
-eglBindAPI(EGL_OPENGL_API);
-#else
-eglBindAPI(EGL_OPENGL_ES_API);
-#endif
-
 #define GLAMOR_CHECK_EGL_EXTENSION(EXT)  \
if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT)) {  \
ErrorF("EGL_" #EXT " required.\n");  \
@@ -699,28 +677,56 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
}
 
 GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_texture_2D_image);
-#ifdef GLAMOR_GLES2
-GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context, 
KHR_surfaceless_gles2);
-#else
-GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context,
-KHR_surfaceless_opengl);
-#endif
 
-#ifndef GLAMOR_GLES2
-glamor_egl->context = eglCreateContext(glamor_egl->display,
-   NULL, EGL_NO_CONTEXT,
-   config_attribs_core);
-#else
-glamor_egl->context = NULL;
-#endif
-if (!glamor_egl->context) {
+if (eglBindAPI(EGL_OPENGL_API)) {
+static const EGLint config_attribs_core[] = {
+EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR,
+EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
+EGL_CONTEXT_MAJOR_VERSION_KHR,
+GLAMOR_GL_CORE_VER_MAJOR,
+EGL_CONTEXT_MINOR_VERSION_KHR,
+GLAMOR_GL_CORE_VER_MINOR,
+EGL_NONE
+};
+static const EGLint config_attribs[] = {
+EGL_NONE
+};
+
+GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context,
+KHR_surfaceless_opengl);
+
 glamor_egl->context = eglCreateContext(glamor_egl->display,
NULL, EGL_NO_CONTEXT,
-   config_attribs);
-if (glamor_egl->context == EGL_NO_CONTEXT) {
-xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create EGL 
context\n");
+   config_attribs_core);
+
+if (glamor_egl->context == EGL_NO_CONTEXT)
+glamor_egl->context = eglCreateContext(glamor_egl->display,
+   NULL, EGL_NO_CONTEXT,
+   config_attribs);
+}
+
+if (glamor_egl->context == EGL_NO_CONTEXT) {
+static const EGLint config_attribs[] = {
+EGL_CONTEXT_CLIENT_VERSION, 2,
+EGL_NONE
+};
+if (!eglBindAPI(EGL_OPENGL_ES_API)) {
+xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+   "glamor: Failed to bind either GL or GLES APIs.\n");
 goto error;
 }
+
+GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context,
+KHR_surfaceless_gles2);
+
+glamor_egl->context = eglCreateContext(glamor_egl->display,
+   NULL, EGL_NO_CONTEXT,
+   config_attribs);
+}
+if (glamor_egl->context == EGL_NO_CONTEXT) {
+xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+   "glamor: Failed to create GL or GLES2 contexts\n");
+goto error;
 }
 
 if (!eglMakeCurrent(glamor_egl->display,
@@ -729,6 +735,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
"Failed to make EGL context current\n");
 goto error;
 }
+
 /*
  * Force the next glamor_make_current call to set the right context
  * (in case of multiple GPUs using glamor)
-- 
2.11.0

_

[PATCH xserver 03/12] modesetting: Drop code for GLAMOR && !GLAMOR_HAS_GBM.

2017-05-16 Thread Eric Anholt
The glamor_egl module that the GLAMOR paths are using is only built if
GLAMOR_HAS_GBM is true, and there's no plan for implementing the
module without GBM.  Simplify modesetting's code as a result.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xfree86/drivers/modesetting/dri2.c|  4 ++--
 hw/xfree86/drivers/modesetting/driver.c  | 14 +++---
 hw/xfree86/drivers/modesetting/driver.h  |  6 ++
 hw/xfree86/drivers/modesetting/drmmode_display.c | 19 ---
 hw/xfree86/drivers/modesetting/pageflip.c|  2 +-
 hw/xfree86/drivers/modesetting/present.c |  8 +++-
 6 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/dri2.c 
b/hw/xfree86/drivers/modesetting/dri2.c
index 8944ef1364ae..bfaea3b843da 100644
--- a/hw/xfree86/drivers/modesetting/dri2.c
+++ b/hw/xfree86/drivers/modesetting/dri2.c
@@ -42,7 +42,7 @@
 #include "driver.h"
 #include "dri2.h"
 
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 
 enum ms_dri2_frame_event_type {
 MS_DRI2_QUEUE_SWAP,
@@ -1113,4 +1113,4 @@ ms_dri2_close_screen(ScreenPtr screen)
 DRI2CloseScreen(screen);
 }
 
-#endif /* GLAMOR */
+#endif /* GLAMOR_HAS_GBM */
diff --git a/hw/xfree86/drivers/modesetting/driver.c 
b/hw/xfree86/drivers/modesetting/driver.c
index a1451fe471e8..f371198a99be 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -593,7 +593,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr 
dirty, int *timeout)
 PixmapSyncDirtyHelper(dirty);
 
 if (!screen->isGPU) {
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 /*
  * When copying from the master framebuffer to the shared pixmap,
  * we must ensure the copy is complete before the slave starts a
@@ -738,7 +738,7 @@ try_enable_glamor(ScrnInfoPtr pScrn)
 
 ms->drmmode.glamor = FALSE;
 
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 if (ms->drmmode.force_24_32) {
 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Cannot use glamor with 24bpp 
packed fb\n");
 return;
@@ -1410,7 +1410,7 @@ msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, 
void **handle)
 static Bool
 msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
 {
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 ScreenPtr screen = ppix->drawable.pScreen;
 ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 modesettingPtr ms = modesettingPTR(scrn);
@@ -1599,7 +1599,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
 
 fbPictureInit(pScreen, NULL, 0);
 
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 if (ms->drmmode.glamor) {
 if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -1666,7 +1666,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
 
 xf86DPMSInit(pScreen, xf86DPMSSet, 0);
 
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 if (ms->drmmode.glamor) {
 XF86VideoAdaptorPtr glamor_adaptor;
 
@@ -1688,7 +1688,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
 return FALSE;
 }
 
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 if (ms->drmmode.glamor) {
 if (!ms_dri2_screen_init(pScreen)) {
 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -1789,7 +1789,7 @@ CloseScreen(ScreenPtr pScreen)
 /* Clear mask of assigned crtc's in this generation */
 ms_ent->assigned_crtcs = 0;
 
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 if (ms->drmmode.glamor) {
 ms_dri2_close_screen(pScreen);
 }
diff --git a/hw/xfree86/drivers/modesetting/driver.h 
b/hw/xfree86/drivers/modesetting/driver.h
index 25e3a547d43d..bfdc66c8933a 100644
--- a/hw/xfree86/drivers/modesetting/driver.h
+++ b/hw/xfree86/drivers/modesetting/driver.h
@@ -33,13 +33,11 @@
 #include 
 #include 
 
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 #define GLAMOR_FOR_XORG 1
 #include "glamor.h"
-#ifdef GLAMOR_HAS_GBM
 #include 
 #endif
-#endif
 
 #include "drmmode_display.h"
 #define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
@@ -146,7 +144,7 @@ void ms_vblank_close_screen(ScreenPtr screen);
 
 Bool ms_present_screen_init(ScreenPtr screen);
 
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 
 typedef void (*ms_pageflip_handler_proc)(modesettingPtr ms,
  uint64_t frame,
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c 
b/hw/xfree86/drivers/modesetting/drmmode_display.c
index bbca8ca704a5..850888c94cf3 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -496,7 +496,7 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
 drmmode_crtc->dpms_mode = mode;
 }
 
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
 static PixmapPtr
 create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id)
 {
@@ -546,7 +546,7 @@ out_free_fb:
 void
 drmmode_copy_fb(ScrnInfoPtr pScrn

[PATCH xserver 01/12] glamor_egl: Print a useful identifying string on initialization.

2017-05-16 Thread Eric Anholt
The EGL version is not used anywhere in the glamor code, so it's not
interesting.  And when saying that we've started using GL
acceleration, it's nice to know what GL we're actually using.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_egl.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index ca94227ccac2..e5dfe657d92e 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -49,15 +49,6 @@
 #include "glamor_priv.h"
 #include "dri3.h"
 
-static const char glamor_name[] = "glamor";
-
-static void
-glamor_identify(int flags)
-{
-xf86Msg(X_INFO, "%s: OpenGL accelerated X.org driver based.\n",
-glamor_name);
-}
-
 struct glamor_egl_screen_private {
 EGLDisplay display;
 EGLContext context;
@@ -737,7 +728,6 @@ Bool
 glamor_egl_init(ScrnInfoPtr scrn, int fd)
 {
 struct glamor_egl_screen_private *glamor_egl;
-const char *version;
 
 EGLint config_attribs[] = {
 #ifdef GLAMOR_GLES2
@@ -755,7 +745,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 EGL_NONE
 };
 
-glamor_identify(0);
 glamor_egl = calloc(sizeof(*glamor_egl), 1);
 if (glamor_egl == NULL)
 return FALSE;
@@ -796,9 +785,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 eglBindAPI(EGL_OPENGL_ES_API);
 #endif
 
-version = eglQueryString(glamor_egl->display, EGL_VERSION);
-xf86Msg(X_INFO, "%s: EGL version %s:\n", glamor_name, version);
-
 #define GLAMOR_CHECK_EGL_EXTENSION(EXT)  \
if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT)) {  \
ErrorF("EGL_" #EXT " required.\n");  \
@@ -856,6 +842,9 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 glamor_egl->dri3_capable = TRUE;
 #endif
 
+xf86DrvMsg(scrn->scrnIndex, X_INFO, "glamor X acceleration enabled on 
%s\n",
+   glGetString(GL_RENDERER));
+
 glamor_egl->saved_free_screen = scrn->FreeScreen;
 scrn->FreeScreen = glamor_egl_free_screen;
 #ifdef GLAMOR_GLES2
-- 
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 10/12] glamor_egl: Drop warning about indirect GLX and GLES2.

2017-05-16 Thread Eric Anholt
Indirect GLX uses its own context and doesn't care what glamor is
using.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_egl.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 6bc9b5383f08..a82c1f790997 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -746,12 +746,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 
 glamor_egl->saved_free_screen = scrn->FreeScreen;
 scrn->FreeScreen = glamor_egl_free_screen;
-#ifdef GLAMOR_GLES2
-xf86DrvMsg(scrn->scrnIndex, X_INFO, "Using GLES2.\n");
-xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-   "Glamor is using GLES2 but GLX needs GL. "
-   "Indirect GLX may not work correctly.\n");
-#endif
 return TRUE;
 
 error:
-- 
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 04/12] glamor_egl: Drop the has_gem flag.

2017-05-16 Thread Eric Anholt
We're using GBM, so we know we've got GEM.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_egl.c | 35 +++
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index f68d153114df..bf23dc8ed16c 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -58,7 +58,6 @@ struct glamor_egl_screen_private {
 int fd;
 int cpp;
 struct gbm_device *gbm;
-int has_gem;
 int gl_context_depth;
 int dri3_capable;
 
@@ -193,19 +192,6 @@ glamor_egl_create_textured_screen_ext(ScreenPtr screen,
 return glamor_egl_create_textured_screen(screen, handle, stride);
 }
 
-static Bool
-glamor_egl_check_has_gem(int fd)
-{
-struct drm_gem_flink flink;
-
-flink.handle = 0;
-
-ioctl(fd, DRM_IOCTL_GEM_FLINK, );
-if (errno == ENOENT || errno == EINVAL)
-return TRUE;
-return FALSE;
-}
-
 static void
 glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image)
 {
@@ -240,17 +226,13 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int 
handle, int stride)
 glamor_egl = glamor_egl_get_screen_private(scrn);
 
 glamor_make_current(glamor_priv);
-if (glamor_egl->has_gem) {
-if (!glamor_get_flink_name(glamor_egl->fd, handle, )) {
-xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-   "Couldn't flink pixmap handle\n");
-glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
-assert(0);
-return FALSE;
-}
+if (!glamor_get_flink_name(glamor_egl->fd, handle, )) {
+xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+   "Couldn't flink pixmap handle\n");
+glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
+assert(0);
+return FALSE;
 }
-else
-name = handle;
 
 image = _glamor_egl_create_image(glamor_egl,
  pixmap->drawable.width,
@@ -419,8 +401,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
 pixmap->devKind = gbm_bo_get_stride(bo);
 
 if (want_name) {
-if (glamor_egl->has_gem)
-glamor_get_name_from_bo(glamor_egl->fd, bo, );
+glamor_get_name_from_bo(glamor_egl->fd, bo, );
 }
 else {
 fd = gbm_bo_get_fd(bo);
@@ -738,8 +719,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 goto error;
 }
 
-glamor_egl->has_gem = glamor_egl_check_has_gem(fd);
-
 if (!eglInitialize
 (glamor_egl->display, _egl->major, _egl->minor)) {
 xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglInitialize() failed\n");
-- 
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 02/12] glamor_egl: Unifdef GLAMOR_HAS_GBM.

2017-05-16 Thread Eric Anholt
We only build this code with GBM, and supporting non-GBM well would be
invasive.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_egl.c | 34 --
 1 file changed, 34 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index e5dfe657d92e..f68d153114df 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -38,10 +38,8 @@
 #include 
 #define EGL_DISPLAY_NO_X_MESA
 
-#ifdef GLAMOR_HAS_GBM
 #include 
 #include 
-#endif
 
 #include "glamor_egl.h"
 
@@ -59,9 +57,7 @@ struct glamor_egl_screen_private {
 CloseScreenProcPtr CloseScreen;
 int fd;
 int cpp;
-#ifdef GLAMOR_HAS_GBM
 struct gbm_device *gbm;
-#endif
 int has_gem;
 int gl_context_depth;
 int dri3_capable;
@@ -167,13 +163,9 @@ glamor_create_texture_from_image(ScreenPtr screen,
 struct gbm_device *
 glamor_egl_get_gbm_device(ScreenPtr screen)
 {
-#ifdef GLAMOR_HAS_GBM
 struct glamor_egl_screen_private *glamor_egl =
 glamor_egl_get_screen_private(xf86ScreenToScrn(screen));
 return glamor_egl->gbm;
-#else
-return NULL;
-#endif
 }
 
 Bool
@@ -314,7 +306,6 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr 
pixmap,
 return ret;
 }
 
-#ifdef GLAMOR_HAS_GBM
 static void
 glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name)
 {
@@ -324,12 +315,10 @@ glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, 
int *name)
 if (!glamor_get_flink_name(gbm_fd, handle.u32, name))
 *name = -1;
 }
-#endif
 
 static Bool
 glamor_make_pixmap_exportable(PixmapPtr pixmap)
 {
-#ifdef GLAMOR_HAS_GBM
 ScreenPtr screen = pixmap->drawable.pScreen;
 ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 struct glamor_egl_screen_private *glamor_egl =
@@ -394,9 +383,6 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap)
 screen->DestroyPixmap(exported);
 
 return TRUE;
-#else
-return FALSE;
-#endif
 }
 
 struct gbm_bo *
@@ -420,7 +406,6 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
  unsigned int tex,
  Bool want_name, CARD16 *stride, CARD32 *size)
 {
-#ifdef GLAMOR_HAS_GBM
 struct glamor_egl_screen_private *glamor_egl;
 struct gbm_bo *bo;
 int fd = -1;
@@ -446,9 +431,6 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
 gbm_bo_destroy(bo);
  failure:
 return fd;
-#else
-return -1;
-#endif
 }
 
 _X_EXPORT Bool
@@ -458,7 +440,6 @@ glamor_back_pixmap_from_fd(PixmapPtr pixmap,
CARD16 height,
CARD16 stride, CARD8 depth, CARD8 bpp)
 {
-#ifdef GLAMOR_HAS_GBM
 ScreenPtr screen = pixmap->drawable.pScreen;
 ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 struct glamor_egl_screen_private *glamor_egl;
@@ -488,9 +469,6 @@ glamor_back_pixmap_from_fd(PixmapPtr pixmap,
 ret = glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo);
 gbm_bo_destroy(bo);
 return ret;
-#else
-return FALSE;
-#endif
 }
 
 _X_EXPORT PixmapPtr
@@ -500,7 +478,6 @@ glamor_pixmap_from_fd(ScreenPtr screen,
   CARD16 height,
   CARD16 stride, CARD8 depth, CARD8 bpp)
 {
-#ifdef GLAMOR_HAS_GBM
 PixmapPtr pixmap;
 Bool ret;
 
@@ -512,9 +489,6 @@ glamor_pixmap_from_fd(ScreenPtr screen,
 return NULL;
 }
 return pixmap;
-#else
-return NULL;
-#endif
 }
 
 static Bool
@@ -703,10 +677,8 @@ static void glamor_egl_cleanup(struct 
glamor_egl_screen_private *glamor_egl)
 lastGLContext = NULL;
 eglTerminate(glamor_egl->display);
 }
-#ifdef GLAMOR_HAS_GBM
 if (glamor_egl->gbm)
 gbm_device_destroy(glamor_egl->gbm);
-#endif
 free(glamor_egl->device_path);
 free(glamor_egl);
 }
@@ -753,7 +725,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 
 scrn->privates[xf86GlamorEGLPrivateIndex].ptr = glamor_egl;
 glamor_egl->fd = fd;
-#ifdef GLAMOR_HAS_GBM
 glamor_egl->gbm = gbm_create_device(glamor_egl->fd);
 if (glamor_egl->gbm == NULL) {
 ErrorF("couldn't get display device\n");
@@ -766,9 +737,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglGetDisplay() failed\n");
 goto error;
 }
-#else
-glamor_egl->display = eglGetDisplay((EGLNativeDisplayType) (intptr_t) fd);
-#endif
 
 glamor_egl->has_gem = glamor_egl_check_has_gem(fd);
 
@@ -835,12 +803,10 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
  * (in case of multiple GPUs using glamor)
  */
 lastGLContext = NULL;
-#ifdef GLAMOR_HAS_GBM
 if (epoxy_has_egl_extension(glamor_egl->display,
 "EGL_KHR_gl_texture_2D_image") &&
 epoxy_has_gl_extension("GL_OES_EGL_image"))
 glamor_egl->dri3_capable = TRUE;
-#endif
 
 xf86DrvMsg(scrn->scrnIndex, X_INFO, "glamor X acceleration enable

[PATCH xf86-video-ati] Use plain glamor_egl_create_textured_screen().

2017-05-16 Thread Eric Anholt
Since 5064ffab631 (2014), glamor's implementation of _ext just drops the
back_pixmap arg, which we were passing NULL (the default) to anyway.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 src/radeon_glamor.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index 590c9f0c079c..e5e35553acf7 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -61,11 +61,10 @@ radeon_glamor_create_screen_resources(ScreenPtr screen)
return FALSE;
 #endif
 
-   if (!glamor_egl_create_textured_screen_ext(screen,
-  info->front_bo->handle,
-  scrn->displayWidth *
-  info->pixel_bytes,
-  NULL))
+   if (!glamor_egl_create_textured_screen(screen,
+  info->front_bo->handle,
+  scrn->displayWidth *
+  info->pixel_bytes))
return FALSE;
 
return TRUE;
-- 
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 5/7] meson: Make XV optional

2017-05-11 Thread Eric Anholt
Julien Cristau <jcris...@debian.org> writes:

> On Mon, May  8, 2017 at 10:13:52 -0700, Eric Anholt wrote:
>
>> Optional XV seems a bit silly to me.  Could we just do something
>> like:
>> 
>> build_xv = build_xorg || build_dmx || build_ephyr?
>
> FWIW the Xorg build we're shipping in debian installer images (which run
> a single specific gtk2 client) have xv disabled.  I could be convinced
> not to care, though; no idea what the size difference is, or if this
> still matters 7 years later.

Looks like about 70kb total, more than I thought it would be.


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 4/4] meson: Detect strlcat/strlcpy/reallocarray in libbsd

2017-05-09 Thread Eric Anholt
Peter Harris <phar...@opentext.com> writes:

> If we're linking with libbsd anyway, we might as well use the functions
> it provides instead of compiling our replacements.
>
> Signed-off-by: Peter Harris <phar...@opentext.com>

This series is:

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

Let me know if you would like me to push them.


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: fix autoConfigDevice() regression that skipped all but the first driver match

2017-05-09 Thread Eric Anholt
Aaron Plattner <aplatt...@nvidia.com> writes:

> On 05/09/2017 04:51 PM, Eric Anholt wrote:
>> Aaron Plattner <aplatt...@nvidia.com> writes:
>> 
>>> Commit 112d0d7d01b9 lost the initialization of the variable i in the loop 
>>> to add
>>> secondary driver matches to the list of configs:
>>>
>>>   @@ -398,8 +412,8 @@ autoConfigDevice(GDevPtr preconf_device)
>>>
>>>/* for each other driver found, copy the first screen, 
>>> insert it
>>> * into the list of screens and set the driver */
>>>   -for (i = 1; i < num_matches; i++) {
>>>   -if (!copyScreen(slp[0].screen, ptr, i, matches[i]))
>>>   +while (i++ < md.nmatches) {
>>>   +if (!copyScreen(slp[0].screen, ptr, i, md.matches[i]))
>>>return NULL;
>>>}
>>>
>>> This caused only the first match to be added, because an earlier loop sets 
>>> i =
>>> md.nmatches.
>>>
>>> Fix this by reverting the while loop back to a for loop.
>>>
>>> Reported-by: Michel Dänzer <mic...@daenzer.net>
>>> Reported-by: Peter Hutterer <peter.hutte...@who-t.net>
>>> Reported-by: Eric Anholt <e...@anholt.net>
>>> Cc: Adam Jackson <a...@redhat.com>
>>> Fixes: 112d0d7d01b9 ("xfree86: Improved autoconfig drivers matching")
>>> Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
>>> ---
>>> Resend: forgot to Cc the list.
>> 
>> This is a pretty clear unintended behavior change.
>> 
>> Tested-by: Eric Anholt <e...@anholt.net>
>> 
>> Since we collided on me pushing the revert, shall I squash this into a
>> re-cherry-pick of the change as a v2?
>
> Sounds good to me.

Done.  Thanks for the fix!


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: fix autoConfigDevice() regression that skipped all but the first driver match

2017-05-09 Thread Eric Anholt
Aaron Plattner <aplatt...@nvidia.com> writes:

> Commit 112d0d7d01b9 lost the initialization of the variable i in the loop to 
> add
> secondary driver matches to the list of configs:
>
>  @@ -398,8 +412,8 @@ autoConfigDevice(GDevPtr preconf_device)
>
>   /* for each other driver found, copy the first screen, insert it
>* into the list of screens and set the driver */
>  -for (i = 1; i < num_matches; i++) {
>  -if (!copyScreen(slp[0].screen, ptr, i, matches[i]))
>  +while (i++ < md.nmatches) {
>  +if (!copyScreen(slp[0].screen, ptr, i, md.matches[i]))
>   return NULL;
>   }
>
> This caused only the first match to be added, because an earlier loop sets i =
> md.nmatches.
>
> Fix this by reverting the while loop back to a for loop.
>
> Reported-by: Michel Dänzer <mic...@daenzer.net>
> Reported-by: Peter Hutterer <peter.hutte...@who-t.net>
> Reported-by: Eric Anholt <e...@anholt.net>
> Cc: Adam Jackson <a...@redhat.com>
> Fixes: 112d0d7d01b9 ("xfree86: Improved autoconfig drivers matching")
> Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
> ---
> Resend: forgot to Cc the list.

This is a pretty clear unintended behavior change.

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

Since we collided on me pushing the revert, shall I squash this into a
re-cherry-pick of the change as a v2?


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 4/7] meson: Make driprotos and libdrm optional

2017-05-09 Thread Eric Anholt
Jon Turney <jon.tur...@dronecode.org.uk> writes:

> On 08/05/2017 21:28, Jon Turney wrote:
>> On 08/05/2017 18:12, Eric Anholt wrote:
>>> Jon Turney writes:
>>>> +libxserver_dri3 = ''
>>>
>>> Pretty sure this should be = []
>>
>> Yeah, me too.  But when I try it:
>>
>>> Meson encountered an error in file hw/kdrive/ephyr/meson.build, line
>>> 40, column 0:
>>> Link target [] is not library.
>>
>> Hmmm..  if I add it with libxserver += libxserver_dri3, it works, so it
>> seems there is some kind of list flattening failure somewhere...
>
> Yes, it seems link_with: doesn't get flattened.
>
> https://github.com/mesonbuild/meson/issues/1764
>
> Attached is a revised patch, which does the flattening by hand.

Thanks for investigating.  Seems like a reasonable workaround.

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] Improved autoconfig drivers matching

2017-05-09 Thread Eric Anholt
Adam Jackson  writes:

> On Mon, 2017-05-01 at 18:03 +0900, Michel Dänzer wrote:
>> On 28/04/17 04:11 AM, Adam Jackson wrote:
>> > Fixed up (and rebased and made meson-aware) and merged:
>> > 
>> > To ssh://git.freedesktop.org/git/xorg/xserver
>> >    1549e3037..112d0d7d0  master -> master
>> 
>> This broke things on my development box.
>> 
>> There are two GPUs. When I want Xorg to use the secondary GPU for its
>> primary screen, I use a xorg.conf with (effectively) only:
>> 
>> Section "Device"
>> Identifier "Device0"
>> BusID   "PCI:1:0:0"
>> EndSection
>> 
>> Before this change, this worked fine, automatically[0] using the amdgpu
>> driver for that GPU. With this change, Xorg fails to start up, see the
>> attached log file.
>
> Ugh. I don't know if I'm going to have time to investigate that in
> detail, so I lean towards reverting. If the original problem was that
> 20 was too small a number let's just bump it to something safely crazy
> like 256. Sound reasonable?

I just got hit by it too.  I've pushed the revert until Aaron can sort
it out.


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] xfree86: build a shared lib identical to Xorg

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

> Because we can use a shared lib in dlsym() for the symbol loader test, but we
> can't use the executable.
>
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

Apparently I've had the test working just because my default amd64 build
is PIE, such that the Xorg binary is effectively just a shared lib with
a main.

We may find this lib useful for some of our unit testing, anyway, so I'm
happy with your solution.

> +# For symbol presence testing only
> +xorgserver_lib = shared_library(
> +'xorgserver',
> +srcs_xorg,
> +include_directories: [inc, xorg_inc],
> +link_whole: xorg_link,
> +dependencies: xorg_deps,
> +link_args: '-Wl,--export-dynamic',
> +c_args: xorg_c_args,
> +install: false,
> +)
> +
> +xorgserver_dep = declare_dependency(link_with : xorgserver_lib)

Elsewhere we have no ' ' before ':'.

Other than that,

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 xserver] meson: Use link_whole() not link_with(), for the Xorg dixmods.

2017-05-08 Thread Eric Anholt
I clearly hadn't run ninja test, since fb no longer had any of the fb
symbols in it.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xfree86/dixmods/meson.build | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/dixmods/meson.build b/hw/xfree86/dixmods/meson.build
index 39276dc32839..e4ffdba9333e 100644
--- a/hw/xfree86/dixmods/meson.build
+++ b/hw/xfree86/dixmods/meson.build
@@ -18,7 +18,7 @@ shared_module(
 include_directories: [inc, xorg_inc],
 c_args: xorg_c_args,
 dependencies: common_dep,
-link_with: libxserver_fb,
+link_whole: libxserver_fb,
 
 install: true,
 install_dir: module_dir,
@@ -31,7 +31,7 @@ shared_module(
 include_directories: [inc, xorg_inc],
 c_args: [ xorg_c_args, wfb_args ],
 dependencies: common_dep,
-link_with: libxserver_wfb,
+link_whole: libxserver_wfb,
 
 install: true,
 install_dir: module_dir,
@@ -43,7 +43,7 @@ shared_module(
 include_directories: [inc, xorg_inc],
 c_args: xorg_c_args,
 dependencies: common_dep,
-link_with: libxserver_miext_shadow,
+link_whole: libxserver_miext_shadow,
 
 install: true,
 install_dir: module_dir,
@@ -57,7 +57,7 @@ if build_glx
 include_directories: [ inc, xorg_inc, glx_inc ],
 c_args: [ xorg_c_args, glx_align64 ],
 dependencies: [ common_dep, dl_dep ],
-link_with: libxserver_glx,
+link_whole: libxserver_glx,
 
 install: true,
 install_dir: join_paths(module_dir, 'extensions')
-- 
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 7/7] meson: An empty array is not a dependency object

2017-05-08 Thread Eric Anholt
Jon Turney <jon.tur...@dronecode.org.uk> writes:

> Using the meson idiom of initializing a variaible to an empty array to
> represent a null value does not work well for a variable expected to hold a
> dependency object, as trying to apply found() to it will fail (currently).
>
> I think this can be demonstrated by configuing with Dglamor=no, then gbm_dep
> is set to [] in meson.build, and then tested with found() in
> include/meson.build.
>
> Use dependency('') to create an empty dependency.
>
> Future work: In the autotools build GBM is required if build_xorg &
> build_glamor.  I suspect that it was also required for build_xwayland &
> build_glamor, but that was never checked.  That test seems to have gone
> missing in meson.build, the required:false when checking for gbm should
> possibly be dropped?
>
> Signed-off-by: Jon Turney <jon.tur...@dronecode.org.uk>
> ---
>  meson.build | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index d3e0685bd..bc2323641 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -177,7 +177,7 @@ endif
>  
>  build_dbus = build_hal or build_systemd_logind
>  
> -udev_dep = []
> +udev_dep = dependency('', required:false)
>  if build_udev
>  udev_dep = dependency('libudev', version: '>= 143')
>  endif
> @@ -198,7 +198,7 @@ else
>  build_glamor = get_option('glamor') == 'yes'
>  endif

Could we just do the gbm_dep hunk and not the udev one, if the udev hunk
isn't needed?

>  
> -gbm_dep = []
> +gbm_dep = dependency('', required:false)
>  if build_glamor
>  gbm_dep = dependency('gbm', version: '>= 10.2', required: false)
>  if gbm_dep.found()

We've certainly got a cleanup of gbm_dep to do, but I'm fine with this
for now.  Meson folks agreed that this was the best workaround, though
"[].found() == false" may be available in the future.

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 6/7] meson: Refine build_dbus

2017-05-08 Thread Eric Anholt
Jon Turney <jon.tur...@dronecode.org.uk> writes:

> As in autotools build, only turn on build_dbus (build dbus-core.c) if it's
> needed by build_hal or build_systemd_logind, not just because dbus is
> available.
>
> Building dbus-core.c without NEED_DBUS defined fails, as the contents of
> dbus-core.h are turned off.

I got confused by dbus/hal/systemd requirements several times.  Thanks
for fixing it up.

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 5/7] meson: Make XV optional

2017-05-08 Thread Eric Anholt
Jon Turney  writes:

> Signed-off-by: Jon Turney 
> ---
>  meson.build   | 11 ++-
>  meson_options.txt |  3 +++
>  2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index c7c9c79c3..5f30b996c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -251,6 +251,16 @@ if libdrm_dep.found()
>build_modesetting = dependency('libdrm', version: '>= 2.4.46', required: 
> false).found()
>  endif
>  
> +build_xv = false
> +if get_option('xv') == 'auto'
> +if (host_machine.system() != 'windows' and
> +host_machine.system() != 'cygwin')
> +build_xv = true
> +endif
> +else
> +build_xv = get_option('xv') == 'yes'
> +endif

Optional XV seems a bit silly to me.  Could we just do something
like:

build_xv = build_xorg || build_dmx || build_ephyr?


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 4/7] meson: Make driprotos and libdrm optional

2017-05-08 Thread Eric Anholt
())
>  conf_data.set('GLAMOR_HAS_DRM_NAME_FROM_FD_2',
>dependency('libdrm', version: '>= 2.4.74', required: 
> false).found())
>  conf_data.set('GLXEXT', build_glx)
> diff --git a/meson.build b/meson.build
> index df0d3aefa..c7c9c79c3 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -32,16 +32,16 @@ compositeproto_dep = dependency('compositeproto', 
> version: '>= 0.4')
>  recordproto_dep = dependency('recordproto', version: '>= 1.13.99.1')
>  scrnsaverproto_dep = dependency('scrnsaverproto', version: '>= 1.1')
>  resourceproto_dep = dependency('resourceproto', version: '>= 1.2.0')
> -xf86driproto_dep = dependency('xf86driproto', version: '>= 2.1.0')
> -dri2proto_dep = dependency('dri2proto', version: '>= 2.8')
> -dri3proto_dep = dependency('dri3proto', version: '>= 1.0')
> +xf86driproto_dep = dependency('xf86driproto', version: '>= 2.1.0', required: 
> get_option('dri1') == 'yes')
> +dri2proto_dep = dependency('dri2proto', version: '>= 2.8', required: 
> get_option('dri2') == 'yes')
> +dri3proto_dep = dependency('dri3proto', version: '>= 1.0', required: 
> get_option('dri3') == 'yes')
>  xineramaproto_dep = dependency('xineramaproto')
>  xf86bigfontproto_dep = dependency('xf86bigfontproto', version: '>= 1.2.0')
>  xf86dgaproto_dep = dependency('xf86dgaproto', version: '>= 2.0.99.1', 
> required: false)
>  xf86vidmodeproto_dep = dependency('xf86vidmodeproto', version: '>= 
> 2.2.99.1', required: false)
>  windowswmproto_dep = dependency('windowswmproto', required: false)
>  applewmproto_dep = dependency('applewmproto', version: '>= 1.4', required: 
> false)
> -xshmfence_dep = dependency('xshmfence', version: '>= 1.1')
> +xshmfence_dep = dependency('xshmfence', version: '>= 1.1', required: false)
>  
>  pixman_dep = dependency('pixman-1')
>  libbsd_dep = dependency('libbsd', required: false)
> @@ -216,12 +216,44 @@ endif
>  
>  build_glx = get_option('glx')
>  
> +if get_option('dri1') == 'auto'
> +build_dri1 = xf86driproto_dep.found()
> +else
> +build_dri1 = get_option('dri1') == 'yes'
> +endif
> +
> +if get_option('dri2') == 'auto'
> +build_dri2 = dri2proto_dep.found()
> +else
> +build_dri2 = get_option('dri2') == 'yes'
> +endif
> +
> +if get_option('dri3') == 'auto'
> +build_dri3 = dri3proto_dep.found() and xshmfence_dep.found()
> +else
> +build_dri3 = get_option('dri3') == 'yes'
> +if build_dri3
> +   if not xshmfence_dep.found()
> +   error('DRI3 requested, but xshmfence not found')
> +   endif
> +endif
> +endif
> +
> +libdrm_required = (get_option('dri1') == 'yes') or (get_option('dri2') == 
> 'yes') or (get_option('dri3') == 'yes')
> +libdrm_dep = dependency('libdrm', version: '>= 2.3.1', required: 
> libdrm_required)
> +build_modesetting = false
> +if libdrm_dep.found()
> +  if build_dri2
> +# 2.4.65 is required for drmGetDevice
> +dependency('libdrm', version: '>= 2.4.65')
> +  endif
> +  # 2.4.46 is required for cursor hotspot support.
> +  build_modesetting = dependency('libdrm', version: '>= 2.4.46', required: 
> false).found()
> +endif

I think this is more clearly stated as:

build_modesetting = libdrm_dep.version().version_compare('>= 2.4.46')

It's a bit of an odd choice (modesetting driver if you have dri1/2/3
enabled, or if libdrm happened to be found anyway), but that should be
true so often I don't think it's worth worrying about.

>  # XXX: Allow configuration of these.
>  build_apm = false
>  build_acpi = false
> -build_dri1 = true
> -build_dri2 = true
> -build_dri3 = true
>  build_dpms = true
>  build_mitshm = true
>  build_res = true
> @@ -346,7 +378,6 @@ libxserver = [
>  libxserver_composite,
>  libxserver_damageext,
>  libxserver_dbe,
> -libxserver_dri3,
>  libxserver_randr,
>  libxserver_miext_damage,
>  libxserver_render,
> @@ -361,4 +392,10 @@ libxserver = [
>  libxserver_os,
>  ]
>  
> +if build_dri3
> +libserver += [
> +libxserver_dri3
> +]
> +endif

These two hunks can be dropped if the [] construct is used, above.

With these little changes, patches 1-4 are:

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 app/xdpyinfo] Use XRANDR 1.2 extension for reporting dimensions and resolution per output

2017-05-08 Thread Eric Anholt
Pali Rohár  writes:

> [ Unknown signature status ]
> On Saturday 06 May 2017 13:28:17 Julien Cristau wrote:
>> On Fri, May  5, 2017 at 10:08:14 +0200, Pali Rohár wrote:
>> > PING.
>> > 
>> > I would like to know if there is some problem with this and
>> > something needs to be reworked or if it can be accepted.
>> > 
>> > Currently xdpyinfo report bogus dimensions and resolution values
>> > and lot of people complain about this problem. It should be fixed.
>> 
>> Yes, there's a problem with this.  xrandr is the tool to get monitor
>> dimensions, xdpyinfo serves a different purpose.  You could add
>> support for xdpyinfo -ext RANDR, but changing the default output is
>> a bad idea IMO.
>
> But xdpyinfo already output dimensions and that value is incorrect.
>
> If you do not agree that it should be fixed, then I can send patch to 
> totally remove dimensions information from xdpyinfo to not provide 
> incorrect and bogus values anymore.

That would also not be accepted.  You don't get to rewrite output like
this in old CLI tools that have had consistent behavior for decades.  It
causes breakage for systems expecting old behavior, even when that
behavior is unfortunate and wrong.  You just build different, better
tools, and convince users to switch over.  In this case, that tool
exists and is called xrandr.


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 resend] xf86: dri2: Use va_gl as vdpau_driver for Intel i965 GPUs

2017-05-08 Thread Eric Anholt
Hans de Goede  writes:

> The modesetting driver (which now often is used with Intel GPUs),
> relies on dri2_probe_driver_name() to get the dri and vdpau driver
> names, before this commit it would always assign the same name to
> the 2 names. But the vdpau driver for i965 GPUs should be va_gl
> (i915 does not support vdpau at all).
>
> This commit modifies the used lookup table and dri2_probe_driver_name()
> to set the vdpau_driver to va_gl for i965 GPUs, it leaves the 2
> names the same for all other GPUs.
>
> Note this commit adds a FIXME comment for a memory leak in
> dri2_probe_driver_name(), that leak was already present and fixing
> it falls outside of the scope of this commit.

It sounds from va_gl's page like it could be used not just on intel but
on AMD.  Since va_gl sounds like it's a generic fallback to layering
vaapi in between vdpau and hardware, could the vdpau wrapper lib be
modified to always try it as a fallback for no driver-specific lib being
present?  This seems to me like the right place to fix things: the X
server has only worse knowledge of what drivers your software has than
your software itself does.

Alternatively, if the vdpau wrapper lib is not modifiable, should we be
answering va_gl for basically everything where we don't know of an open
vdpau implementation?


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] meson: Fix kdrive build.

2017-05-03 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/kdrive/ephyr/meson.build | 1 -
 hw/kdrive/src/meson.build   | 1 -
 2 files changed, 2 deletions(-)

diff --git a/hw/kdrive/ephyr/meson.build b/hw/kdrive/ephyr/meson.build
index cf1cfd5e0c6f..615649865c1e 100644
--- a/hw/kdrive/ephyr/meson.build
+++ b/hw/kdrive/ephyr/meson.build
@@ -4,7 +4,6 @@ srcs = [
 'ephyrcursor.c',
 'ephyr_draw.c',
 'hostx.c',
-'os.c',
 ]
 
 xephyr_dep = [
diff --git a/hw/kdrive/src/meson.build b/hw/kdrive/src/meson.build
index d257307cb8ab..06bc34e04460 100644
--- a/hw/kdrive/src/meson.build
+++ b/hw/kdrive/src/meson.build
@@ -3,7 +3,6 @@ srcs_kdrive = [
 'kdrive.c',
 'kinfo.c',
 'kinput.c',
-'kmode.c',
 'kshadow.c',
 '../../../mi/miinitext.c',
 ]
-- 
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] Makefile.am: make 'make distcheck' verify the meson build

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

> Signed-off-by: Adam Jackson <a...@redhat.com>

Cute.

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 v2 xserver] Makefile.am: add the meson files to the tarball

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

> While we're shipping both build systems, we'll likely have 'make dist'
> generated tarballs - those tarballs should be buildable with meson to
> have more exposure.
>
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

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 xserver 1/2] meson: use link_with for Xorg's shared modules as well as Xorg.

2017-04-28 Thread Eric Anholt
I converted Xorg when meson 0.40 came out, but fumbled my grep and
forgot that I had instances of the .extract_all_objects() workaround
in dixmods, too.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xfree86/dixmods/meson.build | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/dixmods/meson.build b/hw/xfree86/dixmods/meson.build
index 36027f045991..39276dc32839 100644
--- a/hw/xfree86/dixmods/meson.build
+++ b/hw/xfree86/dixmods/meson.build
@@ -18,7 +18,7 @@ shared_module(
 include_directories: [inc, xorg_inc],
 c_args: xorg_c_args,
 dependencies: common_dep,
-objects: libxserver_fb.extract_all_objects(),
+link_with: libxserver_fb,
 
 install: true,
 install_dir: module_dir,
@@ -31,7 +31,7 @@ shared_module(
 include_directories: [inc, xorg_inc],
 c_args: [ xorg_c_args, wfb_args ],
 dependencies: common_dep,
-objects: libxserver_wfb.extract_all_objects(),
+link_with: libxserver_wfb,
 
 install: true,
 install_dir: module_dir,
@@ -43,7 +43,7 @@ shared_module(
 include_directories: [inc, xorg_inc],
 c_args: xorg_c_args,
 dependencies: common_dep,
-objects: libxserver_miext_shadow.extract_all_objects(),
+link_with: libxserver_miext_shadow,
 
 install: true,
 install_dir: module_dir,
@@ -57,7 +57,7 @@ if build_glx
 include_directories: [ inc, xorg_inc, glx_inc ],
 c_args: [ xorg_c_args, glx_align64 ],
 dependencies: [ common_dep, dl_dep ],
-objects: libxserver_glx.extract_all_objects(),
+link_with: libxserver_glx,
 
 install: true,
 install_dir: join_paths(module_dir, 'extensions')
-- 
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] meson: Fix glx build with DRI2 disabled.

2017-04-28 Thread Eric Anholt
A common meson pattern is to use empty arrays for optional sources and
dependencies, since it generally iterates over trees of arrays looking
for values.  A value of '' will actually go looking for ''.

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

diff --git a/glx/meson.build b/glx/meson.build
index c5f5ecc8f430..a4af2b84688e 100644
--- a/glx/meson.build
+++ b/glx/meson.build
@@ -49,7 +49,7 @@ if build_glx
 )
 endif
 
-srcs_glxdri2 = ''
+srcs_glxdri2 = []
 if build_dri2 or build_dri3
 srcs_glxdri2 = files('glxdri2.c')
 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

Re: [PATCH xserver] Makefile.am: add the meson files to the tarball

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

> While we're providing both build systems, we'll likely have 'make dist'
> generated tarballs - those tarballs should be buildable with meson to
> have more exposure.
>
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
> ---
> triggered by:
> https://mail.gnome.org/archives/desktop-devel-list/2017-April/msg00091.html
>
> I opted to keep all the meson-specifics in one location rather than
> sprinkling it across the various Makefile.am's.
>
>  Makefile.am | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Makefile.am b/Makefile.am
> index f0fa2d8..2c51f5e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -74,6 +74,12 @@ endif
>  
>  EXTRA_DIST = xorg-server.pc.in xorg-server.m4 autogen.sh
>  
> +meson_files = $(shell find . -type f -name '*meson.*' -print 2>/dev/null)
> +EXTRA_DIST += meson_options.txt \
> +  hw/xfree86/loader/symbol-test.c \
> +  hw/xfree86/common/xf86Build.sh \
> +  $(meson_files)

Matching sucks because it might pick up other things, but it's the only
reasonable solution when using autotool's make dist.  Hopefully we can
stop that soon.

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 0/3] meson build for xserver

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

> On Tue, 2017-04-25 at 16:02 -0700, Eric Anholt wrote:
>
>> meson build/ -Dxephyr=true  # ./configure equivalent
>> mesonconf build/ -Ddmx=yes  # Turns on a feature later.
>
> I also found useful:
>
> mesonconf build/  # display available build options and their values
>
> Eric updated this slightly on his meson branch, which I've merged:
>
> remote: E: failed to find patch for rev 
> 1549e30372756cfdb85379fd8d93c769297ab6e6.
> remote: I: 0 patch(es) updated to state Accepted.
> To ssh://git.freedesktop.org/git/xorg/xserver
>c7be7a688..1549e3037  master -> master
>
> I'm not sure when exactly we'll be able to be rid of the automake
> build. If nothing else, meson's requirement for python3 makes building
> with it on RHEL7 slightly awkward for me. With that in mind, some
> guidelines, if I may be so bold:
>
> Contributors: If your new feature changes the build system, while it is
> appreciated if it builds with both, it is not absolutely necessary; if
> the learning curve is too high or one build system makes the feature
> difficult to realize, we'll fix that up before merging. (Yes I'm
> volunteering.)

Consider me also on the hook for that.

> Pushers: Avoid pushing anything that breaks either build system. In
> particular, if a single change alters either build system as well as
> the code, verify that the other build system is either similarly
> altered or needs no alteration.
>
> I haven't verified the meson test path, and expect it doesn't work yet.
> Once it works I'll switch my pre-push checks to build with both build
> systems but run the tests from meson, so I can at least hide the
> automake slowness parallel to xts slowness.

Getting the tests hooked back up is high on my list, also Travis.

Are we melting two CPUs with xtest at this point, or are there still
sleeps?  If we're melting two CPUs, then it may be time to split our
test list up, do multiple piglit-run.pys in parallel, and merge results
later.  I think piglit has support for doing that.


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/9] First round of meson fixes

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

> This fixes the dmx build, and builds the rest of the Xorg loadables.
>
> I kind of wish static library targets would accept an empty file list,
> I think the 'if srcs_libc.length() > 0' trick in os/meson.build is a
> bit ugly. Ah well, the fact that you can then pass it as a link_with to
> another static library and have it work like you expect makes up for it.

I'd say that pattern was the hardest thing to adjust to with meson, for
me.

One whitespace comment, two optional changes, otherwise it's all:

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 5/9] meson: Build libwfb.so

2017-04-27 Thread Eric Anholt
Adam Jackson  writes:

> Signed-off-by: Adam Jackson 
> ---
>  fb/meson.build | 10 ++
>  hw/xfree86/dixmods/meson.build | 12 
>  2 files changed, 22 insertions(+)
>
> diff --git a/fb/meson.build b/fb/meson.build
> index ef8e68ca2..12329073d 100644
> --- a/fb/meson.build
> +++ b/fb/meson.build
> @@ -34,3 +34,13 @@ libxserver_fb = static_library('libxserver_fb',
>   dependencies: common_dep,
>   pic: true,
>  )
> +
> +wfb_args = '-DFB_ACCESS_WRAPPER'
> +
> +libxserver_wfb = static_library('libxserver_wfb',
> + srcs_fb,
> +c_args: wfb_args,
> + include_directories: inc,
> + dependencies: common_dep,
> + pic: true,
> +)

Indentation gone wrong.

We could use "build_by_default: false" here to keep it from being built
unless Xorg's libwfb needs it.

(meson by default builds executables and libraries even if nothing
depends on them, but doesn't build custom targets unless something
depends on them)


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 4/9] meson: Build libglx.so

2017-04-27 Thread Eric Anholt
Adam Jackson  writes:

> Signed-off-by: Adam Jackson 
> ---
>  glx/meson.build|  5 +
>  hw/xfree86/dixmods/meson.build | 15 +++
>  meson.build|  2 ++
>  3 files changed, 22 insertions(+)
>
> diff --git a/glx/meson.build b/glx/meson.build
> index a29e53cfa..c5f5ecc8f 100644
> --- a/glx/meson.build
> +++ b/glx/meson.build
> @@ -48,3 +48,8 @@ if build_glx
>  ]
>  )
>  endif
> +
> +srcs_glxdri2 = ''
> +if build_dri2 or build_dri3
> +srcs_glxdri2 = files('glxdri2.c')
> +endif
> diff --git a/hw/xfree86/dixmods/meson.build b/hw/xfree86/dixmods/meson.build
> index 2b8fe1349..e2c91265d 100644
> --- a/hw/xfree86/dixmods/meson.build
> +++ b/hw/xfree86/dixmods/meson.build
> @@ -36,3 +36,18 @@ shared_module(
>  install: true,
>  install_dir: module_dir,
>  )
> +
> +if build_glx
> +shared_module(
> +'glx',
> +[ 'glxmodule.c', srcs_glxdri2 ],
> +
> +include_directories: [ inc, xorg_inc, glx_inc ],
> +c_args: [ xorg_c_args, glx_align64 ],
> +dependencies: [ common_dep, dl_dep ],
> +objects: libxserver_glx.extract_all_objects(),

Oops, I should have converted the other dixmods to .link_whole.  We can
either use that here now, or I'll send a fixup later.


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/3] Use #ifdef instead of #if for features to make Meson easier.

2017-04-26 Thread Eric Anholt
Aaron Plattner  writes:

> We try to do exactly the opposite in our internal driver build, because
> it's too easy to accidentally do something like
>
> #ifdef GLAMOUR_HAS_GBM
>
> And mistakes like that don't always cause obvious build failures like
> this would. So we build everything with -Wundef -Werror=undef and try to
> use #if whenever possible. It's a shame that Meson makes that hard.

Meson makes what you want easy with:

set10(varname, boolean_value) is the same as above but the value is
either true or false and will be written as 1 or 0, respectively

but autotools usually produces either #define 1 or #undef, unless you go
through contortions.  This seemed like the easy, consistent solution
today, given that our codebase is almost all #ifdef.  One alternative
would be to just disable -Wundef for now.  The other alternative to this
patch would be something like:

conf_array += ['HAVE_DBM_H', cc.has_header('dbm.h')]

then finish with something like:

foreach conf: conf_array
if conf[1]
conf_data.set(conf[0], '1')
endif
endforeach

but I think I'd rather wait and consistently swap to .set10() and #if
once we've nuked autotools.


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] os: Handle SIGABRT

2017-04-25 Thread Eric Anholt
Michel Dänzer <mic...@daenzer.net> writes:

> From: Michel Dänzer <michel.daen...@amd.com>
>
> Without this, assertion failures make life hard for users and those
> trying to help them.

There are two other places that do things with SIGSEGV, and I think
SIGABRT should be added to their lists, too:

- xf86Init.c's notrapSignals case
- quartz.c's QuartzInitOutput() that also tries to not trap signals.

With that fixed, it will be:

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 xserver 3/3] Add a Meson build system alongside autotools.

2017-04-25 Thread Eric Anholt
This is a work in progress that builds Xvfb, Xephyr, Xwayland, Xnest,
and Xdmx so far.  The outline of Xquartz/Xwin support is in tree, but
hasn't been built yet.  The unit tests are also not done.

The intent is to build this as a complete replacement for the
autotools system, then eventually replace autotools.  meson is faster
to generate the build, faster to run the bulid, shorter to write the
build files in, and less error-prone than autotools.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 Xext/meson.build   |  61 +
 Xi/meson.build |  67 ++
 composite/meson.build  |  13 ++
 config/meson.build |  35 +++
 damageext/meson.build  |   9 +
 dbe/meson.build|  10 +
 dix/meson.build|  47 
 dri3/meson.build   |  12 +
 exa/meson.build|  24 ++
 fb/meson.build |  36 +++
 glamor/meson.build |  58 +
 glx/meson.build|  50 
 hw/dmx/config/meson.build  |  81 +++
 hw/dmx/examples/meson.build|  33 +++
 hw/dmx/glxProxy/meson.build|  27 +++
 hw/dmx/input/meson.build   |  32 +++
 hw/dmx/meson.build |  68 ++
 hw/kdrive/ephyr/meson.build|  62 +
 hw/kdrive/meson.build  |   2 +
 hw/kdrive/src/meson.build  |  22 ++
 hw/meson.build |  25 ++
 hw/vfb/meson.build |  21 ++
 hw/xfree86/common/meson.build  |  93 
 hw/xfree86/common/xf86Build.sh |   6 +
 hw/xfree86/ddc/meson.build |  15 ++
 hw/xfree86/dixmods/meson.build |  38 +++
 hw/xfree86/dri/meson.build |  23 ++
 hw/xfree86/dri2/meson.build|  16 ++
 hw/xfree86/drivers/modesetting/meson.build |  42 
 hw/xfree86/exa/meson.build |   9 +
 hw/xfree86/glamor_egl/meson.build  |  22 ++
 hw/xfree86/i2c/meson.build |  12 +
 hw/xfree86/int10/meson.build   |  54 +
 hw/xfree86/loader/loader.c |   4 +
 hw/xfree86/loader/meson.build  |  16 ++
 hw/xfree86/loader/symbol-test.c|  53 +
 hw/xfree86/meson.build | 106 +
 hw/xfree86/modes/meson.build   |  30 +++
 hw/xfree86/os-support/meson.build  | 125 ++
 hw/xfree86/parser/meson.build  |  32 +++
 hw/xfree86/ramdac/meson.build  |  27 +++
 hw/xfree86/x86emu/meson.build  |  15 ++
 hw/xnest/meson.build   |  37 +++
 hw/xquartz/meson.build |  40 
 hw/xwayland/meson.build|  66 ++
 include/meson.build| 329 ++
 include/xorg-config.h.meson.in | 151 
 meson.build| 360 +
 meson_options.txt  |  46 
 mi/meson.build |  39 
 miext/damage/meson.build   |   9 +
 miext/shadow/meson.build   |  32 +++
 miext/sync/meson.build |  17 ++
 os/meson.build |  65 ++
 present/meson.build|  19 ++
 pseudoramiX/meson.build|   5 +
 randr/meson.build  |  26 +++
 record/meson.build |  10 +
 render/meson.build |  19 ++
 xfixes/meson.build |  13 ++
 xkb/meson.build|  42 
 61 files changed, 2858 insertions(+)
 create mode 100644 Xext/meson.build
 create mode 100644 Xi/meson.build
 create mode 100644 composite/meson.build
 create mode 100644 config/meson.build
 create mode 100644 damageext/meson.build
 create mode 100644 dbe/meson.build
 create mode 100644 dix/meson.build
 create mode 100644 dri3/meson.build
 create mode 100644 exa/meson.build
 create mode 100644 fb/meson.build
 create mode 100644 glamor/meson.build
 create mode 100644 glx/meson.build
 create mode 100644 hw/dmx/config/meson.build
 create mode 100644 hw/dmx/examples/meson.build
 create mode 100644 hw/dmx/glxProxy/meson.build
 create mode 100644 hw/dmx/input/meson.build
 create mode 100644 hw/dmx/meson.build
 create mode 100644 hw/kdrive/ephyr/meson.build
 create mode 100644 hw/kdrive/meson.build
 create mode 100644 hw/kdrive/src/meson.build
 create mode 100644 hw/meson.build
 create mode 100644 hw/vfb/meson.build
 create mode 100644 hw/xfree86/common/meson.build
 create mode 100755 hw/xfree86/common/xf86Build.sh
 create mode 100644 hw/xfree86/ddc/meson.build
 create mode 100644 hw/xfree86/dixmods/meson

[PATCH xserver 0/3] meson build for xserver

2017-04-25 Thread Eric Anholt
Here's my little patch series for adding a Meson build system for the
X Server.  You'll need meson 0.40, which was released this weekend --
it has a feature that we requested for Xorg's meson.build, and the
bugfix for chrpath when installing the the modesetting driver.

The meson build is not quite complete yet (see patch 3 for some notes
on that, and its XXX comments), but I'm hoping we can merge it and
finish it off in the shared tree.  My expectation is that we would
ship a release with autotools and meson in parallel, then remove
autotools after that release.

autotools:   meson:
no-op build  0.83 0.49
touch Makefile.am1.28
touch configure.ac  16.68
touch meson.build 2.92
clean ccache build  16.74 1.44
clean build 52.2427.84

Note that the time for no-op build isn't quite fair to meson: in the
meson build I have the X.org BUILD_DATE changing on every ninja build,
while autotools was setting BUILD_DATE once at ./configure time.

Quick guide:

meson build/ -Dxephyr=true  # ./configure equivalent
mesonconf build/ -Ddmx=yes  # Turns on a feature later.
ninja -C build/ # make equivalent
ninja -C build/ install # make install equivalent
ninja -C build/ test# make check equivalent

Eric Anholt (3):
  dix: Remove a redundant #define
  Use #ifdef instead of #if for features to make Meson easier.
  Add a Meson build system alongside autotools.

 Xext/meson.build   |  61 +
 Xi/meson.build |  67 ++
 composite/meson.build  |  13 ++
 config/meson.build |  35 +++
 damageext/meson.build  |   9 +
 dbe/meson.build|  10 +
 dix/dispatch.c |   3 +-
 dix/meson.build|  47 
 dri3/meson.build   |  12 +
 exa/meson.build|  24 ++
 fb/meson.build |  36 +++
 glamor/glamor_priv.h   |   4 +-
 glamor/meson.build |  58 +
 glx/meson.build|  50 
 hw/dmx/config/meson.build  |  81 +++
 hw/dmx/examples/meson.build|  33 +++
 hw/dmx/glxProxy/meson.build|  27 +++
 hw/dmx/input/meson.build   |  32 +++
 hw/dmx/meson.build |  68 ++
 hw/kdrive/ephyr/meson.build|  62 +
 hw/kdrive/meson.build  |   2 +
 hw/kdrive/src/meson.build  |  22 ++
 hw/meson.build |  25 ++
 hw/vfb/meson.build |  21 ++
 hw/xfree86/common/meson.build  |  93 
 hw/xfree86/common/xf86.h   |   2 +-
 hw/xfree86/common/xf86Build.sh |   6 +
 hw/xfree86/ddc/meson.build |  15 ++
 hw/xfree86/dixmods/meson.build |  38 +++
 hw/xfree86/dri/meson.build |  23 ++
 hw/xfree86/dri2/meson.build|  16 ++
 hw/xfree86/drivers/modesetting/driver.c|  16 +-
 hw/xfree86/drivers/modesetting/meson.build |  42 
 hw/xfree86/exa/meson.build |   9 +
 hw/xfree86/glamor_egl/meson.build  |  22 ++
 hw/xfree86/i2c/meson.build |  12 +
 hw/xfree86/int10/meson.build   |  54 +
 hw/xfree86/loader/loader.c |   4 +
 hw/xfree86/loader/loadmod.c|   4 +-
 hw/xfree86/loader/meson.build  |  16 ++
 hw/xfree86/loader/symbol-test.c|  53 +
 hw/xfree86/meson.build | 106 +
 hw/xfree86/modes/meson.build   |  30 +++
 hw/xfree86/os-support/meson.build  | 125 ++
 hw/xfree86/parser/meson.build  |  32 +++
 hw/xfree86/ramdac/meson.build  |  27 +++
 hw/xfree86/sdksyms.sh  |   8 +-
 hw/xfree86/x86emu/meson.build  |  15 ++
 hw/xnest/meson.build   |  37 +++
 hw/xquartz/meson.build |  40 
 hw/xwayland/meson.build|  66 ++
 hw/xwayland/xwayland.c |   2 +-
 include/dixstruct.h|   2 +-
 include/meson.build| 329 ++
 include/os.h   |   2 +-
 include/xorg-config.h.meson.in | 151 
 include/xserver_poll.h |   2 +-
 meson.build| 360 +
 meson_options.txt  |  46 
 mi/meson.build |  39 
 miext/damage/meson.build   |   9 +
 miext/shadow/meson.build   |  32 +++
 miext/sync/meson.build |  17 ++
 os/meson.build

[PATCH xserver 2/3] Use #ifdef instead of #if for features to make Meson easier.

2017-04-25 Thread Eric Anholt
We mostly use #ifdef throughout the tree, and this lets the generated
config.h files just be #define TOKEN instead of #define TOKEN 1.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor_priv.h|  4 ++--
 hw/xfree86/common/xf86.h|  2 +-
 hw/xfree86/drivers/modesetting/driver.c | 16 
 hw/xfree86/loader/loadmod.c |  4 ++--
 hw/xfree86/sdksyms.sh   |  8 
 hw/xwayland/xwayland.c  |  2 +-
 include/dixstruct.h |  2 +-
 include/os.h|  2 +-
 include/xserver_poll.h  |  2 +-
 os/utils.c  | 16 
 10 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 7b92f35705f4..a90879a7bbfd 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -38,7 +38,7 @@
 #endif
 
 #include 
-#if GLAMOR_HAS_GBM
+#ifdef GLAMOR_HAS_GBM
 #define MESA_EGL_NO_X11_HEADERS
 #include 
 #endif
@@ -342,7 +342,7 @@ typedef struct glamor_pixmap_private {
 GLuint pbo;
 RegionRec prepare_region;
 Bool prepared;
-#if GLAMOR_HAS_GBM
+#ifdef GLAMOR_HAS_GBM
 EGLImageKHR image;
 #endif
 /** block width of this large pixmap. */
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index f1a5bd6741bd..877b9e9e768e 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -35,7 +35,7 @@
 #ifndef _XF86_H
 #define _XF86_H
 
-#if HAVE_XORG_CONFIG_H
+#ifdef HAVE_XORG_CONFIG_H
 #include 
 #elif HAVE_DIX_CONFIG_H
 #include 
diff --git a/hw/xfree86/drivers/modesetting/driver.c 
b/hw/xfree86/drivers/modesetting/driver.c
index d7030e5c2117..a1451fe471e8 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -55,7 +55,7 @@
 #ifdef XSERVER_PLATFORM_BUS
 #include "xf86platformBus.h"
 #endif
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 #include 
 #endif
 
@@ -227,7 +227,7 @@ check_outputs(int fd, int *count)
 *count = res->count_connectors;
 
 ret = res->count_connectors > 0;
-#if defined DRM_CAP_PRIME && GLAMOR_HAS_GBM_LINEAR
+#if defined(DRM_CAP_PRIME) && defined(GLAMOR_HAS_GBM_LINEAR)
 if (ret == FALSE) {
 uint64_t value = 0;
 if (drmGetCap(fd, DRM_CAP_PRIME, ) == 0 &&
@@ -244,7 +244,7 @@ probe_hw(const char *dev, struct xf86_platform_device 
*platform_dev)
 {
 int fd;
 
-#if XF86_PDEV_SERVER_FD
+#ifdef XF86_PDEV_SERVER_FD
 if (platform_dev && (platform_dev->flags & XF86_PDEV_SERVER_FD)) {
 fd = xf86_platform_device_odev_attributes(platform_dev)->fd;
 if (fd == -1)
@@ -366,7 +366,7 @@ ms_setup_entity(ScrnInfoPtr scrn, int entity_num)
 pPriv->ptr = xnfcalloc(sizeof(modesettingEntRec), 1);
 }
 
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 static Bool
 ms_pci_probe(DriverPtr driver,
  int entity_num, struct pci_device *dev, intptr_t match_data)
@@ -826,7 +826,7 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
 return TRUE;
 }
 
-#if XSERVER_PLATFORM_BUS
+#ifdef XSERVER_PLATFORM_BUS
 if (pEnt->location.type == BUS_PLATFORM) {
 #ifdef XF86_PDEV_SERVER_FD
 if (pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)
@@ -844,7 +844,7 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
 }
 else
 #endif
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 if (pEnt->location.type == BUS_PCI) {
 char *BusID = NULL;
 struct pci_device *PciInfo;
@@ -1018,7 +1018,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
 if (ms->drmmode.glamor)
 pScrn->capabilities |= RR_Capability_SinkOffload;
 }
-#if GLAMOR_HAS_GBM_LINEAR
+#ifdef GLAMOR_HAS_GBM_LINEAR
 if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor)
 pScrn->capabilities |= RR_Capability_SourceOutput | 
RR_Capability_SourceOffload;
 #endif
@@ -1189,7 +1189,7 @@ msEnableSharedPixmapFlipping(RRCrtcPtr crtc, PixmapPtr 
front, PixmapPtr back)
 if (ms->drmmode.reverse_prime_offload_mode)
 return FALSE;
 
-#if XSERVER_PLATFORM_BUS
+#ifdef XSERVER_PLATFORM_BUS
 if (pEnt->location.type == BUS_PLATFORM) {
 char *syspath =
 xf86_platform_device_odev_attributes(pEnt->location.id.plat)->
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 09aae0ea200b..5063500857a7 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -627,10 +627,10 @@ static const char *compiled_in_modules[] = {
 "extmod",
 "dri",
 "dri2",
-#if DRI3
+#ifdef DRI3
 "dri3",
 #endif
-#if PRESENT
+#ifdef PRESENT
 "present",
 #endif
 NULL
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index cb2e5616b3da..9aa1eec4f792 100755
--- a/

[PATCH xserver 1/3] dix: Remove a redundant #define

2017-04-25 Thread Eric Anholt
Found when the meson conversion set the symbol to defined, instead of
defined to 1.

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

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 78ac095b1fb8..a2df1e0e6dca 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -222,8 +222,7 @@ UpdateCurrentTimeIf(void)
 #define SMART_SCHEDULE_MAX_SLICE   15
 
 #ifdef HAVE_SETITIMER
-#define SMART_SCHEDULE_DEFAULT_SIGNAL_ENABLE HAVE_SETITIMER
-Bool SmartScheduleSignalEnable = SMART_SCHEDULE_DEFAULT_SIGNAL_ENABLE;
+Bool SmartScheduleSignalEnable = TRUE;
 #endif
 
 long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
-- 
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] modesetting: Add the "DPI" connector type.

2017-04-25 Thread Eric Anholt
The number for it was merged to drm_mode.h in kernel 4.7, and the
output_names[] array just requires that we slot in new strings in
order.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c 
b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 516eb7691507..bbca8ca704a5 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1621,6 +1621,7 @@ static const char *const output_names[] = {
 "eDP",
 "Virtual",
 "DSI",
+"DPI",
 };
 
 static xf86OutputPtr find_output(ScrnInfoPtr pScrn, int id)
-- 
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 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

<    1   2   3   4   5   6   7   8   9   10   >