Mesa (master): st/mesa: expose OES_geometry_shader and OES_texture_cube_map_array

2016-08-31 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: e3db41545676d0b7961ac4caa5ef645cdbf12691
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3db41545676d0b7961ac4caa5ef645cdbf12691

Author: Ilia Mirkin 
Date:   Sat Aug 27 17:47:37 2016 -0400

st/mesa: expose OES_geometry_shader and OES_texture_cube_map_array

Signed-off-by: Ilia Mirkin 
Reviewed-by: Marek Olšák 

---

 docs/features.txt  |  4 ++--
 docs/relnotes/12.1.0.html  |  4 ++--
 src/mesa/state_tracker/st_extensions.c | 15 +++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index d6c3240..690c160 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -260,7 +260,7 @@ GLES3.2, GLSL ES 3.2:
   GL_OES_copy_image DONE (all drivers)
   GL_OES_draw_buffers_indexed   DONE (all drivers that 
support GL_ARB_draw_buffers_blend)
   GL_OES_draw_elements_base_vertex  DONE (all drivers)
-  GL_OES_geometry_shaderDONE (i965/gen8+)
+  GL_OES_geometry_shaderDONE (i965/gen8+, 
nvc0, radeonsi)
   GL_OES_gpu_shader5DONE (all drivers that 
support GL_ARB_gpu_shader5)
   GL_OES_primitive_bounding_box DONE (i965/gen7+, 
nvc0, radeonsi)
   GL_OES_sample_shading DONE (i965, nvc0, 
r600, radeonsi)
@@ -271,7 +271,7 @@ GLES3.2, GLSL ES 3.2:
   GL_OES_tessellation_shaderstarted (Ken)
   GL_OES_texture_border_clamp   DONE (all drivers)
   GL_OES_texture_buffer DONE (i965, nvc0, 
radeonsi)
-  GL_OES_texture_cube_map_array DONE (i965/gen8+)
+  GL_OES_texture_cube_map_array DONE (i965/gen8+, 
nvc0, radeonsi)
   GL_OES_texture_stencil8   DONE (all drivers that 
support GL_ARB_texture_stencil8)
   GL_OES_texture_storage_multisample_2d_array   DONE (all drivers that 
support GL_ARB_texture_multisample)
 
diff --git a/docs/relnotes/12.1.0.html b/docs/relnotes/12.1.0.html
index bb20e4f..3368ebc 100644
--- a/docs/relnotes/12.1.0.html
+++ b/docs/relnotes/12.1.0.html
@@ -58,9 +58,9 @@ Note: some of the new features are only available with 
certain drivers.
 GL_KHR_blend_equation_advanced on i965
 GL_KHR_texture_compression_astc_sliced_3d on i965
 GL_OES_copy_image on nv50, nvc0, r600, radeonsi, softpipe, llvmpipe
-GL_OES_geometry_shader on i965/gen8+
+GL_OES_geometry_shader on i965/gen8+, nvc0, radeonsi
 GL_OES_primitive_bounding_box on i965/gen7+, nvc0, radeonsi
-GL_OES_texture_cube_map_array on i965/gen8+
+GL_OES_texture_cube_map_array on i965/gen8+, nvc0, radeonsi
 
 
 Bug fixes
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 2238d1a..807fbfb 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -946,6 +946,16 @@ void st_init_extensions(struct pipe_screen *screen,
   extensions->ARB_tessellation_shader = GL_TRUE;
}
 
+   /* What this is really checking for is the ability to support multiple
+* invocations of a geometry shader. There is no separate cap for that, so
+* we check the GLSLVersion.
+*/
+   if (consts->GLSLVersion >= 400 &&
+   screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY,
+PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
+  extensions->OES_geometry_shader = GL_TRUE;
+   }
+
if (screen->fence_finish) {
   extensions->ARB_sync = GL_TRUE;
}
@@ -1211,6 +1221,11 @@ void st_init_extensions(struct pipe_screen *screen,
   extensions->ARB_gpu_shader5 &&
   extensions->EXT_shader_integer_mix;
 
+   extensions->OES_texture_cube_map_array =
+  extensions->ARB_ES3_1_compatibility &&
+  extensions->OES_geometry_shader &&
+  extensions->ARB_texture_cube_map_array;
+
extensions->OES_primitive_bounding_box = 
extensions->ARB_ES3_1_compatibility;
consts->NoPrimitiveBoundingBoxOutput = true;
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): Introduce .editorconfig

2016-08-31 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 3bd885d09cea6ecf19ddfd948c8dd74f5e3ea600
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3bd885d09cea6ecf19ddfd948c8dd74f5e3ea600

Author: Eric Engestrom 
Date:   Tue Aug 30 21:02:18 2016 +0100

Introduce .editorconfig

A few weeks ago, Jose Fonseca suggested [0] we use .editorconfig files
to try and enforce the formatting of the code, to which Michel Dänzer
suggested [1] we start by importing the existing .dir-locals.el
settings. The first draft was discussed in the RFC [2].

These .editorconfig are a first step, one that has the advantage of
requiring little to no intervention from the devs once the settings
files are in place, but the settings are very limited. This does have
the advantage of applying while the code is being written.
This doesn't replace the need for more comprehensive formatting tools
such as clang-format & clang-tidy, but those reformat the code after
the fact.

[0] https://lists.freedesktop.org/archives/mesa-dev/2016-June/121545.html
[1] https://lists.freedesktop.org/archives/mesa-dev/2016-June/121639.html
[2] https://lists.freedesktop.org/archives/mesa-dev/2016-July/123431.html

Acked-by: Nicolai Hähnle 
Acked-by: Eric Anholt 
Signed-off-by: Eric Engestrom 
Reviewed-by: Jose Fonseca 

