Mesa (master): st/nine: Do not use scratch for face register
Module: Mesa Branch: master Commit: d899826733b1f6614c913c1c216f8157bf9e297d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d899826733b1f6614c913c1c216f8157bf9e297d Author: Axel Davy <davyax...@gmail.com> Date: Thu Apr 5 23:46:48 2018 +0200 st/nine: Do not use scratch for face register Scratch registers are reused every instructions. Since vFace is reused, a new temporary register should be used. Fixes: https://github.com/iXit/Mesa-3D/issues/311 Signed-off-by: Axel Davy <davyax...@gmail.com> CC: "17.3 18.0" <mesa-sta...@lists.freedesktop.org> --- src/gallium/state_trackers/nine/nine_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index cc667ebfbc..422df931c7 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -1079,7 +1079,7 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) case D3DSMO_FACE: if (ureg_src_is_undef(tx->regs.vFace)) { if (tx->face_is_sysval_integer) { - tmp = tx_scratch(tx); + tmp = ureg_DECL_temporary(ureg); tx->regs.vFace = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_FACE, 0); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Declare lighting consts for ff shaders
Module: Mesa Branch: master Commit: 39240926cd45519f35a6fa576c387f727b057aa1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=39240926cd45519f35a6fa576c387f727b057aa1 Author: Axel Davy <davyax...@gmail.com> Date: Mon Apr 2 18:25:35 2018 +0200 st/nine: Declare lighting consts for ff shaders The lighting constants were not declared previously, but were accessed with indirect addressing, which is illegal. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=105442 Signed-off-by: Axel Davy <davyax...@gmail.com> Tested-by: Dieter Nützel <die...@nuetzel-hh.de> CC: "17.3 18.0" <mesa-sta...@lists.freedesktop.org> --- src/gallium/state_trackers/nine/nine_ff.c | 4 1 file changed, 4 insertions(+) diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index d7b697caee..fabc1d3b88 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -810,6 +810,10 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs) const unsigned loop_label = l++; +/* Declare all light constants to allow indirect adressing */ +for (i = 32; i < 96; i++) +ureg_DECL_constant(ureg, i); + ureg_MOV(ureg, rCtr, ureg_imm1f(ureg, 32.0f)); /* (0) */ ureg_MOV(ureg, rD, ureg_imm1f(ureg, 0.0f)); ureg_MOV(ureg, rA, ureg_imm1f(ureg, 0.0f)); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix bad tracking of bound vs textures
Module: Mesa Branch: master Commit: 76fa1f730b7ee232021bb20bae0ead6779941cf1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=76fa1f730b7ee232021bb20bae0ead6779941cf1 Author: Axel Davy <davyax...@gmail.com> Date: Sat Mar 10 14:21:52 2018 +0100 st/nine: Fix bad tracking of bound vs textures An incorrect formula was used to compute bound_samplers_mask_vs. Since s is above always 8 for vs and the variable is encoded on 8 bits, it was always 0. This resulted in commiting the samplers every call when there was at least one texture read in the vs shader. Signed-off-by: Axel Davy <davyax...@gmail.com> Reviewed-by: Patrick Rudolph <s...@das-labor.org> Tested-by: Dieter Nützel <die...@nuetzel-hh.de> --- src/gallium/state_trackers/nine/nine_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 26b2dea3bd..c81a05a952 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -980,7 +980,7 @@ update_textures_and_samplers(struct NineDevice9 *device) context->changed.sampler[s] = ~0; } -context->bound_samplers_mask_vs |= (1 << s); +context->bound_samplers_mask_vs |= (1 << i); } cso_set_sampler_views(context->cso, PIPE_SHADER_VERTEX, num_textures, view); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix bad tracking of vs textures for NINESBT_ALL
Module: Mesa Branch: master Commit: 71eae7940ef7fa92e01cdc9afa1172f92d4b489e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=71eae7940ef7fa92e01cdc9afa1172f92d4b489e Author: Axel Davy <davyax...@gmail.com> Date: Sat Mar 10 14:23:43 2018 +0100 st/nine: Fix bad tracking of vs textures for NINESBT_ALL Stateblocks with NINESBT_ALL should track all textures. For better performance they have a faster path which copies all the required. This path was only tracking ps textures. Fixes: https://github.com/iXit/Mesa-3D/issues/303 Signed-off-by: Axel Davy <davyax...@gmail.com> Reviewed-by: Patrick Rudolph <s...@das-labor.org> Tested-by: Dieter Nützel <die...@nuetzel-hh.de> CC: "17.3 18.0" <mesa-sta...@lists.freedesktop.org> --- src/gallium/state_trackers/nine/stateblock9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c index 4b7166f0da..54bf1e3c95 100644 --- a/src/gallium/state_trackers/nine/stateblock9.c +++ b/src/gallium/state_trackers/nine/stateblock9.c @@ -454,7 +454,7 @@ nine_state_copy_common_all(struct NineDevice9 *device, /* Textures */ if (1) { -for (i = 0; i < device->caps.MaxSimultaneousTextures; i++) +for (i = 0; i < NINE_MAX_SAMPLERS; i++) NineStateBlock9_BindTexture(device, apply, >texture[i], src->texture[i]); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix non inversible matrix check
Module: Mesa Branch: master Commit: dbc24835d75466951a44b391b42e39461a6ac5a2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbc24835d75466951a44b391b42e39461a6ac5a2 Author: Axel Davy <davyax...@gmail.com> Date: Sat Mar 10 18:49:59 2018 +0100 st/nine: Fix non inversible matrix check There was a missing absolute value when checking if the determinant was big enough. Fixes: https://github.com/iXit/Mesa-3D/issues/292 Signed-off-by: Axel Davy <davyax...@gmail.com> Reviewed-by: Patrick Rudolph <s...@das-labor.org> Tested-by: Dieter Nützel <die...@nuetzel-hh.de> CC: "17.3 18.0" <mesa-sta...@lists.freedesktop.org> --- src/gallium/state_trackers/nine/nine_ff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index 6c30839b29..d7b697caee 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -2474,7 +2474,7 @@ nine_d3d_matrix_inverse(D3DMATRIX *D, const D3DMATRIX *M) M->m[2][0] * D->m[0][2] + M->m[3][0] * D->m[0][3]; -if (det < 1e-30) {/* non inversible */ +if (fabsf(det) < 1e-30) {/* non inversible */ *D = *M; /* wine tests */ return; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fixes warning about implicit conversion
Module: Mesa Branch: master Commit: f61e9a958bd8d61cb7ca575ca987caefc6edbffd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f61e9a958bd8d61cb7ca575ca987caefc6edbffd Author: Axel Davy <davyax...@gmail.com> Date: Sat Mar 10 14:28:10 2018 +0100 st/nine: Fixes warning about implicit conversion Makes the conversion explicit. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=102542 Signed-off-by: Axel Davy <davyax...@gmail.com> Reviewed-by: Patrick Rudolph <s...@das-labor.org> Tested-by: Dieter Nützel <die...@nuetzel-hh.de> CC: "17.3 18.0" <mesa-sta...@lists.freedesktop.org> --- src/gallium/state_trackers/nine/nine_ff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index eb673e4aff..6c30839b29 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -1935,7 +1935,7 @@ nine_ff_load_lights(struct NineDevice9 *device) dst[38 + l * 8].x = cosf(light->Theta * 0.5f); dst[38 + l * 8].y = cosf(light->Phi * 0.5f); dst[38 + l * 8].z = 1.0f / (dst[38 + l * 8].x - dst[38 + l * 8].y); -dst[39 + l * 8].w = (l + 1) == context->ff.num_lights_active; +dst[39 + l * 8].w = (float)((l + 1) == context->ff.num_lights_active); } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix a regression and syntax cleanup
Module: Mesa Branch: master Commit: 7e04ae74d44105dca8190fc2fdd2ab8581cbe698 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e04ae74d44105dca8190fc2fdd2ab8581cbe698 Author: Axel Davy <axel.d...@ens.fr> Date: Mon May 22 00:19:01 2017 +0200 st/nine: Fix a regression and syntax cleanup A few cleanups and in particular initializing properly the new pipe_draw_info fields. This should fix the regression caused by 330d0607ed60fd3edca192e54b4246310f06652f Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101088 Signed-off-by: Axel Davy <axel.d...@ens.fr> Tested-by: Edmondo Tommasina <edmondo.tommas...@gmail.com> Tested-by: Dieter Nützel <die...@nuetzel-hh.de> --- src/gallium/state_trackers/nine/device9.c | 2 +- src/gallium/state_trackers/nine/indexbuffer9.c | 8 ++-- src/gallium/state_trackers/nine/indexbuffer9.h | 5 ++--- src/gallium/state_trackers/nine/nine_state.c | 20 +++- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 9f9e104b91..88df38c43f 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -2915,7 +2915,7 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This, ibuf, ibuf ? NULL : (void*)pIndexData, index_offset, - index_size); + index_size); NineAfterDraw(This); pipe_vertex_buffer_unreference(); diff --git a/src/gallium/state_trackers/nine/indexbuffer9.c b/src/gallium/state_trackers/nine/indexbuffer9.c index d5f5492563..e73d29b5bd 100644 --- a/src/gallium/state_trackers/nine/indexbuffer9.c +++ b/src/gallium/state_trackers/nine/indexbuffer9.c @@ -49,9 +49,6 @@ NineIndexBuffer9_ctor( struct NineIndexBuffer9 *This, if (FAILED(hr)) return hr; -This->buffer = NULL; -This->offset = 0; - switch (pDesc->Format) { case D3DFMT_INDEX16: This->index_size = 2; break; case D3DFMT_INDEX32: This->index_size = 4; break; @@ -73,11 +70,10 @@ NineIndexBuffer9_dtor( struct NineIndexBuffer9 *This ) } struct pipe_resource * -NineIndexBuffer9_GetBuffer( struct NineIndexBuffer9 *This ) +NineIndexBuffer9_GetBuffer( struct NineIndexBuffer9 *This, unsigned *offset ) { /* The resource may change */ -This->buffer = NineBuffer9_GetResource(>base, >offset); -return This->buffer; +return NineBuffer9_GetResource(>base, offset); } HRESULT NINE_WINAPI diff --git a/src/gallium/state_trackers/nine/indexbuffer9.h b/src/gallium/state_trackers/nine/indexbuffer9.h index 0efad7f5f1..e688488da8 100644 --- a/src/gallium/state_trackers/nine/indexbuffer9.h +++ b/src/gallium/state_trackers/nine/indexbuffer9.h @@ -37,8 +37,6 @@ struct NineIndexBuffer9 struct NineBuffer9 base; /* g3d stuff */ -struct pipe_resource *buffer; -unsigned offset; unsigned index_size; D3DINDEXBUFFER_DESC desc; @@ -65,7 +63,8 @@ NineIndexBuffer9_dtor( struct NineIndexBuffer9 *This ); /*** Nine private ***/ struct pipe_resource * -NineIndexBuffer9_GetBuffer( struct NineIndexBuffer9 *This ); +NineIndexBuffer9_GetBuffer( struct NineIndexBuffer9 *This, +unsigned *offset ); /*** Direct3D public ***/ diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 0fc4c8315a..30935760ae 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -1575,12 +1575,11 @@ nine_context_set_indices(struct NineDevice9 *device, { struct pipe_resource *res = NULL; UINT IndexSize = 0; -UINT OffsetInBytes = 0; +unsigned OffsetInBytes = 0; if (idxbuf) { -res = NineIndexBuffer9_GetBuffer(idxbuf); +res = NineIndexBuffer9_GetBuffer(idxbuf, ); IndexSize = idxbuf->index_size; -OffsetInBytes = idxbuf->offset; } nine_context_set_indices_apply(device, res, IndexSize, OffsetInBytes); @@ -2540,6 +2539,7 @@ init_draw_info(struct pipe_draw_info *info, if (dev->context.stream_instancedata_mask & dev->context.stream_usage_mask) info->instance_count = MAX2(dev->context.stream_freq[0] & 0x7F, 1); info->primitive_restart = FALSE; +info->has_user_indices = FALSE; info->restart_index = 0; info->count_from_stream_output = NULL; info->indirect = NULL; @@ -2561,17 +2561,18 @@ CSMT_ITEM_NO_WAIT(nine_context_draw_primitive, info.index_bias = 0; info.min_index = info.start; info.max_index = info.count - 1; +info.
Mesa (master): st/nine: Fix support for ps 1.4 dw and dz modifiers
Module: Mesa Branch: master Commit: 442780ea373cbea7d138e9cfa8c4857bb8118b3a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=442780ea373cbea7d138e9cfa8c4857bb8118b3a Author: Axel Davy <axel.d...@ens.fr> Date: Sun Mar 26 22:57:15 2017 +0200 st/nine: Fix support for ps 1.4 dw and dz modifiers RCP was used incorrectly to support NINED3DSPSM_DW and NINED3DSPSM_DZ. src.x was used as input instead of src.w or src.z. Fixes: https://github.com/iXit/Mesa-3D/issues/271 Signed-off-by: Axel Davy <axel.d...@ens.fr> Tested-by: Dieter Nützel <die...@nuetzel-hh.de> --- src/gallium/state_trackers/nine/nine_shader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index 6dcd97603d..40fb6be88f 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -1116,14 +1116,14 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) case NINED3DSPSM_DW: tmp = tx_scratch(tx); /* NOTE: app is not allowed to read w with this modifier */ -ureg_RCP(ureg, ureg_writemask(tmp, NINED3DSP_WRITEMASK_3), src); +ureg_RCP(ureg, ureg_writemask(tmp, NINED3DSP_WRITEMASK_3), ureg_scalar(src, TGSI_SWIZZLE_W)); ureg_MUL(ureg, tmp, src, ureg_swizzle(ureg_src(tmp), NINE_SWIZZLE4(W,W,W,W))); src = ureg_src(tmp); break; case NINED3DSPSM_DZ: tmp = tx_scratch(tx); /* NOTE: app is not allowed to read z with this modifier */ -ureg_RCP(ureg, ureg_writemask(tmp, NINED3DSP_WRITEMASK_2), src); +ureg_RCP(ureg, ureg_writemask(tmp, NINED3DSP_WRITEMASK_2), ureg_scalar(src, TGSI_SWIZZLE_Z)); ureg_MUL(ureg, tmp, src, ureg_swizzle(ureg_src(tmp), NINE_SWIZZLE4(Z,Z,Z,Z))); src = ureg_src(tmp); break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Resolve deadlock in surface/ volume dtors when using csmt
Module: Mesa Branch: master Commit: bd85bb51c717a1858157c73adcb689e3986b2134 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd85bb51c717a1858157c73adcb689e3986b2134 Author: Axel Davy <axel.d...@ens.fr> Date: Wed Mar 15 22:45:03 2017 +0100 st/nine: Resolve deadlock in surface/volume dtors when using csmt Surfaces and Volumes can be freed in the worker thread. Without this patch, pending_uploads_counter could be non-zero in the Surfaces or Volumes dtor, leading to deadlock. Instead decrease properly the counter before releasing the item. Also avoid another potential deadlock if the item is not properly unlocked: Do not call UnlockRect which will cause deadlock, but free directly using the deadlock safe nine_context_get_pipe_multithread. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99246 CC: "17.0" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> Tested-by: James Harvey <lothmor...@gmail.com> --- src/gallium/state_trackers/nine/nine_csmt_helper.h | 2 +- src/gallium/state_trackers/nine/surface9.c | 10 -- src/gallium/state_trackers/nine/volume9.c | 10 -- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_csmt_helper.h b/src/gallium/state_trackers/nine/nine_csmt_helper.h index b0bbc054fc..dc46bbd3a2 100644 --- a/src/gallium/state_trackers/nine/nine_csmt_helper.h +++ b/src/gallium/state_trackers/nine/nine_csmt_helper.h @@ -233,8 +233,8 @@ name##_rx( struct NineDevice9 *device, struct csmt_instruction *instr ) \ name##_priv( \ device ARGS_FOR_CALL( __VA_ARGS__ ) \ ); \ -ARGS_FOR_UNBIND( __VA_ARGS__ ) \ p_atomic_dec(args->counter); \ +ARGS_FOR_UNBIND( __VA_ARGS__ ) \ return 0; \ } \ \ diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 836369cafd..d917fa1f86 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -204,9 +204,15 @@ NineSurface9_dtor( struct NineSurface9 *This ) { DBG("This=%p\n", This); -if (This->transfer) -NineSurface9_UnlockRect(This); +if (This->transfer) { +struct pipe_context *pipe = nine_context_get_pipe_multithread(This->base.base.device); +pipe->transfer_unmap(pipe, This->transfer); +This->transfer = NULL; +} +/* Note: Following condition cannot happen currently, since we + * refcount the surface in the functions increasing + * pending_uploads_counter. */ if (p_atomic_read(>pending_uploads_counter)) nine_csmt_process(This->base.base.device); diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c index 11236a02e7..62af3e6225 100644 --- a/src/gallium/state_trackers/nine/volume9.c +++ b/src/gallium/state_trackers/nine/volume9.c @@ -142,9 +142,15 @@ NineVolume9_dtor( struct NineVolume9 *This ) { DBG("This=%p\n", This); -if (This->transfer) -NineVolume9_UnlockBox(This); +if (This->transfer) { +struct pipe_context *pipe = nine_context_get_pipe_multithread(This->base.device); +pipe->transfer_unmap(pipe, This->transfer); +This->transfer = NULL; +} +/* Note: Following condition cannot happen currently, since we + * refcount the volume in the functions increasing + * pending_uploads_counter. */ if (p_atomic_read(>pending_uploads_counter)) nine_csmt_process(This->base.device); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Use atomics for available_texture_mem
Module: Mesa Branch: master Commit: bdf035ea6f784b90a6cbfd4ce16f3188ab15b2d3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bdf035ea6f784b90a6cbfd4ce16f3188ab15b2d3 Author: Axel Davy <axel.d...@ens.fr> Date: Wed Mar 15 22:53:36 2017 +0100 st/nine: Use atomics for available_texture_mem Resource dtor can be executed in the worker thread. Use atomic to avoid threading safety issues. CC: "17.0" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> Tested-by: James Harvey <lothmor...@gmail.com> --- src/gallium/state_trackers/nine/resource9.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/nine/resource9.c b/src/gallium/state_trackers/nine/resource9.c index c583724174..852801624a 100644 --- a/src/gallium/state_trackers/nine/resource9.c +++ b/src/gallium/state_trackers/nine/resource9.c @@ -79,7 +79,7 @@ NineResource9_ctor( struct NineResource9 *This, if (This->info.target != PIPE_BUFFER) { This->size = util_resource_size(>info); -This->base.device->available_texture_mem -= This->size; +p_atomic_add(>base.device->available_texture_mem, -This->size); if (This->base.device->available_texture_mem <= This->base.device->available_texture_limit) { return D3DERR_OUTOFVIDEOMEMORY; @@ -111,7 +111,7 @@ NineResource9_dtor( struct NineResource9 *This ) /* NOTE: size is 0, unless something has actually been allocated */ if (This->base.device) -This->base.device->available_texture_mem += This->size; +p_atomic_add(>base.device->available_texture_mem, This->size); NineUnknown_dtor(>base); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix user vertex data uploader with csmt
Module: Mesa Branch: master Commit: 31f8b3babb5a2d685d6e8b8ed0a2120c7966e9b1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=31f8b3babb5a2d685d6e8b8ed0a2120c7966e9b1 Author: Axel Davy <axel.d...@ens.fr> Date: Wed Mar 15 22:29:12 2017 +0100 st/nine: Fix user vertex data uploader with csmt Fix regression caused by abb1c645c476b5dd289ce3efae0594f8796f9cf8 The patch made csmt use context.pipe instead of secondary_pipe, leading to thread safety issues. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/device9.c | 15 +++ src/gallium/state_trackers/nine/device9.h | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 843716207d..4943658934 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -476,6 +476,7 @@ NineDevice9_ctor( struct NineDevice9 *This, This->driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS); This->driver_caps.user_sw_vbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS); This->driver_caps.user_sw_cbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_CONSTANT_BUFFERS); +This->vertex_uploader = This->csmt_active ? This->pipe_secondary->stream_uploader : This->context.pipe->stream_uploader; if (!This->driver_caps.user_cbufs) This->constbuf_alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT); This->driver_caps.window_space_position_support = GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION); @@ -2817,17 +2818,15 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This, vtxbuf.buffer = NULL; vtxbuf.user_buffer = pVertexStreamZeroData; -/* csmt is unactive when user vertex or index buffers are used, thus no - * need to call NineDevice9_GetPipe. */ if (!This->driver_caps.user_vbufs) { -u_upload_data(This->context.pipe->stream_uploader, +u_upload_data(This->vertex_uploader, 0, (prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * VertexStreamZeroStride, /* XXX */ 4, vtxbuf.user_buffer, _offset, ); -u_upload_unmap(This->context.pipe->stream_uploader); +u_upload_unmap(This->vertex_uploader); vtxbuf.user_buffer = NULL; } @@ -2883,27 +2882,27 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This, if (!This->driver_caps.user_vbufs) { const unsigned base = MinVertexIndex * VertexStreamZeroStride; -u_upload_data(This->context.pipe->stream_uploader, +u_upload_data(This->vertex_uploader, base, NumVertices * VertexStreamZeroStride, /* XXX */ 4, (const uint8_t *)vbuf.user_buffer + base, _offset, ); -u_upload_unmap(This->context.pipe->stream_uploader); +u_upload_unmap(This->vertex_uploader); /* Won't be used: */ vbuf.buffer_offset -= base; vbuf.user_buffer = NULL; } if (This->csmt_active) { -u_upload_data(This->context.pipe->stream_uploader, +u_upload_data(This->pipe_secondary->stream_uploader, 0, (prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * ibuf.index_size, 4, ibuf.user_buffer, , ); -u_upload_unmap(This->context.pipe->stream_uploader); +u_upload_unmap(This->pipe_secondary->stream_uploader); ibuf.user_buffer = NULL; } diff --git a/src/gallium/state_trackers/nine/device9.h b/src/gallium/state_trackers/nine/device9.h index 4b1630c40f..c5fd8f76c6 100644 --- a/src/gallium/state_trackers/nine/device9.h +++ b/src/gallium/state_trackers/nine/device9.h @@ -140,6 +140,7 @@ struct NineDevice9 boolean buggy_barycentrics; } driver_bugs; +struct u_upload_mgr *vertex_uploader; unsigned constbuf_alignment; struct nine_range_pool range_pool; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: make use of common uploaders v4
Module: Mesa Branch: master Commit: abb1c645c476b5dd289ce3efae0594f8796f9cf8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=abb1c645c476b5dd289ce3efae0594f8796f9cf8 Author: Constantine CharlamovDate: Tue Feb 21 07:31:30 2017 +0300 st/nine: make use of common uploaders v4 Make use of common uploaders that landed recently to Mesa v2: fixed formatting, broken due to thunderbird configuration v3: per Axel comment: added a comment into NineDevice9_DrawPrimitiveUP v4: per Axel comment: changed style of the comment --- src/gallium/state_trackers/nine/device9.c| 50 +--- src/gallium/state_trackers/nine/device9.h| 5 --- src/gallium/state_trackers/nine/nine_ff.c| 8 ++--- src/gallium/state_trackers/nine/nine_state.c | 48 +- 4 files changed, 37 insertions(+), 74 deletions(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index b9b7a63..c3924a2 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -477,31 +477,8 @@ NineDevice9_ctor( struct NineDevice9 *This, This->driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS); This->driver_caps.user_sw_vbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS); This->driver_caps.user_sw_cbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_CONSTANT_BUFFERS); - -/* Implicit use of context pipe for vertex and index uploaded when - * csmt is not active. Does not need to sync since csmt is unactive, - * thus no need to call NineDevice9_GetPipe at each upload. */ -if (!This->driver_caps.user_vbufs) -This->vertex_uploader = u_upload_create(This->csmt_active ? -This->pipe_secondary : This->context.pipe, -65536, -PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM); -This->vertex_sw_uploader = u_upload_create(This->pipe_sw, 65536, -PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM); -if (!This->driver_caps.user_ibufs) -This->index_uploader = u_upload_create(This->csmt_active ? -This->pipe_secondary : This->context.pipe, - 128 * 1024, - PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STREAM); -if (!This->driver_caps.user_cbufs) { +if (!This->driver_caps.user_cbufs) This->constbuf_alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT); -This->constbuf_uploader = u_upload_create(This->context.pipe, This->vs_const_size, - PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_STREAM); -} - -This->constbuf_sw_uploader = u_upload_create(This->pipe_sw, 128 * 1024, - PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_STREAM); - This->driver_caps.window_space_position_support = GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION); This->driver_caps.vs_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS); This->driver_caps.ps_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS); @@ -552,17 +529,6 @@ NineDevice9_dtor( struct NineDevice9 *This ) nine_state_clear(>state, TRUE); nine_context_clear(This); -if (This->vertex_uploader) -u_upload_destroy(This->vertex_uploader); -if (This->index_uploader) -u_upload_destroy(This->index_uploader); -if (This->constbuf_uploader) -u_upload_destroy(This->constbuf_uploader); -if (This->vertex_sw_uploader) -u_upload_destroy(This->vertex_sw_uploader); -if (This->constbuf_sw_uploader) -u_upload_destroy(This->constbuf_sw_uploader); - nine_bind(>record, NULL); pipe_sampler_view_reference(>dummy_sampler_view, NULL); @@ -2852,15 +2818,17 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This, vtxbuf.buffer = NULL; vtxbuf.user_buffer = pVertexStreamZeroData; +/* csmt is unactive when user vertex or index buffers are used, thus no + * need to call NineDevice9_GetPipe. */ if (!This->driver_caps.user_vbufs) { -u_upload_data(This->vertex_uploader, +u_upload_data(This->context.pipe->stream_uploader, 0, (prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * VertexStreamZeroStride, /* XXX */ 4, vtxbuf.user_buffer, _offset, ); -u_upload_unmap(This->vertex_uploader); +u_upload_unmap(This->context.pipe->stream_uploader); vtxbuf.user_buffer = NULL; } @@ -2916,27 +2884,27 @@
Mesa (master): st/nine: Rework CreatePipeSurface
Module: Mesa Branch: master Commit: f895ab8e22dc520304141ba56c1b81d8d6657ccd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f895ab8e22dc520304141ba56c1b81d8d6657ccd Author: Axel Davy <axel.d...@ens.fr> Date: Wed Dec 28 18:24:12 2016 +0100 st/nine: Rework CreatePipeSurface Create both surfaces in one call. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/surface9.c | 49 ++ src/gallium/state_trackers/nine/surface9.h | 3 -- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index a5c4a9e..4b8e213 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -44,6 +44,9 @@ #define DBG_CHANNEL DBG_SURFACE +static void +NineSurface9_CreatePipeSurfaces( struct NineSurface9 *This ); + HRESULT NineSurface9_ctor( struct NineSurface9 *This, struct NineUnknownParams *pParams, @@ -184,10 +187,8 @@ NineSurface9_ctor( struct NineSurface9 *This, if (This->base.resource && (pDesc->Usage & D3DUSAGE_DYNAMIC)) This->base.resource->flags |= NINE_RESOURCE_FLAG_LOCKABLE; -if (This->base.resource && (pDesc->Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL))) { -(void) NineSurface9_CreatePipeSurface(This, 0); -(void) NineSurface9_CreatePipeSurface(This, 1); -} +if (This->base.resource && (pDesc->Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL))) +NineSurface9_CreatePipeSurfaces(This); /* TODO: investigate what else exactly needs to be cleared */ if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) @@ -220,8 +221,8 @@ NineSurface9_dtor( struct NineSurface9 *This ) NineResource9_dtor(>base); } -struct pipe_surface * -NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB ) +static void +NineSurface9_CreatePipeSurfaces( struct NineSurface9 *This ) { struct pipe_context *pipe; struct pipe_screen *screen = NineDevice9_GetScreen(This->base.base.device); @@ -233,21 +234,33 @@ NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB ) assert(resource); srgb_format = util_format_srgb(resource->format); -if (sRGB && srgb_format != PIPE_FORMAT_NONE && -screen->is_format_supported(screen, srgb_format, -resource->target, 0, resource->bind)) -templ.format = srgb_format; -else -templ.format = resource->format; +if (srgb_format == PIPE_FORMAT_NONE || +!screen->is_format_supported(screen, srgb_format, + resource->target, 0, resource->bind)) +srgb_format = resource->format; + +memset(, 0, sizeof(templ)); +templ.format = resource->format; templ.u.tex.level = This->level; templ.u.tex.first_layer = This->layer; templ.u.tex.last_layer = This->layer; pipe = nine_context_get_pipe_acquire(This->base.base.device); -This->surface[sRGB] = pipe->create_surface(pipe, resource, ); + +This->surface[0] = pipe->create_surface(pipe, resource, ); + +memset(, 0, sizeof(templ)); +templ.format = srgb_format; +templ.u.tex.level = This->level; +templ.u.tex.first_layer = This->layer; +templ.u.tex.last_layer = This->layer; + +This->surface[1] = pipe->create_surface(pipe, resource, ); + nine_context_get_pipe_release(This->base.base.device); -assert(This->surface[sRGB]); -return This->surface[sRGB]; + +assert(This->surface[0]); /* TODO: Handle failure */ +assert(This->surface[1]); } #ifdef DEBUG @@ -762,10 +775,8 @@ NineSurface9_SetResourceResize( struct NineSurface9 *This, pipe_surface_reference(>surface[0], NULL); pipe_surface_reference(>surface[1], NULL); -if (resource) { -(void) NineSurface9_CreatePipeSurface(This, 0); -(void) NineSurface9_CreatePipeSurface(This, 1); -} +if (resource) +NineSurface9_CreatePipeSurfaces(This); } diff --git a/src/gallium/state_trackers/nine/surface9.h b/src/gallium/state_trackers/nine/surface9.h index 8263060..6f416f2 100644 --- a/src/gallium/state_trackers/nine/surface9.h +++ b/src/gallium/state_trackers/nine/surface9.h @@ -90,9 +90,6 @@ NineSurface9_dtor( struct NineSurface9 *This ); void NineSurface9_MarkContainerDirty( struct NineSurface9 *This ); -struct pipe_surface * -NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB ); - static inline struct pipe_surface * NineSurface9_GetSurface( struct NineSurface9 *This, int sRGB ) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Don' t call u_box_union_* when dirty region is empty
Module: Mesa Branch: master Commit: 9b5f5de9e9efd6a0c0f53806c0f4b5890c84f98b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9b5f5de9e9efd6a0c0f53806c0f4b5890c84f98b Author: Masanori Kakura <kakura...@gmail.com> Date: Wed Dec 28 22:21:02 2016 +0900 st/nine: Don't call u_box_union_* when dirty region is empty When dirty region is empty, u_box_union_* incorrectly expands the new region. This fixes broken font rendering issue in WOLF RPG Editor v2.10 games. Signed-off-by: Masanori Kakura <kakura...@gmail.com> Reviewed-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/cubetexture9.c | 12 src/gallium/state_trackers/nine/texture9.c | 10 +++--- src/gallium/state_trackers/nine/volumetexture9.c | 10 +++--- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c index 977a345..65251ad 100644 --- a/src/gallium/state_trackers/nine/cubetexture9.c +++ b/src/gallium/state_trackers/nine/cubetexture9.c @@ -285,10 +285,14 @@ NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This, This->base.base.info.height0, >dirty_rect[FaceType]); } else { -struct pipe_box box; -rect_to_pipe_box_clamp(, pDirtyRect); -u_box_union_2d(>dirty_rect[FaceType], >dirty_rect[FaceType], - ); +if (This->dirty_rect[FaceType].width == 0) { +rect_to_pipe_box_clamp(>dirty_rect[FaceType], pDirtyRect); +} else { +struct pipe_box box; +rect_to_pipe_box_clamp(, pDirtyRect); +u_box_union_2d(>dirty_rect[FaceType], >dirty_rect[FaceType], + ); +} (void) u_box_clip_2d(>dirty_rect[FaceType], >dirty_rect[FaceType], This->base.base.info.width0, diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c index bf054cc..78ca4ad 100644 --- a/src/gallium/state_trackers/nine/texture9.c +++ b/src/gallium/state_trackers/nine/texture9.c @@ -330,9 +330,13 @@ NineTexture9_AddDirtyRect( struct NineTexture9 *This, u_box_origin_2d(This->base.base.info.width0, This->base.base.info.height0, >dirty_rect); } else { -struct pipe_box box; -rect_to_pipe_box_clamp(, pDirtyRect); -u_box_union_2d(>dirty_rect, >dirty_rect, ); +if (This->dirty_rect.width == 0) { +rect_to_pipe_box_clamp(>dirty_rect, pDirtyRect); +} else { +struct pipe_box box; +rect_to_pipe_box_clamp(, pDirtyRect); +u_box_union_2d(>dirty_rect, >dirty_rect, ); +} (void) u_box_clip_2d(>dirty_rect, >dirty_rect, This->base.base.info.width0, This->base.base.info.height0); diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c index 5c83fdb..c836dd2 100644 --- a/src/gallium/state_trackers/nine/volumetexture9.c +++ b/src/gallium/state_trackers/nine/volumetexture9.c @@ -222,9 +222,13 @@ NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This, This->dirty_box.height = This->base.base.info.height0; This->dirty_box.depth = This->base.base.info.depth0; } else { -struct pipe_box box; -d3dbox_to_pipe_box(, pDirtyBox); -u_box_union_3d(>dirty_box, >dirty_box, ); +if (This->dirty_box.width == 0) { +d3dbox_to_pipe_box(>dirty_box, pDirtyBox); +} else { +struct pipe_box box; +d3dbox_to_pipe_box(, pDirtyBox); +u_box_union_3d(>dirty_box, >dirty_box, ); +} This->dirty_box.x = MAX2(This->dirty_box.x, 0); This->dirty_box.y = MAX2(This->dirty_box.y, 0); This->dirty_box.z = MAX2(This->dirty_box.z, 0); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Flush the queue at device dtor
Module: Mesa Branch: master Commit: 5f4359ea0ed54b06d443e0ba040eb73406fc3e34 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f4359ea0ed54b06d443e0ba040eb73406fc3e34 Author: Axel Davy <axel.d...@ens.fr> Date: Wed Dec 28 18:58:48 2016 +0100 st/nine: Flush the queue at device dtor Flush the queue to get refcounts right, and properly release the items, instead of throwing away all pending commands. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/device9.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index b150faa..92bc72c 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -535,8 +535,13 @@ NineDevice9_dtor( struct NineDevice9 *This ) DBG("This=%p\n", This); -/* Do not call nine_csmt_process here. The device is dead! */ +/* Flush all pending commands to get refcount right, + * and properly release bound objects. It is ok to still + * execute commands while we are in device dtor, because + * we haven't released anything yet. Note that no pending + * command can increase the device refcount. */ if (This->csmt_active && This->csmt_ctx) { +nine_csmt_process(This); nine_csmt_destroy(This, This->csmt_ctx); This->csmt_active = FALSE; This->csmt_ctx = NULL; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Protect dtors with mutex
Module: Mesa Branch: master Commit: 970556292b37fb9f7a64460a964e7a88503dcab6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=970556292b37fb9f7a64460a964e7a88503dcab6 Author: Axel Davy <axel.d...@ens.fr> Date: Thu Jan 5 23:04:09 2017 +0100 st/nine: Protect dtors with mutex When the flag D3DCREATE_MULTITHREAD is set, a global mutex is used to protect nine calls. However for performance reasons, AddRef and Release didn't hold the mutex, and instead used atomics. Unfortunately at item release, the item can be destroyed, and that destruction path should be protected by a mutex (at least for some objects). Without this patch, it is possible an app thread is in a dtor while another thread is making gallium nine calls. It is possible that two threads are using the same gallium pipe, which is forbiden. The problem has been made worse with csmt, because it can cause hang, since nine_csmt_process is not threadsafe. Fixes Hitman hang, and possibly others. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/iunknown.c | 26 +++ src/gallium/state_trackers/nine/iunknown.h | 3 ++ src/gallium/state_trackers/nine/nine_lock.c | 51 ++--- src/gallium/state_trackers/nine/nine_lock.h | 3 ++ 4 files changed, 64 insertions(+), 19 deletions(-) diff --git a/src/gallium/state_trackers/nine/iunknown.c b/src/gallium/state_trackers/nine/iunknown.c index eae4997..d76d644 100644 --- a/src/gallium/state_trackers/nine/iunknown.c +++ b/src/gallium/state_trackers/nine/iunknown.c @@ -26,6 +26,7 @@ #include "nine_helpers.h" #include "nine_pdata.h" +#include "nine_lock.h" #define DBG_CHANNEL DBG_UNKNOWN @@ -135,6 +136,31 @@ NineUnknown_Release( struct NineUnknown *This ) return r; } +/* No need to lock the mutex protecting nine (when D3DCREATE_MULTITHREADED) + * for AddRef and Release, except for dtor as some of the dtors require it. */ +ULONG NINE_WINAPI +NineUnknown_ReleaseWithDtorLock( struct NineUnknown *This ) +{ +if (This->forward) +return NineUnknown_ReleaseWithDtorLock(This->container); + +ULONG r = p_atomic_dec_return(>refs); + +if (r == 0) { +if (This->device) { +if (NineUnknown_ReleaseWithDtorLock(NineUnknown(This->device)) == 0) +return r; /* everything's gone */ +} +/* Containers (here with !forward) take care of item destruction */ +if (!This->container && This->bind == 0) { +NineLockGlobalMutex(); +This->dtor(This); +NineUnlockGlobalMutex(); +} +} +return r; +} + HRESULT NINE_WINAPI NineUnknown_GetDevice( struct NineUnknown *This, IDirect3DDevice9 **ppDevice ) diff --git a/src/gallium/state_trackers/nine/iunknown.h b/src/gallium/state_trackers/nine/iunknown.h index 4b9edaa..f9ce7b5 100644 --- a/src/gallium/state_trackers/nine/iunknown.h +++ b/src/gallium/state_trackers/nine/iunknown.h @@ -100,6 +100,9 @@ NineUnknown_AddRef( struct NineUnknown *This ); ULONG NINE_WINAPI NineUnknown_Release( struct NineUnknown *This ); +ULONG NINE_WINAPI +NineUnknown_ReleaseWithDtorLock( struct NineUnknown *This ); + HRESULT NINE_WINAPI NineUnknown_GetDevice( struct NineUnknown *This, IDirect3DDevice9 **ppDevice ); diff --git a/src/gallium/state_trackers/nine/nine_lock.c b/src/gallium/state_trackers/nine/nine_lock.c index fb24400..1136dad 100644 --- a/src/gallium/state_trackers/nine/nine_lock.c +++ b/src/gallium/state_trackers/nine/nine_lock.c @@ -43,12 +43,25 @@ #include "volumetexture9.h" #include "d3d9.h" +#include "nine_lock.h" #include "os/os_thread.h" /* Global mutex as described by MSDN */ pipe_static_mutex(d3dlock_global); +void +NineLockGlobalMutex() +{ +pipe_mutex_lock(d3dlock_global); +} + +void +NineUnlockGlobalMutex() +{ +pipe_mutex_unlock(d3dlock_global); +} + static HRESULT NINE_WINAPI LockAuthenticatedChannel9_GetCertificateSize( struct NineAuthenticatedChannel9 *This, UINT *pCertificateSize ) @@ -114,7 +127,7 @@ LockAuthenticatedChannel9_Configure( struct NineAuthenticatedChannel9 *This, IDirect3DAuthenticatedChannel9Vtbl LockAuthenticatedChannel9_vtable = { (void *)NineUnknown_QueryInterface, (void *)NineUnknown_AddRef, -(void *)NineUnknown_Release, +(void *)NineUnknown_ReleaseWithDtorLock, (void *)LockAuthenticatedChannel9_GetCertificateSize, (void *)LockAuthenticatedChannel9_GetCertificate, (void *)LockAuthenticatedChannel9_NegotiateKeyExchange, @@ -398,7 +411,7 @@ LockCryptoSession9_GetEncryptionBltKey( struct NineCryptoSession9 *This, IDirect3DCryptoSession9Vtbl LockCryptoSession9_vtable = { (void *)NineUnknown_QueryInterface, (void *)NineUnknown_AddRef, -(void *)NineUnknown_Rel
Mesa (master): st/nine: Flush pending commands if needed for surface9 changes
Module: Mesa Branch: master Commit: 6b87a2a77a459d5c69f296b732d66daa9ff8e223 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b87a2a77a459d5c69f296b732d66daa9ff8e223 Author: Axel Davy <axel.d...@ens.fr> Date: Wed Dec 28 18:32:39 2016 +0100 st/nine: Flush pending commands if needed for surface9 changes nine_context uses NineSurface9 fields, thus we need to flush pending commands using the surface before changing the fields. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/surface9.c | 28 src/gallium/state_trackers/nine/surface9.h | 17 - 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 4b8e213..836369c 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -755,6 +755,33 @@ NineSurface9_UploadSelf( struct NineSurface9 *This, return D3D_OK; } +/* Currently nine_context uses the NineSurface9 + * fields when it is render target. Any modification requires + * pending commands with the surface to be executed. If the bind + * count is 0, there is no pending commands. */ +#define PROCESS_IF_BOUND(surf) \ +if (surf->base.base.bind) \ +nine_csmt_process(surf->base.base.device); + +void +NineSurface9_SetResource( struct NineSurface9 *This, + struct pipe_resource *resource, unsigned level ) +{ +/* No need to call PROCESS_IF_BOUND, because SetResource is used only + * for MANAGED textures, and they are not render targets. */ +assert(This->base.pool == D3DPOOL_MANAGED); +This->level = level; +pipe_resource_reference(>base.resource, resource); +} + +void +NineSurface9_SetMultiSampleType( struct NineSurface9 *This, + D3DMULTISAMPLE_TYPE mst ) +{ +PROCESS_IF_BOUND(This); +This->desc.MultiSampleType = mst; +} + void NineSurface9_SetResourceResize( struct NineSurface9 *This, struct pipe_resource *resource ) @@ -764,6 +791,7 @@ NineSurface9_SetResourceResize( struct NineSurface9 *This, assert(This->desc.Pool == D3DPOOL_DEFAULT); assert(!This->texture); +PROCESS_IF_BOUND(This); pipe_resource_reference(>base.resource, resource); This->desc.Width = This->base.info.width0 = resource->width0; diff --git a/src/gallium/state_trackers/nine/surface9.h b/src/gallium/state_trackers/nine/surface9.h index 6f416f2..7badde4 100644 --- a/src/gallium/state_trackers/nine/surface9.h +++ b/src/gallium/state_trackers/nine/surface9.h @@ -103,22 +103,13 @@ NineSurface9_GetResource( struct NineSurface9 *This ) return This->base.resource; } -static inline void +void NineSurface9_SetResource( struct NineSurface9 *This, - struct pipe_resource *resource, unsigned level ) -{ -This->level = level; -pipe_resource_reference(>base.resource, resource); -pipe_surface_reference(>surface[0], NULL); -pipe_surface_reference(>surface[1], NULL); -} + struct pipe_resource *resource, unsigned level ); -static inline void +void NineSurface9_SetMultiSampleType( struct NineSurface9 *This, - D3DMULTISAMPLE_TYPE mst ) -{ -This->desc.MultiSampleType = mst; -} + D3DMULTISAMPLE_TYPE mst ); void NineSurface9_SetResourceResize( struct NineSurface9 *This, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Process pending commands on Reset
Module: Mesa Branch: master Commit: 4e922c81f616bba71565de8d7fd8f5f6955ce1cc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e922c81f616bba71565de8d7fd8f5f6955ce1cc Author: Axel Davy <axel.d...@ens.fr> Date: Wed Dec 28 18:49:10 2016 +0100 st/nine: Process pending commands on Reset Some nine_state_* and nine_context_* functions used for Reset() require all pending commands are flushed. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/device9.c| 1 + src/gallium/state_trackers/nine/device9ex.c | 1 + src/gallium/state_trackers/nine/nine_state.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index d76d506..b150faa 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -917,6 +917,7 @@ NineDevice9_Reset( struct NineDevice9 *This, break; } +nine_csmt_process(This); nine_state_clear(>state, TRUE); nine_context_clear(This); diff --git a/src/gallium/state_trackers/nine/device9ex.c b/src/gallium/state_trackers/nine/device9ex.c index 30c8c65..2853a81 100644 --- a/src/gallium/state_trackers/nine/device9ex.c +++ b/src/gallium/state_trackers/nine/device9ex.c @@ -257,6 +257,7 @@ NineDevice9Ex_Reset( struct NineDevice9Ex *This, break; } +nine_csmt_process(>base); nine_state_clear(>base.state, TRUE); nine_context_clear(>base); diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 697e216..8909692 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -2995,6 +2995,9 @@ static const DWORD nine_samp_state_defaults[NINED3DSAMP_LAST + 1] = [NINED3DSAMP_CUBETEX] = 0 }; +/* Note: The following 4 functions assume there is no + * pending commands */ + void nine_state_restore_non_cso(struct NineDevice9 *device) { struct nine_context *context = >context; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Remove duplicated checks
Module: Mesa Branch: master Commit: d43bc05e8ba0f326273c21b10f714e4d2514adae URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d43bc05e8ba0f326273c21b10f714e4d2514adae Author: Axel Davy <axel.d...@ens.fr> Date: Wed Dec 28 17:54:47 2016 +0100 st/nine: Remove duplicated checks There is no need to check on csmt_active before calling nine_csmt_process, because the function checks already. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/device9.c| 3 +-- src/gallium/state_trackers/nine/nine_state.c | 14 ++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index f095ff3..d76d506 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -522,8 +522,7 @@ NineDevice9_ctor( struct NineDevice9 *This, nine_state_init_sw(This); ID3DPresentGroup_Release(This->present); -if (This->csmt_active) -nine_csmt_process(This); +nine_csmt_process(This); return D3D_OK; } diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index afc309f..697e216 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -280,8 +280,7 @@ nine_csmt_resume( struct NineDevice9 *device ) struct pipe_context * nine_context_get_pipe( struct NineDevice9 *device ) { -if (device->csmt_active) -nine_csmt_process(device); +nine_csmt_process(device); return device->context.pipe; } @@ -1908,8 +1907,8 @@ nine_context_light_enable_stateblock(struct NineDevice9 *device, { struct nine_context *context = >context; -if (device->csmt_active) /* TODO: fix */ -nine_csmt_process(device); +/* TODO: Use CSMT_* to avoid calling nine_csmt_process */ +nine_csmt_process(device); memcpy(context->ff.active_light, active_light, NINE_MAX_LIGHTS_ACTIVE * sizeof(context->ff.active_light[0])); context->ff.num_lights_active = num_lights_active; context->changed.group |= NINE_STATE_FF_LIGHTING; @@ -2821,10 +2820,9 @@ nine_context_get_query_result(struct NineDevice9 *device, struct pipe_query *que struct pipe_context *pipe; boolean ret; -if (wait) { -if (device->csmt_active) -nine_csmt_process(device); -} else if (p_atomic_read(counter) > 0) { +if (wait) +nine_csmt_process(device); +else if (p_atomic_read(counter) > 0) { if (flush && device->csmt_active) nine_queue_flush(device->csmt_ctx->pool); DBG("Pending begin/end. Returning\n"); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): 26 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=123e947228241e743a4d0fdb8a911f57a3dd4ef9 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Dec 18 19:21:08 2016 +0100 st/nine: Upload on secondary context for Draw*Up Avoid synchronization by using the secondary context for uploading the vertex data for Draw*Up. v2: Rely on u_upload_mgr to use persistent coherent buffers. Do not flush. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ec4e5f630ed68ece3f176b174cfd66eff023904 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Dec 13 01:16:21 2016 +0100 st/nine: Dirty MANAGED buffers at Lock time Tests suggest MANAGED buffers are made dirty at Lock time, not at Unlock time. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bad7f7cc638391acc93f070fce3e1b7035dc48f8 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Dec 4 20:34:59 2016 +0100 st/nine: Implement new buffer upload path This new buffer upload path enables to lock faster than the normal path when using DISCARD/NOOVERWRITE. v2: Diverse cleanups and fixes. v3: Fix allocation size for 'lone' buffers and add more debug info. v4: Rewrite of the path to handle when DISCARD/NOOVERWRITE is not used anymore. The resource content is copied to the new resource used. v5: flush for safety after unmap (not sure it is really required here, but safer to flush). v6: Do not use the path if persistent coherent mapping is unavailable. Fix buffer creation flags. v7: Do not flush since it is not needed. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8960be0e939bc6c0f9f34c5d4a16891af7e325fd Author: Axel Davy <axel.d...@ens.fr> Date: Sun Dec 4 19:23:11 2016 +0100 st/nine: Allow non-zero resource offset for vertex buffers Next patches will introduce an offset. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e64be6f91652e7e5ba60c86c379ee41bb7e4f81 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Dec 4 10:34:34 2016 +0100 st/nine: Do not wait for DEFAULT lock for volumes when we can If the volumes (and the texture container) are not referenced, then they are no pending operations on them. We can lock directly. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4f16615ef6546c6f8eab8a2d2a50cdab1773a91 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Dec 4 10:33:19 2016 +0100 st/nine: Do not wait for DEFAULT lock for surfaces when we can If the surfaces (and the texture container) are not referenced, then they are no pending operations on them. We can lock directly. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=525a1b292a3d65857db06832e175fba840b75ff8 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Dec 4 10:32:01 2016 +0100 st/nine: Add arguments to context's blit and copy_region The new arguments enable to reference the objects while the function hasn't run. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=325324c749c2331162e7889efc335bfcfcd27005 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Dec 4 01:13:25 2016 +0100 st/nine: Idem for nine_context_gen_mipmap Will enable to use the bind count as an information for whether the surface/volume is used in the worker thread. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7089d88199d607d8a135a9605f14ec6393134205 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Dec 4 01:10:34 2016 +0100 st/nine: Bind destination for surface/volume uploads Will enable to use the bind count as an information for whether the surface/volume is used in the worker thread. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4a9b21feb890c149f0aa44b0bb6ea63a9932925 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Dec 4 00:29:16 2016 +0100 st/nine: Use nine_context_box_upload for volumes Use nine_context_box_upload for uploads: . systemmem volume to default volume . managed volume internal content to its resource. Check the uploads are executed before any action that can alter the data, that is LockBox and volume destruction. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f04263923132bcf0425e1297da460543e93a95fe Author: Axel Davy <axel.d...@ens
Mesa (master): 99 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b154ac04d9cacf98631a826c25e7e3756f5cda9 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Nov 13 12:41:53 2016 +0100 st/nine: Optimize ColorFill When we lock the whole surface to overwrite it, we can use DISCARD. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9bf1da05d9375f6faf4a3977c7674a1cda9ca0b0 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Nov 13 12:40:10 2016 +0100 st/nine: Simplify ColorFill For render targets, NineSurface9_GetSurface is not expected to fail. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=31262bbce085c69ef7a654528f509cb37415b41f Author: Axel Davy <axel.d...@ens.fr> Date: Sat Nov 12 23:36:35 2016 +0100 st/nine: use get_pipe_acquire/release when possible Use the acquire/release semantic when we don't need to wait for any pending command. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=22f6d6fbd270333979c282627349eb74c06acd6b Author: Axel Davy <axel.d...@ens.fr> Date: Thu Nov 3 23:37:46 2016 +0100 st/nine: Implement Fast path for dynamic buffers and csmt Use the secondary pipe for DISCARD/NOOVERWRITE, which avoids stalling to get the pipe from the worker thread. v2: flush at unmap. This is required for example if the driver does hidden draw calls or copies. In the case of unsynchronized it is probably not required, but it is more safe. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e8234fff42022b12ff7bdbff052c75c71f5bedb Author: Axel Davy <axel.d...@ens.fr> Date: Thu Nov 3 22:12:01 2016 +0100 st/nine: Add secondary pipe for device The secondary pipe will be used for operations that don't need synchronization. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a7eeefd7dd858682244e43eb5cb0d2c84fb0b07 Author: Axel Davy <axel.d...@ens.fr> Date: Sat Nov 12 22:24:04 2016 +0100 st/nine: Add nine_context_get_pipe_acquire/release See commit for description. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddb6f1d2d138109b5716baf4d77683d5bf6cffc8 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Dec 13 01:10:15 2016 +0100 st/nine: SYSTEMMEM ignores DISCARD. Tests show SYSTEMMEM should ignore DISCARD. Prevents game bugs with following patches reimplementing DISCARD. Halo is affected. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f344db8b0fdb08cdcba00d714309f27e073edf8 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Nov 6 12:38:38 2016 +0100 st/nine: Upload Managed buffers just before draw call using them Previously we were uploading Managed buffers at the next draw call after they were set dirty. This is not the expected behaviour. Instead upload just before draw call needing the content. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e52aded87febcf422ae80551e5d204be04c89278 Author: Axel Davy <axel.d...@ens.fr> Date: Thu Nov 3 21:53:53 2016 +0100 st/nine: Track bindings for buffers Similar code than for textures. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=62068c9d90ceda8a4a6696dee1ec7f7a718b9d36 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Nov 6 12:06:22 2016 +0100 st/nine: Fix BASETEX_REGISTER_UPDATE BASETEX_REGISTER_UPDATE was adding the texture to the list of textures to upload in too many cases. tex->base.base.bind will be set to true if the texture is in a stateblock, whereas we want to upload only if bound to the device, which is what bind_count is for. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=804b28cdc461043bba18f1b2b914ef61b9773192 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Nov 6 12:05:50 2016 +0100 st/nine: Simplify the logic to bind textures This makes the code more readable. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fef23f6712064416f02211f1517e387169735e0b Author: Patrick Rudolph <s...@das-labor.org> Date: Wed Nov 2 17:17:21 2016 +0100 st/nine: Use nine_context for resource_copy_region Use nine_context wrapper for resource_copy_region. Enables to offload it with CSMT. Signed-off-by: Patrick Rud
Mesa (master): st/nine: Use align_calloc instead of align_malloc
Module: Mesa Branch: master Commit: 942778099ea597ee6b04ebdc74f506667fc7782c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=942778099ea597ee6b04ebdc74f506667fc7782c Author: Axel Davy <axel.d...@ens.fr> Date: Fri Oct 21 17:27:10 2016 +0200 st/nine: Use align_calloc instead of align_malloc We are not sure exactly what needs to be 0 initialized, but we are missing some cases. 0 initialize all our current aligned allocation. Fixes Tree of Savior visual issues. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/buffer9.c | 2 +- src/gallium/state_trackers/nine/cubetexture9.c | 2 +- src/gallium/state_trackers/nine/surface9.c | 4 ++-- src/gallium/state_trackers/nine/texture9.c | 2 +- src/gallium/state_trackers/nine/volume9.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index e7c6a2f..cbf410b 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -125,7 +125,7 @@ NineBuffer9_ctor( struct NineBuffer9 *This, return hr; if (Pool == D3DPOOL_MANAGED) { -This->managed.data = align_malloc( +This->managed.data = align_calloc( nine_format_get_level_alloc_size(This->base.info.format, Size, 1, 0), 32); if (!This->managed.data) diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c index 912d508..0a834eb 100644 --- a/src/gallium/state_trackers/nine/cubetexture9.c +++ b/src/gallium/state_trackers/nine/cubetexture9.c @@ -111,7 +111,7 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This, face_size = nine_format_get_size_and_offsets(pf, level_offsets, EdgeLength, EdgeLength, info->last_level); -This->managed_buffer = align_malloc(6 * face_size, 32); +This->managed_buffer = align_calloc(6 * face_size, 32); if (!This->managed_buffer) return E_OUTOFMEMORY; } diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 664b78f..1b00b96 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -146,7 +146,7 @@ NineSurface9_ctor( struct NineSurface9 *This, FALSE, TRUE); if (This->base.info.format != This->format_conversion) { -This->data_conversion = align_malloc( +This->data_conversion = align_calloc( nine_format_get_level_alloc_size(This->format_conversion, pDesc->Width, pDesc->Height, @@ -160,7 +160,7 @@ NineSurface9_ctor( struct NineSurface9 *This, if ((allocate && pDesc->Pool != D3DPOOL_DEFAULT) || pDesc->Format == D3DFMT_NULL) { /* Ram buffer with no parent. Has to allocate the resource itself */ assert(!user_buffer); -This->data = align_malloc( +This->data = align_calloc( nine_format_get_level_alloc_size(This->base.info.format, pDesc->Width, pDesc->Height, diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c index a13d7f4..bf054cc 100644 --- a/src/gallium/state_trackers/nine/texture9.c +++ b/src/gallium/state_trackers/nine/texture9.c @@ -161,7 +161,7 @@ NineTexture9_ctor( struct NineTexture9 *This, * apps access sublevels of texture even if they locked only first * level) */ level_offsets = alloca(sizeof(unsigned) * (info->last_level + 1)); -user_buffer = align_malloc( +user_buffer = align_calloc( nine_format_get_size_and_offsets(pf, level_offsets, Width, Height, info->last_level), 32); diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c index e2201af..89565f2 100644 --- a/src/gallium/state_trackers/nine/volume9.c +++ b/src/gallium/state_trackers/nine/volume9.c @@ -42,7 +42,7 @@ NineVolume9_AllocateData( struct NineVolume9 *This ) DBG("(%p(This=%p),level=%u) Allocating 0x%x bytes of system memory.\n", This->base.container, This, This->level, size); -This->data = (uint8_t *)align_malloc(size, 32); +This->data = (uint8_t *)align_calloc(size, 32); if (!This->data) return E_OUTOFMEMORY; return D3D_OK; @@ -124,7 +1
Mesa (master): gallium/util: Add align_calloc
Module: Mesa Branch: master Commit: 54010cf8b6da71a1b14c0dc586bb7e6be27052de URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=54010cf8b6da71a1b14c0dc586bb7e6be27052de Author: Axel Davy <axel.d...@ens.fr> Date: Fri Oct 21 17:25:08 2016 +0200 gallium/util: Add align_calloc Add implementation for align_calloc, which is align_malloc + memset. v2: add if (ptr) before memset. Fix indentation. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com> --- src/gallium/auxiliary/util/u_memory.h | 8 1 file changed, 8 insertions(+) diff --git a/src/gallium/auxiliary/util/u_memory.h b/src/gallium/auxiliary/util/u_memory.h index 597df62..66c3ba4 100644 --- a/src/gallium/auxiliary/util/u_memory.h +++ b/src/gallium/auxiliary/util/u_memory.h @@ -63,6 +63,14 @@ extern "C" { #define align_malloc(_size, _alignment) os_malloc_aligned(_size, _alignment) #define align_free(_ptr) os_free_aligned(_ptr) +static inline void * +align_calloc(size_t size, unsigned long alignment) +{ + void *ptr = align_malloc(size, alignment); + if (ptr) + memset(ptr, 0, size); + return ptr; +} /** * Duplicate a block of memory. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix locking CubeTexture surfaces.
Module: Mesa Branch: master Commit: eed605a473554575305e1bf10c3641761a85feb9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eed605a473554575305e1bf10c3641761a85feb9 Author: Axel Davy <axel.d...@ens.fr> Date: Sat Oct 22 12:00:40 2016 +0200 st/nine: Fix locking CubeTexture surfaces. Only one face of Cubetextures was locked when in DEFAULT Pool. Fixes: https://github.com/iXit/Mesa-3D/issues/129 CC: "12.0 13.0" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/surface9.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 1b00b96..2efdfd1 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -447,6 +447,7 @@ NineSurface9_LockRect( struct NineSurface9 *This, } else { u_box_origin_2d(This->desc.Width, This->desc.Height, ); } +box.z = This->layer; user_warn(This->desc.Format == D3DFMT_NULL); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix mistake in Volume9 UnlockBox
Module: Mesa Branch: master Commit: fe7bb46134162c9a9a18832f1746991aa78121e8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe7bb46134162c9a9a18832f1746991aa78121e8 Author: Axel Davy <axel.d...@ens.fr> Date: Sat Oct 22 11:59:11 2016 +0200 st/nine: Fix mistake in Volume9 UnlockBox In the format fallback path, the height was used instead of the depth. CC: "12.0 13.0" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/volume9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c index 89565f2..a31dc0a 100644 --- a/src/gallium/state_trackers/nine/volume9.c +++ b/src/gallium/state_trackers/nine/volume9.c @@ -373,7 +373,7 @@ NineVolume9_UnlockBox( struct NineVolume9 *This ) This->layer_stride_conversion, 0, 0, 0, This->desc.Width, This->desc.Height, -This->desc.Height); +This->desc.Depth); if (!This->data) pipe_transfer_unmap(This->pipe, transfer); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix leak with integer and boolean constants
Module: Mesa Branch: master Commit: 25beccb379731b0e6fc728982190779da47aa6fd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=25beccb379731b0e6fc728982190779da47aa6fd Author: Axel Davy <axel.d...@ens.fr> Date: Tue Oct 18 23:05:02 2016 +0200 st/nine: Fix leak with integer and boolean constants Leak introduced by: a83dce01284f220b1bf932774730e13fca6cdd20 The patch also moves the part to release changed.vs_const_i and changed.vs_const_b before the if (!cb.buffer_size) check, to avoid reuploading every draw call if integer or boolean constants are dirty, but the shaders use no constants. Signed-off-by: Axel Davy <axel.d...@ens.fr> CC: "13.0" <mesa-sta...@lists.freedesktop.org> --- src/gallium/state_trackers/nine/nine_state.c | 39 +--- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index f6bf51e..ea72c77 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -126,7 +126,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device) cb.user_buffer = state->vs_const_i; state->pipe.cb2_swvp = cb; -state->changed.vs_const_i = 0; } if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) { @@ -138,7 +137,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device) cb.user_buffer = state->vs_const_b; state->pipe.cb3_swvp = cb; -state->changed.vs_const_b = 0; } if (!device->driver_caps.user_cbufs) { @@ -236,14 +234,30 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device) if (state->changed.vs_const_i || state->changed.group & NINE_STATE_SWVP) { int *idst = (int *)>vs_const_f[4 * device->max_vs_const_f]; memcpy(idst, state->vs_const_i, NINE_MAX_CONST_I * sizeof(int[4])); -state->changed.vs_const_i = 0; } if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) { int *idst = (int *)>vs_const_f[4 * device->max_vs_const_f]; uint32_t *bdst = (uint32_t *)[4 * NINE_MAX_CONST_I]; memcpy(bdst, state->vs_const_b, NINE_MAX_CONST_B * sizeof(BOOL)); -state->changed.vs_const_b = 0; +} + +if (device->state.changed.vs_const_i) { +struct nine_range *r = device->state.changed.vs_const_i; +struct nine_range *p = r; +while (p->next) +p = p->next; +nine_range_pool_put_chain(>range_pool, r, p); +device->state.changed.vs_const_i = NULL; +} + +if (device->state.changed.vs_const_b) { +struct nine_range *r = device->state.changed.vs_const_b; +struct nine_range *p = r; +while (p->next) +p = p->next; +nine_range_pool_put_chain(>range_pool, r, p); +device->state.changed.vs_const_b = NULL; } if (!cb.buffer_size) @@ -290,23 +304,6 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device) device->state.changed.vs_const_f = NULL; } -if (device->state.changed.vs_const_i) { -struct nine_range *r = device->state.changed.vs_const_i; -struct nine_range *p = r; -while (p->next) -p = p->next; -nine_range_pool_put_chain(>range_pool, r, p); -device->state.changed.vs_const_i = NULL; -} - -if (device->state.changed.vs_const_b) { -struct nine_range *r = device->state.changed.vs_const_b; -struct nine_range *p = r; -while (p->next) -p = p->next; -nine_range_pool_put_chain(>range_pool, r, p); -device->state.changed.vs_const_b = NULL; -} state->changed.group &= ~NINE_STATE_VS_CONST; state->commit |= NINE_STATE_COMMIT_CONST_VS; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix multisample limit check
Module: Mesa Branch: master Commit: 9baf4505fb31d3fbd2d18ca8b5e732079ef4af66 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9baf4505fb31d3fbd2d18ca8b5e732079ef4af66 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Oct 16 11:44:09 2016 +0200 st/nine: Fix multisample limit check Fixes regression introduced by b5603056872708fdd82f1224854097805a01d4c0 The regression prevents some apps to start. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/adapter9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c index e9c911b..f00590d 100644 --- a/src/gallium/state_trackers/nine/adapter9.c +++ b/src/gallium/state_trackers/nine/adapter9.c @@ -393,7 +393,7 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This, /* In error cases return only 1 quality level supported */ *pQualityLevels = 1; } -user_assert(MultiSampleType < D3DMULTISAMPLE_16_SAMPLES, D3DERR_INVALIDCALL); +user_assert(MultiSampleType <= D3DMULTISAMPLE_16_SAMPLES, D3DERR_INVALIDCALL); hr = NineAdapter9_GetScreen(This, DeviceType, ); if (FAILED(hr)) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix possible segfault in surface ctor
Module: Mesa Branch: master Commit: 0717cd975d85eb04389d84c54b796863aa537cf0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0717cd975d85eb04389d84c54b796863aa537cf0 Author: Axel Davy <axel.d...@ens.fr> Date: Wed Oct 12 19:10:53 2016 +0200 st/nine: Fix possible segfault in surface ctor Regression introduced by ba0274c7d6c3b77a36bbe1b444f427b0c873e2f3 Check the resource exists before assigning it a flag (and use This->base.resource instead of pResource, since the former may have a newly allocate resource, while the latter would be NULL). This should reintroduce the behaviour of previous code. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/surface9.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index dc31bb9..664b78f 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -187,8 +187,8 @@ NineSurface9_ctor( struct NineSurface9 *This, This->stride = nine_format_get_stride(This->base.info.format, pDesc->Width); -if (pDesc->Usage & D3DUSAGE_DYNAMIC) -pResource->flags |= NINE_RESOURCE_FLAG_LOCKABLE; +if (This->base.resource && (pDesc->Usage & D3DUSAGE_DYNAMIC)) +This->base.resource->flags |= NINE_RESOURCE_FLAG_LOCKABLE; /* TODO: investigate what else exactly needs to be cleared */ if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Remove useless code in nine_shader
Module: Mesa Branch: master Commit: 98b8ad61c6bc531646bec1e773b0f57f99e47159 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=98b8ad61c6bc531646bec1e773b0f57f99e47159 Author: Axel Davy <axel.d...@ens.fr> Date: Wed Oct 12 18:58:24 2016 +0200 st/nine: Remove useless code in nine_shader Since 1604efa6fda9b780e8537a131ad77f3e83e5a67a, lconsti and lconstb don't need to be initialized. Remove some leftovers from the previous code (which has now invalid use of ARRAY_SIZE on a pointer instead of an array). Reported by Coverity. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/nine_shader.c | 5 - 1 file changed, 5 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index 0f8bcdd..ab21daf 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -3361,11 +3361,6 @@ tx_ctor(struct shader_translator *tx, struct nine_shader_info *info) for (i = 0; i < ARRAY_SIZE(tx->regs.vT); ++i) tx->regs.vT[i] = ureg_src_undef(); -for (i = 0; i < ARRAY_SIZE(tx->lconsti); ++i) -tx->lconsti[i].idx = -1; -for (i = 0; i < ARRAY_SIZE(tx->lconstb); ++i) -tx->lconstb[i].idx = -1; - sm1_read_version(tx); info->version = (tx->version.major << 4) | tx->version.minor; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/os: Use unsigned integers for size computation
Module: Mesa Branch: master Commit: 197cdd1bbdafaf44dc705e518987a08953b092ab URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=197cdd1bbdafaf44dc705e518987a08953b092ab Author: Axel Davy <axel.d...@ens.fr> Date: Tue Oct 11 18:57:17 2016 +0200 gallium/os: Use unsigned integers for size computation Use uint64_t instead of int64_t in the calculation, as the result is uint64_t. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com> --- src/gallium/auxiliary/os/os_misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/os/os_misc.c b/src/gallium/auxiliary/os/os_misc.c index a32a9e5..09d4400 100644 --- a/src/gallium/auxiliary/os/os_misc.c +++ b/src/gallium/auxiliary/os/os_misc.c @@ -131,7 +131,7 @@ os_get_total_physical_memory(uint64_t *size) if (phys_pages <= 0 || page_size <= 0) return false; - *size = (int64_t)phys_pages * (int64_t)page_size; + *size = (uint64_t)phys_pages * (uint64_t)page_size; return true; #elif defined(PIPE_OS_APPLE) || defined(PIPE_OS_BSD) size_t len = sizeof(*size); @@ -159,7 +159,7 @@ os_get_total_physical_memory(uint64_t *size) if (ret != B_OK || info.max_pages <= 0) return false; - *size = (int64_t)info.max_pages * (int64_t)B_PAGE_SIZE; + *size = (uint64_t)info.max_pages * (uint64_t)B_PAGE_SIZE; return true; #elif defined(PIPE_OS_WINDOWS) MEMORYSTATUSEX status; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): 78 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eef0744d4384a48c70da3f9863a02ceab08c97bb Author: Axel Davy <axel.d...@ens.fr> Date: Sun Oct 2 12:14:03 2016 +0200 st/nine: More checks for GetRenderTargetData Fixes a wine test crash Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a52e700169066c7c2b4a26230f66f77db702af82 Author: Patrick Rudolph <s...@das-labor.org> Date: Wed Sep 28 20:11:34 2016 +0200 st/nine: Add debug output for lost devices Add debug output to ease debugging. Signed-off-by: Patrick Rudolph <s...@das-labor.org> Reviewed-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d85253dc30cc26a40fa6f4a52cf61880827edee Author: Patrick Rudolph <s...@das-labor.org> Date: Wed Sep 28 18:50:19 2016 +0200 st/nine: Prevent crash in GetRenderTargetData Return error instead of crashing on source surfaces with format D3DFMT_NULL. Fix for issue #236. Tested on Windows 7. Signed-off-by: Patrick Rudolph <s...@das-labor.org> Reviewed-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=09edc0555f91d76001b1ffc0e656b0614abb809a Author: Patrick Rudolph <s...@das-labor.org> Date: Sat Sep 24 18:19:26 2016 +0200 st/nine: Set CLAMP_TO_EDGE on cubetextures Wine tests show that cubetextures always use PIPE_TEX_WRAP_CLAMP_TO_EDGE regardless of set sampler states. Fixes failing d3d9 wine test test_cube_wrap. Signed-off-by: Patrick Rudolph <s...@das-labor.org> Reviewed-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa2574497b25d06258404b83282719dbb477b190 Author: Patrick Rudolph <s...@das-labor.org> Date: Sat Sep 24 11:34:33 2016 +0200 st/nine: handle possible failure of D3DWindowBuffer_create Check for errors and pass them to the callers. Signed-off-by: Patrick Rudolph <s...@das-labor.org> Reviewed-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f04fa0a62c6d39659c38eabd63bff54f0d2833fe Author: Patrick Rudolph <s...@das-labor.org> Date: Sat Sep 24 10:46:27 2016 +0200 st/nine: Assert on buffer creation failure Add an assert to make sure buffer creation doesn't fail. Add error handling in calling functions. Signed-off-by: Patrick Rudolph <s...@das-labor.org> Reviewed-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8c01e7a96aed4e64eab11acbae8aef70c8e7cbe Author: Patrick Rudolph <s...@das-labor.org> Date: Fri Sep 23 17:55:08 2016 +0200 st/nine: Use NineDevice9_CreateDepthStencilSurface in swapchain9 Replace custom code with NineDevice9_CreateDepthStencilSurface. All functionality is given now. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=63367e6c9507dccba4e8bc563e190123e25b6893 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Oct 2 00:58:48 2016 +0200 st/nine: Fix check and remove useless code in swapchain9 The removed code was there for two reasons: 1) Allow DF16, DF24, INTZ to be used as depth buffer for swapchain, if the driver doesn't support PIPE_BIND_SAMPLER_VIEW for the underlying format 2) Set PIPE_BIND_SAMPLER_VIEW if possible, such that if StretchRect is called on the depth texture, it is happy. 1) The reason these formats needed a workaround is because the check flags for them in CheckDeviceFormat were incorrect, which led applications to think the formats were valid for swapchains, even if they weren't supported. 2) StretchRect limitations for depth buffers force the resource_copy_region path, which should be fine without PIPE_BIND_SAMPLER_VIEW. Thus fix the check for 1), and remove the code. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=60624be2033f06b414cf76794c2f3b061dc28332 Author: Patrick Rudolph <s...@das-labor.org> Date: Thu Sep 22 17:03:17 2016 +0200 st/nine: Implement MSAA quality levels Advertise quality levels: Each supported multisample count matches to one quality level. The application doesn't know how much samples each quality level has. For that reason it's not possible to set the multisample mask. Return errors on quality level missmatch. Fixes several old games not having multisample support until now. Fix for issue #73. Signed-off-by: Patrick Rudolph <s...@das-labor.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a
Mesa (master): egl/x11_dri3: provide an authentication function
Module: Mesa Branch: master Commit: 5505845945fb9bdd0c752b0f299a627591205dbd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5505845945fb9bdd0c752b0f299a627591205dbd Author: Frank Binns <frank.bi...@imgtec.com> 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 <frank.bi...@imgtec.com> Reviewed-by: Axel Davy <axel.d...@ens.fr> --- 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
Module: Mesa Branch: master Commit: 4c28c916ef229e94bd46fd1703e6b535e03e7e64 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c28c916ef229e94bd46fd1703e6b535e03e7e64 Author: Frank Binns <frank.bi...@imgtec.com> 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 <frank.bi...@imgtec.com> Reviewed-by: Axel Davy <axel.d...@ens.fr> --- 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): st/nine: Use offset_units_unscaled
Module: Mesa Branch: master Commit: b76fa5673924ce09e28f3000808e3bd50ffe4570 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b76fa5673924ce09e28f3000808e3bd50ffe4570 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jun 14 23:24:24 2016 +0200 st/nine: Use offset_units_unscaled offset_units_unscaled enables proper support for depth bias for gallium nine. Use it if available. Solves issues with some games using depth bias. For example: https://github.com/iXit/Mesa-3D/issues/220 Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/device9.c| 1 + src/gallium/state_trackers/nine/device9.h| 1 + src/gallium/state_trackers/nine/nine_pipe.c | 18 +- src/gallium/state_trackers/nine/nine_pipe.h | 2 +- src/gallium/state_trackers/nine/nine_state.c | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index bb1735a..b4ce3c8 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -427,6 +427,7 @@ NineDevice9_ctor( struct NineDevice9 *This, This->driver_caps.window_space_position_support = GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION); This->driver_caps.vs_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS); This->driver_caps.ps_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS); +This->driver_caps.offset_units_unscaled = GET_PCAP(POLYGON_OFFSET_UNITS_UNSCALED); nine_ff_init(This); /* initialize fixed function code */ diff --git a/src/gallium/state_trackers/nine/device9.h b/src/gallium/state_trackers/nine/device9.h index 73a43cf..d584a35 100644 --- a/src/gallium/state_trackers/nine/device9.h +++ b/src/gallium/state_trackers/nine/device9.h @@ -121,6 +121,7 @@ struct NineDevice9 boolean window_space_position_support; boolean vs_integer; boolean ps_integer; +boolean offset_units_unscaled; } driver_caps; struct { diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c index 79b910c..c1814fe 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.c +++ b/src/gallium/state_trackers/nine/nine_pipe.c @@ -70,7 +70,9 @@ nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *dsa_state, } void -nine_convert_rasterizer_state(struct pipe_rasterizer_state *rast_state, const DWORD *rs) +nine_convert_rasterizer_state(struct NineDevice9 *device, + struct pipe_rasterizer_state *rast_state, + const DWORD *rs) { struct pipe_rasterizer_state rast; @@ -120,14 +122,12 @@ nine_convert_rasterizer_state(struct pipe_rasterizer_state *rast_state, const DW /* offset_units has the ogl/d3d11 meaning. * d3d9: offset = scale * dz + bias * ogl/d3d11: offset = scale * dz + r * bias - * with r implementation dependant and is supposed to be - * the smallest value the depth buffer format can hold. - * In practice on current and past hw it seems to be 2^-23 - * for all formats except float formats where it varies depending - * on the content. - * For now use 1 << 23, but in the future perhaps add a way in gallium - * to get r for the format or get the gallium behaviour */ -rast.offset_units = asfloat(rs[D3DRS_DEPTHBIAS]) * (float)(1 << 23); + * with r implementation dependent (+ different formula for float depth + * buffers). r=2^-23 is often the right value for gallium drivers. + * If possible, use offset_units_unscaled, which gives the d3d9 + * behaviour, else scale by 1 << 23 */ +rast.offset_units = asfloat(rs[D3DRS_DEPTHBIAS]) * (device->driver_caps.offset_units_unscaled ? 1.0f : (float)(1 << 23)); +rast.offset_units_unscaled = device->driver_caps.offset_units_unscaled; rast.offset_scale = asfloat(rs[D3DRS_SLOPESCALEDEPTHBIAS]); /* rast.offset_clamp = 0.0f; */ diff --git a/src/gallium/state_trackers/nine/nine_pipe.h b/src/gallium/state_trackers/nine/nine_pipe.h index 4d2bc92..fe8e910 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.h +++ b/src/gallium/state_trackers/nine/nine_pipe.h @@ -38,7 +38,7 @@ extern const enum pipe_format nine_d3d9_to_pipe_format_map[120]; extern const D3DFORMAT nine_pipe_to_d3d9_format_map[PIPE_FORMAT_COUNT]; void nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *, const DWORD *); -void nine_convert_rasterizer_state(struct pipe_rasterizer_state *, const DWORD *); +void nine_convert_rasterizer_state(struct NineDevice9 *, struct pipe_rasterizer_state *, const DWORD *); void nine_convert_blend_state(struct pipe_blend_state *, const DWORD *); void nine_convert_sampler_state(struct cso_context *, int idx, const DWORD *); diff --git a/src/gallium/state_t
Mesa (master): r600g: move PA_SU_POLY_OFFSET_DB_FMT_CNTL to poly offset states for r600
Module: Mesa Branch: master Commit: 400e8d8c4080de0d9ab907b6ebbcc15c1ab02822 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=400e8d8c4080de0d9ab907b6ebbcc15c1ab02822 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jun 14 22:22:50 2016 +0200 r600g: move PA_SU_POLY_OFFSET_DB_FMT_CNTL to poly offset states for r600 Emit PA_SU_POLY_OFFSET_DB_FMT_CNTL with the other poly_offset states. This will be useful to implement PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED. v2: Increase the num_dw field for the poly offset atom Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Marek Olšák <marek.ol...@amd.com> --- src/gallium/drivers/r600/r600_state.c | 37 --- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index afb0e2f..578aef9 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -254,16 +254,24 @@ static void r600_emit_polygon_offset(struct r600_context *rctx, struct r600_atom struct r600_poly_offset_state *state = (struct r600_poly_offset_state*)a; float offset_units = state->offset_units; float offset_scale = state->offset_scale; + uint32_t pa_su_poly_offset_db_fmt_cntl = 0; switch (state->zs_format) { case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z24_UNORM_S8_UINT: offset_units *= 2.0f; + pa_su_poly_offset_db_fmt_cntl = + S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS((char)-24); break; case PIPE_FORMAT_Z16_UNORM: offset_units *= 4.0f; + pa_su_poly_offset_db_fmt_cntl = + S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS((char)-16); break; - default:; + default: + pa_su_poly_offset_db_fmt_cntl = + S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS((char)-23) | + S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1); } radeon_set_context_reg_seq(cs, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, 4); @@ -271,6 +279,9 @@ static void r600_emit_polygon_offset(struct r600_context *rctx, struct r600_atom radeon_emit(cs, fui(offset_units)); radeon_emit(cs, fui(offset_scale)); radeon_emit(cs, fui(offset_units)); + + radeon_set_context_reg(cs, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, + pa_su_poly_offset_db_fmt_cntl); } static uint32_t r600_get_blend_control(const struct pipe_blend_state *state, unsigned i) @@ -1058,25 +1069,6 @@ static void r600_init_depth_surface(struct r600_context *rctx, surf->db_depth_size = S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice); surf->db_prefetch_limit = (rtex->surface.level[level].nblk_y / 8) - 1; - switch (surf->base.format) { - case PIPE_FORMAT_Z24X8_UNORM: - case PIPE_FORMAT_Z24_UNORM_S8_UINT: - surf->pa_su_poly_offset_db_fmt_cntl = - S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS((char)-24); - break; - case PIPE_FORMAT_Z32_FLOAT: - case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: - surf->pa_su_poly_offset_db_fmt_cntl = - S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS((char)-23) | - S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1); - break; - case PIPE_FORMAT_Z16_UNORM: - surf->pa_su_poly_offset_db_fmt_cntl = - S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS((char)-16); - break; - default:; - } - /* use htile only for first level */ if (rtex->htile_buffer && !level) { surf->db_htile_data_base = 0; @@ -1456,9 +1448,6 @@ static void r600_emit_framebuffer_state(struct r600_context *rctx, struct r600_a RADEON_PRIO_DEPTH_BUFFER_MSAA : RADEON_PRIO_DEPTH_BUFFER); - radeon_set_context_reg(cs, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, - surf->pa_su_poly_offset_db_fmt_cntl); - radeon_set_context_reg_seq(cs, R_028000_DB_DEPTH_SIZE, 2); radeon_emit(cs, surf->db_depth_size); /* R_028000_DB_DEPTH_SIZE */ radeon_emit(cs, surf->db_depth_view); /* R_028004_DB_DEPTH_VIEW */ @@ -3084,7 +3073,7 @@ void r600_init_state_functions(struct r600_context *rctx) r600_init_atom(rctx, >db_misc_state.atom, id++, r600_emit_db_misc_state, 7); r600_init_atom(rctx, >db_state.atom, id++, r600_emit_db_state, 11); r600_init_atom(rctx, >dsa_state.atom, id++, r600_emit_cso_state, 0); - r600_init_atom(rctx, >poly_offset_state.atom, id++, r600_emit_polygon_offset, 6); +
Mesa (master): gallium: Add a cap for offset_units_unscaled
Module: Mesa Branch: master Commit: 59a692916ca251db995050f7fc0bb7b4e6e4780b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=59a692916ca251db995050f7fc0bb7b4e6e4780b Author: Axel Davy <axel.d...@ens.fr> Date: Mon Jun 13 22:28:32 2016 +0200 gallium: Add a cap for offset_units_unscaled D3D9 has a different behaviour for depth bias. For OGL/D3D1X, the depth bias unit is the minimal resolvable value for the depth buffer, which depends on the format (and has different behaviour for float depth buffers). For D3D9, the depth bias unit is 1.0f. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Marek Olšák <marek.ol...@amd.com> --- src/gallium/docs/source/cso/rasterizer.rst | 6 ++ src/gallium/docs/source/screen.rst | 2 ++ src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/ilo/ilo_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 1 + src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeonsi/si_pipe.c | 1 + src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/swr/swr_screen.cpp | 1 + src/gallium/drivers/vc4/vc4_screen.c | 1 + src/gallium/drivers/virgl/virgl_screen.c | 1 + src/gallium/include/pipe/p_defines.h | 1 + src/gallium/include/pipe/p_state.h | 7 +++ 19 files changed, 31 insertions(+) diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst index 8d473b8..616e451 100644 --- a/src/gallium/docs/source/cso/rasterizer.rst +++ b/src/gallium/docs/source/cso/rasterizer.rst @@ -127,6 +127,12 @@ offset_tri offset_units Specifies the polygon offset bias +offset_units_unscaled +Specifies the unit of the polygon offset bias. If false, use the +GL/D3D1X behaviour. If true, offset_units is a floating point offset +which isn't scaled (D3D9). Note that GL/D3D1X behaviour has different +formula whether the depth buffer is unorm or float, which is not +the case for D3D9. offset_scale Specifies the polygon offset scale offset_clamp diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index a20b372..141b45a 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -343,6 +343,8 @@ The integer capabilities: * ``PIPE_CAP_TGSI_VOTE``: Whether the ``VOTE_*`` ops can be used in shaders. * ``PIPE_CAP_MAX_WINDOW_RECTANGLES``: The maxium number of window rectangles supported in ``set_window_rectangles``. +* ``PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED``: If true, the driver implements support + for ``pipe_rasterizer_state::offset_units_unscaled``. .. _pipe_capf: diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 9138024..93b70e0 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -264,6 +264,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES: case PIPE_CAP_TGSI_VOTE: case PIPE_CAP_MAX_WINDOW_RECTANGLES: + case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED: return 0; case PIPE_CAP_MAX_VIEWPORTS: diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index e898f7e..3f0ab98 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -275,6 +275,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES: case PIPE_CAP_TGSI_VOTE: case PIPE_CAP_MAX_WINDOW_RECTANGLES: + case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED: return 0; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index a775aa6..2024688 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -504,6 +504,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES: case PIPE_CAP_TGSI_VOTE: case PIPE_CAP_MAX_WINDOW_RECTANGLES: + case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED: return 0; case PIPE_CAP_VENDOR_ID: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 7d01e64..684c7a5 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -327,6 +327,7 @@
Mesa (master): r600g: Implement POLYGON_OFFSET_UNITS_UNSCALED
Module: Mesa Branch: master Commit: f6704f2a4db7113e597d4bab2cefc02e166c2ad9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6704f2a4db7113e597d4bab2cefc02e166c2ad9 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jun 14 23:13:26 2016 +0200 r600g: Implement POLYGON_OFFSET_UNITS_UNSCALED Empirical tests show that the polygon offset behaviour is entirely determined by the content of the PA_SU_POLY_OFFSET states, and not by the depth buffer format bound. PA_SU_POLY_OFFSET seems to directly set the parameters of the polygon offset formula, and setting 0 for PA_SU_POLY_OFFSET_DB_FMT_CNTL (ie setting the unorm depth bias behaviour with a scale of 2^0 = 1.0f) gives the unscaled behaviour. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Marek Olšák <marek.ol...@amd.com> --- src/gallium/drivers/r600/evergreen_state.c | 39 +++- src/gallium/drivers/r600/r600_pipe.c | 2 +- src/gallium/drivers/r600/r600_pipe.h | 2 ++ src/gallium/drivers/r600/r600_state.c| 35 + src/gallium/drivers/r600/r600_state_common.c | 4 ++- 5 files changed, 46 insertions(+), 36 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 797f593..fab0359 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -492,6 +492,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, rs->offset_units = state->offset_units; rs->offset_scale = state->offset_scale * 16.0f; rs->offset_enable = state->offset_point || state->offset_line || state->offset_tri; + rs->offset_units_unscaled = state->offset_units_unscaled; if (state->point_size_per_vertex) { psize_min = util_get_min_point_size(state); @@ -1665,24 +1666,26 @@ static void evergreen_emit_polygon_offset(struct r600_context *rctx, struct r600 float offset_scale = state->offset_scale; uint32_t pa_su_poly_offset_db_fmt_cntl = 0; - switch (state->zs_format) { - case PIPE_FORMAT_Z24X8_UNORM: - case PIPE_FORMAT_Z24_UNORM_S8_UINT: - case PIPE_FORMAT_X8Z24_UNORM: - case PIPE_FORMAT_S8_UINT_Z24_UNORM: - offset_units *= 2.0f; - pa_su_poly_offset_db_fmt_cntl = - S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-24); - break; - case PIPE_FORMAT_Z16_UNORM: - offset_units *= 4.0f; - pa_su_poly_offset_db_fmt_cntl = - S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-16); - break; - default: - pa_su_poly_offset_db_fmt_cntl = - S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-23) | - S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1); + if (!state->offset_units_unscaled) { + switch (state->zs_format) { + case PIPE_FORMAT_Z24X8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_UINT: + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_S8_UINT_Z24_UNORM: + offset_units *= 2.0f; + pa_su_poly_offset_db_fmt_cntl = + S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-24); + break; + case PIPE_FORMAT_Z16_UNORM: + offset_units *= 4.0f; + pa_su_poly_offset_db_fmt_cntl = + S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-16); + break; + default: + pa_su_poly_offset_db_fmt_cntl = + S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-23) | + S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1); + } } radeon_set_context_reg_seq(cs, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, 4); diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index fe1af7c..57721d9 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -282,6 +282,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS: case PIPE_CAP_QUERY_MEMORY_INFO: case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT: + case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED: return 1; case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: @@ -370,7 +371,6 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES: case PIPE_CAP_TGSI_VOTE: case PIPE_CAP_MAX_WINDOW_RECTANGLES: - case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED: return 0; case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS: diff --git a/s
Mesa (master): r600g: move PA_SU_POLY_OFFSET_DB_FMT_CNTL to poly offset states for evergreen
Module: Mesa Branch: master Commit: fe2ec50d754d9ddf38d167ff56e376577732c128 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe2ec50d754d9ddf38d167ff56e376577732c128 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jun 14 22:30:11 2016 +0200 r600g: move PA_SU_POLY_OFFSET_DB_FMT_CNTL to poly offset states for evergreen Emit PA_SU_POLY_OFFSET_DB_FMT_CNTL with the other poly_offset states. This will be useful to implement PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED. v2: Increase the num_dw field for the poly offset atom Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Marek Olšák <marek.ol...@amd.com> --- src/gallium/drivers/r600/evergreen_state.c | 38 ++ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 0b8488d..797f593 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1222,27 +1222,6 @@ static void evergreen_init_depth_surface(struct r600_context *rctx, surf->db_depth_slice = S_02805C_SLICE_TILE_MAX(levelinfo->nblk_x * levelinfo->nblk_y / 64 - 1); - switch (surf->base.format) { - case PIPE_FORMAT_Z24X8_UNORM: - case PIPE_FORMAT_Z24_UNORM_S8_UINT: - case PIPE_FORMAT_X8Z24_UNORM: - case PIPE_FORMAT_S8_UINT_Z24_UNORM: - surf->pa_su_poly_offset_db_fmt_cntl = - S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-24); - break; - case PIPE_FORMAT_Z32_FLOAT: - case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: - surf->pa_su_poly_offset_db_fmt_cntl = - S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-23) | - S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1); - break; - case PIPE_FORMAT_Z16_UNORM: - surf->pa_su_poly_offset_db_fmt_cntl = - S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-16); - break; - default:; - } - if (rtex->surface.flags & RADEON_SURF_SBUFFER) { uint64_t stencil_offset; unsigned stile_split = rtex->surface.stencil_tile_split; @@ -1627,8 +1606,6 @@ static void evergreen_emit_framebuffer_state(struct r600_context *rctx, struct r RADEON_PRIO_DEPTH_BUFFER_MSAA : RADEON_PRIO_DEPTH_BUFFER); - radeon_set_context_reg(cs, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, - zb->pa_su_poly_offset_db_fmt_cntl); radeon_set_context_reg(cs, R_028008_DB_DEPTH_VIEW, zb->db_depth_view); radeon_set_context_reg_seq(cs, R_028040_DB_Z_INFO, 8); @@ -1686,6 +1663,7 @@ static void evergreen_emit_polygon_offset(struct r600_context *rctx, struct r600 struct r600_poly_offset_state *state = (struct r600_poly_offset_state*)a; float offset_units = state->offset_units; float offset_scale = state->offset_scale; + uint32_t pa_su_poly_offset_db_fmt_cntl = 0; switch (state->zs_format) { case PIPE_FORMAT_Z24X8_UNORM: @@ -1693,11 +1671,18 @@ static void evergreen_emit_polygon_offset(struct r600_context *rctx, struct r600 case PIPE_FORMAT_X8Z24_UNORM: case PIPE_FORMAT_S8_UINT_Z24_UNORM: offset_units *= 2.0f; + pa_su_poly_offset_db_fmt_cntl = + S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-24); break; case PIPE_FORMAT_Z16_UNORM: offset_units *= 4.0f; + pa_su_poly_offset_db_fmt_cntl = + S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-16); break; - default:; + default: + pa_su_poly_offset_db_fmt_cntl = + S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS((char)-23) | + S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1); } radeon_set_context_reg_seq(cs, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, 4); @@ -1705,6 +1690,9 @@ static void evergreen_emit_polygon_offset(struct r600_context *rctx, struct r600 radeon_emit(cs, fui(offset_units)); radeon_emit(cs, fui(offset_scale)); radeon_emit(cs, fui(offset_units)); + + radeon_set_context_reg(cs, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, + pa_su_poly_offset_db_fmt_cntl); } static void evergreen_emit_cb_misc_state(struct r600_context *rctx, struct r600_atom *atom) @@ -3645,7 +3633,7 @@ void evergreen_init_state_functions(struct r600_context *rctx) r600_init_atom(rctx, >db_misc_state.atom, id++, evergreen_emit_db_misc_state, 10); r600_init_atom(rctx, >db_state.atom, id++, ever
Mesa (master): radeonsi: Implement POLYGON_OFFSET_UNITS_UNSCALED
Module: Mesa Branch: master Commit: be7957b156e30ffe9fb647b58ba00e236e498c3f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=be7957b156e30ffe9fb647b58ba00e236e498c3f Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jun 14 22:41:50 2016 +0200 radeonsi: Implement POLYGON_OFFSET_UNITS_UNSCALED Empirical tests show that the polygon offset behaviour is entirely determined by the content of the PA_SU_POLY_OFFSET states, and not by the depth buffer format bound. PA_SU_POLY_OFFSET seems to directly set the parameters of the polygon offset formula, and setting 0 for PA_SU_POLY_OFFSET_DB_FMT_CNTL (ie setting the unorm depth bias behaviour with a scale of 2^0 = 1.0f) gives the unscaled behaviour. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Marek Olšák <marek.ol...@amd.com> --- src/gallium/drivers/radeonsi/si_pipe.c | 2 +- src/gallium/drivers/radeonsi/si_state.c | 32 ++-- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 37406aa..e025df4 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -357,6 +357,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT: case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR: case PIPE_CAP_GENERATE_MIPMAP: + case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED: return 1; case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: @@ -415,7 +416,6 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES: case PIPE_CAP_TGSI_VOTE: case PIPE_CAP_MAX_WINDOW_RECTANGLES: - case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED: return 0; case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS: diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index ccae571..04e9f19 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -810,20 +810,24 @@ static void *si_create_rs_state(struct pipe_context *ctx, float offset_scale = state->offset_scale * 16.0f; uint32_t pa_su_poly_offset_db_fmt_cntl = 0; - switch (i) { - case 0: /* 16-bit zbuffer */ - offset_units *= 4.0f; - pa_su_poly_offset_db_fmt_cntl = S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(-16); - break; - case 1: /* 24-bit zbuffer */ - offset_units *= 2.0f; - pa_su_poly_offset_db_fmt_cntl = S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(-24); - break; - case 2: /* 32-bit zbuffer */ - offset_units *= 1.0f; - pa_su_poly_offset_db_fmt_cntl = S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(-23) | - S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1); - break; + if (!state->offset_units_unscaled) { + switch (i) { + case 0: /* 16-bit zbuffer */ + offset_units *= 4.0f; + pa_su_poly_offset_db_fmt_cntl = + S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(-16); + break; + case 1: /* 24-bit zbuffer */ + offset_units *= 2.0f; + pa_su_poly_offset_db_fmt_cntl = + S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(-24); + break; + case 2: /* 32-bit zbuffer */ + offset_units *= 1.0f; + pa_su_poly_offset_db_fmt_cntl = S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(-23) | + S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1); + break; + } } si_pm4_set_reg(pm4, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeon: Remove useless pa_su_poly_offset_db_fmt_cntl
Module: Mesa Branch: master Commit: c2b7b48a54e0124dd8aa0513a264d76535ea9829 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c2b7b48a54e0124dd8aa0513a264d76535ea9829 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jun 14 22:32:04 2016 +0200 radeon: Remove useless pa_su_poly_offset_db_fmt_cntl pa_su_poly_offset_db_fmt_cntl usages were removed in previous patches. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Marek Olšák <marek.ol...@amd.com> --- src/gallium/drivers/radeon/r600_pipe_common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 8117c9a..a70c7fe 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -317,7 +317,6 @@ struct r600_surface { unsigned db_htile_surface; unsigned db_htile_data_base; unsigned db_preload_control;/* EG and later */ - unsigned pa_su_poly_offset_db_fmt_cntl; }; struct r600_common_screen { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): 43 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f21b7d1e5c21b749ae7c19d3dc80dc4e14e4bb77 Author: Wang He <xw897002...@gmail.com> Date: Tue May 10 13:40:30 2016 +0800 st/nine: Minor change to support musl libc A few changes to support musl libc as well. In particular fpu_control.h is glibc specific. fenv.h doesn't enable to do exactly what we want either, so instead use assembly directly. Signed-off-by: Wang He <xw897002...@gmail.com> Reviewed-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=de39231134348a5ffb92f7cc2b3098e11384912a Author: Patrick Rudolph <s...@das-labor.org> Date: Fri Apr 29 08:50:16 2016 +0200 st/nine: Enable D3DPMISCCAPS_PERSTAGECONSTANT Nine already supports the feature. There are no failing WINE tests for per stage constants. Enabling D3DPMISCCAPS_PERSTAGECONSTANT as it fixes https://github.com/iXit/Mesa-3D/issues/205 Signed-off-by: Patrick Rudolph <s...@das-labor.org> Reviewed-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=839f41763436cd1a438771f50ffa16fa33c5 Author: Axel Davy <axel.d...@ens.fr> Date: Sat May 7 11:33:24 2016 +0200 st/nine: Turn on thread_submit by default when on different device The last remaining issues with thread_submit have been resolved, thus turn it when on a different device (the case where is is beneficial). Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9cae3cdc890b2aa261d635667a5850929a0913f5 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Apr 3 13:04:39 2016 +0200 st/nine: Fix usage of rasterizer multisample bit. pipe_rasterizer multisample bit should be enabled only when really wanting to do multisampling, thus we should disable when not having msaa render target. This fixes some depth calculation precision issues on radeon. Also disable it when depth and stencil tests are disabled, since in that case multisampling is same as not multisampled. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f297e7de0f3fc0bd4fec483d4bf778a9678992c7 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Apr 3 10:52:22 2016 +0200 st/nine: ATOC has effect only with ALPHATESTENABLE ATOC extension does something only when alpha test is enabled. Use a second bit to encode the difference with ATIATOC. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=edc5cdced56756bfda898a4ed5bd480cd07c2d7e Author: Axel Davy <axel.d...@ens.fr> Date: Sat May 7 11:20:47 2016 +0200 st/nine: Add debug string for ATOC We were missing a debug string for this format. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e89dcf0c4ad543e5404d28b1f949387d63f59ee Author: Axel Davy <axel.d...@ens.fr> Date: Sat Mar 19 19:27:34 2016 +0100 st/nine: Add asserts for output/input packing Nine doesn't support vs output/ps input packing. We haven't found any application requiring that, and implementing it properly is complex. Add asserts for now. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=aeddda0c3a2294d923ba57604d9bda5cab0d0f70 Author: Axel Davy <axel.d...@ens.fr> Date: Mon Mar 14 21:29:53 2016 +0100 st/nine: Use correct PIPE_HANDLE_USAGE flag for frontbuffer copy When taking screenshots we do a copy from the frontbuffer to an allocated buffer (which we then copy to a ram buffer). Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca7c78a88ecc828a1b08dc18667d2a70d9d0e09d Author: Axel Davy <axel.d...@ens.fr> Date: Sat Mar 12 12:24:51 2016 +0100 st/nine: Fix output shift calculation We were getting it wrong for negative values. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8d95d40872dafbd372c071455d26ab078cdd170 Author: Axel Davy <axel.d...@ens.fr> Date: Fri Mar 11 23:30:05 2016 +0100 st/nine: Fix CheckDeviceFormat advertising for surfaces Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ef231c80f7bb8aa08b9402d7cdfc792e8752b39 Author: Axel Davy <axel.d...@ens.fr> Date: Fri Mar 11 23:03:56 2016 +0100 st/nine: Improve buffer placement Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7639033973c4f0fece37457ac250dd9df73410e8 Author: Axel Davy <axel.d...@ens
Mesa (master): st/nine: specify WINAPI only for i386 and amd64
Module: Mesa Branch: master Commit: 2a529a8ac810b3b40e7a9a071d9544b168928b94 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a529a8ac810b3b40e7a9a071d9544b168928b94 Author: Christian Schmidbauer <ch.schmidba...@gmail.com> Date: Sun Mar 13 22:50:31 2016 +0100 st/nine: specify WINAPI only for i386 and amd64 Currently mesa fails building with the x32 abi as ms_abi is not defined in such a case. The patch uses ms_abi only for amd64 targets and stdcall only for i386 targets to be sure that those are defined. This patch additionally checks for __GNUC__ to guarantee that __attribute__ is available. CC: "11.1 11.2" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Christian Schmidbauer <ch.schmidba...@gmail.com> Acked-by: Axel Davy <axel.d...@ens.fr> --- include/D3D9/d3d9types.h | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/D3D9/d3d9types.h b/include/D3D9/d3d9types.h index d74ce80..e0b8652 100644 --- a/include/D3D9/d3d9types.h +++ b/include/D3D9/d3d9types.h @@ -178,11 +178,17 @@ typedef struct _RGNDATA { #undef WINAPI #endif /* WINAPI*/ -#if defined(__x86_64__) || defined(_M_X64) -#define WINAPI __attribute__((ms_abi)) -#else /* x86_64 */ -#define WINAPI __attribute__((__stdcall__)) -#endif /* x86_64 */ +#ifdef __GNUC__ + #if (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) +#define WINAPI __attribute__((ms_abi)) + #elif defined(__i386) || defined(_M_IX86) +#define WINAPI __attribute__((__stdcall__)) + #else /* neither amd64 nor i386 */ +#define WINAPI + #endif +#else /* __GNUC__ */ + #define WINAPI +#endif /* Implementation caps */ #define D3DPRESENT_BACK_BUFFERS_MAX3 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Use Position input helper for ps3 declared inputs
Module: Mesa Branch: master Commit: 8a8affdfdace486f4e416e66e2dd0ed122505a90 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a8affdfdace486f4e416e66e2dd0ed122505a90 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Feb 21 16:35:31 2016 +0100 st/nine: Use Position input helper for ps3 declared inputs When the semantic is Position (which can happen with index 0 only), use the helper to get Position input. Cc: "11.2" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/nine_shader.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index f0c5236..eb6479b 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -2052,9 +2052,16 @@ DECL_SPECIAL(DCL) unsigned interp_location = 0; /* SM3 only, SM2 input semantic determined by file */ assert(sem.reg.idx < Elements(tx->regs.v)); + +if (tgsi.Name == TGSI_SEMANTIC_POSITION) { +tx->regs.v[sem.reg.idx] = nine_get_position_input(tx); +return D3D_OK; +} + if (sem.reg.mod & NINED3DSPDM_CENTROID || (tgsi.Name == TGSI_SEMANTIC_COLOR && tx->info->force_color_in_centroid)) interp_location = TGSI_INTERPOLATE_LOC_CENTROID; + tx->regs.v[sem.reg.idx] = ureg_DECL_fs_input_cyl_centroid( ureg, tgsi.Name, tgsi.Index, nine_tgsi_to_interp_mode(), ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Handle READONLY for buffer MANAGED pool
Module: Mesa Branch: master Commit: 35c858c42c818d5bf5b4bfee03a342df52acface URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=35c858c42c818d5bf5b4bfee03a342df52acface Author: Axel Davy <axel.d...@ens.fr> Date: Wed Feb 24 23:44:40 2016 +0100 st/nine: Handle READONLY for buffer MANAGED pool READONLY won't trigger an upload. Cc: "11.2" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/buffer9.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index e066fc5..8efb4ce 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -174,13 +174,16 @@ NineBuffer9_Lock( struct NineBuffer9 *This, u_box_1d(OffsetToLock, SizeToLock, ); if (This->base.pool == D3DPOOL_MANAGED) { -if (!This->managed.dirty) { -assert(LIST_IS_EMPTY(>managed.list)); -list_add(>managed.list, >base.base.device->update_buffers); -This->managed.dirty = TRUE; -This->managed.dirty_box = box; -} else { -u_box_union_2d(>managed.dirty_box, >managed.dirty_box, ); +/* READONLY doesn't dirty the buffer */ +if (!(Flags & D3DLOCK_READONLY)) { +if (!This->managed.dirty) { +assert(LIST_IS_EMPTY(>managed.list)); +list_add(>managed.list, >base.base.device->update_buffers); +This->managed.dirty = TRUE; +This->managed.dirty_box = box; +} else { +u_box_union_2d(>managed.dirty_box, >managed.dirty_box, ); +} } *ppbData = (char *)This->managed.data + OffsetToLock; DBG("returning pointer %p\n", *ppbData); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix second Multithreading issue with MANAGED buffers
Module: Mesa Branch: master Commit: 83bc2acfe90fd2e503bab4b5a586c1e2822863f5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=83bc2acfe90fd2e503bab4b5a586c1e2822863f5 Author: Axel Davy <axel.d...@ens.fr> Date: Sat Feb 27 11:02:21 2016 +0100 st/nine: Fix second Multithreading issue with MANAGED buffers Here is another threading issue with MANAGED buffers: Thread 1: buffer creation Thread 1: buffer lock Thread 2: Draw call Thread 1: writes data Thread 1: Unlock Without this patch, the buffer is initially dirty and in the list of things to upload after its creation. The draw call will then upload the data and unset the dirty flag, and the Unlock won't trigger a second upload. Fixes regression introduced by cc0114f30b587a10766ec212afb3ad356099ef23: "st/nine: Implement Managed vertex/index buffers" Cc: "11.2" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/buffer9.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index 6d5d9d6..1103741 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -182,6 +182,9 @@ NineBuffer9_Lock( struct NineBuffer9 *This, This->managed.dirty_box = box; } else { u_box_union_2d(>managed.dirty_box, >managed.dirty_box, ); +/* Do not upload while we are locking, we'll add it back later */ +if (!LIST_IS_EMPTY(>managed.list)) +list_delinit(>managed.list); } } *ppbData = (char *)This->managed.data + OffsetToLock; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Introduce helper for Position shader input
Module: Mesa Branch: master Commit: f08c990af53e91114257b19e5679e2dbbc277e45 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f08c990af53e91114257b19e5679e2dbbc277e45 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Feb 21 16:30:15 2016 +0100 st/nine: Introduce helper for Position shader input Cc: "11.2" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/nine_shader.c | 31 +-- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index a7a7da2..f0c5236 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -830,6 +830,18 @@ nine_ureg_dst_register(unsigned file, int index) return ureg_dst(ureg_src_register(file, index)); } +static inline struct ureg_src +nine_get_position_input(struct shader_translator *tx) +{ +struct ureg_program *ureg = tx->ureg; + +if (tx->wpos_is_sysval) +return ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); +else +return ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, + 0, TGSI_INTERPOLATE_LINEAR); +} + static struct ureg_src tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) { @@ -955,16 +967,8 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) case D3DSPR_MISCTYPE: switch (param->idx) { case D3DSMO_POSITION: - if (ureg_src_is_undef(tx->regs.vPos)) { - if (tx->wpos_is_sysval) { - tx->regs.vPos = - ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); - } else { - tx->regs.vPos = - ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); - } - } + if (ureg_src_is_undef(tx->regs.vPos)) + tx->regs.vPos = nine_get_position_input(tx); if (tx->shift_wpos) { /* TODO: do this only once */ struct ureg_dst wpos = tx_scratch(tx); @@ -3269,12 +3273,7 @@ shader_add_ps_fog_stage(struct shader_translator *tx, struct ureg_src src_col) } if (tx->info->fog_mode != D3DFOG_NONE) { -if (tx->wpos_is_sysval) { -depth = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); -} else { -depth = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); -} +depth = nine_get_position_input(tx); depth = ureg_scalar(depth, TGSI_SWIZZLE_Z); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix Multithreading issue with MANAGED buffers
Module: Mesa Branch: master Commit: 44246fe99d4c880b70a58043624bf023237009f5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=44246fe99d4c880b70a58043624bf023237009f5 Author: Axel Davy <axel.d...@ens.fr> Date: Thu Feb 25 19:07:37 2016 +0100 st/nine: Fix Multithreading issue with MANAGED buffers d3d calls are protected by mutexes, however if app is doing in two threads: Thread 1: buffer Lock Thread 2: Draw call Thread 1: writes data Thread 1: Unlock Then before this patch, the Draw call would begin to upload the buffer. Solves this by moving the moment we add the buffer to the queue of things to upload (We move it from Lock time to Unlock time). Cc: "11.2" <mesa-sta...@lists.freedesktop.org> Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/buffer9.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index 8efb4ce..6d5d9d6 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -178,7 +178,6 @@ NineBuffer9_Lock( struct NineBuffer9 *This, if (!(Flags & D3DLOCK_READONLY)) { if (!This->managed.dirty) { assert(LIST_IS_EMPTY(>managed.list)); -list_add(>managed.list, >base.base.device->update_buffers); This->managed.dirty = TRUE; This->managed.dirty_box = box; } else { @@ -232,8 +231,13 @@ NineBuffer9_Unlock( struct NineBuffer9 *This ) user_assert(This->nmaps > 0, D3DERR_INVALIDCALL); if (This->base.pool != D3DPOOL_MANAGED) This->pipe->transfer_unmap(This->pipe, This->maps[--(This->nmaps)]); -else +else { This->nmaps--; +/* TODO: Fix this to upload at the first draw call needing the data, + * instead of at the next draw call */ +if (!This->nmaps && This->managed.dirty && LIST_IS_EMPTY(>managed.list)) +list_add(>managed.list, >base.base.device->update_buffers); +} return D3D_OK; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Align stack for entry points
Module: Mesa Branch: master Commit: 77d6c11f8fa87ba1070028cb036807dc8a115633 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=77d6c11f8fa87ba1070028cb036807dc8a115633 Author: Axel Davy <axel.d...@ens.fr> Date: Sun Feb 7 12:29:45 2016 +0100 st/nine: Align stack for entry points For 32 bits, incoming stack is 4-byte aligned. We need to realign the stack to 16-byte at some point, or there are issues later (crash with SSE, llvm, etc). This patch chooses to align the stack at API entry points. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/Makefile.sources | 1 + src/gallium/state_trackers/nine/adapter9.c | 18 +- src/gallium/state_trackers/nine/adapter9.h | 18 +- .../state_trackers/nine/authenticatedchannel9.c| 10 +- .../state_trackers/nine/authenticatedchannel9.h| 10 +- src/gallium/state_trackers/nine/basetexture9.c | 14 +- src/gallium/state_trackers/nine/basetexture9.h | 14 +- src/gallium/state_trackers/nine/buffer9.c | 4 +- src/gallium/state_trackers/nine/buffer9.h | 4 +- src/gallium/state_trackers/nine/cryptosession9.c | 18 +- src/gallium/state_trackers/nine/cryptosession9.h | 18 +- src/gallium/state_trackers/nine/cubetexture9.c | 10 +- src/gallium/state_trackers/nine/cubetexture9.h | 10 +- src/gallium/state_trackers/nine/device9.c | 232 +-- src/gallium/state_trackers/nine/device9.h | 232 +-- src/gallium/state_trackers/nine/device9ex.c| 34 +- src/gallium/state_trackers/nine/device9ex.h| 36 +- src/gallium/state_trackers/nine/device9video.c | 6 +- src/gallium/state_trackers/nine/device9video.h | 6 +- src/gallium/state_trackers/nine/indexbuffer9.c | 6 +- src/gallium/state_trackers/nine/indexbuffer9.h | 6 +- src/gallium/state_trackers/nine/iunknown.c | 8 +- src/gallium/state_trackers/nine/iunknown.h | 9 +- src/gallium/state_trackers/nine/nine_flags.h | 14 + src/gallium/state_trackers/nine/nine_lock.c| 444 ++--- .../state_trackers/nine/nineexoverlayextension.c | 2 +- .../state_trackers/nine/nineexoverlayextension.h | 2 +- src/gallium/state_trackers/nine/pixelshader9.c | 2 +- src/gallium/state_trackers/nine/pixelshader9.h | 2 +- src/gallium/state_trackers/nine/query9.c | 8 +- src/gallium/state_trackers/nine/query9.h | 8 +- src/gallium/state_trackers/nine/resource9.c| 14 +- src/gallium/state_trackers/nine/resource9.h| 14 +- src/gallium/state_trackers/nine/stateblock9.c | 4 +- src/gallium/state_trackers/nine/stateblock9.h | 4 +- src/gallium/state_trackers/nine/surface9.c | 12 +- src/gallium/state_trackers/nine/surface9.h | 12 +- src/gallium/state_trackers/nine/swapchain9.c | 12 +- src/gallium/state_trackers/nine/swapchain9.h | 12 +- src/gallium/state_trackers/nine/swapchain9ex.c | 6 +- src/gallium/state_trackers/nine/swapchain9ex.h | 6 +- src/gallium/state_trackers/nine/texture9.c | 10 +- src/gallium/state_trackers/nine/texture9.h | 10 +- src/gallium/state_trackers/nine/vertexbuffer9.c| 6 +- src/gallium/state_trackers/nine/vertexbuffer9.h| 6 +- .../state_trackers/nine/vertexdeclaration9.c | 2 +- .../state_trackers/nine/vertexdeclaration9.h | 2 +- src/gallium/state_trackers/nine/vertexshader9.c| 2 +- src/gallium/state_trackers/nine/vertexshader9.h| 2 +- src/gallium/state_trackers/nine/volume9.c | 14 +- src/gallium/state_trackers/nine/volume9.h | 14 +- src/gallium/state_trackers/nine/volumetexture9.c | 10 +- src/gallium/state_trackers/nine/volumetexture9.h | 10 +- 53 files changed, 703 insertions(+), 687 deletions(-) Diff: http://cgit.freedesktop.org/mesa/mesa/diff/?id=77d6c11f8fa87ba1070028cb036807dc8a115633 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Implement Managed vertex/index buffers
Module: Mesa Branch: master Commit: cc0114f30b587a10766ec212afb3ad356099ef23 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cc0114f30b587a10766ec212afb3ad356099ef23 Author: Axel Davy <axel.d...@ens.fr> Date: Sat Feb 6 13:39:58 2016 +0100 st/nine: Implement Managed vertex/index buffers We were implementing those the same way than the default pool, which is sub-optimal. The buffer is supposed to return pointer to a ram copy when user locks, and automatically update the vram copy when needed. v2: Rename NineBuffer9_Validate to NineBuffer9_Upload Rename validate_buffers to update_managed_buffers Initialize NineBuffer9 managed fields after the resource is allocated. In case of allocation failure, when the dtor is executed, This->base.pool is then rightfully set. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/buffer9.c| 77 src/gallium/state_trackers/nine/buffer9.h| 28 ++ src/gallium/state_trackers/nine/device9.c| 11 src/gallium/state_trackers/nine/device9.h| 2 + src/gallium/state_trackers/nine/nine_state.c | 12 + 5 files changed, 121 insertions(+), 9 deletions(-) diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index 82aa000..e066fc5 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -93,7 +93,26 @@ NineBuffer9_ctor( struct NineBuffer9 *This, hr = NineResource9_ctor(>base, pParams, NULL, TRUE, Type, Pool, Usage); -return hr; + +if (FAILED(hr)) +return hr; + +if (Pool == D3DPOOL_MANAGED) { +This->managed.data = align_malloc( +nine_format_get_level_alloc_size(This->base.info.format, + Size, 1, 0), 32); +if (!This->managed.data) +return E_OUTOFMEMORY; +memset(This->managed.data, 0, Size); +This->managed.dirty = TRUE; +u_box_1d(0, Size, >managed.dirty_box); +list_inithead(>managed.list); +list_inithead(>managed.list2); +list_add(>managed.list, >device->update_buffers); +list_add(>managed.list2, >device->managed_buffers); +} + +return D3D_OK; } void @@ -106,6 +125,15 @@ NineBuffer9_dtor( struct NineBuffer9 *This ) FREE(This->maps); } +if (This->base.pool == D3DPOOL_MANAGED) { +if (This->managed.data) +align_free(This->managed.data); +if (This->managed.list.prev != NULL && This->managed.list.next != NULL) +list_del(>managed.list); +if (This->managed.list2.prev != NULL && This->managed.list2.next != NULL) +list_del(>managed.list2); +} + NineResource9_dtor(>base); } @@ -138,6 +166,28 @@ NineBuffer9_Lock( struct NineBuffer9 *This, D3DLOCK_READONLY | D3DLOCK_NOOVERWRITE)), D3DERR_INVALIDCALL); +if (SizeToLock == 0) { +SizeToLock = This->size - OffsetToLock; +user_warn(OffsetToLock != 0); +} + +u_box_1d(OffsetToLock, SizeToLock, ); + +if (This->base.pool == D3DPOOL_MANAGED) { +if (!This->managed.dirty) { +assert(LIST_IS_EMPTY(>managed.list)); +list_add(>managed.list, >base.base.device->update_buffers); +This->managed.dirty = TRUE; +This->managed.dirty_box = box; +} else { +u_box_union_2d(>managed.dirty_box, >managed.dirty_box, ); +} +*ppbData = (char *)This->managed.data + OffsetToLock; +DBG("returning pointer %p\n", *ppbData); +This->nmaps++; +return D3D_OK; +} + if (This->nmaps == This->maxmaps) { struct pipe_transfer **newmaps = REALLOC(This->maps, sizeof(struct pipe_transfer *)*This->maxmaps, @@ -149,13 +199,6 @@ NineBuffer9_Lock( struct NineBuffer9 *This, This->maps = newmaps; } -if (SizeToLock == 0) { -SizeToLock = This->size - OffsetToLock; -user_warn(OffsetToLock != 0); -} - -u_box_1d(OffsetToLock, SizeToLock, ); - data = This->pipe->transfer_map(This->pipe, This->base.resource, 0, usage, , >maps[This->nmaps]); @@ -184,6 +227,22 @@ NineBuffer9_Unlock( struct NineBuffer9 *This ) DBG("This=%p\n", This); user_assert(This->nmaps > 0, D3DERR_INVALIDCALL); -This->pipe->transfer_unmap(This->pipe, This->maps[--(This->nmaps)]); +if (This->base.pool != D3DPOOL_MANAGED) +This->pipe->transfer_unmap(This->pipe, This->maps[--(This->nmaps)]); +else +This->nmaps--; return D3D_OK; } + +void +Nin
Mesa (master): st/nine: SCRATCH does support all formats
Module: Mesa Branch: master Commit: 6cba347530433c61b218d2b897fb57f33835b37b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6cba347530433c61b218d2b897fb57f33835b37b Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jan 26 18:27:39 2016 +0100 st/nine: SCRATCH does support all formats Add new argument to d3d9_to_pipe_format_checked to be able to bypass format support checks. This argument is set to TRUE when the requested Pool is SCRATCH. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> --- src/gallium/state_trackers/nine/adapter9.c | 21 +++-- src/gallium/state_trackers/nine/cubetexture9.c | 4 +++- src/gallium/state_trackers/nine/device9.c| 2 +- src/gallium/state_trackers/nine/nine_pipe.h | 8 ++-- src/gallium/state_trackers/nine/surface9.c | 3 ++- src/gallium/state_trackers/nine/swapchain9.c | 8 src/gallium/state_trackers/nine/texture9.c | 4 +++- src/gallium/state_trackers/nine/volume9.c| 3 ++- src/gallium/state_trackers/nine/volumetexture9.c | 4 +++- 9 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c index 5e9c7f7..e677c7b 100644 --- a/src/gallium/state_trackers/nine/adapter9.c +++ b/src/gallium/state_trackers/nine/adapter9.c @@ -207,11 +207,11 @@ NineAdapter9_CheckDeviceType( struct NineAdapter9 *This, dfmt = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D, 1, PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SHARED, FALSE); + PIPE_BIND_SHARED, FALSE, FALSE); bfmt = d3d9_to_pipe_format_checked(screen, BackBufferFormat, PIPE_TEXTURE_2D, 1, PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SHARED, FALSE); + PIPE_BIND_SHARED, FALSE, FALSE); if (dfmt == PIPE_FORMAT_NONE || bfmt == PIPE_FORMAT_NONE) { DBG("Unsupported Adapter/BackBufferFormat.\n"); return D3DERR_NOTAVAILABLE; @@ -270,7 +270,7 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This, return hr; pf = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D, 0, PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SHARED, FALSE); + PIPE_BIND_SHARED, FALSE, FALSE); if (pf == PIPE_FORMAT_NONE) { DBG("AdapterFormat %s not available.\n", d3dformat_to_string(AdapterFormat)); @@ -332,7 +332,8 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This, srgb = (Usage & (D3DUSAGE_QUERY_SRGBREAD | D3DUSAGE_QUERY_SRGBWRITE)) != 0; -pf = d3d9_to_pipe_format_checked(screen, CheckFormat, target, 0, bind, srgb); +pf = d3d9_to_pipe_format_checked(screen, CheckFormat, target, + 0, bind, srgb, FALSE); if (pf == PIPE_FORMAT_NONE) { DBG("NOT AVAILABLE\n"); return D3DERR_NOTAVAILABLE; @@ -379,7 +380,7 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This, PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_RENDER_TARGET; pf = d3d9_to_pipe_format_checked(screen, SurfaceFormat, PIPE_TEXTURE_2D, - MultiSampleType, bind, FALSE); + MultiSampleType, bind, FALSE, FALSE); if (pf == PIPE_FORMAT_NONE) { DBG("%s with %u samples not available.\n", @@ -418,16 +419,16 @@ NineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 *This, dfmt = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D, 0, PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SHARED, FALSE); + PIPE_BIND_SHARED, FALSE, FALSE); bfmt = d3d9_to_pipe_format_checked(screen, RenderTargetFormat, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET, FALSE); + PIPE_BIND_RENDER_TARGET, FALSE, FALSE); if (RenderTargetFormat == D3DFMT_NULL) bfmt = dfmt; zsfmt = d3d9_to_pipe_format_checked(screen, DepthStencilFormat, PIPE_TEXTURE_2D, 0, d3d9_get_pipe_depth_format_bindings(DepthStencilFormat), -FALSE); +FALSE, FALSE); if (dfmt == PIPE_FORMAT_NONE || bfmt == PIPE_FORMAT_NO
Mesa (master): st/nine: Clean pSharedHandle Texture ctors checks
Module: Mesa Branch: master Commit: 6c4774bbe4f259cf7af329ce6493d9b50310689f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c4774bbe4f259cf7af329ce6493d9b50310689f Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jan 26 18:00:30 2016 +0100 st/nine: Clean pSharedHandle Texture ctors checks Clarify the behaviour and clean the checks Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> --- src/gallium/state_trackers/nine/cubetexture9.c | 7 --- src/gallium/state_trackers/nine/texture9.c | 25 src/gallium/state_trackers/nine/volumetexture9.c | 7 --- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c index c6fa397..1749190 100644 --- a/src/gallium/state_trackers/nine/cubetexture9.c +++ b/src/gallium/state_trackers/nine/cubetexture9.c @@ -54,12 +54,13 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This, Format, Pool, pSharedHandle); user_assert(EdgeLength, D3DERR_INVALIDCALL); -user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); -user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) || -(Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL); +/* user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); */ user_assert(!pSharedHandle, D3DERR_INVALIDCALL); /* TODO */ +user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) || +(Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL); + if (Usage & D3DUSAGE_AUTOGENMIPMAP) Levels = 0; diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c index 7338215..3052937 100644 --- a/src/gallium/state_trackers/nine/texture9.c +++ b/src/gallium/state_trackers/nine/texture9.c @@ -61,18 +61,22 @@ NineTexture9_ctor( struct NineTexture9 *This, d3dformat_to_string(Format), nine_D3DPOOL_to_str(Pool), pSharedHandle); user_assert(Width && Height, D3DERR_INVALIDCALL); + +/* pSharedHandle: can be non-null for ex only. + * D3DPOOL_SYSTEMMEM: Levels must be 1 + * D3DPOOL_DEFAULT: no restriction for Levels + * Other Pools are forbidden. */ user_assert(!pSharedHandle || pParams->device->ex, D3DERR_INVALIDCALL); -/* When is used shared handle, Pool must be - * SYSTEMMEM with Levels 1 or DEFAULT with any Levels */ -user_assert(!pSharedHandle || Pool != D3DPOOL_SYSTEMMEM || Levels == 1, -D3DERR_INVALIDCALL); -user_assert(!pSharedHandle || Pool == D3DPOOL_SYSTEMMEM || Pool == D3DPOOL_DEFAULT, -D3DERR_INVALIDCALL); -user_assert((Usage != D3DUSAGE_AUTOGENMIPMAP || Levels <= 1), D3DERR_INVALIDCALL); +user_assert(!pSharedHandle || +(Pool == D3DPOOL_SYSTEMMEM && Levels == 1) || +Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); + user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) || -(Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL); +(Pool != D3DPOOL_SYSTEMMEM && Pool != D3DPOOL_SCRATCH && Levels <= 1), +D3DERR_INVALIDCALL); -/* TODO: implement buffer sharing (should work with cross process too) +/* TODO: implement pSharedHandle for D3DPOOL_DEFAULT (cross process + * buffer sharing). * * Gem names may have fit but they're depreciated and won't work on render-nodes. * One solution is to use shm buffers. We would use a /dev/shm file, fill the first @@ -85,9 +89,6 @@ NineTexture9_ctor( struct NineTexture9 *This, * invalid handle, that we would fail to import. Please note that we don't advertise * the flag indicating the support for that feature, but apps seem to not care. */ -user_assert(!pSharedHandle || -Pool == D3DPOOL_SYSTEMMEM || -Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); if (pSharedHandle && Pool == D3DPOOL_DEFAULT) { if (!*pSharedHandle) { diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c index cdfe7f2..cdec21f 100644 --- a/src/gallium/state_trackers/nine/volumetexture9.c +++ b/src/gallium/state_trackers/nine/volumetexture9.c @@ -49,14 +49,15 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This, Usage, Format, Pool, pSharedHandle); user_assert(Width && Height && Depth, D3DERR_INVALIDCALL); -user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); + +/* user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); */ +user_assert(!pSharedHandle, D3DERR_INVALIDCALL); /* TODO */ + /* An IDirect3DVolume9 cannot be bound as a render target can it ?
Mesa (master): st/nine: Drop path for ureg_NRM and ureg_CLAMP
Module: Mesa Branch: master Commit: d7a5468da9796af193e65cd5823525b97dfed2df URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7a5468da9796af193e65cd5823525b97dfed2df Author: Axel Davy <axel.d...@ens.fr> Date: Sat Feb 6 20:03:51 2016 +0100 st/nine: Drop path for ureg_NRM and ureg_CLAMP using MIN/MAX is fine instead of CLAMP. NRM doesn't exist anymore. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> --- src/gallium/state_trackers/nine/nine_ff.c | 28 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index e79d0b4..d5daabd 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -24,8 +24,6 @@ #include "util/u_hash_table.h" #include "util/u_upload_mgr.h" -#define NINE_TGSI_LAZY_DEVS 1 - #define DBG_CHANNEL DBG_FF #define NINE_FF_NUM_VS_CONST 256 @@ -319,15 +317,11 @@ ureg_normalize3(struct ureg_program *ureg, struct ureg_dst dst, struct ureg_src src, struct ureg_dst tmp) { -#ifdef NINE_TGSI_LAZY_DEVS struct ureg_dst tmp_x = ureg_writemask(tmp, TGSI_WRITEMASK_X); ureg_DP3(ureg, tmp_x, src, src); ureg_RSQ(ureg, tmp_x, _X(tmp)); ureg_MUL(ureg, dst, src, _X(tmp)); -#else -ureg_NRM(ureg, dst, src); -#endif } static void * @@ -549,15 +543,8 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs) */ if (key->vertexpointsize) { struct ureg_src cPsz1 = ureg_DECL_constant(ureg, 26); -#ifdef NINE_TGSI_LAZY_DEVS -struct ureg_dst tmp_clamp = ureg_DECL_temporary(ureg); - -ureg_MAX(ureg, tmp_clamp, vs->aPsz, _(cPsz1)); -ureg_MIN(ureg, oPsz, ureg_src(tmp_clamp), _(cPsz1)); -ureg_release_temporary(ureg, tmp_clamp); -#else -ureg_CLAMP(ureg, oPsz, vs->aPsz, _(cPsz1), _(cPsz1)); -#endif +ureg_MAX(ureg, tmp_x, _(vs->aPsz), _(cPsz1)); +ureg_MIN(ureg, oPsz, _X(tmp), _(cPsz1)); } else if (key->pointscale) { struct ureg_src cPsz1 = ureg_DECL_constant(ureg, 26); struct ureg_src cPsz2 = ureg_DECL_constant(ureg, 27); @@ -570,15 +557,8 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs) ureg_MAD(ureg, tmp_x, _Y(tmp), _X(tmp), _(cPsz1)); ureg_RCP(ureg, tmp_x, ureg_src(tmp)); ureg_MUL(ureg, tmp_x, ureg_src(tmp), _(cPsz1)); -#ifdef NINE_TGSI_LAZY_DEVS -struct ureg_dst tmp_clamp = ureg_DECL_temporary(ureg); - -ureg_MAX(ureg, tmp_clamp, _X(tmp), _(cPsz1)); -ureg_MIN(ureg, oPsz, ureg_src(tmp_clamp), _(cPsz1)); -ureg_release_temporary(ureg, tmp_clamp); -#else -ureg_CLAMP(ureg, oPsz, _X(tmp), _(cPsz1), _(cPsz1)); -#endif +ureg_MAX(ureg, tmp_x, _X(tmp), _(cPsz1)); +ureg_MIN(ureg, oPsz, _X(tmp), _(cPsz1)); } for (i = 0; i < 8; ++i) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Remove usage of SQRT in ff code
Module: Mesa Branch: master Commit: 6b43f5b1d4efca53f246296f98db00ff8f7544b6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b43f5b1d4efca53f246296f98db00ff8f7544b6 Author: Axel Davy <axel.d...@ens.fr> Date: Sat Feb 6 19:55:54 2016 +0100 st/nine: Remove usage of SQRT in ff code SQRT is not supported everywhere, so replace it by RSQ + MUL and handle case <= 0. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/gallium/state_trackers/nine/nine_ff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index a5466a7..e79d0b4 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -563,7 +563,9 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs) struct ureg_src cPsz2 = ureg_DECL_constant(ureg, 27); ureg_DP3(ureg, tmp_x, ureg_src(r[1]), ureg_src(r[1])); -ureg_SQRT(ureg, tmp_y, _X(tmp)); +ureg_RSQ(ureg, tmp_y, _X(tmp)); +ureg_MUL(ureg, tmp_y, _Y(tmp), _X(tmp)); +ureg_CMP(ureg, tmp_y, ureg_negate(_Y(tmp)), _Y(tmp), ureg_imm1f(ureg, 0.0f)); ureg_MAD(ureg, tmp_x, _Y(tmp), _(cPsz2), _(cPsz2)); ureg_MAD(ureg, tmp_x, _Y(tmp), _X(tmp), _(cPsz1)); ureg_RCP(ureg, tmp_x, ureg_src(tmp)); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Move texture creation checks
Module: Mesa Branch: master Commit: bb65b189f34fb497b69e1b267cb355a6829d4b6b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb65b189f34fb497b69e1b267cb355a6829d4b6b Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jan 26 17:32:22 2016 +0100 st/nine: Move texture creation checks We were having checks at both Create*Texture functions and in ctors. Move all Create*Texture checks to ctors. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> --- src/gallium/state_trackers/nine/cubetexture9.c | 2 ++ src/gallium/state_trackers/nine/device9.c| 13 - src/gallium/state_trackers/nine/texture9.c | 9 + src/gallium/state_trackers/nine/volumetexture9.c | 2 ++ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c index 460cc85..c6fa397 100644 --- a/src/gallium/state_trackers/nine/cubetexture9.c +++ b/src/gallium/state_trackers/nine/cubetexture9.c @@ -53,6 +53,8 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This, This, pParams, EdgeLength, Levels, Usage, Format, Pool, pSharedHandle); +user_assert(EdgeLength, D3DERR_INVALIDCALL); +user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) || (Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL); diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 475ef96..b6e75b4 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -925,15 +925,6 @@ NineDevice9_CreateTexture( struct NineDevice9 *This, D3DUSAGE_SOFTWAREPROCESSING | D3DUSAGE_TEXTAPI; *ppTexture = NULL; -user_assert(Width && Height, D3DERR_INVALIDCALL); -user_assert(!pSharedHandle || This->ex, D3DERR_INVALIDCALL); -/* When is used shared handle, Pool must be - * SYSTEMMEM with Levels 1 or DEFAULT with any Levels */ -user_assert(!pSharedHandle || Pool != D3DPOOL_SYSTEMMEM || Levels == 1, -D3DERR_INVALIDCALL); -user_assert(!pSharedHandle || Pool == D3DPOOL_SYSTEMMEM || Pool == D3DPOOL_DEFAULT, -D3DERR_INVALIDCALL); -user_assert((Usage != D3DUSAGE_AUTOGENMIPMAP || Levels <= 1), D3DERR_INVALIDCALL); hr = NineTexture9_new(This, Width, Height, Levels, Usage, Format, Pool, , pSharedHandle); @@ -967,8 +958,6 @@ NineDevice9_CreateVolumeTexture( struct NineDevice9 *This, D3DUSAGE_SOFTWAREPROCESSING; *ppVolumeTexture = NULL; -user_assert(Width && Height && Depth, D3DERR_INVALIDCALL); -user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); hr = NineVolumeTexture9_new(This, Width, Height, Depth, Levels, Usage, Format, Pool, , pSharedHandle); @@ -1001,8 +990,6 @@ NineDevice9_CreateCubeTexture( struct NineDevice9 *This, D3DUSAGE_SOFTWAREPROCESSING; *ppCubeTexture = NULL; -user_assert(EdgeLength, D3DERR_INVALIDCALL); -user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); hr = NineCubeTexture9_new(This, EdgeLength, Levels, Usage, Format, Pool, , pSharedHandle); diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c index 0bc37d3..7338215 100644 --- a/src/gallium/state_trackers/nine/texture9.c +++ b/src/gallium/state_trackers/nine/texture9.c @@ -60,6 +60,15 @@ NineTexture9_ctor( struct NineTexture9 *This, nine_D3DUSAGE_to_str(Usage), d3dformat_to_string(Format), nine_D3DPOOL_to_str(Pool), pSharedHandle); +user_assert(Width && Height, D3DERR_INVALIDCALL); +user_assert(!pSharedHandle || pParams->device->ex, D3DERR_INVALIDCALL); +/* When is used shared handle, Pool must be + * SYSTEMMEM with Levels 1 or DEFAULT with any Levels */ +user_assert(!pSharedHandle || Pool != D3DPOOL_SYSTEMMEM || Levels == 1, +D3DERR_INVALIDCALL); +user_assert(!pSharedHandle || Pool == D3DPOOL_SYSTEMMEM || Pool == D3DPOOL_DEFAULT, +D3DERR_INVALIDCALL); +user_assert((Usage != D3DUSAGE_AUTOGENMIPMAP || Levels <= 1), D3DERR_INVALIDCALL); user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) || (Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL); diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c index e5b2b53..cdfe7f2 100644 --- a/src/gallium/state_trackers/nine/volumetexture9.c +++ b/src/gallium/state_trackers/nine/volumetexture9.c @@ -48,6 +48,8 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This, This, pParams,
Mesa (master): st/nine: Do not set SHARED flag for shared textures.
Module: Mesa Branch: master Commit: 36b4bb303cec3de59621f41a8dea3aaeca3d12c5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=36b4bb303cec3de59621f41a8dea3aaeca3d12c5 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jan 26 17:04:21 2016 +0100 st/nine: Do not set SHARED flag for shared textures. We do not support shared textures, thus no need to set the shared flag. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> --- src/gallium/state_trackers/nine/texture9.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c index a11dad4..6d1f897 100644 --- a/src/gallium/state_trackers/nine/texture9.c +++ b/src/gallium/state_trackers/nine/texture9.c @@ -140,9 +140,6 @@ NineTexture9_ctor( struct NineTexture9 *This, DBG("Application asked for Software Vertex Processing, " "but this is unimplemented\n"); -if (pSharedHandle) -info->bind |= PIPE_BIND_SHARED; - if (pSharedHandle && *pSharedHandle) { /* Pool == D3DPOOL_SYSTEMMEM */ user_buffer = (void *)*pSharedHandle; level_offsets = alloca(sizeof(unsigned) * (info->last_level + 1)); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Clean useless code in texture9.c
Module: Mesa Branch: master Commit: d973a525d387f1562e796ec598951ee5d2f02540 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d973a525d387f1562e796ec598951ee5d2f02540 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jan 26 17:13:00 2016 +0100 st/nine: Clean useless code in texture9.c This->base.base.resource is worth NULL for SYSTEMMEM textures. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> --- src/gallium/state_trackers/nine/texture9.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c index 6d1f897..0bc37d3 100644 --- a/src/gallium/state_trackers/nine/texture9.c +++ b/src/gallium/state_trackers/nine/texture9.c @@ -48,7 +48,6 @@ NineTexture9_ctor( struct NineTexture9 *This, { struct pipe_screen *screen = pParams->device->screen; struct pipe_resource *info = >base.base.info; -struct pipe_resource *resource; enum pipe_format pf; unsigned *level_offsets; unsigned l; @@ -182,11 +181,6 @@ NineTexture9_ctor( struct NineTexture9 *This, sfdesc.MultiSampleType = D3DMULTISAMPLE_NONE; sfdesc.MultiSampleQuality = 0; -if (Pool == D3DPOOL_SYSTEMMEM) -resource = NULL; -else -resource = This->base.base.resource; - for (l = 0; l <= info->last_level; ++l) { sfdesc.Width = u_minify(Width, l); sfdesc.Height = u_minify(Height, l); @@ -196,7 +190,7 @@ NineTexture9_ctor( struct NineTexture9 *This, level_offsets[l] : NULL; hr = NineSurface9_new(This->base.base.base.device, NineUnknown(This), - resource, user_buffer_for_level, + This->base.base.resource, user_buffer_for_level, D3DRTYPE_TEXTURE, l, 0, , >surfaces[l]); if (FAILED(hr)) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Fix stateblocks crashes with lights
Module: Mesa Branch: master Commit: 17078d92ea524c9f0e9dff8d17f8b2df752d24cc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=17078d92ea524c9f0e9dff8d17f8b2df752d24cc Author: Axel Davy <axel.d...@ens.fr> Date: Sat Feb 6 19:29:10 2016 +0100 st/nine: Fix stateblocks crashes with lights We had several issues of crashes with it. This should fix it. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> --- src/gallium/state_trackers/nine/stateblock9.c | 40 +-- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c index 0d1a04b..4789346 100644 --- a/src/gallium/state_trackers/nine/stateblock9.c +++ b/src/gallium/state_trackers/nine/stateblock9.c @@ -86,7 +86,7 @@ NineStateBlock9_dtor( struct NineStateBlock9 *This ) */ static void nine_state_copy_common(struct nine_state *dst, - const struct nine_state *src, + struct nine_state *src, struct nine_state *mask, /* aliases either src or dst */ const boolean apply, struct nine_range_pool *pool) @@ -267,17 +267,41 @@ nine_state_copy_common(struct nine_state *dst, } } if (mask->changed.group & NINE_STATE_FF_LIGHTING) { -if (dst->ff.num_lights < mask->ff.num_lights) { +unsigned num_lights = MAX2(dst->ff.num_lights, src->ff.num_lights); +/* Can happen in Capture() if device state has created new lights after + * the stateblock was created. + * Can happen in Apply() if the stateblock had recorded the creation of + * new lights. */ +if (dst->ff.num_lights < num_lights) { dst->ff.light = REALLOC(dst->ff.light, dst->ff.num_lights * sizeof(D3DLIGHT9), -mask->ff.num_lights * sizeof(D3DLIGHT9)); -for (i = dst->ff.num_lights; i < mask->ff.num_lights; ++i) { -memset(>ff.light[i], 0, sizeof(D3DLIGHT9)); -dst->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID; +num_lights * sizeof(D3DLIGHT9)); +memset(>ff.light[dst->ff.num_lights], 0, (num_lights - dst->ff.num_lights) * sizeof(D3DLIGHT9)); +/* if mask == dst, a Type of 0 will trigger + * "dst->ff.light[i] = src->ff.light[i];" later, + * which is what we want in that case. */ +if (mask != dst) { +for (i = src->ff.num_lights; i < num_lights; ++i) +src->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID; } -dst->ff.num_lights = mask->ff.num_lights; +dst->ff.num_lights = num_lights; } -for (i = 0; i < mask->ff.num_lights; ++i) +/* Can happen in Capture() if the stateblock had recorded the creation of + * new lights. + * Can happen in Apply() if device state has created new lights after + * the stateblock was created. */ +if (src->ff.num_lights < num_lights) { +src->ff.light = REALLOC(src->ff.light, +src->ff.num_lights * sizeof(D3DLIGHT9), +num_lights * sizeof(D3DLIGHT9)); +memset(>ff.light[src->ff.num_lights], 0, (num_lights - src->ff.num_lights) * sizeof(D3DLIGHT9)); +for (i = src->ff.num_lights; i < num_lights; ++i) +src->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID; +src->ff.num_lights = num_lights; +} +/* Note: mask is either src or dst, so at this point src, dst and mask + * have num_lights lights. */ +for (i = 0; i < num_lights; ++i) if (mask->ff.light[i].Type != NINED3DLIGHT_INVALID) dst->ff.light[i] = src->ff.light[i]; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Support ATI1/ATI2 for CubeTexture
Module: Mesa Branch: master Commit: 3a2e0c77848120f44031d2deb91108ff8e951d85 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a2e0c77848120f44031d2deb91108ff8e951d85 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jan 26 18:14:02 2016 +0100 st/nine: Support ATI1/ATI2 for CubeTexture Texture and CubeTexture use common code, and thus ATI1/ATI2 is already implemented for CubeTexture. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> --- src/gallium/state_trackers/nine/adapter9.c | 5 +++-- src/gallium/state_trackers/nine/cubetexture9.c | 4 src/gallium/state_trackers/nine/volumetexture9.c | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c index 8428b1b..5e9c7f7 100644 --- a/src/gallium/state_trackers/nine/adapter9.c +++ b/src/gallium/state_trackers/nine/adapter9.c @@ -338,8 +338,9 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This, return D3DERR_NOTAVAILABLE; } -/* we support ATI1 and ATI2 hack only for 2D textures */ -if (RType != D3DRTYPE_TEXTURE && (CheckFormat == D3DFMT_ATI1 || CheckFormat == D3DFMT_ATI2)) +/* we support ATI1 and ATI2 hack only for 2D and Cube textures */ +if (RType != D3DRTYPE_TEXTURE && RType != D3DRTYPE_CUBETEXTURE && +(CheckFormat == D3DFMT_ATI1 || CheckFormat == D3DFMT_ATI2)) return D3DERR_NOTAVAILABLE; /* if (Usage & D3DUSAGE_NONSECURE) { don't know the implications of this } */ /* if (Usage & D3DUSAGE_SOFTWAREPROCESSING) { we can always support this } */ diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c index 1749190..03b5fca 100644 --- a/src/gallium/state_trackers/nine/cubetexture9.c +++ b/src/gallium/state_trackers/nine/cubetexture9.c @@ -69,10 +69,6 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This, if (pf == PIPE_FORMAT_NONE) return D3DERR_INVALIDCALL; -/* We support ATI1 and ATI2 hacks only for 2D textures */ -if (Format == D3DFMT_ATI1 || Format == D3DFMT_ATI2) -return D3DERR_INVALIDCALL; - if (compressed_format(Format)) { const unsigned w = util_format_get_blockwidth(pf); const unsigned h = util_format_get_blockheight(pf); diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c index cdec21f..cd94a36 100644 --- a/src/gallium/state_trackers/nine/volumetexture9.c +++ b/src/gallium/state_trackers/nine/volumetexture9.c @@ -63,7 +63,7 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This, if (pf == PIPE_FORMAT_NONE) return D3DERR_INVALIDCALL; -/* We support ATI1 and ATI2 hacks only for 2D textures */ +/* We support ATI1 and ATI2 hacks only for 2D and Cube textures */ if (Format == D3DFMT_ATI1 || Format == D3DFMT_ATI2) return D3DERR_INVALIDCALL; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/nine: Add format checks to create_zs_or_rt_surface
Module: Mesa Branch: master Commit: dbcb4f46ad792ed4f0f3cc64449ccd6288a6f386 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbcb4f46ad792ed4f0f3cc64449ccd6288a6f386 Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jan 26 18:21:26 2016 +0100 st/nine: Add format checks to create_zs_or_rt_surface Returns INVALIDCALL when trying to create a surface of unsupported format. In practice, apps are supposed to check for format support before trying to create a render target of that format. However some bad behaving apps could just try to create the surface and deduce if it failed that it wasn't supported. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> --- src/gallium/state_trackers/nine/device9.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index b6e75b4..3ebff3a 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -1126,6 +1126,9 @@ create_zs_or_rt_surface(struct NineDevice9 *This, templ.nr_samples, templ.bind, FALSE); +if (templ.format == PIPE_FORMAT_NONE && Format != D3DFMT_NULL) +return D3DERR_INVALIDCALL; + desc.Format = Format; desc.Type = D3DRTYPE_SURFACE; desc.Usage = 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): 46 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=94d91c67077a5efd13b9505fe01a3c80ccb37bc9 Author: Axel Davy <axel.d...@ens.fr> Date: Thu Jan 28 22:32:43 2016 +0100 st/nine: Use align_free when needed Use align_free to free memory allocated with align_malloc. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b12fe77ea7bbd8f159c0902a7c1d4ab22d4629c Author: Axel Davy <axel.d...@ens.fr> Date: Tue Jan 26 16:40:30 2016 +0100 st/nine: Disallow non-argb cursors Only argb cursors are allowed. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=24ddadbba9ddfde579cc4cc65f58b063122b8d02 Author: Axel Davy <axel.d...@ens.fr> Date: Sat Jan 9 14:16:15 2016 +0100 st/nine: Enforce centroid for color input when multisampling is on The color inputs must automatically use centroid whether multisampling is used or not. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5389bb92d5dfa1676cf28a80392f0fcb0eb8dc8 Author: Axel Davy <axel.d...@ens.fr> Date: Thu Jan 28 22:44:42 2016 +0100 st/nine: Fix centroid flag sem.reg.mod & NINED3DSPDM_CENTROID is worth 4 when centroid is requested, whereas TGSI_INTERPOLATE_LOC_CENTROID is worth 1. Signed-off-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee31f0fed4bd97e3c9a0c4547ad908d55607f532 Author: Axel Davy <axel.d...@ens.fr> Date: Mon Jan 4 16:15:18 2016 +0100 st/nine: Use fast clears more often for MRTs This enables to use fast clears in the following case: pixel shader renders to 1 RT 4 RT bound clear new pixel shader bound that renders to 4 RTs Previously the fast clear path wouldn't be hit, because when trying the fast clear path, the framebuffer state would be configured for 1 RT, instead of 4. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e85ef7d8e501b3f0a94d8e53fbd3372ba24b89ec Author: Axel Davy <axel.d...@ens.fr> Date: Mon Jan 4 16:13:07 2016 +0100 st/nine: Use linear filtering for shadow mapping Some docs say linear filtering is always used when app does shadow mapping. Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Patrick Rudolph <s...@das-labor.org> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b35da59deff0d6671649a6aedc10b3c81aeb8a7 Author: Patrick Rudolph <s...@das-labor.org> Date: Thu Oct 22 15:46:16 2015 +0200 st/nine: Respect block alignment on surface lock Respect block alignment for ATI1/ATI2 format when trying to lock a surface using LockRect(). Fixes failing WINE tests device.c test_surface_blocks() tests. Signed-off-by: Patrick Rudolph <s...@das-labor.org> Reviewed-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=56b4222b299ff08da4eda63fcc608dc77fc585f1 Author: Axel Davy <axel.d...@ens.fr> Date: Sat May 16 14:28:41 2015 +0200 st/nine: Add Render state validation layer Testing Win behaviour seems to show wrong states are accepted, but then depending on the states some specific 'good' behaviours happen. This adds some validation to catch invalid states and have these 'good' behaviours when it happens. Also reorders SetRenderState to match the expected optimisation: (Value == previous Value) => return immediately, which affects D3D9 hacks too. Signed-off-by: Axel Davy <axel.d...@ens.fr> Signed-off-by: Patrick Rudolph <s...@das-labor.org> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7132617436dda072f874f6f206847e62038ce39e Author: Patrick Rudolph <s...@das-labor.org> Date: Mon May 25 13:06:58 2015 +0200 DRI_CONFIG: Add option to override vendor id Add config option override_vendorid to report a fake card in d3dadapter9 drm. Signed-off-by: Patrick Rudolph <s...@das-labor.org> Reviewed-by: Axel Davy <axel.d...@ens.fr> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a893ac8869a0be08582f3b224d1a92ff37fc400 Author: Patrick Rudolph <s...@das-labor.org> Date: Wed Sep 30 16:42:10 2015 +0200 st/nine: Implement NineDevice9_GetAvailableTextureMem Implement a device private memory counter similar to Win 7. Only textures and surfaces increment vidmem and
Mesa (master): radeonsi: Add option for SI scheduler
Module: Mesa Branch: master Commit: dda7a849868d5a4be6cec9d28c86a52aba62b32b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dda7a849868d5a4be6cec9d28c86a52aba62b32b Author: Axel Davy <axel.d...@ens.fr> Date: Fri Jan 15 10:47:42 2016 +0100 radeonsi: Add option for SI scheduler Add a debug option to select the LLVM SI Machine Scheduler. R600_DEBUG=sisched Signed-off-by: Axel Davy <axel.d...@ens.fr> Reviewed-by: Edward O'Callaghan <eocallag...@alterapraxis.com> Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com> Reviewed-by: Marek Olšák <marek.ol...@amd.com> --- src/gallium/drivers/radeon/r600_pipe_common.c | 1 + src/gallium/drivers/radeon/r600_pipe_common.h | 1 + src/gallium/drivers/radeonsi/si_pipe.c| 6 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 34fe57b..c827dbd 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -409,6 +409,7 @@ static const struct debug_named_value common_debug_options[] = { { "nodcc", DBG_NO_DCC, "Disable DCC." }, { "nodccclear", DBG_NO_DCC_CLEAR, "Disable DCC fast clear." }, { "norbplus", DBG_NO_RB_PLUS, "Disable RB+ on Stoney." }, + { "sisched", DBG_SI_SCHED, "Enable LLVM SI Machine Instruction Scheduler." }, DEBUG_NAMED_VALUE_END /* must be last */ }; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index a8928f2..88e9cbc 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -87,6 +87,7 @@ #define DBG_NO_DCC (1llu << 43) #define DBG_NO_DCC_CLEAR (1llu << 44) #define DBG_NO_RB_PLUS (1llu << 45) +#define DBG_SI_SCHED (1llu << 46) #define R600_MAP_BUFFER_ALIGNMENT 64 diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 0c1ae90..f483f92 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -215,7 +215,11 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, r600_target = radeon_llvm_get_r600_target(triple); sctx->tm = LLVMCreateTargetMachine(r600_target, triple, r600_get_llvm_processor_name(sscreen->b.family), - "+DumpCode,+vgpr-spilling", +#if HAVE_LLVM >= 0x0308 + sscreen->b.debug_flags & DBG_SI_SCHED ? + "+DumpCode,+vgpr-spilling,+si-scheduler" : +#endif + "+DumpCode,+vgpr-spilling", LLVMCodeGenLevelDefault, LLVMRelocDefault, LLVMCodeModelDefault); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): 72 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=20746c2e7d8d065445bbb30f0d1383c30459a784 Author: Krzysztof Sobiecki sob...@gmail.com Date: Thu Aug 20 23:19:30 2015 +0200 st/nine: Always use user constant buffers We had several reports of users hitting bugs with the other path to upload constants, and switching to the user constant buffer path solves the bugs. User constant buffers are expected to be slower for Nvidia cards, so ideally this patch should be reverted when the path is fixed. Reviewed-by: Axel Davy axel.d...@ens.fr Signed-off-by: Krzysztof Sobiecki sob...@gmail.com URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f57e9c77e388e1c5373265f4bc15434e63477757 Author: Axel Davy axel.d...@ens.fr Date: Sun Aug 16 13:11:50 2015 +0200 st/nine: Silent warning in nine_ff release build was complaining Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3cc205bbeb19d417b17be0f6200cb5cda9adca8a Author: Axel Davy axel.d...@ens.fr Date: Sun Aug 16 13:11:27 2015 +0200 st/nine: Silent warning in sm1_declusage_to_tgsi release build was complaining Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d48cab9fa6b75db054e3a53819b465611923e9bc Author: Axel Davy axel.d...@ens.fr Date: Sun Aug 16 12:58:41 2015 +0200 st/nine: Silent warning in NineCubeTexture9_ctor The compiler was complaining the value may be uninitialised when it is used (which is wrong). Initialize to NULL to silent the warning. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f02d5e814904d7a5c041d6869751731712e8195 Author: Axel Davy axel.d...@ens.fr Date: Sun Aug 16 12:57:40 2015 +0200 st/nine: Silent warning in update_vertex_buffer There was an unused variable URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=719f124620d3c9b4d6ce14db3dbfc7af05626e5b Author: Axel Davy axel.d...@ens.fr Date: Sun Aug 9 19:06:01 2015 +0200 st/nine: Catch setting the same shader This is quite rare that an app does set again the same shaders, but it isn't an expensive check either. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eba3c390a3c6221781ca4d9c344c6f448e177b6c Author: Axel Davy axel.d...@ens.fr Date: Sun Aug 9 19:02:02 2015 +0200 st/nine: Avoid Constant upload when there is no change It is very common for d3d9 apps to set again the constants they need before every draw call, even if nothing changed. Since we are mostly gpu bound, it is better to check for change, and upload constants again (and thus use gpu bandwith) only if the constants changed. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a747094ed0ab32541936dd18931f382901affe6 Author: Axel Davy axel.d...@ens.fr Date: Sat Jul 25 17:54:26 2015 +0200 st/nine: Fix the number of texture stages The number of texture stages is 8. 'tex_stage' array was too big, and thus the checks with 'Elements(state-ff.tex_stage)' were passing, causing some invalid API calls to pass, and crash because of out of bounds write since bumpmap_vars was just the correct size. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f15ff98e2c53f6ce62443b24e3a9cf79c60ddff7 Author: Axel Davy axel.d...@ens.fr Date: Thu May 14 19:24:57 2015 +0200 st/nine: Use CSO cache for sampler views The CSO cache unbinds views that are not needed anymore, which we don't do. It checks for change before committing the views. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=98f786b270b3e55a1e8a7bdc8182e436702748a2 Author: Axel Davy axel.d...@ens.fr Date: Thu May 14 19:10:41 2015 +0200 st/nine: Calculate dummy sampler state only once Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5effeb8eaf16e39a2f561b4b277f3810a69fc88 Author: Axel Davy axel.d...@ens.fr Date: Thu May 14 15:42:50 2015 +0200 st/nine: Better check shader constant limits Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bae2c7c15444b02a4820e3182c345545bd348561 Author: Axel Davy axel.d...@ens.fr Date: Thu Aug 13 19:24:02 2015 +0200 st/nine: Remove NINED3DRS_ZBIASSCALE It wasn't giving the expected result. This fixes some object being transparents in games like FEAR. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6379a28aa75a38676120891b355c434bec4125e1 Author: Axel Davy axel.d...@ens.fr Date: Sun May 17 00:22:33 2015 +0200 st
Mesa (master): egl/wayland: Implement swrast support
Module: Mesa Branch: master Commit: cdcfe48fb0431184fabb40aa5a244d086f551df5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cdcfe48fb0431184fabb40aa5a244d086f551df5 Author: Axel Davy axel.d...@ens.fr Date: Fri May 1 11:11:20 2015 +0200 egl/wayland: Implement swrast support Reviewed-by: Dave Airlie airl...@redhat.com Reviewed-by: Daniel Stone dani...@collabora.com. Signed-off-by: Axel Davy axel.d...@ens.fr --- src/egl/drivers/dri2/egl_dri2.c |5 +- src/egl/drivers/dri2/egl_dri2.h |4 + src/egl/drivers/dri2/platform_wayland.c | 704 ++- 3 files changed, 696 insertions(+), 17 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 169abcc..467b81c 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -729,7 +729,10 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp) #endif #ifdef HAVE_WAYLAND_PLATFORM case _EGL_PLATFORM_WAYLAND: - wl_drm_destroy(dri2_dpy-wl_drm); + if (dri2_dpy-wl_drm) + wl_drm_destroy(dri2_dpy-wl_drm); + if (dri2_dpy-wl_shm) + wl_shm_destroy(dri2_dpy-wl_shm); wl_registry_destroy(dri2_dpy-wl_registry); wl_event_queue_destroy(dri2_dpy-wl_queue); if (dri2_dpy-own_device) { diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index cabeb2d..adade3d 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -196,6 +196,7 @@ struct dri2_egl_display struct wl_registry *wl_registry; struct wl_drm*wl_server_drm; struct wl_drm*wl_drm; + struct wl_shm*wl_shm; struct wl_event_queue*wl_queue; int authenticated; int formats; @@ -257,6 +258,9 @@ struct dri2_egl_surface __DRIimage *dri_image; /* for is_different_gpu case. NULL else */ __DRIimage *linear_copy; + /* for swrast */ + void *data; + int data_size; #endif #ifdef HAVE_DRM_PLATFORM struct gbm_bo *bo; diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index e9f142c..9914b68 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -1,5 +1,6 @@ /* * Copyright © 2011-2012 Intel Corporation + * Copyright © 2012 Collabora, Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the Software), @@ -35,6 +36,7 @@ #include unistd.h #include fcntl.h #include xf86drm.h +#include sys/mman.h #include egl_dri2.h #include egl_dri2_fallbacks.h @@ -233,13 +235,18 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].dri_image); if (dri2_surf-color_buffers[i].linear_copy) dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].linear_copy); + if (dri2_surf-color_buffers[i].data) + munmap(dri2_surf-color_buffers[i].data, +dri2_surf-color_buffers[i].data_size); } - for (i = 0; i __DRI_BUFFER_COUNT; i++) - if (dri2_surf-dri_buffers[i] - dri2_surf-dri_buffers[i]-attachment != __DRI_BUFFER_BACK_LEFT) - dri2_dpy-dri2-releaseBuffer(dri2_dpy-dri_screen, - dri2_surf-dri_buffers[i]); + if (dri2_dpy-dri2) { + for (i = 0; i __DRI_BUFFER_COUNT; i++) + if (dri2_surf-dri_buffers[i] + dri2_surf-dri_buffers[i]-attachment != __DRI_BUFFER_BACK_LEFT) +dri2_dpy-dri2-releaseBuffer(dri2_dpy-dri_screen, + dri2_surf-dri_buffers[i]); + } if (dri2_surf-throttle_callback) wl_callback_destroy(dri2_surf-throttle_callback); @@ -267,18 +274,24 @@ dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf) dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].dri_image); if (dri2_surf-color_buffers[i].linear_copy) dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].linear_copy); + if (dri2_surf-color_buffers[i].data) + munmap(dri2_surf-color_buffers[i].data, +dri2_surf-color_buffers[i].data_size); dri2_surf-color_buffers[i].wl_buffer = NULL; dri2_surf-color_buffers[i].dri_image = NULL; dri2_surf-color_buffers[i].linear_copy = NULL; + dri2_surf-color_buffers[i].data = NULL; dri2_surf-color_buffers[i].locked = 0; } - for (i = 0; i __DRI_BUFFER_COUNT; i++) - if (dri2_surf-dri_buffers[i] - dri2_surf-dri_buffers[i]-attachment != __DRI_BUFFER_BACK_LEFT) - dri2_dpy-dri2-releaseBuffer(dri2_dpy-dri_screen, - dri2_surf-dri_buffers[i]); + if (dri2_dpy-dri2) { + for (i = 0; i __DRI_BUFFER_COUNT; i
Mesa (master): egl/wayland: Implement DRI_PRIME support
Module: Mesa Branch: master Commit: 4cd546df82c557b9a765e40db2f96c4faa299846 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4cd546df82c557b9a765e40db2f96c4faa299846 Author: Axel Davy axel.d...@ens.fr Date: Fri May 1 01:16:24 2015 +0200 egl/wayland: Implement DRI_PRIME support When the server gpu and requested gpu are different: . They likely don't support the same tiling modes . They likely do not have fast access to the same locations Thus we do: . render to a tiled buffer we do not share with the server . Copy the content at every swap to a buffer with no tiling that we share with the server. This is similar to the glx dri3 DRI_PRIME implementation. Reviewed-by: Dave Airlie airl...@redhat.com Reviewed-by: Daniel Stone dani...@collabora.com Signed-off-by: Axel Davy axel.d...@ens.fr --- src/egl/drivers/dri2/egl_dri2.h |3 + src/egl/drivers/dri2/platform_wayland.c | 104 ++- 2 files changed, 92 insertions(+), 15 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 3ee3f80..cabeb2d 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -201,6 +201,7 @@ struct dri2_egl_display int formats; uint32_t capabilities; int is_render_node; + int is_different_gpu; #endif }; @@ -254,6 +255,8 @@ struct dri2_egl_surface #ifdef HAVE_WAYLAND_PLATFORM struct wl_buffer *wl_buffer; __DRIimage *dri_image; + /* for is_different_gpu case. NULL else */ + __DRIimage *linear_copy; #endif #ifdef HAVE_DRM_PLATFORM struct gbm_bo *bo; diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index bdb19c2..b111c3a 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -240,6 +240,8 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) wl_buffer_destroy(dri2_surf-color_buffers[i].wl_buffer); if (dri2_surf-color_buffers[i].dri_image) dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].dri_image); + if (dri2_surf-color_buffers[i].linear_copy) + dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].linear_copy); } for (i = 0; i __DRI_BUFFER_COUNT; i++) @@ -274,9 +276,12 @@ dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf) wl_buffer_destroy(dri2_surf-color_buffers[i].wl_buffer); if (dri2_surf-color_buffers[i].dri_image) dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].dri_image); + if (dri2_surf-color_buffers[i].linear_copy) + dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].linear_copy); dri2_surf-color_buffers[i].wl_buffer = NULL; dri2_surf-color_buffers[i].dri_image = NULL; + dri2_surf-color_buffers[i].linear_copy = NULL; dri2_surf-color_buffers[i].locked = 0; } @@ -338,13 +343,29 @@ get_back_bo(struct dri2_egl_surface *dri2_surf) if (dri2_surf-back == NULL) return -1; + + if (dri2_dpy-is_different_gpu + dri2_surf-back-linear_copy == NULL) { + dri2_surf-back-linear_copy = + dri2_dpy-image-createImage(dri2_dpy-dri_screen, + dri2_surf-base.Width, + dri2_surf-base.Height, + dri_image_format, + __DRI_IMAGE_USE_SHARE | + __DRI_IMAGE_USE_LINEAR, + NULL); + if (dri2_surf-back-linear_copy == NULL) + return -1; + } + if (dri2_surf-back-dri_image == NULL) { dri2_surf-back-dri_image = dri2_dpy-image-createImage(dri2_dpy-dri_screen, dri2_surf-base.Width, dri2_surf-base.Height, dri_image_format, - __DRI_IMAGE_USE_SHARE, + dri2_dpy-is_different_gpu ? + 0 : __DRI_IMAGE_USE_SHARE, NULL); dri2_surf-back-age = 0; } @@ -432,8 +453,11 @@ update_buffers(struct dri2_egl_surface *dri2_surf) dri2_surf-color_buffers[i].wl_buffer) { wl_buffer_destroy(dri2_surf-color_buffers[i].wl_buffer); dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].dri_image); + if (dri2_dpy-is_different_gpu) + dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].linear_copy); dri2_surf-color_buffers[i].wl_buffer = NULL; dri2_surf-color_buffers[i].dri_image = NULL; + dri2_surf-color_buffers[i].linear_copy = NULL; } } @@ -578,16 +602,20 @@ create_wl_buffer(struct
Mesa (master): egl/wayland: Simplify dri2_wl_create_surface
Module: Mesa Branch: master Commit: cd25e52f6bb5279cd7b1992e5907df3966b900ce URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd25e52f6bb5279cd7b1992e5907df3966b900ce Author: Axel Davy axel.d...@ens.fr Date: Fri May 1 11:16:41 2015 +0200 egl/wayland: Simplify dri2_wl_create_surface This function is always used with EGL_WINDOW_BIT. Pixmaps are forbidden for Wayland, and PBuffers are unimplemented. Reviewed-by: Daniel Stone dani...@collabora.com. Signed-off-by: Axel Davy axel.d...@ens.fr --- src/egl/drivers/dri2/platform_wayland.c | 38 +++ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index b111c3a..e9f142c 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -120,7 +120,7 @@ resize_callback(struct wl_egl_window *wl_win, void *data) * Called via eglCreateWindowSurface(), drv-API.CreateWindowSurface(). */ static _EGLSurface * -dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, +dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, void *native_window, const EGLint *attrib_list) { @@ -137,7 +137,7 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, return NULL; } - if (!_eglInitSurface(dri2_surf-base, disp, type, conf, attrib_list)) + if (!_eglInitSurface(dri2_surf-base, disp, EGL_WINDOW_BIT, conf, attrib_list)) goto cleanup_surf; if (conf-RedSize == 5) @@ -147,25 +147,17 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, else dri2_surf-format = WL_DRM_FORMAT_ARGB; - switch (type) { - case EGL_WINDOW_BIT: - dri2_surf-wl_win = window; + dri2_surf-wl_win = window; - dri2_surf-wl_win-private = dri2_surf; - dri2_surf-wl_win-resize_callback = resize_callback; + dri2_surf-wl_win-private = dri2_surf; + dri2_surf-wl_win-resize_callback = resize_callback; - dri2_surf-base.Width = -1; - dri2_surf-base.Height = -1; - break; - default: - goto cleanup_surf; - } + dri2_surf-base.Width = -1; + dri2_surf-base.Height = -1; dri2_surf-dri_drawable = (*dri2_dpy-dri2-createNewDrawable) (dri2_dpy-dri_screen, - type == EGL_WINDOW_BIT ? - dri2_conf-dri_double_config : - dri2_conf-dri_single_config, + dri2_conf-dri_double_config, dri2_surf); if (dri2_surf-dri_drawable == NULL) { _eglError(EGL_BAD_ALLOC, dri2-createNewDrawable); @@ -193,8 +185,7 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); _EGLSurface *surf; - surf = dri2_wl_create_surface(drv, disp, EGL_WINDOW_BIT, conf, - native_window, attrib_list); + surf = dri2_wl_create_surface(drv, disp, conf, native_window, attrib_list); if (surf != NULL) dri2_wl_swap_interval(drv, disp, surf, dri2_dpy-default_swap_interval); @@ -253,10 +244,8 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) if (dri2_surf-throttle_callback) wl_callback_destroy(dri2_surf-throttle_callback); - if (dri2_surf-base.Type == EGL_WINDOW_BIT) { - dri2_surf-wl_win-private = NULL; - dri2_surf-wl_win-resize_callback = NULL; - } + dri2_surf-wl_win-private = NULL; + dri2_surf-wl_win-resize_callback = NULL; free(surf); @@ -428,9 +417,8 @@ update_buffers(struct dri2_egl_surface *dri2_surf) dri2_egl_display(dri2_surf-base.Resource.Display); int i; - if (dri2_surf-base.Type == EGL_WINDOW_BIT - (dri2_surf-base.Width != dri2_surf-wl_win-width || -dri2_surf-base.Height != dri2_surf-wl_win-height)) { + if (dri2_surf-base.Width != dri2_surf-wl_win-width || + dri2_surf-base.Height != dri2_surf-wl_win-height) { dri2_wl_release_buffers(dri2_surf); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/swrast: Enable config extension for swrast
Module: Mesa Branch: master Commit: 13fa84e1bcf1e07c69bb678508f8cdb0912b57c5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=13fa84e1bcf1e07c69bb678508f8cdb0912b57c5 Author: Axel Davy axel.d...@ens.fr Date: Fri May 1 19:08:37 2015 +0200 egl/swrast: Enable config extension for swrast Enables to use dri config for swrast, like vblank_mode. Reviewed-by: Dave Airlie airl...@redhat.com Signed-off-by: Axel Davy axel.d...@ens.fr --- src/egl/drivers/dri2/egl_dri2.c| 27 +-- src/gallium/state_trackers/dri/drisw.c |1 + src/mesa/drivers/dri/swrast/swrast.c |1 + 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 467b81c..fe5cbc8 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -576,6 +576,7 @@ dri2_create_screen(_EGLDisplay *disp) { const __DRIextension **extensions; struct dri2_egl_display *dri2_dpy; + unsigned i; dri2_dpy = disp-DriverData; @@ -616,28 +617,26 @@ dri2_create_screen(_EGLDisplay *disp) extensions = dri2_dpy-core-getExtensions(dri2_dpy-dri_screen); if (dri2_dpy-dri2) { - unsigned i; - if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions)) goto cleanup_dri_screen; - - for (i = 0; extensions[i]; i++) { -if (strcmp(extensions[i]-name, __DRI2_ROBUSTNESS) == 0) { -dri2_dpy-robustness = (__DRIrobustnessExtension *) extensions[i]; -} -if (strcmp(extensions[i]-name, __DRI2_CONFIG_QUERY) == 0) { - dri2_dpy-config = (__DRI2configQueryExtension *) extensions[i]; -} - if (strcmp(extensions[i]-name, __DRI2_FENCE) == 0) { -dri2_dpy-fence = (__DRI2fenceExtension *) extensions[i]; - } - } } else { assert(dri2_dpy-swrast); if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions)) goto cleanup_dri_screen; } + for (i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]-name, __DRI2_ROBUSTNESS) == 0) { + dri2_dpy-robustness = (__DRIrobustnessExtension *) extensions[i]; + } + if (strcmp(extensions[i]-name, __DRI2_CONFIG_QUERY) == 0) { + dri2_dpy-config = (__DRI2configQueryExtension *) extensions[i]; + } + if (strcmp(extensions[i]-name, __DRI2_FENCE) == 0) { + dri2_dpy-fence = (__DRI2fenceExtension *) extensions[i]; + } + } + dri2_setup_screen(disp); return EGL_TRUE; diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c index 5f69a2d..4a2c1bb 100644 --- a/src/gallium/state_trackers/dri/drisw.c +++ b/src/gallium/state_trackers/dri/drisw.c @@ -333,6 +333,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable, static const __DRIextension *drisw_screen_extensions[] = { driTexBufferExtension.base, dri2RendererQueryExtension.base, + dri2ConfigQueryExtension.base, NULL }; diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 2ddb474..cbc946c 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -958,6 +958,7 @@ static const __DRIextension *swrast_driver_extensions[] = { driCoreExtension.base, driSWRastExtension.base, driCopySubBufferExtension.base, +dri2ConfigQueryExtension.base, swrast_vtable.base, NULL }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): doc/egl: Remove depreciated EGL_SOFTWARE
Module: Mesa Branch: master Commit: 05ac39ac497ad7835cac7a161491282b5f69d711 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=05ac39ac497ad7835cac7a161491282b5f69d711 Author: Axel Davy axel.d...@ens.fr Date: Fri May 1 00:06:31 2015 +0200 doc/egl: Remove depreciated EGL_SOFTWARE EGL_SOFTWARE is not supported anywhere in the code, whereas LIBGL_ALWAYS_SOFTWARE is. Reviewed-by: Dave Airlie airl...@redhat.com Reviewed-by: Daniel Stone dani...@collabora.com Signed-off-by: Axel Davy axel.d...@ens.fr --- docs/egl.html |8 1 file changed, 8 deletions(-) diff --git a/docs/egl.html b/docs/egl.html index d946bb0..3ab1a60 100644 --- a/docs/egl.html +++ b/docs/egl.html @@ -184,14 +184,6 @@ values are: codedebug/code, codeinfo/code, codewarning/code, and codefatal/code./p /dd - -dtcodeEGL_SOFTWARE/code/dt -dd - -pFor drivers that support both hardware and software rendering, setting this -variable to true forces the use of software rendering./p - -/dd /dl h2EGL Drivers/h2 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/wayland: properly destroy wayland objects
Module: Mesa Branch: master Commit: 6aaf09b93b668a24b557e05195b9897e8cee8559 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6aaf09b93b668a24b557e05195b9897e8cee8559 Author: Axel Davy axel.d...@ens.fr Date: Fri May 1 00:03:32 2015 +0200 egl/wayland: properly destroy wayland objects the wl_registry and the wl_queue allocated weren't destroyed. CC: 10.5 mesa-sta...@lists.freedesktop.org Reviewed-by: Dave Airlie airl...@redhat.com Reviewed-by: Daniel Stone dani...@collabora.com Signed-off-by: Axel Davy axel.d...@ens.fr --- src/egl/drivers/dri2/egl_dri2.c |2 ++ src/egl/drivers/dri2/platform_wayland.c |5 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index f4c29da..169abcc 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -730,6 +730,8 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp) #ifdef HAVE_WAYLAND_PLATFORM case _EGL_PLATFORM_WAYLAND: wl_drm_destroy(dri2_dpy-wl_drm); + wl_registry_destroy(dri2_dpy-wl_registry); + wl_event_queue_destroy(dri2_dpy-wl_queue); if (dri2_dpy-own_device) { wl_display_disconnect(dri2_dpy-wl_dpy); } diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index e226005..a5bcf25 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -1029,7 +1029,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) wl_registry_add_listener(dri2_dpy-wl_registry, registry_listener, dri2_dpy); if (roundtrip(dri2_dpy) 0 || dri2_dpy-wl_drm == NULL) - goto cleanup_dpy; + goto cleanup_registry; if (roundtrip(dri2_dpy) 0 || dri2_dpy-fd == -1) goto cleanup_drm; @@ -1112,6 +1112,9 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) cleanup_drm: free(dri2_dpy-device_name); wl_drm_destroy(dri2_dpy-wl_drm); + cleanup_registry: + wl_registry_destroy(dri2_dpy-wl_registry); + wl_event_queue_destroy(dri2_dpy-wl_queue); cleanup_dpy: free(dri2_dpy); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glx/dri3: Add additional check for gpu offloading case
Module: Mesa Branch: master Commit: c4ff6d00cd7dde4646ff96733f68d3ddbf540c2c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c4ff6d00cd7dde4646ff96733f68d3ddbf540c2c Author: Axel Davy axel.d...@ens.fr Date: Fri May 1 00:20:34 2015 +0200 glx/dri3: Add additional check for gpu offloading case Checks blitImage is implemented. Initially having the __DRIimageExtension extension at version 9 at least meant blitImage was supported. However some implementation do advertise version = 9 without implementing it. CC: 10.5 mesa-sta...@lists.freedesktop.org Reviewed-by: Dave Airlie airl...@redhat.com Reviewed-by: Daniel Stone dani...@collabora.com Signed-off-by: Axel Davy axel.d...@ens.fr --- src/glx/dri3_glx.c |5 + 1 file changed, 5 insertions(+) diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index ff77a91..dfb0093 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -1985,6 +1985,11 @@ dri3_create_screen(int screen, struct glx_display * priv) goto handle_error; } + if (psc-is_different_gpu !psc-image-blitImage) { + ErrorMessageF(Different GPU, but blitImage not implemented for this driver\n); + goto handle_error; + } + if (!psc-is_different_gpu ( !psc-texBuffer || psc-texBuffer-base.version 2 || !psc-texBuffer-setTexBuffer2 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/wayland: Add support for render-nodes
Module: Mesa Branch: master Commit: fb0960a14bd6980aa63deef45ec3cf1ab99bcf0a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb0960a14bd6980aa63deef45ec3cf1ab99bcf0a Author: Axel Davy axel.d...@ens.fr Date: Fri May 1 01:30:10 2015 +0200 egl/wayland: Add support for render-nodes It is possible the server advertises a render-node. In that case no authentication is needed, and Gem names are forbidden. Reviewed-by: Dave Airlie airl...@redhat.com Reviewed-by: Daniel Stone dani...@collabora.com Signed-off-by: Axel Davy axel.d...@ens.fr v2: do not check for __DRI_IMAGE_DRIVER, but instead do not advertise __DRI_DRI2_LOADER when on a render-node. --- src/egl/drivers/dri2/egl_dri2.h |1 + src/egl/drivers/dri2/platform_wayland.c | 69 --- 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 371fb4a..3ee3f80 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -200,6 +200,7 @@ struct dri2_egl_display int authenticated; int formats; uint32_t capabilities; + int is_render_node; #endif }; diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index a5bcf25..bdb19c2 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -800,12 +800,33 @@ bad_format: return NULL; } +static char +is_fd_render_node(int fd) +{ + struct stat render; + + if (fstat(fd, render)) + return 0; + + if (!S_ISCHR(render.st_mode)) + return 0; + + if (render.st_rdev 0x80) + return 1; + return 0; +} + static int dri2_wl_authenticate(_EGLDisplay *disp, uint32_t id) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); int ret = 0; + if (dri2_dpy-is_render_node) { + _eglLog(_EGL_WARNING, wayland-egl: client asks server to +authenticate for render-nodes); + return 0; + } dri2_dpy-authenticated = 0; wl_drm_authenticate(dri2_dpy-wl_drm, id); @@ -847,8 +868,13 @@ drm_handle_device(void *data, struct wl_drm *drm, const char *device) return; } - drmGetMagic(dri2_dpy-fd, magic); - wl_drm_authenticate(dri2_dpy-wl_drm, magic); + if (is_fd_render_node(dri2_dpy-fd)) { + dri2_dpy-is_render_node = 1; + dri2_dpy-authenticated = 1; + } else { + drmGetMagic(dri2_dpy-fd, magic); + wl_drm_authenticate(dri2_dpy-wl_drm, magic); + } } static void @@ -1046,18 +1072,23 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) if (!dri2_load_driver(disp)) goto cleanup_driver_name; - dri2_dpy-dri2_loader_extension.base.name = __DRI_DRI2_LOADER; - dri2_dpy-dri2_loader_extension.base.version = 3; - dri2_dpy-dri2_loader_extension.getBuffers = dri2_wl_get_buffers; - dri2_dpy-dri2_loader_extension.flushFrontBuffer = dri2_wl_flush_front_buffer; - dri2_dpy-dri2_loader_extension.getBuffersWithFormat = - dri2_wl_get_buffers_with_format; - - dri2_dpy-extensions[0] = dri2_dpy-dri2_loader_extension.base; - dri2_dpy-extensions[1] = image_loader_extension.base; - dri2_dpy-extensions[2] = image_lookup_extension.base; - dri2_dpy-extensions[3] = use_invalidate.base; - dri2_dpy-extensions[4] = NULL; + dri2_dpy-extensions[0] = image_loader_extension.base; + dri2_dpy-extensions[1] = image_lookup_extension.base; + dri2_dpy-extensions[2] = use_invalidate.base; + + /* render nodes cannot use Gem names, and thus do not support +* the __DRI_DRI2_LOADER extension */ + if (!dri2_dpy-is_render_node) { + dri2_dpy-dri2_loader_extension.base.name = __DRI_DRI2_LOADER; + dri2_dpy-dri2_loader_extension.base.version = 3; + dri2_dpy-dri2_loader_extension.getBuffers = dri2_wl_get_buffers; + dri2_dpy-dri2_loader_extension.flushFrontBuffer = dri2_wl_flush_front_buffer; + dri2_dpy-dri2_loader_extension.getBuffersWithFormat = + dri2_wl_get_buffers_with_format; + dri2_dpy-extensions[3] = dri2_dpy-dri2_loader_extension.base; + dri2_dpy-extensions[4] = NULL; + } else + dri2_dpy-extensions[3] = NULL; dri2_dpy-swap_available = EGL_TRUE; @@ -1075,6 +1106,14 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) dri2_dpy-image-createImageFromFds == NULL) dri2_dpy-capabilities = ~WL_DRM_CAPABILITY_PRIME; + /* We cannot use Gem names with render-nodes, only prime fds (dma-buf). +* The server needs to accept them */ + if (dri2_dpy-is_render_node + !(dri2_dpy-capabilities WL_DRM_CAPABILITY_PRIME)) { + _eglLog(_EGL_WARNING, wayland-egl: display is not render-node capable); + goto cleanup_screen; + } + types = EGL_WINDOW_BIT; for (i = 0; dri2_dpy-driver_configs[i]; i++) { config = dri2_dpy-driver_configs[i]; @@ -1103,6 +1142,8
Mesa (master): egl/x11: move dri2_x11_swrast_create_image_khr to egl_dri2_fallback.h
Module: Mesa Branch: master Commit: f1cc478d89986c87f01fdaae510335965e19493c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1cc478d89986c87f01fdaae510335965e19493c Author: Axel Davy axel.d...@ens.fr Date: Fri May 1 11:12:46 2015 +0200 egl/x11: move dri2_x11_swrast_create_image_khr to egl_dri2_fallback.h Reviewed-by: Dave Airlie airl...@redhat.com Reviewed-by: Daniel Stone dani...@collabora.com Signed-off-by: Axel Davy axel.d...@ens.fr --- src/egl/drivers/dri2/egl_dri2_fallbacks.h |9 + src/egl/drivers/dri2/platform_x11.c | 11 +-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h b/src/egl/drivers/dri2/egl_dri2_fallbacks.h index 9cba001..e769af3 100644 --- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h +++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h @@ -45,6 +45,15 @@ dri2_fallback_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp, return NULL; } +static inline _EGLImage* +dri2_fallback_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, + _EGLContext *ctx, EGLenum target, + EGLClientBuffer buffer, + const EGLint *attr_list) +{ + return NULL; +} + static inline EGLBoolean dri2_fallback_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index ddb3b54..300072d 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1017,15 +1017,6 @@ dri2_x11_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, } } -static _EGLImage* -dri2_x11_swrast_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, - _EGLContext *ctx, EGLenum target, - EGLClientBuffer buffer, - const EGLint *attr_list) -{ - return NULL; -} - static EGLBoolean dri2_x11_get_sync_values(_EGLDisplay *display, _EGLSurface *surface, EGLuint64KHR *ust, EGLuint64KHR *msc, @@ -1058,7 +1049,7 @@ static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = { .create_pixmap_surface = dri2_x11_create_pixmap_surface, .create_pbuffer_surface = dri2_x11_create_pbuffer_surface, .destroy_surface = dri2_x11_destroy_surface, - .create_image = dri2_x11_swrast_create_image_khr, + .create_image = dri2_fallback_create_image_khr, .swap_interval = dri2_fallback_swap_interval, .swap_buffers = dri2_x11_swap_buffers, .swap_buffers_region = dri2_fallback_swap_buffers_region, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): 29 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=231be57ee2515428e3de31f514effe9cf06bcda0 Author: Axel Davy axel.d...@ens.fr Date: Fri Feb 20 12:59:45 2015 +0100 st/nine: Remove Managed texture hack. Previously binding an unitialized managed texture was causing a crash, and a workaround was added to prevent the crash. This patch removes this workaround and instead set the initial state of managed textures as dirty, so that when the texture is bound for the first time, it is always initialized. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=58d295d41e30434c57024873af2006b79eea Author: Axel Davy axel.d...@ens.fr Date: Fri Feb 20 12:34:47 2015 +0100 st/nine: Enforce LOD 0 for D3DUSAGE_AUTOGENMIPMAP For D3DUSAGE_AUTOGENMIPMAP textures, applications can only lock/copy from/get surface descriptor for/etc the first level. Thus it makes sense to restrict the LOD to 0, and use only the first level to generate the sublevels. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f57e014365563c0dcc32451401a76212abf0a54 Author: Axel Davy axel.d...@ens.fr Date: Fri Feb 20 12:11:56 2015 +0100 st/nine: Some D3DUSAGE_AUTOGENMIPMAP fixes Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=24eca6a30dea4cde0b0528b85e83d45a6430762e Author: Axel Davy axel.d...@ens.fr Date: Thu Feb 19 22:28:37 2015 +0100 st/nine: util_gen_mipmap doesn't need we reset states. util_gen_mipmap uses pipe-blit, and thus doesn't need we restore all states after using it. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a7758c5525fa90bf7c546acc58a9ea41f7d320b Author: Axel Davy axel.d...@ens.fr Date: Thu Feb 19 20:55:42 2015 +0100 st/nine: D3DUSAGE_AUTOGENMIPMAP is forbidden for volumes Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec411d9b74f9aca941b27fafeae1416df0f9eaec Author: Axel Davy axel.d...@ens.fr Date: Thu Feb 19 20:23:06 2015 +0100 st/nine: Fix NineBaseTexture9_PreLoad It wasn't uploading the texture when the lod had changed. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b45fa97a22d091a5c9a3d9c9432ff880e79231d6 Author: Axel Davy axel.d...@ens.fr Date: Thu Feb 19 19:34:02 2015 +0100 st/nine: Rewrite Managed texture uploads That part of the code was quite obscure. This new implementation tries to make it clearer by separating the differents parts, and commenting more. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=090ebc7638e64592716ac4ecd4c29609b2f35421 Author: Axel Davy axel.d...@ens.fr Date: Thu Feb 19 17:44:43 2015 +0100 st/nine: Bound the dirty regions to resource size Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=520e36f89cb9048258d9c1ca42de68564ad876a9 Author: Axel Davy axel.d...@ens.fr Date: Thu Feb 19 17:34:45 2015 +0100 st/nine: Simplify Surface9 Managed resources implementation Remove the Surface9 code for dirty rects, used only for Managed resources. Instead convey the information to the parent texture. According to documentation, this seems to be the expected behaviour, and if documentation is wrong there, that's not a problem since it can only leads to more texture updates in corner cases. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c2247ac60f426a6441f964f2204af9f8dc04dc5 Author: Axel Davy axel.d...@ens.fr Date: Thu Feb 19 16:35:45 2015 +0100 st/nine: Remove impossible cases with Managed textures Copying to/from a Managed texture is forbidden. Rendering to a Managed texture is forbidden. Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e558ce98f2b01e11ff79c29efaea2877121ae04a Author: Axel Davy axel.d...@ens.fr Date: Thu Feb 19 16:18:00 2015 +0100 st/nine: Encapsulate variables for MANAGED resource Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=35fe920e1ec877d487e5dd33c9aea7e1ec1dbe11 Author: Axel Davy axel.d...@ens.fr Date: Thu Feb 19 11:21:12 2015 +0100 st/nine: Rework texture data allocation Some applications assume the memory for multilevel textures is allocated per continuous blocks. This patch implements that behaviour. v2: cache offsets Reviewed-by: Ilia Mirkin imir...@alum.mit.edu Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa
Mesa (master): 44 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=17abefa12be1d5e7d436bfbb082c3eba19adf26c Author: Tiziano Bacocco tizb...@gmail.com Date: Fri Jan 30 13:51:44 2015 +0100 st/nine: Implement dummy vbo behaviour when vs is missing inputs Use a dummy vertex buffer object when vs inputs have no corresponding entries in the vertex declaration. This dummy buffer will give to the shader float4(0,0,0,0). This fixes several artifacts on some games. Signed-off-by: Axel Davy axel.d...@ens.fr Signed-off-by: Tiziano Bacocco tizb...@gmail.com URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=90585cbc9aef27904efc86dbfbd8743d27a6f599 Author: Axel Davy axel.d...@ens.fr Date: Sat Jan 24 17:58:28 2015 +0100 gallium/targets/d3dadapter9: Free card device The drm fd wasn't released, causing a crash for wine tests on nouveau, which seems to have a bug when a lot of device descriptors are open. Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b3a9d5c9f54a0c1b1e95cc61214fd69c6777680 Author: Axel Davy axel.d...@ens.fr Date: Sun Jan 11 17:51:59 2015 +0100 gallium/targets/d3dadapter9: Release the pipe_screen at destruction. We weren't releasing hal and ref, causing some issues (threads not released, etc) Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f50614910c40366d94964fe2c5da5772aff2f96 Author: Axel Davy axel.d...@ens.fr Date: Sat Jan 10 18:49:16 2015 +0100 gallium/targets/d3dadapter9: Fix device detection for render-nodes When on a render node the unique ioctl doesn't work. This patch drops the code to detect the device, which relied on an ioctl, and replaces it by the mesa loader function. The mesa loader function is more complete and won't fail for render-nodes. Alternatively we could also have used the pipe cap to determine the vendor and device id from the driver. Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c54d154e86cd93caed527824166f468a6c24c70 Author: Axel Davy axel.d...@ens.fr Date: Sat Jan 24 12:02:04 2015 +0100 st/nine: Dummy sampler should have a=1 Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9ac74e604bbce3b24565a9c277dc8f8fe9826e97 Author: Axel Davy axel.d...@ens.fr Date: Fri Jan 23 23:20:17 2015 +0100 st/nine: Fix update_framebuffer binding cbufs the pixel shader wouldn't render to Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee606b47800021d74732bf5155a1d7d68822fa02 Author: Axel Davy axel.d...@ens.fr Date: Fri Jan 23 23:51:32 2015 +0100 st/nine: Clear: better behave if rt_mask is different to the one of the framebuffer bound Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8d48f6f7181fa6cc7c4ff5b1c0e8883d6f8ce6d Author: Axel Davy axel.d...@ens.fr Date: Wed Jan 21 08:59:05 2015 +0100 st/nine: Fix multisampling support detection Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1d369e804623663e78002c0101d668bd3d42762 Author: Tiziano Bacocco tizb...@gmail.com Date: Wed Jan 21 00:41:11 2015 +0100 st/nine: Fix enabled lights in stateblocks Reviewed-by: Axel Davy axel.d...@ens.fr Signed-off-by: Tiziano Bacocco tizb...@gmail.com URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1543defc5ea8a17cf5558bb6468031f9c29b9a15 Author: Axel Davy axel.d...@ens.fr Date: Mon Jan 19 17:13:57 2015 +0100 st/nine: Fix depth stencil formats bindings flags. Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=49214a3dfc4f5173e22846d92c5dd0c2b24e3638 Author: Axel Davy axel.d...@ens.fr Date: Mon Jan 19 16:20:35 2015 +0100 st/nine: Fix gpu memory leak in swapchain Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d538007734bb37a7f2aa865abaa225aa13799484 Author: Axel Davy axel.d...@ens.fr Date: Mon Jan 19 16:09:07 2015 +0100 st/nine: SetResourceResize should track nr_samples too Reviewed-by: Tiziano Bacocco tizb...@gmail.com Signed-off-by: Axel Davy axel.d...@ens.fr URL: http://cgit.freedesktop.org