---

 .editorconfig| 34 
 bin/.editorconfig|  3 +++
 include/D3D9/.editorconfig   |  2 ++
 include/c11/.editorconfig|  3 +++
 include/d3dadapter/.editorconfig |  3 +++
 include/vulkan/.editorconfig |  3 +++
 src/egl/drivers/haiku/.editorconfig  |  2 ++
 src/egl/wayland/.editorconfig|  2 ++
 src/gallium/drivers/freedreno/.editorconfig  |  2 ++
 src/gallium/drivers/r300/.editorconfig   |  3 +++
 src/gallium/drivers/r600/.editorconfig   |  2 ++
 src/gallium/drivers/radeon/.editorconfig |  2 ++
 src/gallium/drivers/radeonsi/.editorconfig   |  2 ++
 src/gallium/drivers/vc4/.editorconfig|  3 +++
 src/gallium/drivers/vc4/kernel/.editorconfig |  2 ++
 src/gallium/state_trackers/hgl/.editorconfig |  2 ++
 src/gallium/state_trackers/nine/.editorconfig|  3 +++
 src/gallium/state_trackers/xa/.editorconfig  |  3 +++
 src/gallium/targets/d3dadapter9/.editorconfig|  3 +++
 src/gallium/targets/haiku-softpipe/.editorconfig |  2 ++
 src/gallium/winsys/freedreno/drm/.editorconfig   |  2 ++
 src/gallium/winsys/nouveau/drm/.editorconfig |  2 ++
 src/gallium/winsys/radeon/drm/.editorconfig  |  3 +++
 src/gallium/winsys/sw/hgl/.editorconfig  |  2 ++
 src/getopt/.editorconfig |  2 ++
 src/gtest/.editorconfig  |  3 +++
 src/hgl/.editorconfig|  2 ++
 src/mesa/drivers/dri/nouveau/.editorconfig   |  2 ++
 28 files changed, 99 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000..a8b8a88
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,34 @@
+# To use this config on you editor, follow the instructions at:
+# http://editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+insert_final_newline = true
+
+[*.{c,h,cpp,hpp,cc,hh}]
+indent_style = space
+indent_size = 3
+
+[{Makefile*,*.mk}]
+indent_style = tab
+
+[{*.py,SCons*}]
+indent_style = space
+indent_size = 4
+
+[*.pl]
+indent_style = space
+indent_size = 4
+
+[*.m4]
+indent_style = space
+indent_size = 2
+
+[*.yml]
+indent_style = space
+indent_size = 2
+
+[*.patch]
+trim_trailing_whitespace = false
diff --git a/bin/.editorconfig b/bin/.editorconfig
new file mode 100644
index 000..b9a948f
--- /dev/null
+++ b/bin/.editorconfig
@@ -0,0 +1,3 @@
+[*.sh]
+indent_style = space
+indent_size = 2
diff --git a/include/D3D9/.editorconfig b/include/D3D9/.editorconfig
new file mode 100644
index 000..0dcc752
--- /dev/null
+++ b/include/D3D9/.editorconfig
@@ -0,0 +1,2 @@
+[*.h]
+indent_style = tab
diff --git a/include/c11/.editorconfig b/include/c11/.editorconfig
new file mode 100644
index 000..bdbea00
--- /dev/null
+++ b/include/c11/.editorconfig
@@ -0,0 +1,3 @@
+[*.h]
+indent_style = space
+indent_size = 4
diff --git a/include/d3dadapter/.editorconfig b/include/d3dadapter/.editorconfig
new file mode 100644
index 000..bdbea00
--- /dev/null
+++ b/include/d3dadapter/.editorconfig
@@ -0,0 +1,3 @@
+[*.h]
+indent_style = space
+indent_size = 4
diff --git a/include/vulkan/.editorconfig b/include/vulkan/.editorconfig
new file mode 100644
index 000..bdbea00
--- /dev/null
+++ b/include/vulkan/.editorconfig
@@ -0,0 +1,3 @@
+[*.h]
+indent_style = space
+indent_size = 4
diff --git a/src/egl/drivers/haiku/.editorconfig 
b/src/egl/drivers/haiku/.editorconfig
new file mode 100644
index 000..5ae8c6f
--- /dev/null
+++ 

Mesa (master): vc4: Add missing break statement.

2016-08-31 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 509e2dbc105a04e8bc6ed292b921cbe27957a779
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=509e2dbc105a04e8bc6ed292b921cbe27957a779

Author: Eric Anholt 
Date:   Mon Aug 29 11:23:35 2016 -0700

vc4: Add missing break statement.

This opcode isn't used yet, so it didn't affect anything.  Caught by
Coverity, reported to me by imirkin.

---

 src/gallium/drivers/vc4/vc4_qpu_emit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c 
b/src/gallium/drivers/vc4/vc4_qpu_emit.c
index 79588b3..4d371c0 100644
--- a/src/gallium/drivers/vc4/vc4_qpu_emit.c
+++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c
@@ -434,6 +434,7 @@ vc4_generate_code_block(struct vc4_compile *c,
 
 case QOP_LOAD_IMM_I2:
 queue(block, qpu_load_imm_i2(dst, 
qinst->src[0].index));
+break;
 
 case QOP_ROT_MUL:
 /* Rotation at the hardware level occurs on the inputs

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): gallium/docs: clarify render_condition_enabled parameter to clear functions

2016-08-31 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c87e8c851526123aa5edb09b20fa50e02d4398f5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c87e8c851526123aa5edb09b20fa50e02d4398f5

Author: Brian Paul 
Date:   Wed Aug 31 10:03:53 2016 -0600

gallium/docs: clarify render_condition_enabled parameter to clear functions

If false, it means do the clear unconditionally.

Reviewed-by: Marek Olšák 

---

 src/gallium/docs/source/context.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/docs/source/context.rst 
b/src/gallium/docs/source/context.rst
index 1b045fa..13dd606 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -231,12 +231,16 @@ If a surface includes several layers then all layers will 
be cleared.
 ``clear_render_target`` clears a single color rendertarget with the specified
 color value. While it is only possible to clear one surface at a time (which 
can
 include several layers), this surface need not be bound to the framebuffer.
+If render_condition_enabled is false, any current rendering condition is 
ignored
+and the clear will be unconditional.
 
 ``clear_depth_stencil`` clears a single depth, stencil or depth/stencil surface
 with the specified depth and stencil values (for combined depth/stencil 
buffers,
 it is also possible to only clear one or the other part). While it is only
 possible to clear one surface at a time (which can include several layers),
 this surface need not be bound to the framebuffer.
+If render_condition_enabled is false, any current rendering condition is 
ignored
+and the clear will be unconditional.
 
 ``clear_texture`` clears a non-PIPE_BUFFER resource's specified level
 and bounding box with a clear value provided in that resource's native

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: Add some more .gitignore

2016-08-31 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: b8bff0823b0ec1986bf7ab6fab6150fd6fbf7853
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8bff0823b0ec1986bf7ab6fab6150fd6fbf7853

Author: Jason Ekstrand 
Date:   Wed Aug 31 13:45:27 2016 -0700

mesa: Add some more .gitignore

---

 src/compiler/glsl/.gitignore | 1 +
 src/intel/tools/.gitignore   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/compiler/glsl/.gitignore b/src/compiler/glsl/.gitignore
index 5c890ae..ab03e79 100644
--- a/src/compiler/glsl/.gitignore
+++ b/src/compiler/glsl/.gitignore
@@ -5,6 +5,7 @@ glsl_parser.output
 glsl_test
 ir_expression_operation.h
 ir_expression_operation_strings.h
+ir_expression_operation_constant.h
 subtest-cr/
 subtest-lf/
 subtest-cr-lf/
diff --git a/src/intel/tools/.gitignore b/src/intel/tools/.gitignore
new file mode 100644
index 000..0c80a6f
--- /dev/null
+++ b/src/intel/tools/.gitignore
@@ -0,0 +1 @@
+/aubinator

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Pass start_offset to brw_set_uip_jip().

2016-08-31 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 90eaf01616a8cf7a39dae63a3d5636874fa68fa5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=90eaf01616a8cf7a39dae63a3d5636874fa68fa5

Author: Matt Turner 
Date:   Mon Aug 29 15:57:41 2016 -0700

i965: Pass start_offset to brw_set_uip_jip().

Without this, we would pass over the instructions in the SIMD8 program
(which is located earlier in the buffer) when brw_set_uip_jip() is
called to handle the SIMD16 program.

The assertion about compacted control flow was bogus: halt, cont, break
cannot be compacted because they have both JIP and UIP. Instead, we
should never see a compacted instruction in this code at all.

Reviewed-by: Iago Toral Quiroga 

---

 src/mesa/drivers/dri/i965/brw_eu.h   |  2 +-
 src/mesa/drivers/dri/i965/brw_eu_emit.c  | 14 +++---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp   |  2 +-
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp |  2 +-
 4 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
b/src/mesa/drivers/dri/i965/brw_eu.h
index aeb1a76..2898b2f 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -526,7 +526,7 @@ void brw_math_invert( struct brw_codegen *p,
 
 void brw_set_src1(struct brw_codegen *p, brw_inst *insn, struct brw_reg reg);
 
-void brw_set_uip_jip(struct brw_codegen *p);
+void brw_set_uip_jip(struct brw_codegen *p, int start_offset);
 
 enum brw_conditional_mod brw_negate_cmod(uint32_t cmod);
 enum brw_conditional_mod brw_swap_cmod(uint32_t cmod);
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 31fe040..6da47f2 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -2775,7 +2775,7 @@ brw_find_loop_end(struct brw_codegen *p, int start_offset)
  * BREAK, CONT, and HALT instructions to their correct locations.
  */
 void
-brw_set_uip_jip(struct brw_codegen *p)
+brw_set_uip_jip(struct brw_codegen *p, int start_offset)
 {
const struct brw_device_info *devinfo = p->devinfo;
int offset;
@@ -2786,17 +2786,9 @@ brw_set_uip_jip(struct brw_codegen *p)
if (devinfo->gen < 6)
   return;
 
-   for (offset = 0; offset < p->next_insn_offset;
-offset = next_offset(devinfo, store, offset)) {
+   for (offset = start_offset; offset < p->next_insn_offset; offset += 16) {
   brw_inst *insn = store + offset;
-
-  if (brw_inst_cmpt_control(devinfo, insn)) {
-/* Fixups for compacted BREAK/CONTINUE not supported yet. */
- assert(brw_inst_opcode(devinfo, insn) != BRW_OPCODE_BREAK &&
-brw_inst_opcode(devinfo, insn) != BRW_OPCODE_CONTINUE &&
-brw_inst_opcode(devinfo, insn) != BRW_OPCODE_HALT);
-continue;
-  }
+  assert(brw_inst_cmpt_control(devinfo, insn) == 0);
 
   int block_end_offset = brw_find_next_block_end(p, offset);
   switch (brw_inst_opcode(devinfo, insn)) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index c96e3e9..2f4ba7b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -2127,7 +2127,7 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
   }
}
 
-   brw_set_uip_jip(p);
+   brw_set_uip_jip(p, start_offset);
annotation_finalize(, p->next_insn_offset);
 
 #ifndef NDEBUG
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index b428d3a..9f94383 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -2024,7 +2024,7 @@ generate_code(struct brw_codegen *p,
   }
}
 
-   brw_set_uip_jip(p);
+   brw_set_uip_jip(p, 0);
annotation_finalize(, p->next_insn_offset);
 
 #ifndef NDEBUG

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Fix missing dirty bits related to is_drawing_points/ lines.

2016-08-31 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: cd19db4ee61b6182b31ef8dfa1981ea59cfa34c4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd19db4ee61b6182b31ef8dfa1981ea59cfa34c4

Author: Kenneth Graunke 
Date:   Thu Aug 25 23:00:13 2016 -0700

i965: Fix missing dirty bits related to is_drawing_points/lines.

calculate_attr_overrides() uses is_drawing_points(), which depends
on tessellation and geometry program state, as well as polygon state.

v2: Add missing _NEW_POLYGON as well.  Caught by Iago Toral.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Iago Toral Quiroga 

---

 src/mesa/drivers/dri/i965/gen6_clip_state.c |  5 +
 src/mesa/drivers/dri/i965/gen7_sf_state.c   | 14 +++---
 src/mesa/drivers/dri/i965/gen8_sf_state.c   |  9 +++--
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c 
b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 4a3f7f9..8a3d05a 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -230,6 +230,9 @@ upload_clip_state(struct brw_context *brw)
else
   enable = GEN6_CLIP_ENABLE;
 
+   /* _NEW_POLYGON,
+* BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_TES_PROG_DATA | BRW_NEW_PRIMITIVE
+*/
if (!brw_is_drawing_points(brw) && !brw_is_drawing_lines(brw))
   dw2 |= GEN6_CLIP_XY_TEST;
 
@@ -255,6 +258,7 @@ const struct brw_tracked_state gen6_clip_state = {
.dirty = {
   .mesa  = _NEW_BUFFERS |
_NEW_LIGHT |
+   _NEW_POLYGON |
_NEW_TRANSFORM,
   .brw   = BRW_NEW_BLORP |
BRW_NEW_CONTEXT |
@@ -281,6 +285,7 @@ const struct brw_tracked_state gen7_clip_state = {
BRW_NEW_META_IN_PROGRESS |
BRW_NEW_PRIMITIVE |
BRW_NEW_RASTERIZER_DISCARD |
+   BRW_NEW_TES_PROG_DATA |
BRW_NEW_VUE_MAP_GEOM_OUT,
},
.emit = upload_clip_state,
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index ba0592a..8727bf8 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -59,8 +59,10 @@ upload_sbe_state(struct brw_context *brw)
}
dw1 |= point_sprite_origin;
 
-   /* BRW_NEW_VUE_MAP_GEOM_OUT | BRW_NEW_FRAGMENT_PROGRAM
-* _NEW_POINT | _NEW_LIGHT | _NEW_PROGRAM | BRW_NEW_FS_PROG_DATA
+   /* _NEW_POINT | _NEW_LIGHT | _NEW_PROGRAM,
+* BRW_NEW_FS_PROG_DATA | BRW_NEW_FRAGMENT_PROGRAM |
+* BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA |
+* BRW_NEW_VUE_MAP_GEOM_OUT
 */
uint32_t urb_entry_read_length;
uint32_t urb_entry_read_offset;
@@ -90,12 +92,14 @@ const struct brw_tracked_state gen7_sbe_state = {
   .mesa  = _NEW_BUFFERS |
_NEW_LIGHT |
_NEW_POINT |
+   _NEW_POLYGON |
_NEW_PROGRAM,
   .brw   = BRW_NEW_BLORP |
BRW_NEW_CONTEXT |
BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_FS_PROG_DATA |
BRW_NEW_GEOMETRY_PROGRAM |
+   BRW_NEW_TES_PROG_DATA |
BRW_NEW_PRIMITIVE |
BRW_NEW_VUE_MAP_GEOM_OUT,
},
@@ -187,7 +191,9 @@ upload_sf_state(struct brw_context *brw)
   dw2 |= GEN6_SF_CULL_NONE;
}
 
-   /* _NEW_SCISSOR _NEW_POLYGON BRW_NEW_GEOMETRY_PROGRAM BRW_NEW_PRIMITIVE */
+   /* _NEW_SCISSOR | _NEW_POLYGON,
+* BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA
+*/
if (ctx->Scissor.EnableFlags ||
brw_is_drawing_points(brw) || brw_is_drawing_lines(brw))
   dw2 |= GEN6_SF_SCISSOR_ENABLE;
@@ -256,7 +262,9 @@ const struct brw_tracked_state gen7_sf_state = {
_NEW_SCISSOR,
   .brw   = BRW_NEW_BLORP |
BRW_NEW_CONTEXT |
+   BRW_NEW_GEOMETRY_PROGRAM |
BRW_NEW_PRIMITIVE |
+   BRW_NEW_TES_PROG_DATA |
BRW_NEW_VUE_MAP_GEOM_OUT,
},
.emit = upload_sf_state,
diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c 
b/src/mesa/drivers/dri/i965/gen8_sf_state.c
index 0c4f1df..93c77f7 100644
--- a/src/mesa/drivers/dri/i965/gen8_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c
@@ -60,8 +60,10 @@ upload_sbe(struct brw_context *brw)
else
   dw1 |= GEN6_SF_POINT_SPRITE_UPPERLEFT;
 
-   /* BRW_NEW_VUE_MAP_GEOM_OUT | BRW_NEW_FRAGMENT_PROGRAM |
-* _NEW_POINT | _NEW_LIGHT | _NEW_PROGRAM | BRW_NEW_FS_PROG_DATA
+   /* _NEW_POINT | _NEW_LIGHT | _NEW_PROGRAM,
+* BRW_NEW_FS_PROG_DATA | BRW_NEW_FRAGMENT_PROGRAM |
+* BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA |
+* BRW_NEW_VUE_MAP_GEOM_OUT
 */
calculate_attr_overrides(brw, attr_overrides,
 _sprite_enables,
@@ -132,11 +134,14 @@ const struct brw_tracked_state gen8_sbe_state = {
   .mesa  = _NEW_BUFFERS |
   

Mesa (master): i965: Merge gen7_clip_state atom into gen6_clip_state atom.

2016-08-31 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: bea048752ea95d5e074891f2131f54d6e0760538
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bea048752ea95d5e074891f2131f54d6e0760538

Author: Kenneth Graunke 
Date:   Tue Aug 30 13:16:02 2016 -0700

i965: Merge gen7_clip_state atom into gen6_clip_state atom.

The original motivation was that gen6_clip_state ignored _NEW_POLYGON
as it didn't care about early culling.  The only other change was that
Gen6 ignored BRW_NEW_TES_PROG_DATA as it doesn't have tessellation
shaders, but listening to this is harmless as it'll never be signalled.

Now that we've added _NEW_POLYGON for is_drawing_lines/points, we can
merge the two as the distinction is meaningless.

This actually fixes a bug, though: Gen8+ was using the gen6_clip_state
atom because it doesn't care about early culling, but it also needs
BRW_NEW_TES_PROG_DATA, which was missing.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Iago Toral Quiroga 

---

 src/mesa/drivers/dri/i965/brw_state.h|  1 -
 src/mesa/drivers/dri/i965/brw_state_upload.c |  2 +-
 src/mesa/drivers/dri/i965/gen6_clip_state.c  | 18 --
 3 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index 43bab9e..bfcdf29 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -131,7 +131,6 @@ extern const struct brw_tracked_state gen6_vs_state;
 extern const struct brw_tracked_state gen6_wm_push_constants;
 extern const struct brw_tracked_state gen6_wm_state;
 extern const struct brw_tracked_state gen7_depthbuffer;
-extern const struct brw_tracked_state gen7_clip_state;
 extern const struct brw_tracked_state gen7_ds_state;
 extern const struct brw_tracked_state gen7_gs_state;
 extern const struct brw_tracked_state gen7_tcs_push_constants;
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c 
b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 69acf3b..60f3be6 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -237,7 +237,7 @@ static const struct brw_tracked_state *gen7_render_atoms[] =
_ds_state,
_gs_state,
_sol_state,
-   _clip_state,
+   _clip_state,
_sbe_state,
_sf_state,
_wm_state,
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c 
b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 1c5b944..7dc9740 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -267,24 +267,6 @@ const struct brw_tracked_state gen6_clip_state = {
BRW_NEW_META_IN_PROGRESS |
BRW_NEW_PRIMITIVE |
BRW_NEW_RASTERIZER_DISCARD |
-   BRW_NEW_VUE_MAP_GEOM_OUT,
-   },
-   .emit = upload_clip_state,
-};
-
-const struct brw_tracked_state gen7_clip_state = {
-   .dirty = {
-  .mesa  = _NEW_BUFFERS |
-   _NEW_LIGHT |
-   _NEW_POLYGON |
-   _NEW_TRANSFORM,
-  .brw   = BRW_NEW_BLORP |
-   BRW_NEW_CONTEXT |
-   BRW_NEW_FS_PROG_DATA |
-   BRW_NEW_GS_PROG_DATA |
-   BRW_NEW_META_IN_PROGRESS |
-   BRW_NEW_PRIMITIVE |
-   BRW_NEW_RASTERIZER_DISCARD |
BRW_NEW_TES_PROG_DATA |
BRW_NEW_VUE_MAP_GEOM_OUT,
},

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Use gs_prog_data in is_drawing_points/lines().

2016-08-31 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 4c116cbafb086653e3fcfb78128cc04b8c9264b1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c116cbafb086653e3fcfb78128cc04b8c9264b1

Author: Kenneth Graunke 
Date:   Thu Aug 25 22:52:22 2016 -0700

i965: Use gs_prog_data in is_drawing_points/lines().

State upload code should use prog_data rather than poking at core
Mesa shader data structures wherever possible.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Iago Toral Quiroga 

---

 src/mesa/drivers/dri/i965/gen6_clip_state.c | 16 
 src/mesa/drivers/dri/i965/gen6_sf_state.c   |  8 +---
 src/mesa/drivers/dri/i965/gen7_sf_state.c   |  8 
 src/mesa/drivers/dri/i965/gen8_sf_state.c   |  4 ++--
 4 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c 
b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 8a3d05a..1c5b944 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -43,9 +43,9 @@ brw_is_drawing_points(const struct brw_context *brw)
   return true;
}
 
-   if (brw->geometry_program) {
-  /* BRW_NEW_GEOMETRY_PROGRAM */
-  return brw->geometry_program->OutputType == GL_POINTS;
+   if (brw->gs.prog_data) {
+  /* BRW_NEW_GS_PROG_DATA */
+  return brw->gs.prog_data->output_topology == _3DPRIM_POINTLIST;
} else if (brw->tes.prog_data) {
   /* BRW_NEW_TES_PROG_DATA */
   return brw->tes.prog_data->output_topology ==
@@ -66,9 +66,9 @@ brw_is_drawing_lines(const struct brw_context *brw)
   return true;
}
 
-   if (brw->geometry_program) {
-  /* BRW_NEW_GEOMETRY_PROGRAM */
-  return brw->geometry_program->OutputType == GL_LINE_STRIP;
+   if (brw->gs.prog_data) {
+  /* BRW_NEW_GS_PROG_DATA */
+  return brw->gs.prog_data->output_topology == _3DPRIM_LINESTRIP;
} else if (brw->tes.prog_data) {
   /* BRW_NEW_TES_PROG_DATA */
   return brw->tes.prog_data->output_topology ==
@@ -263,7 +263,7 @@ const struct brw_tracked_state gen6_clip_state = {
   .brw   = BRW_NEW_BLORP |
BRW_NEW_CONTEXT |
BRW_NEW_FS_PROG_DATA |
-   BRW_NEW_GEOMETRY_PROGRAM |
+   BRW_NEW_GS_PROG_DATA |
BRW_NEW_META_IN_PROGRESS |
BRW_NEW_PRIMITIVE |
BRW_NEW_RASTERIZER_DISCARD |
@@ -281,7 +281,7 @@ const struct brw_tracked_state gen7_clip_state = {
   .brw   = BRW_NEW_BLORP |
BRW_NEW_CONTEXT |
BRW_NEW_FS_PROG_DATA |
-   BRW_NEW_GEOMETRY_PROGRAM |
+   BRW_NEW_GS_PROG_DATA |
BRW_NEW_META_IN_PROGRESS |
BRW_NEW_PRIMITIVE |
BRW_NEW_RASTERIZER_DISCARD |
diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 7cef17a..059dd90 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -193,7 +193,7 @@ calculate_attr_overrides(const struct brw_context *brw,
 * correctly set the attr overrides.
 *
 * _NEW_POLYGON
-* BRW_NEW_PRIMITIVE | BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_TES_PROG_DATA
+* BRW_NEW_PRIMITIVE | BRW_NEW_GS_PROG_DATA | BRW_NEW_TES_PROG_DATA
 */
bool drawing_points = brw_is_drawing_points(brw);
 
@@ -335,7 +335,9 @@ upload_sf_state(struct brw_context *brw)
unreachable("not reached");
}
 
-   /* _NEW_SCISSOR _NEW_POLYGON BRW_NEW_GEOMETRY_PROGRAM BRW_NEW_PRIMITIVE */
+   /* _NEW_SCISSOR | _NEW_POLYGON,
+* BRW_NEW_GS_PROG_DATA | BRW_NEW_TES_PROG_DATA | BRW_NEW_PRIMITIVE
+*/
if (ctx->Scissor.EnableFlags ||
brw_is_drawing_points(brw) || brw_is_drawing_lines(brw))
   dw3 |= GEN6_SF_SCISSOR_ENABLE;
@@ -448,7 +450,7 @@ const struct brw_tracked_state gen6_sf_state = {
BRW_NEW_CONTEXT |
BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_FS_PROG_DATA |
-   BRW_NEW_GEOMETRY_PROGRAM |
+   BRW_NEW_GS_PROG_DATA |
BRW_NEW_PRIMITIVE |
BRW_NEW_TES_PROG_DATA |
BRW_NEW_VUE_MAP_GEOM_OUT,
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index 8727bf8..06d3463 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -61,7 +61,7 @@ upload_sbe_state(struct brw_context *brw)
 
/* _NEW_POINT | _NEW_LIGHT | _NEW_PROGRAM,
 * BRW_NEW_FS_PROG_DATA | BRW_NEW_FRAGMENT_PROGRAM |
-* BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA |
+* BRW_NEW_GS_PROG_DATA | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA |
 * BRW_NEW_VUE_MAP_GEOM_OUT
 */
uint32_t urb_entry_read_length;
@@ -98,7 +98,7 @@ const struct brw_tracked_state gen7_sbe_state = {
BRW_NEW_CONTEXT |
BRW_NEW_FRAGMENT_PROGRAM |
  

Mesa (master): nv50: remove unused nv50_program::immd_size field

2016-08-31 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: b2f3d50ca75e97e3e37f4f8d68f6e1c4133a60bb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b2f3d50ca75e97e3e37f4f8d68f6e1c4133a60bb

Author: Samuel Pitoiset 
Date:   Wed Aug 31 17:42:04 2016 +0200

nv50: remove unused nv50_program::immd_size field

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/nv50/nv50_program.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.h 
b/src/gallium/drivers/nouveau/nv50/nv50_program.h
index fc9ada4..009d41f 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.h
@@ -59,7 +59,6 @@ struct nv50_program {
unsigned code_size;
unsigned code_base;
uint32_t *immd;
-   unsigned immd_size;
unsigned parm_size; /* size limit of uniform buffer */
uint32_t tls_space; /* required local memory per thread */
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nvc0: remove an attempt at uploading all IMMD into a CB

2016-08-31 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: 3df8615dcd67af4cbe1a65bcb15231320202f4e8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3df8615dcd67af4cbe1a65bcb15231320202f4e8

Author: Samuel Pitoiset 
Date:   Wed Aug 31 17:42:05 2016 +0200

nvc0: remove an attempt at uploading all IMMD into a CB

This has never been used because info->immd.bufSize is always 0
and anyways this is an experimental code which has never been
completed.

This gets rid of some unused code in the program validation process.

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/nvc0/nvc0_program.c  | 17 -
 src/gallium/drivers/nouveau/nvc0/nvc0_program.h  |  3 ---
 src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c | 20 
 3 files changed, 40 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
index ae21789..8d97201 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
@@ -604,8 +604,6 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t 
chipset,
 
prog->code = info->bin.code;
prog->code_size = info->bin.codeSize;
-   prog->immd_data = info->immd.buf;
-   prog->immd_size = info->immd.bufSize;
prog->relocs = info->bin.relocData;
prog->fixups = info->bin.fixupData;
prog->num_gprs = MAX2(4, (info->bin.maxGPR + 1));
@@ -692,13 +690,6 @@ nvc0_program_upload_code(struct nvc0_context *nvc0, struct 
nvc0_program *prog)
uint32_t lib_pos = screen->lib_code->start;
uint32_t code_pos;
 
-   /* c[] bindings need to be aligned to 0x100, but we could use relocations
-* to save space. */
-   if (prog->immd_size) {
-  prog->immd_base = size;
-  size = align(size, 0x40);
-  size += prog->immd_size + 0xc0; /* add 0xc0 for align 0x40 -> 0x100 */
-   }
/* On Fermi, SP_START_ID must be aligned to 0x40.
 * On Kepler, the first instruction must be aligned to 0x80 because
 * latency information is expected only at certain positions.
@@ -726,9 +717,6 @@ nvc0_program_upload_code(struct nvc0_context *nvc0, struct 
nvc0_program *prog)
   IMMED_NVC0(nvc0->base.pushbuf, NVC0_3D(SERIALIZE), 0);
}
prog->code_base = prog->mem->start;
-   prog->immd_base = align(prog->mem->start + prog->immd_base, 0x100);
-   assert((prog->immd_size == 0) || (prog->immd_base + prog->immd_size <=
- prog->mem->start + prog->mem->size));
 
if (!is_cp) {
   if (screen->base.class_3d >= NVE4_3D_CLASS) {
@@ -783,10 +771,6 @@ nvc0_program_upload_code(struct nvc0_context *nvc0, struct 
nvc0_program *prog)
NV_VRAM_DOMAIN(>base), 
NVC0_SHADER_HEADER_SIZE, prog->hdr);
nvc0->base.push_data(>base, screen->text, code_pos,
 NV_VRAM_DOMAIN(>base), prog->code_size, 
prog->code);
-   if (prog->immd_size)
-  nvc0->base.push_data(>base,
-   screen->text, prog->immd_base, 
NV_VRAM_DOMAIN(>base),
-   prog->immd_size, prog->immd_data);
 
BEGIN_NVC0(nvc0->base.pushbuf, NVC0_3D(MEM_BARRIER), 1);
PUSH_DATA (nvc0->base.pushbuf, 0x1011);
@@ -830,7 +814,6 @@ nvc0_program_destroy(struct nvc0_context *nvc0, struct 
nvc0_program *prog)
if (prog->mem)
   nouveau_heap_free(>mem);
FREE(prog->code); /* may be 0 for hardcoded shaders */
-   FREE(prog->immd_data);
FREE(prog->relocs);
FREE(prog->fixups);
if (prog->type == PIPE_SHADER_COMPUTE && prog->cp.syms)
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_program.h
index 328088e..d33aa04 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.h
@@ -26,11 +26,8 @@ struct nvc0_program {
uint8_t num_gprs;
 
uint32_t *code;
-   uint32_t *immd_data;
unsigned code_base;
unsigned code_size;
-   unsigned immd_base;
-   unsigned immd_size; /* size of immediate array data */
unsigned parm_size; /* size of non-bindable uniforms (c0[]) */
 
uint32_t hdr[20];
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
index 01fe7ce..0ae4bb1 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
@@ -34,8 +34,6 @@ static inline void
 nvc0_program_update_context_state(struct nvc0_context *nvc0,
   struct nvc0_program *prog, int stage)
 {
-   struct nouveau_pushbuf *push = nvc0->base.pushbuf;
-
if (prog && prog->need_tls) {
   const uint32_t flags = NV_VRAM_DOMAIN(>screen->base) | 
NOUVEAU_BO_RDWR;
   if (!nvc0->state.tls_required)
@@ -46,24 +44,6 @@ nvc0_program_update_context_state(struct nvc0_context *nvc0,
  

Mesa (master): nv30: set usage to staging so that the buffer is allocated in GART

2016-08-31 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 6118bcab4e9f57b834578afb34256d793efe83d0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6118bcab4e9f57b834578afb34256d793efe83d0

Author: Ilia Mirkin 
Date:   Wed Aug 31 02:12:08 2016 -0400

nv30: set usage to staging so that the buffer is allocated in GART

The code a few lines below expects to migrate the bo in question to
VRAM. Since we're filling the initial data via CPU, it's more efficient
to create the temporary buffer in GART. There is no "push" method
implemented, otherwise we'd use that instead.

Signed-off-by: Ilia Mirkin 
Cc: mesa-sta...@lists.freedesktop.org

---

 src/gallium/drivers/nouveau/nv30/nv30_transfer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nv30/nv30_transfer.c 
b/src/gallium/drivers/nouveau/nv30/nv30_transfer.c
index 5299b70..e4b9497 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_transfer.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_transfer.c
@@ -115,7 +115,8 @@ nv30_transfer_rect_fragprog(struct nv30_context *nv30)
struct pipe_context *pipe = >base.pipe;
 
if (!fp) {
-  nv30->blit_fp = pipe_buffer_create(pipe->screen, 0, 0, 12 * 4);
+  nv30->blit_fp =
+ pipe_buffer_create(pipe->screen, 0, PIPE_USAGE_STAGING, 12 * 4);
   if (nv30->blit_fp) {
  struct pipe_transfer *transfer;
  u32 *map = pipe_buffer_map(pipe, nv30->blit_fp,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl/x11_dri3: provide an authentication function

2016-08-31 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 5505845945fb9bdd0c752b0f299a627591205dbd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5505845945fb9bdd0c752b0f299a627591205dbd

Author: Frank Binns 
Date:   Fri Jun 17 18:41:21 2016 +0100

egl/x11_dri3: provide an authentication function

To support WL_bind_wayland_display an authentication function needs to be
provided but this was not being done for this platform as it's not strictly
necessary. However, as this isn't an optional function there's the potential
for a segfault to occur if authentication is mistakenly performed. Protect
against this by providing a function that prints an error.

Signed-off-by: Frank Binns 
Reviewed-by: Axel Davy 

---

 src/egl/drivers/dri2/platform_x11_dri3.c | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c
index b781987..f996750 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -226,6 +226,23 @@ dri3_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
return NULL;
 }
 
+static int
+dri3_authenticate(_EGLDisplay *disp, uint32_t id)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+
+   if (dri2_dpy->device_name) {
+  _eglLog(_EGL_WARNING,
+  "Wayland client render node authentication is unnecessary");
+  return 0;
+   }
+
+   _eglLog(_EGL_WARNING,
+   "Wayland client primary node authentication isn't supported");
+
+   return -1;
+}
+
 /**
  * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
  */
@@ -419,7 +436,7 @@ dri3_get_dri_drawable(_EGLSurface *surf)
 }
 
 struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
-   .authenticate = NULL,
+   .authenticate = dri3_authenticate,
.create_window_surface = dri3_create_window_surface,
.create_pixmap_surface = dri3_create_pixmap_surface,
.create_pbuffer_surface = dri3_create_pbuffer_surface,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl/x11_dri3: disable WL_bind_wayland_display for devices without render nodes

2016-08-31 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 4c28c916ef229e94bd46fd1703e6b535e03e7e64
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c28c916ef229e94bd46fd1703e6b535e03e7e64

Author: Frank Binns 
Date:   Fri Jun 17 18:41:20 2016 +0100

egl/x11_dri3: disable WL_bind_wayland_display for devices without render nodes

Up until now, DRI3 was only used for devices that have render nodes, unless
overridden via an environment variable, with it falling back to DRI2 otherwise.
This limitation was there in order to support WL_bind_wayland_display as it
requires client opened device node fds to be authenticated, which isn't possible
when using DRI3. This is an unfortunate compromise as DRI3 provides security
benefits over DRI2.

Instead, allow DRI3 to be used for devices without render nodes but don't
advertise WL_bind_wayland_display in this case. Applications that need this
extension can still be run by disabling DRI3 support via the LIBGL_DRI3_DISABLE
environment variable.

Signed-off-by: Frank Binns 
Reviewed-by: Axel Davy 

---

 src/egl/drivers/dri2/platform_x11.c  |  3 ++-
 src/egl/drivers/dri2/platform_x11_dri3.c | 33 +---
 2 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11.c 
b/src/egl/drivers/dri2/platform_x11.c
index 686552c..c8a9808 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1336,7 +1336,8 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay 
*disp)
disp->Extensions.EXT_buffer_age = EGL_TRUE;
 
 #ifdef HAVE_WAYLAND_PLATFORM
-   disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
+   if (dri2_dpy->device_name)
+  disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
 #endif
 
if (dri2_dpy->conn) {
diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c
index 9363a8a..b781987 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -437,29 +437,6 @@ struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
.get_dri_drawable = dri3_get_dri_drawable,
 };
 
-static char *
-dri3_get_device_name(int fd)
-{
-   char *ret = NULL;
-
-   ret = drmGetRenderDeviceNameFromFd(fd);
-   if (ret)
-  return ret;
-
-   /* For dri3, render node support is required for WL_bind_wayland_display.
-* In order not to regress on older systems without kernel or libdrm
-* support, fall back to dri2. User can override it with environment
-* variable if they don't need to use that extension.
-*/
-   if (getenv("EGL_FORCE_DRI3") == NULL) {
-  _eglLog(_EGL_WARNING, "Render node support not available, falling back 
to dri2");
-  _eglLog(_EGL_WARNING, "If you want to force dri3, set EGL_FORCE_DRI3 
environment variable");
-   } else
-  ret = loader_get_device_name_for_fd(fd);
-
-   return ret;
-}
-
 EGLBoolean
 dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
 {
@@ -539,11 +516,11 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
   return EGL_FALSE;
}
 
-   dri2_dpy->device_name = dri3_get_device_name(dri2_dpy->fd);
-   if (!dri2_dpy->device_name) {
-  close(dri2_dpy->fd);
-  return EGL_FALSE;
-   }
+   /* Only try to get a render device name since it's only needed for
+* WL_bind_wayland_display and dri3 doesn't provide a mechanism for
+* authenticating client opened device node fds. If this fails then
+* don't advertise the extension. */
+   dri2_dpy->device_name = drmGetRenderDeviceNameFromFd(dri2_dpy->fd);
 
return EGL_TRUE;
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): scons: Fix MinGW cross compilation.

2016-08-31 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 55e417222f774b2a714313391c8f90982e7a7b4f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=55e417222f774b2a714313391c8f90982e7a7b4f

Author: Jose Fonseca 
Date:   Wed Aug 31 12:16:32 2016 +0100

scons: Fix MinGW cross compilation.

The generated GLSL header files were only being built for the host
platform, and not the target platform.

Trivial.

---

 src/compiler/SConscript.glsl | 46 
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/src/compiler/SConscript.glsl b/src/compiler/SConscript.glsl
index d9878a0..f255369 100644
--- a/src/compiler/SConscript.glsl
+++ b/src/compiler/SConscript.glsl
@@ -89,6 +89,26 @@ mesa_objs = env.StaticObject([
 
 compiler_objs += mesa_objs
 
+# GLSL generated sources
+env.CodeGenerate(
+target = 'glsl/ir_expression_operation.h',
+script = 'glsl/ir_expression_operation.py',
+source = [],
+command = python_cmd + ' $SCRIPT enum > $TARGET'
+)
+env.CodeGenerate(
+target = 'glsl/ir_expression_operation_constant.h',
+script = 'glsl/ir_expression_operation.py',
+source = [],
+command = python_cmd + ' $SCRIPT constant > $TARGET'
+)
+env.CodeGenerate(
+target = 'glsl/ir_expression_operation_strings.h',
+script = 'glsl/ir_expression_operation.py',
+source = [],
+command = python_cmd + ' $SCRIPT strings > $TARGET'
+)
+
 glsl = env.ConvenienceLibrary(
 target = 'glsl',
 source = glsl_sources,
@@ -100,6 +120,11 @@ env.Depends(glsl, glsl_parser)
 
 Export('glsl')
 
+#
+# XXX: It's important to not add any generated source files after this point,
+# or it will break MinGW cross-compilation.
+#
+
 # Skip building these programs as they will cause SCons error "Two environments
 # with different actions were specified for the same target"
 if env['crosscompile'] or env['embedded']:
@@ -116,27 +141,6 @@ env.Prepend(LIBS = [compiler, glsl])
 
 compiler_objs += env.StaticObject("glsl/main.cpp")
 
-# GLSL generated sources
-
-env.CodeGenerate(
-target = 'glsl/ir_expression_operation.h',
-script = 'glsl/ir_expression_operation.py',
-source = [],
-command = python_cmd + ' $SCRIPT enum > $TARGET'
-)
-env.CodeGenerate(
-target = 'glsl/ir_expression_operation_constant.h',
-script = 'glsl/ir_expression_operation.py',
-source = [],
-command = python_cmd + ' $SCRIPT constant > $TARGET'
-)
-env.CodeGenerate(
-target = 'glsl/ir_expression_operation_strings.h',
-script = 'glsl/ir_expression_operation.py',
-source = [],
-command = python_cmd + ' $SCRIPT strings > $TARGET'
-)
-
 glsl_compiler = env.Program(
 target = 'glsl_compiler',
 source = compiler_objs,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit