[Mesa-dev] [Bug 81174] Gallium: GL_LINE_LOOP broken with more than 512 points
https://bugs.freedesktop.org/show_bug.cgi?id=81174 --- Comment #4 from Florian Link --- That sounds like a reasonable explanation, except that the closing lines of the line loops are not always the same, they change when the same line loop is rendered again. But maybe there is some kind of ring buffer involved, that would explain it. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 2/2] r600g/compute: Add debug information to promote and demote functions
v2: Add information about the item's starting point and size --- src/gallium/drivers/r600/compute_memory_pool.c | 9 + 1 file changed, 9 insertions(+) diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c index 1d0ec85..6a525cf 100644 --- a/src/gallium/drivers/r600/compute_memory_pool.c +++ b/src/gallium/drivers/r600/compute_memory_pool.c @@ -339,6 +339,10 @@ int compute_memory_promote_item(struct compute_memory_pool *pool, int64_t start_in_dw; int err = 0; + COMPUTE_DBG(pool->screen, "* compute_memory_promote_item()\n" + " + Promoting Item: %i , starting at: %u (%u bytes) " + "size: %u (%u bytes)\n", item->id, item->start_in_dw, + item->start_in_dw * 4, item->size_in_dw, item->size_in_dw * 4); /* Search for free space in the pool for this item. */ while ((start_in_dw=compute_memory_prealloc_chunk(pool, @@ -409,6 +413,11 @@ void compute_memory_demote_item(struct compute_memory_pool *pool, struct pipe_resource *dst; struct pipe_box box; + COMPUTE_DBG(pool->screen, "* compute_memory_demote_item()\n" + " + Demoting Item: %i, starting at: %u (%u bytes) " + "size: %u (%u bytes)\n", item->id, item->start_in_dw, + item->start_in_dw * 4, item->size_in_dw, item->size_in_dw * 4); + /* First, we remove the item from the item_list */ list_del(&item->link); -- 2.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 81174] Gallium: GL_LINE_LOOP broken with more than 512 points
https://bugs.freedesktop.org/show_bug.cgi?id=81174 --- Comment #5 from Florian Link --- I had a look at the code and it looks like the problem is that the data is collected in a VBO in file: vbo_save_api.c and if the VBO_SAVE_BUFFER_SIZE is exhausted, the buffer is drawn as a line loop, even if the line loop is not yet finished. I guess the correct fix would be to only draw a GL_LINE_STRIP for all overflow related draws, but I guess the problem is where the first vertex for line closing should be cached, since it will be gone with the first overflow. I don't understand the code well enough to be able to fix this. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 81139] Rendering sometimes halts in waiting for back buffers with dri3 & xwayland
https://bugs.freedesktop.org/show_bug.cgi?id=81139 --- Comment #10 from Boyan Ding --- (In reply to comment #9) > If never present_fake_queue_vblank is called with a msc too low (already > passed), then perhaps it's going to wait forever. My guess is that for an > unknown reason, this function is called with a past msc. I can observe the target_msc changes drastically when running glxgears, when traced at present_pixmap. In the apps that works okay, target_msc only increases by one. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 08/15] svga: implement pipe_screen::get_driver_query_group_info v3
On 07/10/2014 12:42 AM, Marek Olšák wrote: Well, the array can always be moved outside of the function and be declared as static. Yes, that's possible for svga and freedreno, but not for radeon because the parameter max_value of some counters depends of the screen. I prefer to keep these constants like that, except if you are really disagree with them. Marek On Thu, Jul 10, 2014 at 12:27 AM, Samuel Pitoiset wrote: On 07/09/2014 09:49 PM, Marek Olšák wrote: If the driver queries are defined as an array, you can also use the Elements macro on the array. For sure, but we can't do that here since the array is local to the get_driver_query_info() callback. Marek On Wed, Jul 9, 2014 at 3:41 PM, Samuel Pitoiset wrote: On 07/09/2014 03:00 PM, Brian Paul wrote: On 07/09/2014 08:34 AM, Samuel Pitoiset wrote: This enables GL_AMD_performance_monitor for svga. V2: - s/pipe_context/pipe_screen in the commit msg V3: - use util_get_driver_query_group_info Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/svga/svga_screen.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index f34664d..29257ab 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -28,6 +28,7 @@ #include "util/u_inlines.h" #include "util/u_string.h" #include "util/u_math.h" +#include "util/u_query.h" #include "svga_winsys.h" #include "svga_public.h" @@ -555,6 +556,15 @@ svga_get_driver_query_info(struct pipe_screen *screen, } +static int +svga_get_driver_query_group_info(struct pipe_screen *screen, + unsigned index, + struct pipe_driver_query_group_info *info) +{ + return util_get_driver_query_group_info(index, 3, info); What does 3 indicate? Please add some documentation for this. Yes, it's the number of driver-specific queries. I suspect it's the number of driver-specific queries supported. If so, it would be better to have a new #define SVGA_QUERY_COUNT 3 in svga_context.h so that if someone adds a new query they won't have to hunt down this magic number here. Okay, I'll add SVGA_QUERY_COUNT and same for others drivers which use that extension (freedreno, radeon and nvc0). Thanks. Thanks. +} + + static void svga_destroy_screen( struct pipe_screen *screen ) { @@ -615,6 +625,7 @@ svga_screen_create(struct svga_winsys_screen *sws) screen->fence_signalled = svga_fence_signalled; screen->fence_finish = svga_fence_finish; screen->get_driver_query_info = svga_get_driver_query_info; + screen->get_driver_query_group_info = svga_get_driver_query_group_info; svgascreen->sws = sws; svga_init_screen_resource_functions(svgascreen); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] Avoid mesa_dri_drivers import lib being installed
On Cygwin and MinGW, linking a shared library also generates an import library Use a wildcard which also matches the name of the megadriver import lib, mesa_dri_drivers.dll.a, so that is also removed after megadriver symlinks are created (This then matches src/gallium/targets/dri/Makefile.am, which already does things this way) Signed-off-by: Jon TURNEY --- src/mesa/drivers/dri/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am index 37136b9..1a93645 100644 --- a/src/mesa/drivers/dri/Makefile.am +++ b/src/mesa/drivers/dri/Makefile.am @@ -91,7 +91,6 @@ install-data-hook: ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \ $(DESTDIR)$(dridir)/$$i; \ done; - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.la + $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.* endif -- 1.8.5.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 81139] Rendering sometimes halts in waiting for back buffers with dri3 & xwayland
https://bugs.freedesktop.org/show_bug.cgi?id=81139 --- Comment #11 from Boyan Ding --- I found the following things: 1. When things are right the window_msc argument of present_pixmap is always a small number (often 1 or sometimes 2), but when things starts to go wrong, it can be very big. 2. When things go wrong (window_msc is very big), present_pixmap is directly originated in dri3_swap_buffers in dri3_glx.c in mesa, which is called by glXSwapBuffers like the following: (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0, flush) ^ 3. target_msc (will be window_msc in present_pixmap) in dri3_swap_buffers is originally 0 (note the mark on the previous line). So it is re-calculated according to the following expression: target_msc = priv->msc + priv->swap_interval * (priv->send_sbc - priv->recv_sbc); and priv->msc is guilty of the big value (Seems that it should be 0 or 1 normally). How can priv->msc change? -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 2/2] r600g/compute: Add debug information to promote and demote functions
On Fri, Jul 11, 2014 at 10:20:54AM +0200, Bruno Jiménez wrote: > v2: Add information about the item's starting point and size Reviewed-by: Tom Stellard > --- > src/gallium/drivers/r600/compute_memory_pool.c | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/src/gallium/drivers/r600/compute_memory_pool.c > b/src/gallium/drivers/r600/compute_memory_pool.c > index 1d0ec85..6a525cf 100644 > --- a/src/gallium/drivers/r600/compute_memory_pool.c > +++ b/src/gallium/drivers/r600/compute_memory_pool.c > @@ -339,6 +339,10 @@ int compute_memory_promote_item(struct > compute_memory_pool *pool, > int64_t start_in_dw; > int err = 0; > > + COMPUTE_DBG(pool->screen, "* compute_memory_promote_item()\n" > + " + Promoting Item: %i , starting at: %u (%u bytes) " > + "size: %u (%u bytes)\n", item->id, item->start_in_dw, > + item->start_in_dw * 4, item->size_in_dw, > item->size_in_dw * 4); > > /* Search for free space in the pool for this item. */ > while ((start_in_dw=compute_memory_prealloc_chunk(pool, > @@ -409,6 +413,11 @@ void compute_memory_demote_item(struct > compute_memory_pool *pool, > struct pipe_resource *dst; > struct pipe_box box; > > + COMPUTE_DBG(pool->screen, "* compute_memory_demote_item()\n" > + " + Demoting Item: %i, starting at: %u (%u bytes) " > + "size: %u (%u bytes)\n", item->id, item->start_in_dw, > + item->start_in_dw * 4, item->size_in_dw, > item->size_in_dw * 4); > + > /* First, we remove the item from the item_list */ > list_del(&item->link); > > -- > 2.0.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] radeonsi: switch descriptors to i32 vectors
On Fri, Jul 11, 2014 at 01:00:34AM +0200, Marek Olšák wrote: > I have just tested it and it works with LLVM 3.4.2. > Ok, thanks. Both patches are: Reviewed-by: Tom Stellard > Marek > > On Thu, Jul 10, 2014 at 5:11 PM, Tom Stellard wrote: > > On Tue, Jul 08, 2014 at 01:37:02AM +0200, Marek Olšák wrote: > >> From: Marek Olšák > >> > >> This is a follow-up to the commit which adds texture fetches with offsets. > > > > Will this still work with LLVM 3.4.2 ? > > > > -Tom > > > >> --- > >> src/gallium/drivers/radeonsi/si_shader.c | 29 > >> - > >> 1 file changed, 16 insertions(+), 13 deletions(-) > >> > >> diff --git a/src/gallium/drivers/radeonsi/si_shader.c > >> b/src/gallium/drivers/radeonsi/si_shader.c > >> index 3dd6ad1..a28d682 100644 > >> --- a/src/gallium/drivers/radeonsi/si_shader.c > >> +++ b/src/gallium/drivers/radeonsi/si_shader.c > >> @@ -1574,7 +1574,7 @@ static void tex_fetch_args( > >> LLVMTypeRef i8 = LLVMInt8TypeInContext(gallivm->context); > >> LLVMTypeRef v16i8 = LLVMVectorType(i8, 16); > >> > >> - /* Truncate v32i8 to v16i8. */ > >> + /* Bitcast and truncate v8i32 to v16i8. */ > >> LLVMValueRef res = si_shader_ctx->resources[sampler_index]; > >> res = LLVMBuildBitCast(gallivm->builder, res, v2i128, ""); > >> res = LLVMBuildExtractElement(gallivm->builder, res, > >> bld_base->uint_bld.zero, ""); > >> @@ -2305,12 +2305,18 @@ static void create_meta_data(struct > >> si_shader_context *si_shader_ctx) > >> si_shader_ctx->const_md = LLVMMDNodeInContext(gallivm->context, > >> args, 3); > >> } > >> > >> +static LLVMTypeRef const_array(LLVMTypeRef elem_type, int num_elements) > >> +{ > >> + return LLVMPointerType(LLVMArrayType(elem_type, num_elements), > >> +CONST_ADDR_SPACE); > >> +} > >> + > >> static void create_function(struct si_shader_context *si_shader_ctx) > >> { > >> struct lp_build_tgsi_context *bld_base = > >> &si_shader_ctx->radeon_bld.soa.bld_base; > >> struct gallivm_state *gallivm = bld_base->base.gallivm; > >> struct si_pipe_shader *shader = si_shader_ctx->shader; > >> - LLVMTypeRef params[SI_NUM_PARAMS], f32, i8, i32, v2i32, v3i32; > >> + LLVMTypeRef params[SI_NUM_PARAMS], f32, i8, i32, v2i32, v3i32, > >> v16i8, v4i32, v8i32; > >> unsigned i, last_sgpr, num_params; > >> > >> i8 = LLVMInt8TypeInContext(gallivm->context); > >> @@ -2318,21 +2324,18 @@ static void create_function(struct > >> si_shader_context *si_shader_ctx) > >> f32 = LLVMFloatTypeInContext(gallivm->context); > >> v2i32 = LLVMVectorType(i32, 2); > >> v3i32 = LLVMVectorType(i32, 3); > >> + v4i32 = LLVMVectorType(i32, 4); > >> + v8i32 = LLVMVectorType(i32, 8); > >> + v16i8 = LLVMVectorType(i8, 16); > >> > >> - params[SI_PARAM_CONST] = LLVMPointerType( > >> - LLVMArrayType(LLVMVectorType(i8, 16), NUM_CONST_BUFFERS), > >> CONST_ADDR_SPACE); > >> - params[SI_PARAM_RW_BUFFERS] = params[SI_PARAM_CONST]; > >> - > >> - /* We assume at most 16 textures per program at the moment. > >> - * This need probably need to be changed to support bindless > >> textures */ > >> - params[SI_PARAM_SAMPLER] = LLVMPointerType( > >> - LLVMArrayType(LLVMVectorType(i8, 16), NUM_SAMPLER_STATES), > >> CONST_ADDR_SPACE); > >> - params[SI_PARAM_RESOURCE] = LLVMPointerType( > >> - LLVMArrayType(LLVMVectorType(i8, 32), NUM_SAMPLER_VIEWS), > >> CONST_ADDR_SPACE); > >> + params[SI_PARAM_CONST] = const_array(v16i8, NUM_CONST_BUFFERS); > >> + params[SI_PARAM_RW_BUFFERS] = const_array(v16i8, 6); /* XXX > >> hardcoded */ > >> + params[SI_PARAM_SAMPLER] = const_array(v4i32, NUM_SAMPLER_STATES); > >> + params[SI_PARAM_RESOURCE] = const_array(v8i32, NUM_SAMPLER_VIEWS); > >> > >> switch (si_shader_ctx->type) { > >> case TGSI_PROCESSOR_VERTEX: > >> - params[SI_PARAM_VERTEX_BUFFER] = params[SI_PARAM_CONST]; > >> + params[SI_PARAM_VERTEX_BUFFER] = const_array(v16i8, 16); /* > >> XXX hardcoded */ > >> params[SI_PARAM_START_INSTANCE] = i32; > >> num_params = SI_PARAM_START_INSTANCE+1; > >> if (shader->key.vs.as_es) { > >> -- > >> 1.9.1 > >> > >> ___ > >> mesa-dev mailing list > >> mesa-dev@lists.freedesktop.org > >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 08/15] svga: implement pipe_screen::get_driver_query_group_info v3
Ah, alright. It was just a minor suggestion. I didn't have a look at all the patches, but I did review some of them and they looked good to me, including this one. Marek On Fri, Jul 11, 2014 at 2:23 PM, Samuel Pitoiset wrote: > On 07/10/2014 12:42 AM, Marek Olšák wrote: >> >> Well, the array can always be moved outside of the function and be >> declared as static. > > > Yes, that's possible for svga and freedreno, but not for radeon because the > parameter max_value of some counters depends of the screen. I prefer to keep > these constants like that, except if you are really disagree with them. > > > >> >> Marek >> >> On Thu, Jul 10, 2014 at 12:27 AM, Samuel Pitoiset >> wrote: >>> >>> On 07/09/2014 09:49 PM, Marek Olšák wrote: If the driver queries are defined as an array, you can also use the Elements macro on the array. >>> >>> >>> For sure, but we can't do that here since the array is local to the >>> get_driver_query_info() callback. >>> >>> Marek On Wed, Jul 9, 2014 at 3:41 PM, Samuel Pitoiset wrote: > > On 07/09/2014 03:00 PM, Brian Paul wrote: >> >> On 07/09/2014 08:34 AM, Samuel Pitoiset wrote: >>> >>> This enables GL_AMD_performance_monitor for svga. >>> >>> V2: >>> - s/pipe_context/pipe_screen in the commit msg >>> >>> V3: >>> - use util_get_driver_query_group_info >>> >>> Signed-off-by: Samuel Pitoiset >>> --- >>> src/gallium/drivers/svga/svga_screen.c | 11 +++ >>> 1 file changed, 11 insertions(+) >>> >>> diff --git a/src/gallium/drivers/svga/svga_screen.c >>> b/src/gallium/drivers/svga/svga_screen.c >>> index f34664d..29257ab 100644 >>> --- a/src/gallium/drivers/svga/svga_screen.c >>> +++ b/src/gallium/drivers/svga/svga_screen.c >>> @@ -28,6 +28,7 @@ >>> #include "util/u_inlines.h" >>> #include "util/u_string.h" >>> #include "util/u_math.h" >>> +#include "util/u_query.h" >>> >>> #include "svga_winsys.h" >>> #include "svga_public.h" >>> @@ -555,6 +556,15 @@ svga_get_driver_query_info(struct pipe_screen >>> *screen, >>> } >>> >>> >>> +static int >>> +svga_get_driver_query_group_info(struct pipe_screen *screen, >>> + unsigned index, >>> + struct pipe_driver_query_group_info >>> *info) >>> +{ >>> + return util_get_driver_query_group_info(index, 3, info); >> >> >> What does 3 indicate? Please add some documentation for this. > > > Yes, it's the number of driver-specific queries. > > >> I suspect it's the number of driver-specific queries supported. If so, >> it >> would be better to have a new #define SVGA_QUERY_COUNT 3 in >> svga_context.h >> so that if someone adds a new query they won't have to hunt down this >> magic >> number here. > > > Okay, I'll add SVGA_QUERY_COUNT and same for others drivers which use > that > extension (freedreno, radeon and nvc0). > > Thanks. > > >> Thanks. >> >> >>> +} >>> + >>> + >>> static void >>> svga_destroy_screen( struct pipe_screen *screen ) >>> { >>> @@ -615,6 +625,7 @@ svga_screen_create(struct svga_winsys_screen >>> *sws) >>>screen->fence_signalled = svga_fence_signalled; >>>screen->fence_finish = svga_fence_finish; >>>screen->get_driver_query_info = svga_get_driver_query_info; >>> + screen->get_driver_query_group_info = >>> svga_get_driver_query_group_info; >>>svgascreen->sws = sws; >>> >>>svga_init_screen_resource_functions(svgascreen); >>> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev > > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev >>> >>> > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] State of llvmpipe geometry shaders?
Hi everyone, I read a post from 2012 that MESA supports geometry shaders. I tried a current MESA 10.2.x release, but MESA GL_VERSION returns OpenGL version 3.0 (not 3.2) and the GL_ARB_geometry_shader4 extension is not reported in the MESA extensions. The function lookup for the functions of GL_ARB_geometry_shader4 works, though. When I run a shader program with a geometry shader, the MESA linker complains that the varying that is used in the fragment shader is not emitted from the vertex shader, which indicates that the geometry shader is not detected/used. Should geometry shaders work in the current MESA llvm pipe release, or do I need to enable/compile in some code? regards, Florian P.S. My geometry shader works on non-MESA native ATI/NVidia/Intel OpenGL drivers, so I don't think it is a problem of my shader code, especially the ATI drivers are quite strict. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] State of llvmpipe geometry shaders?
On 07/11/2014 01:47 AM, Florian Link wrote: Hi everyone, I read a post from 2012 that MESA supports geometry shaders. I tried a current MESA 10.2.x release, but MESA GL_VERSION returns OpenGL version 3.0 (not 3.2) and the GL_ARB_geometry_shader4 extension is not reported in the MESA extensions. The function lookup for the functions of GL_ARB_geometry_shader4 works, though. When I run a shader program with a geometry shader, the MESA linker complains that the varying that is used in the fragment shader is not emitted from the vertex shader, which indicates that the geometry shader is not detected/used. Should geometry shaders work in the current MESA llvm pipe release, or do I need to enable/compile in some code? regards, Florian P.S. My geometry shader works on non-MESA native ATI/NVidia/Intel OpenGL drivers, so I don't think it is a problem of my shader code, especially the ATI drivers are quite strict. llvmpipe supports GS, but only in core profiles. With glxinfo, use the -c option to see core profile version/extension info. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/15] gallium: add new numeric types to pipe_query_result v2
This will be used by GL_AMD_performance_monitor. V2: - add 'uint32_t u32' - rename 'float f32' to 'float f' - add some comments Signed-off-by: Samuel Pitoiset --- src/gallium/include/pipe/p_defines.h | 8 1 file changed, 8 insertions(+) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index f0a1dda..4a4408d 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -708,8 +708,16 @@ union pipe_query_result /* PIPE_QUERY_TIME_ELAPSED */ /* PIPE_QUERY_PRIMITIVES_GENERATED */ /* PIPE_QUERY_PRIMITIVES_EMITTED */ + /* PIPE_DRIVER_QUERY_TYPE_UINT64 */ uint64_t u64; + /* PIPE_DRIVER_QUERY_TYPE_UINT */ + uint32_t u32; + + /* PIPE_DRIVER_QUERY_TYPE_FLOAT */ + /* PIPE_DRIVER_QUERY_TYPE_PERCENTAGE */ + float f; + /* PIPE_QUERY_SO_STATISTICS */ struct pipe_query_data_so_statistics so_statistics; -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/15] gallium: replace pipe_driver_query_info::max_value by a union v2
This will be used to return different numeric types for driver queries. V2: - use float instead of double - reorder pipe_numeric_type_union to avoid bad initializers - rename ui to u64 and i to u32 according to gl_perf_monitor_counter_value - use uint32_t instead of int64_t according to gl_perf_monitor_counter_value Signed-off-by: Samuel Pitoiset --- src/gallium/auxiliary/hud/hud_driver_query.c| 2 +- src/gallium/drivers/freedreno/freedreno_query.c | 12 ++-- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 8 src/gallium/drivers/radeon/r600_pipe_common.c | 16 src/gallium/drivers/svga/svga_screen.c | 6 +++--- src/gallium/include/pipe/p_defines.h| 9 - 6 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/gallium/auxiliary/hud/hud_driver_query.c b/src/gallium/auxiliary/hud/hud_driver_query.c index b48708c..8448cb7 100644 --- a/src/gallium/auxiliary/hud/hud_driver_query.c +++ b/src/gallium/auxiliary/hud/hud_driver_query.c @@ -205,6 +205,6 @@ hud_driver_query_install(struct hud_pane *pane, struct pipe_context *pipe, return FALSE; hud_pipe_query_install(pane, pipe, query.name, query.query_type, 0, - query.max_value, query.uses_byte_units); + query.max_value.u64, query.uses_byte_units); return TRUE; } diff --git a/src/gallium/drivers/freedreno/freedreno_query.c b/src/gallium/drivers/freedreno/freedreno_query.c index cb3b49a..6f01e03 100644 --- a/src/gallium/drivers/freedreno/freedreno_query.c +++ b/src/gallium/drivers/freedreno/freedreno_query.c @@ -86,12 +86,12 @@ fd_get_driver_query_info(struct pipe_screen *pscreen, unsigned index, struct pipe_driver_query_info *info) { struct pipe_driver_query_info list[] = { - {"draw-calls", FD_QUERY_DRAW_CALLS, 0}, - {"batches", FD_QUERY_BATCH_TOTAL, 0}, - {"batches-sysmem", FD_QUERY_BATCH_SYSMEM, 0}, - {"batches-gmem", FD_QUERY_BATCH_GMEM, 0}, - {"restores", FD_QUERY_BATCH_RESTORE, 0}, - {"prims-emitted", PIPE_QUERY_PRIMITIVES_EMITTED, 0}, + {"draw-calls", FD_QUERY_DRAW_CALLS, {0}}, + {"batches", FD_QUERY_BATCH_TOTAL, {0}}, + {"batches-sysmem", FD_QUERY_BATCH_SYSMEM, {0}}, + {"batches-gmem", FD_QUERY_BATCH_GMEM, {0}}, + {"restores", FD_QUERY_BATCH_RESTORE, {0}}, + {"prims-emitted", PIPE_QUERY_PRIMITIVES_EMITTED, {0}}, }; if (!info) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c index 50cef1e..c76cd43 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c @@ -1409,7 +1409,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, if (id < NVC0_QUERY_DRV_STAT_COUNT) { info->name = nvc0_drv_stat_names[id]; info->query_type = NVC0_QUERY_DRV_STAT(id); - info->max_value = ~0ULL; + info->max_value.u64 = ~0ULL; info->uses_byte_units = !!strstr(info->name, "bytes"); return 1; } else @@ -1418,7 +1418,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, if (screen->base.class_3d >= NVE4_3D_CLASS) { info->name = nve4_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT]; info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT); - info->max_value = (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? + info->max_value.u64 = (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? ~0ULL : 100; info->uses_byte_units = FALSE; return 1; @@ -1426,7 +1426,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, if (screen->compute) { info->name = nvc0_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT]; info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT); - info->max_value = ~0ULL; + info->max_value.u64 = ~0ULL; info->uses_byte_units = FALSE; return 1; } @@ -1434,7 +1434,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, /* user asked for info about non-existing query */ info->name = "this_is_not_the_query_you_are_looking_for"; info->query_type = 0xdeadd01d; - info->max_value = 0; + info->max_value.u64 = 0; info->uses_byte_units = FALSE; return 0; } diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 46e8a79..bcddde1 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -546,14 +546,14 @@ static int r600_get_driver_query_info(struct pipe_screen *screen, { struct r600_common_screen *rscreen = (struct r600_common_screen*)scre
[Mesa-dev] [PATCH 07/15] gallium: add util_get_driver_query_group_info v2
This generic function will be used to get groups of queries. V2: - add some comments as request by Brian Paul - put the function name on the next line Signed-off-by: Samuel Pitoiset --- src/gallium/auxiliary/Makefile.sources | 1 + src/gallium/auxiliary/util/u_query.c | 50 ++ src/gallium/auxiliary/util/u_query.h | 45 ++ 3 files changed, 96 insertions(+) create mode 100644 src/gallium/auxiliary/util/u_query.c create mode 100644 src/gallium/auxiliary/util/u_query.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 8919783..1188c94 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -130,6 +130,7 @@ C_SOURCES := \ util/u_math.c \ util/u_mm.c \ util/u_pstipple.c \ + util/u_query.c \ util/u_ringbuffer.c \ util/u_sampler.c \ util/u_simple_shaders.c \ diff --git a/src/gallium/auxiliary/util/u_query.c b/src/gallium/auxiliary/util/u_query.c new file mode 100644 index 000..57fa60f --- /dev/null +++ b/src/gallium/auxiliary/util/u_query.c @@ -0,0 +1,50 @@ +/** + * + * Copyright 2014 Samuel Pitoiset + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **/ + +#include "util/u_memory.h" +#include "util/u_query.h" + +/** + * This function is used to get a generic group of driver-specific queries. + */ +int +util_get_driver_query_group_info(unsigned index, unsigned num_queries, + struct pipe_driver_query_group_info *info) +{ + struct pipe_driver_query_group_info list[] = { + {"Driver queries", num_queries, num_queries} + }; + + if (!info) + return Elements(list); + + if (index >= Elements(list)) + return 0; + + *info = list[index]; + return 1; +} diff --git a/src/gallium/auxiliary/util/u_query.h b/src/gallium/auxiliary/util/u_query.h new file mode 100644 index 000..09428d2 --- /dev/null +++ b/src/gallium/auxiliary/util/u_query.h @@ -0,0 +1,45 @@ +/** + * + * Copyright 2014 Samuel Pitoiset + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **/ + +#ifndef U_QUERY_H +#define U_QUERY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pipe/p_state.h" + +int +util_get_driver_query_group_info(unsigned index, unsigned num_queries, + struct pipe_driver_query_group_info *info); + +#ifdef __cplusplus +} +#endif + +#endif -- 2.0.0
[Mesa-dev] [PATCH 10/15] radeon: implement pipe_screen::get_driver_query_group_info v4
This enables GL_AMD_performance_monitor for radeon. V2: - s/pipe_context/pipe_screen in the commit msg V3: - use util_get_driver_query_group_info V4: - add R600_QUERY_COUNT in r600_pipe_common.h Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/radeon/r600_pipe_common.c | 9 + src/gallium/drivers/radeon/r600_pipe_common.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index bcddde1..5bd7763 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -30,6 +30,7 @@ #include "util/u_memory.h" #include "util/u_format_s3tc.h" #include "util/u_upload_mgr.h" +#include "util/u_query.h" #include "vl/vl_decoder.h" #include "vl/vl_video_buffer.h" #include "radeon/radeon_video.h" @@ -566,6 +567,13 @@ static int r600_get_driver_query_info(struct pipe_screen *screen, return 1; } +static int r600_get_driver_query_group_info(struct pipe_screen *screen, + unsigned index, + struct pipe_driver_query_group_info *info) +{ + return util_get_driver_query_group_info(index, R600_QUERY_COUNT, info); +} + static void r600_fence_reference(struct pipe_screen *screen, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) @@ -724,6 +732,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, rscreen->b.get_compute_param = r600_get_compute_param; rscreen->b.get_paramf = r600_get_paramf; rscreen->b.get_driver_query_info = r600_get_driver_query_info; + rscreen->b.get_driver_query_group_info = r600_get_driver_query_group_info; rscreen->b.get_timestamp = r600_get_timestamp; rscreen->b.fence_finish = r600_fence_finish; rscreen->b.fence_reference = r600_fence_reference; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index d82adf5..87ea111 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -46,6 +46,7 @@ #define R600_RESOURCE_FLAG_FLUSHED_DEPTH (PIPE_RESOURCE_FLAG_DRV_PRIV << 1) #define R600_RESOURCE_FLAG_FORCE_TILING (PIPE_RESOURCE_FLAG_DRV_PRIV << 2) +#define R600_QUERY_COUNT 8 #define R600_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0) #define R600_QUERY_REQUESTED_VRAM (PIPE_QUERY_DRIVER_SPECIFIC + 1) #define R600_QUERY_REQUESTED_GTT (PIPE_QUERY_DRIVER_SPECIFIC + 2) -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/15] nvc0: expose driver queries with two groups
This adds a new group for MP performance counters and requires to write our own implementation of get_driver_query_group_info. Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 52 -- src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 5 +++ 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c index eb13a74..cd11774 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c @@ -24,8 +24,6 @@ #define NVC0_PUSH_EXPLICIT_SPACE_CHECKING -#include "util/u_query.h" - #include "nvc0/nvc0_context.h" #include "nv_object.xml.h" #include "nvc0/nve4_compute.xml.h" @@ -1412,6 +1410,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, if (id < NVC0_QUERY_DRV_STAT_COUNT) { info->name = nvc0_drv_stat_names[id]; info->query_type = NVC0_QUERY_DRV_STAT(id); + info->group_id = NVC0_QUERY_DRV_STAT_GROUP; info->max_value.u64 = ~0ULL; info->uses_byte_units = !!strstr(info->name, "bytes"); return 1; @@ -1421,6 +1420,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, if (screen->base.class_3d >= NVE4_3D_CLASS) { info->name = nve4_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT]; info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT); + info->group_id = NVC0_QUERY_PM_GROUP; info->max_value.u64 = (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? ~0ULL : 100; info->uses_byte_units = FALSE; @@ -1429,6 +1429,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, if (screen->compute) { info->name = nvc0_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT]; info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT); + info->group_id = NVC0_QUERY_PM_GROUP; info->max_value.u64 = ~0ULL; info->uses_byte_units = FALSE; return 1; @@ -1437,6 +1438,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, /* user asked for info about non-existing query */ info->name = "this_is_not_the_query_you_are_looking_for"; info->query_type = 0xdeadd01d; + info->group_id = 0; info->max_value.u64 = 0; info->uses_byte_units = FALSE; return 0; @@ -1447,7 +1449,51 @@ nvc0_screen_get_driver_query_group_info(struct pipe_screen *pscreen, unsigned id, struct pipe_driver_query_group_info *info) { - return util_get_driver_query_group_info(id, NVC0_QUERY_DRV_STAT_COUNT, info); + struct nvc0_screen *screen = nvc0_screen(pscreen); + int count = 0; + +#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS + count++; +#endif + if (screen->base.device->drm_version >= 0x01000101) { + if (screen->base.class_3d >= NVE4_3D_CLASS) { + count++; + } else + if (screen->compute) { + count++; /* NVC0_COMPUTE is not always enabled */ + } + } + + if (!info) + return count; + +#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS + if (id == NVC0_QUERY_DRV_STAT_GROUP) { + info->name = "Driver statistics"; + info->max_active_queries = 8; + info->num_queries = NVC0_QUERY_DRV_STAT_COUNT; + return 1; + } else +#endif + if (id == NVC0_QUERY_PM_GROUP) { + info->name = "Performance counters"; + info->max_active_queries = 8; /* 8 MP counters for NVC0+ */ + + if (screen->base.class_3d >= NVE4_3D_CLASS) { + info->num_queries = NVE4_PM_QUERY_COUNT; + return 1; + } else + if (screen->compute) { + info->num_queries = NVC0_PM_QUERY_COUNT; + return 1; + } + } + + /* user asked for info about non-existing query group */ + info->name = "this_is_not_the_query_group_you_are_looking_for"; + info->max_active_queries = 0; + info->num_queries = 0; + return 0; } void diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h index be9b1c8..405187c 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h @@ -88,6 +88,11 @@ nvc0_screen(struct pipe_screen *screen) return (struct nvc0_screen *)screen; } +/* + * Performance counter groups: + */ +#define NVC0_QUERY_DRV_STAT_GROUP 0 +#define NVC0_QUERY_PM_GROUP 1 /* Performance counter queries: */ -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/15] gallium: add pipe_screen::get_driver_query_group_info v2
Driver queries are organized as a single hierarchy where queries are categorized into groups. Each goup has a list of queries and a maximum number of queries that can be sampled. This will be used by GL_AMD_performance monitor. V2: - add doc to src/gallium/docs/source/screen.rst - s/pipe_context/pipe_screen in the commit msg - rewrite commit message Signed-off-by: Samuel Pitoiset --- src/gallium/docs/source/screen.rst | 10 ++ src/gallium/include/pipe/p_defines.h | 7 +++ src/gallium/include/pipe/p_screen.h | 11 +++ 3 files changed, 28 insertions(+) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index ba583fe..9d94890 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -532,3 +532,13 @@ query at the specified **index** is returned in **info**. The function returns non-zero on success. The driver-specific query is described with the pipe_driver_query_info structure. + +get_driver_query_group_info +^^^ + +Return a driver-specific query group. If the **info** parameter is NULL, +the number of available groups is returned. Otherwise, the driver +query group at the specified **index** is returned in **info**. +The function returns non-zero on success. +The driver-specific query group is described with the +pipe_driver_query_group_info structure. diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index d9b6e5a..8f20974 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -735,6 +735,13 @@ struct pipe_driver_query_info boolean uses_byte_units; /* whether the result is in bytes */ }; +struct pipe_driver_query_group_info +{ + const char *name; + unsigned max_active_queries; + unsigned num_queries; +}; + #ifdef __cplusplus } #endif diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index cf958d2..8fc110e 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -220,6 +220,17 @@ struct pipe_screen { unsigned index, struct pipe_driver_query_info *info); + /** +* Returns a driver-specific query group. +* +* If \p info is NULL, the number of available groups is returned. +* Otherwise, the driver query group at the specified \p index is returned +* in \p info. The function returns non-zero on success. +*/ + int (*get_driver_query_group_info)(struct pipe_screen *screen, + unsigned index, + struct pipe_driver_query_group_info *info); + }; -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/15] st/mesa: implement GL_AMD_performance_monitor v5
From: Christoph Bumiller This is based on the original patch of Christoph Bumiller. (source: http://people.freedesktop.org/~chrisbmr/perfmon.diff) Drivers must implement get_driver_query_group_info and get_driver_query_info in order to enable this extension. V2: (Samuel Pitoiset) - fix compilation - improve the original code - rewrite some parts of the original code V3: - do not use pipe_driver_query_info::min_value which is always set to 0 V4: - only enable AMD_performance_monitor if the driver implements pipe_screen::get_driver_query_group_info and get_driver_query_info - make use of PIPE_DRIVER_QUERY_TYPE_* - use of GL_UNSIGNED_INT in st_GetPerfMonitorResult() V5: - use st/mesa instead of mesa/st - add comments to find_query_type() and reinitialize_perf_monitor() - change copyrights - do not wait for results in st_IsPerfMonitorResultAvailable which is not supposed to block - add st_destroy_perfmon() in order to free memory allocated by groups and counters (this fixes a memleak) Signed-off-by: Samuel Pitoiset --- src/mesa/Makefile.sources | 1 + src/mesa/state_tracker/st_cb_perfmon.c | 392 + src/mesa/state_tracker/st_cb_perfmon.h | 64 ++ src/mesa/state_tracker/st_context.c| 4 + src/mesa/state_tracker/st_extensions.c | 3 + 5 files changed, 464 insertions(+) create mode 100644 src/mesa/state_tracker/st_cb_perfmon.c create mode 100644 src/mesa/state_tracker/st_cb_perfmon.h diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index f4904fb..0b020e2 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -234,6 +234,7 @@ STATETRACKER_FILES = \ $(SRCDIR)state_tracker/st_cb_fbo.c \ $(SRCDIR)state_tracker/st_cb_feedback.c \ $(SRCDIR)state_tracker/st_cb_msaa.c \ + $(SRCDIR)state_tracker/st_cb_perfmon.c \ $(SRCDIR)state_tracker/st_cb_program.c \ $(SRCDIR)state_tracker/st_cb_queryobj.c \ $(SRCDIR)state_tracker/st_cb_rasterpos.c \ diff --git a/src/mesa/state_tracker/st_cb_perfmon.c b/src/mesa/state_tracker/st_cb_perfmon.c new file mode 100644 index 000..8baa2cf --- /dev/null +++ b/src/mesa/state_tracker/st_cb_perfmon.c @@ -0,0 +1,392 @@ +/* + * Copyright (C) 2013 Christoph Bumiller + * Copyright (C) 2014 Samuel Pitoiset + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * Performance monitoring counters interface to gallium. + */ + +#include "st_context.h" +#include "st_cb_perfmon.h" +#include "st_cb_bitmap.h" + +#include "main/bitset.h" + +/* Avoid multiple definitions */ +#undef MALLOC_STRUCT +#undef CALLOC_STRUCT + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" +#include "pipe/p_screen.h" +#include "util/u_math.h" +#include "util/u_memory.h" + +/** + * This function is used to return the ID of a driver-specific query. + * It returns a PIPE_QUERY_x type >= PIPE_QUERY_DRIVER_SPECIFIC, + * or -1 if the driver-specific query is not found. + */ +static int +find_query_type(struct pipe_screen *screen, const char *name) +{ + int num_counters; + int type = -1; + int i; + + num_counters = screen->get_driver_query_info(screen, 0, NULL); + if (!num_counters) + return type; + + for (i = 0; i < num_counters; i++) { + struct pipe_driver_query_info info; + + if (!screen->get_driver_query_info(screen, i, &info)) + continue; + + if (!strncmp(info.name, name, strlen(name))) { + type = info.query_type; + break; + } + } + return type; +} + +/** + * This function is used to initialize a monitor to sane starting state. + */ +static void +reinitialize_perf_monitor(struct st_perf_monitor_object *stm, + struct pipe_context *pipe) +{ + int i; + + for (i = 0; i < stm->num_queries; i++) { + if (stm->queries[i].pq) { + pipe->destroy_query(pipe, stm->queries[i].pq); + stm->queries[i].pq = NULL; + }
[Mesa-dev] [PATCH 11/15] nvc0: implement pipe_screen::get_driver_query_group_info v3
This enables GL_AMD_performance_monitor for nvc0. V2: - use util_get_driver_query_group_info V3: - use of NVC0_QUERY_DRV_STAT_COUNT instead of a magic number Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 10 ++ src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c index 7bf592c..eb13a74 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c @@ -24,6 +24,8 @@ #define NVC0_PUSH_EXPLICIT_SPACE_CHECKING +#include "util/u_query.h" + #include "nvc0/nvc0_context.h" #include "nv_object.xml.h" #include "nvc0/nve4_compute.xml.h" @@ -1440,6 +1442,14 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, return 0; } +int +nvc0_screen_get_driver_query_group_info(struct pipe_screen *pscreen, +unsigned id, +struct pipe_driver_query_group_info *info) +{ + return util_get_driver_query_group_info(id, NVC0_QUERY_DRV_STAT_COUNT, info); +} + void nvc0_init_query_functions(struct nvc0_context *nvc0) { diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index dc9b143..63924b4 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -620,6 +620,7 @@ nvc0_screen_create(struct nouveau_device *dev) pscreen->get_shader_param = nvc0_screen_get_shader_param; pscreen->get_paramf = nvc0_screen_get_paramf; pscreen->get_driver_query_info = nvc0_screen_get_driver_query_info; + pscreen->get_driver_query_group_info = nvc0_screen_get_driver_query_group_info; nvc0_screen_init_resource_functions(pscreen); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h index 4802057..be9b1c8 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h @@ -245,6 +245,9 @@ nvc0_screen(struct pipe_screen *screen) int nvc0_screen_get_driver_query_info(struct pipe_screen *, unsigned, struct pipe_driver_query_info *); +int nvc0_screen_get_driver_query_group_info(struct pipe_screen *, unsigned, +struct pipe_driver_query_group_info *); + boolean nvc0_blitter_create(struct nvc0_screen *); void nvc0_blitter_destroy(struct nvc0_screen *); -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/15] docs: mark GL_AMD_performance_monitor for the 10.3 release v2
GL_AMD_performance_monitor is supported by nvc0, svga, freedreno, r600 and radeonsi. V2: - add radeonsi Signed-off-by: Samuel Pitoiset --- docs/relnotes/10.3.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes/10.3.html b/docs/relnotes/10.3.html index 2e718fc..625063d 100644 --- a/docs/relnotes/10.3.html +++ b/docs/relnotes/10.3.html @@ -56,6 +56,7 @@ Note: some of the new features are only available with certain drivers. GL_ARB_seamless_cubemap_per_texture on i965, llvmpipe, nvc0, r600, radeonsi, softpipe GL_ARB_fragment_layer_viewport on nv50, nvc0, llvmpipe, r600 GL_AMD_vertex_shader_viewport_index on i965/gen7+, r600 +GL_AMD_performance_monitor on nvc0, r600, radeonsi, svga, freedreno -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 15/15] nvc0: init all default values of pipe_driver_query_info
Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c index fcca1cb..6f9a1e6 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c @@ -1409,6 +1409,14 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, if (!info) return count; + /* Init default values. */ + info->name = "this_is_not_the_query_you_are_looking_for"; + info->query_type = 0xdeadd01d; + info->group_id = 0; + info->max_value.u64 = 0; + info->uses_byte_units = FALSE; + info->type = PIPE_DRIVER_QUERY_TYPE_UINT64; + #ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS if (id < NVC0_QUERY_DRV_STAT_COUNT) { info->name = nvc0_drv_stat_names[id]; @@ -1426,7 +1434,6 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, info->group_id = NVC0_QUERY_PM_GROUP; info->max_value.u64 = (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? ~0ULL : 100; - info->uses_byte_units = FALSE; return 1; } else if (screen->compute) { @@ -1434,16 +1441,10 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT); info->group_id = NVC0_QUERY_PM_GROUP; info->max_value.u64 = ~0ULL; - info->uses_byte_units = FALSE; return 1; } } /* user asked for info about non-existing query */ - info->name = "this_is_not_the_query_you_are_looking_for"; - info->query_type = 0xdeadd01d; - info->group_id = 0; - info->max_value.u64 = 0; - info->uses_byte_units = FALSE; return 0; } -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/15] gallium: add new fields to pipe_driver_query_info v2
According to the spec of GL_AMD_performance_monitor, valid type values returned are UNSIGNED_INT, UNSIGNED_INT64_AMD, PERCENTAGE_AMD, FLOAT. This also introduces the new field group_id in order to categorize queries into groups. V2: - add pipe_driver_query_type enum Signed-off-by: Samuel Pitoiset --- src/gallium/include/pipe/p_defines.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 8f20974..f0a1dda 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -727,12 +727,22 @@ union pipe_color_union unsigned int ui[4]; }; +enum pipe_driver_query_type +{ + PIPE_DRIVER_QUERY_TYPE_UINT64 = 0, + PIPE_DRIVER_QUERY_TYPE_UINT = 1, + PIPE_DRIVER_QUERY_TYPE_FLOAT = 2, + PIPE_DRIVER_QUERY_TYPE_PERCENTAGE = 3, +}; + struct pipe_driver_query_info { const char *name; unsigned query_type; /* PIPE_QUERY_DRIVER_SPECIFIC + i */ uint64_t max_value; /* max value that can be returned */ boolean uses_byte_units; /* whether the result is in bytes */ + enum pipe_driver_query_type type; + unsigned group_id; }; struct pipe_driver_query_group_info -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] GL_AMD_performance_monitor v4
Hello everyone, New version of GL_AMD_performance_monitor (version 4). V2 (global changes): - Fix radeon as pinpointed by Marek - Implement pipe_driver_query_group_info for svga, radeon and freedreno V3 (global changes): - Re-organize the series according to hints of Ilia Mirkin - Document pipe_driver_query_group_info - Re-order pipe_numeric_type_union to avoid bad initializers - Add pipe_driver_query_type enum - Only enable AMD_performance_monitor if the driver implements pipe_driver_query_info and pipe_driver_query_group_info V4 (global changes): - Free allocated memory of groups and counters (this fixes a memleak) - Document some functions - Change copyrights - Mark radeonsi as supported by AMD_performance_monitor since it shares the same code that r600 GL_AMD_performance_monitor is now available for nvc0, svga, freedreno and radeon. docs/relnotes/10.3.html| 1 + src/gallium/auxiliary/Makefile.sources | 1 + src/gallium/auxiliary/hud/hud_driver_query.c | 2 +- src/gallium/auxiliary/util/u_query.c | 50 +++ src/gallium/auxiliary/util/u_query.h | 45 ++ src/gallium/docs/source/screen.rst | 10 +++ src/gallium/drivers/freedreno/freedreno_query.c| 25 +--- src/gallium/drivers/freedreno/freedreno_query.h| 3 +- src/gallium/drivers/freedreno/freedreno_query_hw.c | 3 +- src/gallium/drivers/freedreno/freedreno_query_sw.c | 3 +- src/gallium/drivers/galahad/glhd_context.c | 6 +- src/gallium/drivers/i915/i915_query.c | 3 +- src/gallium/drivers/identity/id_context.c | 6 +- src/gallium/drivers/ilo/ilo_query.c| 3 +- src/gallium/drivers/llvmpipe/lp_query.c| 3 +- src/gallium/drivers/noop/noop_pipe.c | 3 +- src/gallium/drivers/nouveau/nv30/nv30_query.c | 5 +- src/gallium/drivers/nouveau/nv50/nv50_query.c | 3 +- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 89 ++- src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 8 +++ src/gallium/drivers/r300/r300_query.c | 9 +-- src/gallium/drivers/radeon/r600_pipe_common.c | 25 +--- src/gallium/drivers/radeon/r600_pipe_common.h | 1 + src/gallium/drivers/radeon/r600_query.c| 16 ++--- src/gallium/drivers/rbug/rbug_context.c| 8 ++- src/gallium/drivers/softpipe/sp_query.c| 3 +- src/gallium/drivers/svga/svga_context.h| 1 + src/gallium/drivers/svga/svga_pipe_query.c | 3 +- src/gallium/drivers/svga/svga_screen.c | 17 +- src/gallium/drivers/trace/tr_context.c | 6 +- src/gallium/include/pipe/p_context.h | 2 +- src/gallium/include/pipe/p_defines.h | 34 ++- src/gallium/include/pipe/p_screen.h| 11 src/mesa/Makefile.sources | 1 + src/mesa/state_tracker/st_cb_perfmon.c | 392 ++ src/mesa/state_tracker/st_cb_perfmon.h | 64 src/mesa/state_tracker/st_context.c| 4 ++ src/mesa/state_tracker/st_extensions.c | 3 + 39 files changed, 803 insertions(+), 70 deletions(-) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/15] nvc0: make begin_query return false when all MP counters are used v2
V2: - do not return immediately after nvc0_mp_pm_query_end() in order to set the current state of the given query Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c index cd11774..fcca1cb 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c @@ -56,7 +56,8 @@ struct nvc0_query { #define NVC0_QUERY_ALLOC_SPACE 256 -static void nvc0_mp_pm_query_begin(struct nvc0_context *, struct nvc0_query *); +static boolean nvc0_mp_pm_query_begin(struct nvc0_context *, + struct nvc0_query *); static void nvc0_mp_pm_query_end(struct nvc0_context *, struct nvc0_query *); static boolean nvc0_mp_pm_query_result(struct nvc0_context *, struct nvc0_query *, void *, boolean); @@ -256,6 +257,7 @@ nvc0_query_begin(struct pipe_context *pipe, struct pipe_query *pq) struct nvc0_context *nvc0 = nvc0_context(pipe); struct nouveau_pushbuf *push = nvc0->base.pushbuf; struct nvc0_query *q = nvc0_query(pq); + boolean ret = true; /* For occlusion queries we have to change the storage, because a previous * query might set the initial render conition to FALSE even *after* we re- @@ -327,12 +329,12 @@ nvc0_query_begin(struct pipe_context *pipe, struct pipe_query *pq) #endif if ((q->type >= NVE4_PM_QUERY(0) && q->type <= NVE4_PM_QUERY_LAST) || (q->type >= NVC0_PM_QUERY(0) && q->type <= NVC0_PM_QUERY_LAST)) { - nvc0_mp_pm_query_begin(nvc0, q); + ret = nvc0_mp_pm_query_begin(nvc0, q); } break; } q->state = NVC0_QUERY_STATE_ACTIVE; - return true; + return ret; } static void @@ -1063,7 +1065,7 @@ nvc0_mp_pm_query_get_cfg(struct nvc0_context *nvc0, struct nvc0_query *q) return &nvc0_mp_pm_queries[q->type - NVC0_PM_QUERY(0)]; } -void +boolean nvc0_mp_pm_query_begin(struct nvc0_context *nvc0, struct nvc0_query *q) { struct nvc0_screen *screen = nvc0->screen; @@ -1082,7 +1084,7 @@ nvc0_mp_pm_query_begin(struct nvc0_context *nvc0, struct nvc0_query *q) if (screen->pm.num_mp_pm_active[0] + num_ab[0] > 4 || screen->pm.num_mp_pm_active[1] + num_ab[1] > 4) { NOUVEAU_ERR("Not enough free MP counter slots !\n"); - return; + return false; } assert(cfg->num_counters <= 4); @@ -1147,6 +1149,7 @@ nvc0_mp_pm_query_begin(struct nvc0_context *nvc0, struct nvc0_query *q) } } } + return true; } static void -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/15] freedreno: implement pipe_screen::get_driver_query_group_info v4
This enables GL_AMD_performance_monitor for freedreno. V2: - s/pipe_context/pipe_screen in the commit msg V3: - use util_get_driver_query_group_info V4: - add FD_QUERY_COUNT in freedreno_query.h Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/freedreno/freedreno_query.c | 9 + src/gallium/drivers/freedreno/freedreno_query.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/gallium/drivers/freedreno/freedreno_query.c b/src/gallium/drivers/freedreno/freedreno_query.c index db2683c..13973a8 100644 --- a/src/gallium/drivers/freedreno/freedreno_query.c +++ b/src/gallium/drivers/freedreno/freedreno_query.c @@ -28,6 +28,7 @@ #include "pipe/p_state.h" #include "util/u_memory.h" +#include "util/u_query.h" #include "freedreno_query.h" #include "freedreno_query_sw.h" @@ -104,10 +105,18 @@ fd_get_driver_query_info(struct pipe_screen *pscreen, return 1; } +static int +fd_get_driver_query_group_info(struct pipe_screen *pscreen, + unsigned index, struct pipe_driver_query_group_info *info) +{ + return util_get_driver_query_group_info(index, FD_QUERY_COUNT, info); +} + void fd_query_screen_init(struct pipe_screen *pscreen) { pscreen->get_driver_query_info = fd_get_driver_query_info; + pscreen->get_driver_query_group_info = fd_get_driver_query_group_info; } void diff --git a/src/gallium/drivers/freedreno/freedreno_query.h b/src/gallium/drivers/freedreno/freedreno_query.h index c2c71da..9cee989 100644 --- a/src/gallium/drivers/freedreno/freedreno_query.h +++ b/src/gallium/drivers/freedreno/freedreno_query.h @@ -56,6 +56,7 @@ fd_query(struct pipe_query *pq) return (struct fd_query *)pq; } +#define FD_QUERY_COUNT 6 #define FD_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0) #define FD_QUERY_BATCH_TOTAL (PIPE_QUERY_DRIVER_SPECIFIC + 1) /* total # of batches (submits) */ #define FD_QUERY_BATCH_SYSMEM(PIPE_QUERY_DRIVER_SPECIFIC + 2) /* batches using system memory (GMEM bypass) */ -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/15] svga: implement pipe_screen::get_driver_query_group_info v4
This enables GL_AMD_performance_monitor for svga. V2: - s/pipe_context/pipe_screen in the commit msg V3: - use util_get_driver_query_group_info V4: - add SVGA_QUERY_COUNT in svga_context.h Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/svga/svga_context.h | 1 + src/gallium/drivers/svga/svga_screen.c | 11 +++ 2 files changed, 12 insertions(+) diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index a75f2a8..67f1816 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -45,6 +45,7 @@ /** Non-GPU queries for gallium HUD */ +#define SVGA_QUERY_COUNT3 #define SVGA_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0) #define SVGA_QUERY_FALLBACKS(PIPE_QUERY_DRIVER_SPECIFIC + 1) #define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 2) diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index f34664d..2e2f2bf 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -28,6 +28,7 @@ #include "util/u_inlines.h" #include "util/u_string.h" #include "util/u_math.h" +#include "util/u_query.h" #include "svga_winsys.h" #include "svga_public.h" @@ -555,6 +556,15 @@ svga_get_driver_query_info(struct pipe_screen *screen, } +static int +svga_get_driver_query_group_info(struct pipe_screen *screen, + unsigned index, + struct pipe_driver_query_group_info *info) +{ + return util_get_driver_query_group_info(index, SVGA_QUERY_COUNT, info); +} + + static void svga_destroy_screen( struct pipe_screen *screen ) { @@ -615,6 +625,7 @@ svga_screen_create(struct svga_winsys_screen *sws) screen->fence_signalled = svga_fence_signalled; screen->fence_finish = svga_fence_finish; screen->get_driver_query_info = svga_get_driver_query_info; + screen->get_driver_query_group_info = svga_get_driver_query_group_info; svgascreen->sws = sws; svga_init_screen_resource_functions(svgascreen); -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/15] gallium: make pipe_context::begin_query return a boolean
This can be used to check if a query is unable to start. Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/freedreno/freedreno_query.c| 4 ++-- src/gallium/drivers/freedreno/freedreno_query.h| 2 +- src/gallium/drivers/freedreno/freedreno_query_hw.c | 3 ++- src/gallium/drivers/freedreno/freedreno_query_sw.c | 3 ++- src/gallium/drivers/galahad/glhd_context.c | 6 +++--- src/gallium/drivers/i915/i915_query.c | 3 ++- src/gallium/drivers/identity/id_context.c | 6 +++--- src/gallium/drivers/ilo/ilo_query.c| 3 ++- src/gallium/drivers/llvmpipe/lp_query.c| 3 ++- src/gallium/drivers/noop/noop_pipe.c | 3 ++- src/gallium/drivers/nouveau/nv30/nv30_query.c | 5 +++-- src/gallium/drivers/nouveau/nv50/nv50_query.c | 3 ++- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 3 ++- src/gallium/drivers/r300/r300_query.c | 9 + src/gallium/drivers/radeon/r600_query.c| 16 +--- src/gallium/drivers/rbug/rbug_context.c| 8 +--- src/gallium/drivers/softpipe/sp_query.c| 3 ++- src/gallium/drivers/svga/svga_pipe_query.c | 3 ++- src/gallium/drivers/trace/tr_context.c | 6 -- src/gallium/include/pipe/p_context.h | 2 +- 20 files changed, 56 insertions(+), 38 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_query.c b/src/gallium/drivers/freedreno/freedreno_query.c index 6f01e03..db2683c 100644 --- a/src/gallium/drivers/freedreno/freedreno_query.c +++ b/src/gallium/drivers/freedreno/freedreno_query.c @@ -59,11 +59,11 @@ fd_destroy_query(struct pipe_context *pctx, struct pipe_query *pq) q->funcs->destroy_query(fd_context(pctx), q); } -static void +static boolean fd_begin_query(struct pipe_context *pctx, struct pipe_query *pq) { struct fd_query *q = fd_query(pq); - q->funcs->begin_query(fd_context(pctx), q); + return q->funcs->begin_query(fd_context(pctx), q); } static void diff --git a/src/gallium/drivers/freedreno/freedreno_query.h b/src/gallium/drivers/freedreno/freedreno_query.h index bc9a7a2..c2c71da 100644 --- a/src/gallium/drivers/freedreno/freedreno_query.h +++ b/src/gallium/drivers/freedreno/freedreno_query.h @@ -37,7 +37,7 @@ struct fd_query; struct fd_query_funcs { void (*destroy_query)(struct fd_context *ctx, struct fd_query *q); - void (*begin_query)(struct fd_context *ctx, struct fd_query *q); + boolean (*begin_query)(struct fd_context *ctx, struct fd_query *q); void (*end_query)(struct fd_context *ctx, struct fd_query *q); boolean (*get_query_result)(struct fd_context *ctx, struct fd_query *q, boolean wait, diff --git a/src/gallium/drivers/freedreno/freedreno_query_hw.c b/src/gallium/drivers/freedreno/freedreno_query_hw.c index 38bd3de..d0df719 100644 --- a/src/gallium/drivers/freedreno/freedreno_query_hw.c +++ b/src/gallium/drivers/freedreno/freedreno_query_hw.c @@ -136,7 +136,7 @@ fd_hw_begin_query(struct fd_context *ctx, struct fd_query *q) { struct fd_hw_query *hq = fd_hw_query(q); if (q->active) - return; + return true; /* begin_query() should clear previous results: */ destroy_periods(ctx, &hq->periods); @@ -149,6 +149,7 @@ fd_hw_begin_query(struct fd_context *ctx, struct fd_query *q) /* add to active list: */ list_del(&hq->list); list_addtail(&hq->list, &ctx->active_queries); + return true; } static void diff --git a/src/gallium/drivers/freedreno/freedreno_query_sw.c b/src/gallium/drivers/freedreno/freedreno_query_sw.c index 8d81698..514df14 100644 --- a/src/gallium/drivers/freedreno/freedreno_query_sw.c +++ b/src/gallium/drivers/freedreno/freedreno_query_sw.c @@ -85,7 +85,7 @@ is_rate_query(struct fd_query *q) } } -static void +static boolean fd_sw_begin_query(struct fd_context *ctx, struct fd_query *q) { struct fd_sw_query *sq = fd_sw_query(q); @@ -93,6 +93,7 @@ fd_sw_begin_query(struct fd_context *ctx, struct fd_query *q) sq->begin_value = read_counter(ctx, q->type); if (is_rate_query(q)) sq->begin_time = os_time_get(); + return true; } static void diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 79d5495..d02f13a 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -95,15 +95,15 @@ galahad_context_destroy_query(struct pipe_context *_pipe, query); } -static void +static boolean galahad_context_begin_query(struct pipe_context *_pipe, struct pipe_query *query) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; - pipe->begin_query(pipe, - qu
[Mesa-dev] [Bug 81174] Gallium: GL_LINE_LOOP broken with more than 512 points
https://bugs.freedesktop.org/show_bug.cgi?id=81174 --- Comment #6 from Marek Olšák --- vbo_save_api.c is for display lists. Direct execution is done in vbo_exec_api.c and vbo_exec_draw.c. Other than that, your understanding is correct. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: Optimize logic operation A || (A && B)
On 07/10/2014 03:31 PM, Matt Turner wrote: > On Thu, Jul 10, 2014 at 2:24 PM, wrote: >> From: Thomas Helland >> >> HURT: shaders/orbital_explorer.shader_test vs: 1049 -> 1052 >> (0.29%) > > There's something wrong with this shader. It seems to fluctuate > between 1048 and 1052 instructions for me, even without any changes. That's weird... is there some uninitialized memory usage that's leading to non-deterministic behavior? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: Optimize logic operation A || (A && B)
On 07/10/2014 04:12 PM, Brian Paul wrote: > On 07/10/2014 03:24 PM, thomashellan...@gmail.com wrote: >> From: Thomas Helland >> >> Let's cut the needless A && B here. >> Gives some effect on a clean shader-db with >> some extra shaders from TF2 and portal. >> >> helped: shaders/tf2/2042.shader_test fs16:23 -> 21 >> (-8.70%) >> helped: shaders/tf2/2042.shader_test fs8: 23 -> 21 >> (-8.70%) >> helped: shaders/tf2/4624.shader_test fs16:21 -> 19 >> (-9.52%) >> helped: shaders/tf2/4624.shader_test fs8: 21 -> 19 >> (-9.52%) >> helped: shaders/tf2/763.shader_test fs16: 23 -> 21 >> (-8.70%) >> helped: shaders/tf2/763.shader_test fs8: 23 -> 21 >> (-8.70%) >> >> HURT: shaders/orbital_explorer.shader_test vs: 1049 -> 1052 >> (0.29%) >> >> total instructions in shared programs: 758979 -> 758970 (-0.00%) >> instructions in affected programs: 1183 -> 1174 (-0.76%) >> GAINED:0 >> LOST: 0 >> >> Signed-off-by: Thomas Helland >> --- >> src/glsl/opt_algebraic.cpp | 10 ++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp >> index ac7514a..8f3a505 100644 >> --- a/src/glsl/opt_algebraic.cpp >> +++ b/src/glsl/opt_algebraic.cpp >> @@ -588,6 +588,16 @@ >> ir_algebraic_visitor::handle_expression(ir_expression *ir) >> } else if (ir->operands[0]->equals(ir->operands[1])) { >>/* (a || a) == a */ >>return ir->operands[0]; >> + } else if (op_expr[0] && op_expr[0]->operation == >> ir_binop_logic_and && >> +(op_expr[0]->operands[0]->equals(op_expr[1]) || >> + op_expr[0]->operands[1]->equals(op_expr[1]))) { >> + /* A || (A && B) or A || (B && A) */ >> + return ir->operands[0]; >> + } else if (op_expr[1] && op_expr[1]->operation == >> ir_binop_logic_and && >> +(op_expr[1]->operands[0]->equals(op_expr[0]) || >> + op_expr[1]->operands[1]->equals(op_expr[0]))) { >> + /* (A && B) || A or (B && A) || A */ >> + return ir->operands[1]; >> } >> break; >> >> > > It would be helpful if the comments indicated what the expression is > simplified to. Ex: > > /* A || (A && B) == A, or A || (B && A) == A */ > > But something else looks fishy here. The comments don't seem to agree > with the code, if I'm reading things right. It looks like the comments are backwards with the code. That is, /* (A && B) || A or (B && A) || A */ shouldbe with the op_expr[0] case instead of the op_expr[1] case. > BTW, looking at these algebraic simplifications in general, where do we > check for operands with side-effects? For example, in the "1^x == 1" > optimization, suppose x is a function call which modifies a global. > Removing x would be invalid, right? > > -Brian > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] Add a dumb drm/kms winsys for software rendering
From: Giovanni Campagna Add a new winsys and target that can be used with a dri2 state tracker and loader instead of drisw. This allows to use gbm as a dri2/image loader and avoid the extra copy from the backbuffer to the shadow frontbuffer. The new driver is called "kms_swrast", and is only loaded by gbm as a fallback, because it is only useful with the gbm platform (as no buffer sharing is possible) v2: [Emil Velikov] - Rebase on top of gallium megadriver. - s/text/test/ in configure.ac (Spotted by Andreas Pokorny). - Add scons support for winsys/sw/kms-dri and fix the build. Signed-off-by: Emil Velikov --- configure.ac | 5 + docs/relnotes/10.3.html| 2 + src/gallium/SConscript | 4 + .../auxiliary/target-helpers/inline_drm_helper.h | 45 ++- src/gallium/targets/dri/Makefile.am| 6 + src/gallium/targets/dri/SConscript | 4 + src/gallium/winsys/Makefile.am | 4 + src/gallium/winsys/sw/kms-dri/Makefile.am | 32 +++ src/gallium/winsys/sw/kms-dri/SConscript | 26 ++ src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 312 + src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.h | 37 +++ 11 files changed, 475 insertions(+), 2 deletions(-) create mode 100644 src/gallium/winsys/sw/kms-dri/Makefile.am create mode 100644 src/gallium/winsys/sw/kms-dri/SConscript create mode 100644 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c create mode 100644 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.h diff --git a/configure.ac b/configure.ac index 48f5f81..dc5be3f 100644 --- a/configure.ac +++ b/configure.ac @@ -1987,6 +1987,10 @@ if test -n "$with_gallium_drivers"; then if test "x$enable_dri" = xyes; then GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri/swrast" fi + +if test "x$have_libdrm" = xyes; then +GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri/kms-swrast" +fi ;; *) AC_MSG_ERROR([Unknown Gallium driver: $driver]) @@ -2223,6 +2227,7 @@ AC_CONFIG_FILES([Makefile src/gallium/winsys/svga/drm/Makefile src/gallium/winsys/sw/dri/Makefile src/gallium/winsys/sw/fbdev/Makefile + src/gallium/winsys/sw/kms-dri/Makefile src/gallium/winsys/sw/null/Makefile src/gallium/winsys/sw/wayland/Makefile src/gallium/winsys/sw/wrapper/Makefile diff --git a/docs/relnotes/10.3.html b/docs/relnotes/10.3.html index 2e718fc..b14466a 100644 --- a/docs/relnotes/10.3.html +++ b/docs/relnotes/10.3.html @@ -56,6 +56,8 @@ Note: some of the new features are only available with certain drivers. GL_ARB_seamless_cubemap_per_texture on i965, llvmpipe, nvc0, r600, radeonsi, softpipe GL_ARB_fragment_layer_viewport on nv50, nvc0, llvmpipe, r600 GL_AMD_vertex_shader_viewport_index on i965/gen7+, r600 +A new software rasterizer driver (kms_swrast_dri.so) that works with +DRM drivers that don't have a full-fledged GEM (such as qxl or simpledrm) diff --git a/src/gallium/SConscript b/src/gallium/SConscript index 8d9849e..cb61720 100644 --- a/src/gallium/SConscript +++ b/src/gallium/SConscript @@ -71,6 +71,10 @@ if env['dri']: ]) SConscript([ +'winsys/sw/kms-dri/SConscript', +]) + +SConscript([ 'winsys/svga/drm/SConscript', ]) diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h index bdd8669..5b15f28 100644 --- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h @@ -8,6 +8,11 @@ #include "dri_screen.h" #endif +#if GALLIUM_SOFTPIPE +#include "target-helpers/inline_sw_helper.h" +#include "sw/kms-dri/kms_dri_sw_winsys.h" +#endif + #if GALLIUM_I915 #include "i915/drm/i915_drm_public.h" #include "i915/i915_public.h" @@ -53,6 +58,33 @@ static char* driver_name = NULL; /* XXX: We need to teardown the winsys if *screen_create() fails. */ +#if GALLIUM_SOFTPIPE +#if defined(DRI_TARGET) + +const __DRIextension **__driDriverGetExtensions_kms_swrast(void); + +PUBLIC const __DRIextension **__driDriverGetExtensions_kms_swrast(void) +{ + globalDriverAPI = &galliumdrm_driver_api; + return galliumdrm_driver_extensions; +} + +static struct pipe_screen * +pipe_kms_swrast_create_screen(int fd) +{ + struct sw_winsys *sws; + struct pipe_screen *screen; + + sws = kms_dri_create_winsys(fd); + if (!sws) + return NULL; + + screen = sw_screen_create(sws); + return screen ? debug_screen_wrap(screen) : NULL; +} +#endif +#endif + #if defined(GALLIUM_I915) #if defined(DRI_TARGET) @@ -247,9 +279,18 @@ pipe_freedreno_create_screen(int fd) inline struct pipe_screen * dd_create_screen(int fd) { + struct pipe_screen *screen
[Mesa-dev] [PATCH 3/3] Add a new capabilities for drivers that can't share buffers
From: Giovanni Campagna The kms-dri swrast driver cannot share buffers using the GEM, so it must tell the loader to disable extensions relying on that, without disabling the image DRI extension altogheter (which would prevent the loader from working at all). This requires a new gallium capability (which is queried on the pipe_screen and for swrast drivers it's forwared to the winsys), and requires a new version of the DRI image extension. v2: Rebased [Emil Velikov] Signed-off-by: Emil Velikov --- include/GL/internal/dri_interface.h | 17 ++- src/egl/drivers/dri2/egl_dri2.c | 10 - src/egl/drivers/dri2/platform_drm.c | 14 ++-- src/gallium/docs/source/screen.rst| 4 src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c| 1 + src/gallium/drivers/ilo/ilo_screen.c | 2 ++ src/gallium/drivers/llvmpipe/lp_screen.c | 9 +++- 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 | 7 ++ src/gallium/drivers/svga/svga_screen.c| 3 +++ src/gallium/include/pipe/p_defines.h | 1 + src/gallium/include/state_tracker/sw_winsys.h | 5 + src/gallium/state_trackers/dri/dri2.c | 24 + src/gallium/state_trackers/dri/dri_screen.h | 1 + src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 26 --- 21 files changed, 119 insertions(+), 12 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 7c28c13..8c5ceb9 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1005,7 +1005,7 @@ struct __DRIdri2ExtensionRec { * extensions. */ #define __DRI_IMAGE "DRI_IMAGE" -#define __DRI_IMAGE_VERSION 9 +#define __DRI_IMAGE_VERSION 10 /** * These formats correspond to the similarly named MESA_FORMAT_* @@ -1134,6 +1134,13 @@ enum __DRIChromaSiting { /*@}*/ /** + * \name Capabilities that might be returned by __DRIimageExtensionRec::getCapabilities + */ +/*@{*/ +#define __DRI_IMAGE_CAP_GLOBAL_NAMES 1 +/*@}*/ + +/** * blitImage flags */ @@ -1261,6 +1268,14 @@ struct __DRIimageExtensionRec { int dstx0, int dsty0, int dstwidth, int dstheight, int srcx0, int srcy0, int srcwidth, int srcheight, int flush_flag); + + /** +* Query for general capabilities of the driver that concern +* buffer sharing and image importing. +* +* \since 10 +*/ + int (*getCapabilities)(__DRIscreen *screen); }; diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index cc7531c..5602ec3 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -518,7 +518,15 @@ dri2_setup_screen(_EGLDisplay *disp) } if (dri2_dpy->image) { - disp->Extensions.MESA_drm_image = EGL_TRUE; + if (dri2_dpy->image->base.version >= 10 && + dri2_dpy->image->getCapabilities != NULL) { + int capabilities; + + capabilities = dri2_dpy->image->getCapabilities(dri2_dpy->dri_screen); + disp->Extensions.MESA_drm_image = (capabilities & __DRI_IMAGE_CAP_GLOBAL_NAMES) != 0; + } else + disp->Extensions.MESA_drm_image = EGL_TRUE; + disp->Extensions.KHR_image_base = EGL_TRUE; disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE; if (dri2_dpy->image->base.version >= 5 && diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 23a8d27..e272beb 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -685,8 +685,18 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) disp->Extensions.EXT_buffer_age = EGL_TRUE; #ifdef HAVE_WAYLAND_PLATFORM - if (dri2_dpy->image) - disp->Extensions.WL_bind_wayland_display = EGL_TRUE; + if (dri2_dpy->image) { + if (dri2_dpy->image->base.version >= 10 && + dri2_dpy->image->getCapabilities != NULL) { + int capabilities; + + capabilities = + dri2_dpy->image->getCapabilities(dri2_dpy->dri_screen); + disp->Extensions.WL_bind_wayland_display = + (capabilities & __DRI_IMAGE_CAP_GLOBAL_NAMES) != 0; + } else + disp->Extensions.WL_bind_wayland_display = EGL_TRUE; + } #endif /* we're supporting EGL 1.4 */ diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index ba583fe..b09f18bd 100644 --- a/src/gallium/docs/sou
[Mesa-dev] [PATCH 1/3] Add support for swrast to the DRM EGL platform
From: Giovanni Campagna Turn GBM into a swrast loader (providing putimage/getimage backed by a dumb KMS buffer). This allows to run KMS+DRM GL applications (such as weston or mutter-wayland) unmodified on cards that don't have any client side HW acceleration component but that can do modeset (examples include simpledrm and qxl) v2: [Emil Velikov] - Fix make check. - Split dri_open_driver() from dri_load_driver(). - Don't try to bind the swrast extensions when using dri. - Handle swrast->CreateNewScreen() failure. - strdup the driver_name, as it's free'd at destruction. - Fallback to kms_swrast when seeking swrast+dumbbuffer. - s/LIBGL_ALWAYS_SOFTWARE/GBM_ALWAYS_SOFTWARE/ - Move gbm_dri_bo_map/unmap to gbm_driiint.h. Signed-off-by: Emil Velikov --- src/egl/drivers/dri2/platform_drm.c | 153 +++ src/gbm/backends/dri/gbm_dri.c | 203 +++- src/gbm/backends/dri/gbm_driint.h | 57 +- src/gbm/gbm-symbols-check | 1 + src/gbm/main/gbm.h | 3 + 5 files changed, 369 insertions(+), 48 deletions(-) diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 6227bc9..23a8d27 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -44,6 +44,7 @@ lock_front_buffer(struct gbm_surface *_surf) { struct gbm_dri_surface *surf = (struct gbm_dri_surface *) _surf; struct dri2_egl_surface *dri2_surf = surf->dri_private; + struct gbm_dri_device *device = (struct gbm_dri_device *) _surf->gbm; struct gbm_bo *bo; if (dri2_surf->current == NULL) { @@ -52,8 +53,11 @@ lock_front_buffer(struct gbm_surface *_surf) } bo = dri2_surf->current->bo; - dri2_surf->current->locked = 1; - dri2_surf->current = NULL; + + if (device->dri2) { + dri2_surf->current->locked = 1; + dri2_surf->current = NULL; + } return bo; } @@ -122,13 +126,22 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, goto cleanup_surf; } - dri2_surf->dri_drawable = - (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen, - dri2_conf->dri_double_config, - dri2_surf->gbm_surf); + if (dri2_dpy->dri2) { + dri2_surf->dri_drawable = + (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen, + dri2_conf->dri_double_config, + dri2_surf->gbm_surf); + + } else { + assert(dri2_dpy->swrast != NULL); + dri2_surf->dri_drawable = + (*dri2_dpy->swrast->createNewDrawable) (dri2_dpy->dri_screen, + dri2_conf->dri_double_config, + dri2_surf->gbm_surf); + } if (dri2_surf->dri_drawable == NULL) { - _eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable"); + _eglError(EGL_BAD_ALLOC, "createNewDrawable()"); goto cleanup_surf; } @@ -221,6 +234,28 @@ get_back_bo(struct dri2_egl_surface *dri2_surf) return 0; } +static int +get_swrast_front_bo(struct dri2_egl_surface *dri2_surf) +{ + struct dri2_egl_display *dri2_dpy = + dri2_egl_display(dri2_surf->base.Resource.Display); + struct gbm_dri_surface *surf = dri2_surf->gbm_surf; + + if (dri2_surf->current == NULL) { + assert(!dri2_surf->color_buffers[0].locked); + dri2_surf->current = &dri2_surf->color_buffers[0]; + } + + if (dri2_surf->current->bo == NULL) + dri2_surf->current->bo = gbm_bo_create(&dri2_dpy->gbm_dri->base.base, + surf->base.width, surf->base.height, + surf->base.format, surf->base.flags); + if (dri2_surf->current->bo == NULL) + return -1; + + return 0; +} + static void back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer) { @@ -374,19 +409,23 @@ dri2_drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); int i; - if (dri2_surf->base.Type == EGL_WINDOW_BIT) { - if (dri2_surf->current) -_eglError(EGL_BAD_SURFACE, "dri2_swap_buffers"); - for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) - if (dri2_surf->color_buffers[i].age > 0) -dri2_surf->color_buffers[i].age++; - dri2_surf->current = dri2_surf->back; - dri2_surf->current->age = 1; - dri2_surf->back = NULL; - } + if (dri2_dpy->swrast) { + (*dri2_dpy->core->swapBuffers)(dri2_surf->dri_drawable); + } else { + if (dri2_surf->base.Type == EGL_WINDOW_BIT) { + if (dri2_surf->current) +_eglError(EGL_BAD_SURFACE, "dri2_swap_buffers"); + for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) +if (dri2_surf->color
[Mesa-dev] [PATCH v4 0/3] Software rendering in EGL-DRM
Hello all, Here is hopefully the last iteration of Giovanni's patches, rebased on top of the buildsystem "mayhem" that I've caused recently. I've a few small changes in patch 1, most significant of which is s/LIBGL_ALWAYS_SOFTWARE/GBM_ALWAYS_SOFTWARE, as I think that having an LIBGL envvar to control gbm is ambiguous and may cause some unexpected issues. Giovanni can you please test that I haven't broken the series with megadrivers and/or during rebase. Thanks, Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Add an option to not generate the SIMD8 fragment shader
For now, this can only be triggered with a new 'no8' INTEL_DEBUG option Signed-off-by: Kristian Høgsberg --- src/mesa/drivers/dri/i965/brw_context.h | 2 ++ src/mesa/drivers/dri/i965/brw_fs.cpp | 14 -- src/mesa/drivers/dri/i965/gen7_wm_state.c | 4 ++-- src/mesa/drivers/dri/i965/gen8_ps_state.c | 4 ++-- src/mesa/drivers/dri/i965/intel_debug.c | 1 + src/mesa/drivers/dri/i965/intel_debug.h | 1 + 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 2943a20..11cea04 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -340,6 +340,7 @@ struct brw_wm_prog_data { /** @} */ } binding_table; + bool no_8; bool dual_src_blend; bool uses_pos_offset; bool uses_omask; @@ -1039,6 +1040,7 @@ struct brw_context bool has_compr4; bool has_negative_rhw_bug; bool has_pln; + bool no_simd8; /** * Some versions of Gen hardware don't do centroid interpolation correctly diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index a3ad375..f018d94 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3258,15 +3258,25 @@ brw_wm_fs_emit(struct brw_context *brw, } } + exec_list *simd8_instructions; + int no_simd8 = (INTEL_DEBUG & DEBUG_NO8) || brw->no_simd8; + if (no_simd8 && simd16_instructions) { + simd8_instructions = NULL; + prog_data->no_8 = true; + } else { + simd8_instructions = &v.instructions; + prog_data->no_8 = false; + } + const unsigned *assembly = NULL; if (brw->gen >= 8) { gen8_fs_generator g(brw, mem_ctx, key, prog_data, prog, fp, v.do_dual_src); - assembly = g.generate_assembly(&v.instructions, simd16_instructions, + assembly = g.generate_assembly(simd8_instructions, simd16_instructions, final_assembly_size); } else { fs_generator g(brw, mem_ctx, key, prog_data, prog, fp, v.do_dual_src, v.runtime_check_aads_emit, INTEL_DEBUG & DEBUG_WM); - assembly = g.generate_assembly(&v.instructions, simd16_instructions, + assembly = g.generate_assembly(simd8_instructions, simd16_instructions, final_assembly_size); } diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c index c03d19d..c3e9316 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c @@ -223,9 +223,9 @@ upload_ps_state(struct brw_context *brw) _mesa_get_min_invocations_per_fragment(ctx, brw->fragment_program, false); assert(min_inv_per_frag >= 1); - if (brw->wm.prog_data->prog_offset_16) { + if (brw->wm.prog_data->prog_offset_16 || brw->wm.prog_data->no_8) { dw4 |= GEN7_PS_16_DISPATCH_ENABLE; - if (min_inv_per_frag == 1) { + if (!brw->wm.prog_data->no_8 && min_inv_per_frag == 1) { dw4 |= GEN7_PS_8_DISPATCH_ENABLE; dw5 |= (brw->wm.prog_data->base.dispatch_grf_start_reg << GEN7_PS_DISPATCH_START_GRF_SHIFT_0); diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c b/src/mesa/drivers/dri/i965/gen8_ps_state.c index f58d49c..49d4fe0 100644 --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c @@ -195,9 +195,9 @@ upload_ps_state(struct brw_context *brw) _mesa_get_min_invocations_per_fragment(ctx, brw->fragment_program, false); assert(min_invocations_per_fragment >= 1); - if (brw->wm.prog_data->prog_offset_16) { + if (brw->wm.prog_data->prog_offset_16 || brw->wm.prog_data->no_8) { dw6 |= GEN7_PS_16_DISPATCH_ENABLE; - if (min_invocations_per_fragment == 1) { + if (!brw->wm.prog_data->no_8 && min_invocations_per_fragment == 1) { dw6 |= GEN7_PS_8_DISPATCH_ENABLE; dw7 |= (brw->wm.prog_data->base.dispatch_grf_start_reg << GEN7_PS_DISPATCH_START_GRF_SHIFT_0); diff --git a/src/mesa/drivers/dri/i965/intel_debug.c b/src/mesa/drivers/dri/i965/intel_debug.c index c72fce2..1fb8b6c 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.c +++ b/src/mesa/drivers/dri/i965/intel_debug.c @@ -66,6 +66,7 @@ static const struct dri_debug_control debug_control[] = { { "nodualobj", DEBUG_NO_DUAL_OBJECT_GS }, { "optimizer", DEBUG_OPTIMIZER }, { "noann", DEBUG_NO_ANNOTATION }, + { "no8", DEBUG_NO8 }, { NULL,0 } }; diff --git a/src/mesa/drivers/dri/i965/intel_debug.h b/src/mesa/drivers/dri/i965/intel_debug.h index 37dc34a..8e1c299 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.h +++ b/src/mesa/drivers/dri/i965/intel_debug.h @@ -62,6 +62,7 @@ extern uint64_t INTEL_DEBUG; #define DEBUG_NO_DUAL_OBJECT_GS 0x8000 #define DEBUG_OPTIMIZER 0x1 #define DEBUG_NO_ANNOTATION 0x2 +#define
Re: [Mesa-dev] [PATCH] i965: Add an option to not generate the SIMD8 fragment shader
On Fri, Jul 11, 2014 at 11:26 AM, Kristian Høgsberg wrote: > For now, this can only be triggered with a new 'no8' INTEL_DEBUG option > > Signed-off-by: Kristian Høgsberg > --- > src/mesa/drivers/dri/i965/brw_context.h | 2 ++ > src/mesa/drivers/dri/i965/brw_fs.cpp | 14 -- > src/mesa/drivers/dri/i965/gen7_wm_state.c | 4 ++-- > src/mesa/drivers/dri/i965/gen8_ps_state.c | 4 ++-- > src/mesa/drivers/dri/i965/intel_debug.c | 1 + > src/mesa/drivers/dri/i965/intel_debug.h | 1 + > 6 files changed, 20 insertions(+), 6 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_context.h > b/src/mesa/drivers/dri/i965/brw_context.h > index 2943a20..11cea04 100644 > --- a/src/mesa/drivers/dri/i965/brw_context.h > +++ b/src/mesa/drivers/dri/i965/brw_context.h > @@ -340,6 +340,7 @@ struct brw_wm_prog_data { >/** @} */ > } binding_table; > > + bool no_8; > bool dual_src_blend; > bool uses_pos_offset; > bool uses_omask; > @@ -1039,6 +1040,7 @@ struct brw_context > bool has_compr4; > bool has_negative_rhw_bug; > bool has_pln; > + bool no_simd8; I don't think you need this? These bools are for device-specific features. > > /** > * Some versions of Gen hardware don't do centroid interpolation correctly > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp > b/src/mesa/drivers/dri/i965/brw_fs.cpp > index a3ad375..f018d94 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp > @@ -3258,15 +3258,25 @@ brw_wm_fs_emit(struct brw_context *brw, >} > } > > + exec_list *simd8_instructions; > + int no_simd8 = (INTEL_DEBUG & DEBUG_NO8) || brw->no_simd8; > + if (no_simd8 && simd16_instructions) { ... it's only used here. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glapi: Use GetProcAddress instead of dlsym on Windows.
This patch fixes this MinGW build error. glapi_gentable.c: In function '_glapi_create_table_from_handle': glapi_gentable.c:123:9: error: implicit declaration of function 'dlsym' [-Werror=implicit-function-declaration] *procp = dlsym(handle, symboln); ^ Signed-off-by: Vinson Lee --- src/mapi/glapi/gen/gl_gentable.py | 4 1 file changed, 4 insertions(+) diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py index d45a5e0..9db6a77 100644 --- a/src/mapi/glapi/gen/gl_gentable.py +++ b/src/mapi/glapi/gen/gl_gentable.py @@ -134,7 +134,11 @@ body_template = """ if(!disp->%(name)s) { void ** procp = (void **) &disp->%(name)s; snprintf(symboln, sizeof(symboln), "%%s%(entry_point)s", symbol_prefix); +#ifdef _WIN32 +*procp = GetProcAddress(handle, symboln); +#else *procp = dlsym(handle, symboln); +#endif } """ -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Add an option to not generate the SIMD8 fragment shader
On Fri, Jul 11, 2014 at 11:35 AM, Matt Turner wrote: > On Fri, Jul 11, 2014 at 11:26 AM, Kristian Høgsberg > wrote: >> For now, this can only be triggered with a new 'no8' INTEL_DEBUG option >> >> Signed-off-by: Kristian Høgsberg >> --- >> src/mesa/drivers/dri/i965/brw_context.h | 2 ++ >> src/mesa/drivers/dri/i965/brw_fs.cpp | 14 -- >> src/mesa/drivers/dri/i965/gen7_wm_state.c | 4 ++-- >> src/mesa/drivers/dri/i965/gen8_ps_state.c | 4 ++-- >> src/mesa/drivers/dri/i965/intel_debug.c | 1 + >> src/mesa/drivers/dri/i965/intel_debug.h | 1 + >> 6 files changed, 20 insertions(+), 6 deletions(-) >> >> diff --git a/src/mesa/drivers/dri/i965/brw_context.h >> b/src/mesa/drivers/dri/i965/brw_context.h >> index 2943a20..11cea04 100644 >> --- a/src/mesa/drivers/dri/i965/brw_context.h >> +++ b/src/mesa/drivers/dri/i965/brw_context.h >> @@ -340,6 +340,7 @@ struct brw_wm_prog_data { >>/** @} */ >> } binding_table; >> >> + bool no_8; >> bool dual_src_blend; >> bool uses_pos_offset; >> bool uses_omask; >> @@ -1039,6 +1040,7 @@ struct brw_context >> bool has_compr4; >> bool has_negative_rhw_bug; >> bool has_pln; >> + bool no_simd8; > > I don't think you need this? These bools are for device-specific features. Right, not for this patch. It's there for compiling the replicated write shader I'm using in the fast clear work, but it's not used here. >> >> /** >> * Some versions of Gen hardware don't do centroid interpolation >> correctly >> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp >> b/src/mesa/drivers/dri/i965/brw_fs.cpp >> index a3ad375..f018d94 100644 >> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp >> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp >> @@ -3258,15 +3258,25 @@ brw_wm_fs_emit(struct brw_context *brw, >>} >> } >> >> + exec_list *simd8_instructions; >> + int no_simd8 = (INTEL_DEBUG & DEBUG_NO8) || brw->no_simd8; >> + if (no_simd8 && simd16_instructions) { > > ... it's only used here. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Avoid mesa_dri_drivers import lib being installed
On 11/07/14 14:39, Jon TURNEY wrote: > On Cygwin and MinGW, linking a shared library also generates an import library > > Use a wildcard which also matches the name of the megadriver import lib, > mesa_dri_drivers.dll.a, so that is also removed after megadriver symlinks are > created > > (This then matches src/gallium/targets/dri/Makefile.am, which already does > things this way) > Reviewed-by: Emil Velikov > Signed-off-by: Jon TURNEY > --- > src/mesa/drivers/dri/Makefile.am | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/src/mesa/drivers/dri/Makefile.am > b/src/mesa/drivers/dri/Makefile.am > index 37136b9..1a93645 100644 > --- a/src/mesa/drivers/dri/Makefile.am > +++ b/src/mesa/drivers/dri/Makefile.am > @@ -91,7 +91,6 @@ install-data-hook: > ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \ > $(DESTDIR)$(dridir)/$$i; \ > done; > - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so > - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.la > + $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.* > > endif > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] glsl: add a mechanism to allow #extension directives in the middle of shaders
Hi, Could somebody from Intel please have a look at this? Thanks, Marek On Tue, Jul 8, 2014 at 8:29 PM, Marek Olšák wrote: > From: Marek Olšák > > This is needed to make Unigine Heaven 4.0 and Unigine Valley 1.0 work > with sample shading. > > Also, if this is disabled, the error message at least makes sense now. > --- > src/glsl/glsl_parser.yy | 8 > src/glsl/glsl_parser_extras.cpp | 2 ++ > src/glsl/glsl_parser_extras.h | 2 ++ > src/mesa/main/mtypes.h | 5 + > 4 files changed, 17 insertions(+) > > diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy > index b989749..4c87163 100644 > --- a/src/glsl/glsl_parser.yy > +++ b/src/glsl/glsl_parser.yy > @@ -376,6 +376,14 @@ external_declaration_list: >if ($2 != NULL) > state->translation_unit.push_tail(& $2->link); > } > + | external_declaration_list extension_statement { > + if (!state->allow_extension_directive_midshader) { > + _mesa_glsl_error(& @2, state, > + "#extension directive is not allowed " > + "in the middle of a shader"); > + YYERROR; > + } > + } > ; > > variable_identifier: > diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp > index b327c2b..890123a 100644 > --- a/src/glsl/glsl_parser_extras.cpp > +++ b/src/glsl/glsl_parser_extras.cpp > @@ -210,6 +210,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct > gl_context *_ctx, > this->early_fragment_tests = false; > memset(this->atomic_counter_offsets, 0, >sizeof(this->atomic_counter_offsets)); > + this->allow_extension_directive_midshader = > + ctx->Const.AllowGLSLExtensionDirectiveMidShader; > } > > /** > diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h > index 1791816..f720d6a 100644 > --- a/src/glsl/glsl_parser_extras.h > +++ b/src/glsl/glsl_parser_extras.h > @@ -490,6 +490,8 @@ struct _mesa_glsl_parse_state { > > /** Atomic counter offsets by binding */ > unsigned atomic_counter_offsets[MAX_COMBINED_ATOMIC_BUFFERS]; > + > + bool allow_extension_directive_midshader; > }; > > # define YYLLOC_DEFAULT(Current, Rhs, N) \ > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > index a7126fd..b42a175 100644 > --- a/src/mesa/main/mtypes.h > +++ b/src/mesa/main/mtypes.h > @@ -3349,6 +3349,11 @@ struct gl_constants > GLuint ForceGLSLVersion; > > /** > +* Allow GLSL #extension directives in the middle of shaders. > +*/ > + GLboolean AllowGLSLExtensionDirectiveMidShader; > + > + /** > * Does the driver support real 32-bit integers? (Otherwise, integers are > * simulated via floats.) > */ > -- > 1.9.1 > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Mesa-dev Patch: Binding Atomic Buffers to mesa
Please always send patches to mesa-dev using git send-email. It has the same syntax as git format-patch, but it sends emails instead of creating files. How to set up git send-email with gmail: http://morefedora.blogspot.cz/2009/02/configuring-git-send-email-to-use-gmail.html This describes how commit messages should look like: http://lists.freedesktop.org/archives/mesa-dev/2014-July/062818.html Marek On Mon, Jul 7, 2014 at 3:30 PM, Aditya Avinash wrote: > Hi, > In src/mesa/main, the bindings for atomic buffers are made to > mesa_init_buffers, mesa_free_buffers, mesa_deletebuffers. > > Here are the two commits made on Jul 07 2014. > https://github.com/adityaatluri/mesa/commits/master > > > > -- > Regards, > Aditya Atluri, > USA. > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 80848] [dri3] Building mesa fails with dri3 enabled
https://bugs.freedesktop.org/show_bug.cgi?id=80848 Emil Velikov changed: What|Removed |Added Assignee|kei...@keithp.com |mesa-dev@lists.freedesktop. ||org --- Comment #6 from Emil Velikov --- So after a bit of tinkering with objdump, libxcb.so, libGL.so and mesa's sources the following files use core xcb functions: src/glx/create_context.c src/glx/tests/create_context_unittest.cpp src/glx/dri3_glx.c src/egl/drivers/dri2/platform_x11.c src/gallium/auxiliary/vl/vl_winsys_dri.c So we should be checking/linking against xcb in: libGL (unconditionally) libEGL (when building the x11 backend) libvdpau* (unconditionally) I'll prep a few patches that correctly link the libraries against libxcb. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 81139] Rendering sometimes halts in waiting for back buffers with dri3 & xwayland
https://bugs.freedesktop.org/show_bug.cgi?id=81139 --- Comment #12 from Axel Davy --- Have you rebuild mesa and xwayland after installing libxcb git ? I think I had accidentally scratched my libxcb installation by the arch package, but installing the libxcb git doesn't seem to be sufficient : I rebuilt Mesa and Xwayland, and can't reproduce the bug anymore. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] configure: check for core xcb (libxcb.so) and link libGL against it.
Make sure to check the presence of the module in order to pick the correct libs flag and before feeding them to the compiler/linker. Current libGL depends conditionally (when building with dri3) upon xcb 1.9.3 and unconditionally on ancient xcb functions - xcb_generate_id and xcb_request_check amongst others. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80848 Signed-off-by: Emil Velikov --- configure.ac | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 48f5f81..53941d2 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,7 @@ GLPROTO_REQUIRED=1.4.14 LIBOMXIL_BELLAGIO_REQUIRED=0.0 VDPAU_REQUIRED=0.4.1 WAYLAND_REQUIRED=1.2.0 +XCB_REQUIRED=1.9.3 XCBDRI2_REQUIRED=1.8 XCBGLX_REQUIRED=1.8.1 XSHMFENCE_REQUIRED=1.1 @@ -909,8 +910,9 @@ dnl case "x$enable_glx$enable_xlib_glx" in xyesyes) # Xlib-based GLX -PKG_CHECK_MODULES([XLIBGL], [x11 xext]) -GL_PC_REQ_PRIV="x11 xext" +dri_modules="x11 xext xcb" +PKG_CHECK_MODULES([XLIBGL], [$dri_modules]) +GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules" X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS" GL_LIB_DEPS="$XLIBGL_LIBS" GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS" @@ -921,7 +923,7 @@ xyesno) PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED]) # find the DRI deps for libGL -dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx >= $XCBGLX_REQUIRED" +dri_modules="x11 xext xdamage xfixes x11-xcb xcb xcb-glx >= $XCBGLX_REQUIRED" if test x"$driglx_direct" = xyes; then if test x"$dri_platform" = xdrm ; then @@ -942,6 +944,7 @@ xyesno) fi if test x"$enable_dri3" = xyes; then + PKG_CHECK_MODULES([TMPDRI3], [xcb >= $XCB_REQUIRED]) dri_modules="$dri_modules xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED" fi fi -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] configure: check for core xcb (libxcb.so) and link libEGL against it.
Make sure to check the presence of the module in order to pick the correct libs flag and before feeding them to the compiler/linker. Current libEGL depends conditionally (when building with x11 platform) upon xcb. Signed-off-by: Emil Velikov --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 53941d2..dd827be 100644 --- a/configure.ac +++ b/configure.ac @@ -1551,7 +1551,7 @@ for plat in $egl_platforms; do ;; x11) - PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 >= $XCBDRI2_REQUIRED xcb-xfixes]) + PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED xcb-xfixes]) ;; drm) -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] configure: check for core xcb (libxcb.so) and link VL targets against it.
Make sure to check the presence of the module in order to pick the correct libs flag and before feeding them to the compiler/linker. Current libXvMC*, libvdpau* and libomx_mesa depends unconditionally upon xcb, due to their usage of the aux/vl gellium module. Signed-off-by: Emil Velikov --- configure.ac | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index dd827be..7755741 100644 --- a/configure.ac +++ b/configure.ac @@ -1413,22 +1413,22 @@ if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then fi if test "x$enable_xvmc" = xyes; then -PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED x11-xcb xcb-dri2 >= $XCBDRI2_REQUIRED]) +PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED]) GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xvmc" enable_gallium_loader=yes fi AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes) if test "x$enable_vdpau" = xyes; then -PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED x11-xcb xcb-dri2 >= $XCBDRI2_REQUIRED], - [VDPAU_LIBS="`$PKG_CONFIG --libs x11-xcb xcb-dri2`"]) +PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED], + [VDPAU_LIBS="`$PKG_CONFIG --libs x11-xcb xcb xcb-dri2`"]) GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau" enable_gallium_loader=yes fi AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes) if test "x$enable_omx" = xyes; then -PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED x11-xcb xcb-dri2 >= $XCBDRI2_REQUIRED]) +PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED]) GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS omx" enable_gallium_loader=yes fi -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 80848] [dri3] Building mesa fails with dri3 enabled
https://bugs.freedesktop.org/show_bug.cgi?id=80848 --- Comment #7 from Emil Velikov --- Created attachment 102646 --> https://bugs.freedesktop.org/attachment.cgi?id=102646&action=edit configure: check for core xcb (libxcb.so) and link libGL against it This patch should resolve the problem. Can you give it a try ? -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa/st: add support for interpolate_at_* ops
Signed-off-by: Ilia Mirkin --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index f79c4d3..3202c56 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2042,6 +2042,15 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) */ emit(ir, TGSI_OPCODE_MAD, result_dst, op[0], op[1], op[2]); break; + case ir_unop_interpolate_at_centroid: + emit(ir, TGSI_OPCODE_INTERP_CENTROID, result_dst, op[0]); + break; + case ir_binop_interpolate_at_offset: + emit(ir, TGSI_OPCODE_INTERP_OFFSET, result_dst, op[0], op[1]); + break; + case ir_binop_interpolate_at_sample: + emit(ir, TGSI_OPCODE_INTERP_SAMPLE, result_dst, op[0], op[1]); + break; case ir_unop_pack_snorm_2x16: case ir_unop_pack_unorm_2x16: case ir_unop_pack_half_2x16: @@ -2063,9 +2072,6 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) case ir_binop_ldexp: case ir_binop_carry: case ir_binop_borrow: - case ir_unop_interpolate_at_centroid: - case ir_binop_interpolate_at_offset: - case ir_binop_interpolate_at_sample: /* This operation is not supported, or should have already been handled. */ assert(!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()"); -- 1.8.5.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 81139] Rendering sometimes halts in waiting for back buffers with dri3 & xwayland
https://bugs.freedesktop.org/show_bug.cgi?id=81139 --- Comment #13 from Boyan Ding --- (In reply to comment #12) > Have you rebuild mesa and xwayland after installing libxcb git ? Oh, I didn't. Things now works like a charm after the rebuild. The ABI has changed so rebuilding is necessary. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V4 0/6] i965 ARB_gpu_shader5 interpolateAt*
After a bunch of experiments with lowering schemes, I've come full circle, back to pretty much the same design as the RFC patches sent out some time ago. This series adds support for the ir_*_interpolate_at_* expression types in the i965 driver. The corresponding glsl parts have already landed. Big changes: - Just generally tidier! - Low-level support is updated to use the new brw_inst API. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V4 5/6] i965/fs: Skip channel expressions splitting for interpolation
The backend will have to do a message send, so we want to keep these in one piece, just like texture ops. Signed-off-by: Chris Forbes --- .../dri/i965/brw_fs_channel_expressions.cpp| 25 ++ 1 file changed, 25 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp index 9fe0ffc..4113f47 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp @@ -75,6 +75,18 @@ channel_expressions_predicate(ir_instruction *ir) if (!expr) return false; + switch (expr->operation) { + /* these opcodes need to act on the whole vector, + * just like texturing. + */ + case ir_unop_interpolate_at_centroid: + case ir_binop_interpolate_at_offset: + case ir_binop_interpolate_at_sample: + return false; + default: + break; + } + for (i = 0; i < expr->get_num_operands(); i++) { if (expr->operands[i]->type->is_vector()) return true; @@ -153,6 +165,16 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) if (!found_vector) return visit_continue; + switch (expr->operation) { + case ir_unop_interpolate_at_centroid: + case ir_binop_interpolate_at_offset: + case ir_binop_interpolate_at_sample: + return visit_continue; + + default: + break; + } + /* Store the expression operands in temps so we can use them * multiple times. */ @@ -414,6 +436,9 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) case ir_unop_unpack_half_2x16_split_x: case ir_unop_unpack_half_2x16_split_y: case ir_binop_pack_half_2x16_split: + case ir_unop_interpolate_at_centroid: + case ir_binop_interpolate_at_offset: + case ir_binop_interpolate_at_sample: unreachable("not reached: expression operates on scalars only"); } -- 2.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V4 3/6] i965: add low-level support for send to pixel interpolator
Signed-off-by: Chris Forbes --- src/mesa/drivers/dri/i965/brw_eu.h | 10 src/mesa/drivers/dri/i965/brw_eu_emit.c | 43 + 2 files changed, 53 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 3164c80..9ae09d7 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -372,6 +372,16 @@ brw_untyped_surface_read(struct brw_compile *p, unsigned msg_length, unsigned response_length); +void +brw_pixel_interpolator_query(struct brw_compile *p, + struct brw_reg dest, + struct brw_reg mrf, + bool noperspective, + GLuint mode, + GLuint data, + GLuint msg_length, + GLuint response_length); + /*** * brw_eu_util.c: */ diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 3f00e4d..0a1a223 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -2633,6 +2633,49 @@ brw_untyped_surface_read(struct brw_compile *p, brw_inst_access_mode(brw, insn) == BRW_ALIGN_1); } +static void +brw_set_pixel_interpolator_query_message(struct brw_compile *p, + struct brw_inst *insn, + bool noperspective, + GLuint mode, + GLuint data, + GLuint msg_length, + GLuint response_length) +{ + const struct brw_context *brw = p->brw; + const unsigned dispatch_width = + (brw_inst_exec_size(brw, insn) == BRW_EXECUTE_16 ? 16 : 8); + + brw_set_message_descriptor(p, insn, GEN7_SFID_PIXEL_INTERPOLATOR, + msg_length, response_length, + false /* header is never present for PI */, + false); + + brw_inst_set_pi_simd_mode(brw, insn, dispatch_width == 16); + brw_inst_set_pi_slot_group(brw, insn, 0); /* zero unless 32/64px dispatch */ + brw_inst_set_pi_nopersp(brw, insn, noperspective); + brw_inst_set_pi_message_type(brw, insn, mode); + brw_inst_set_pi_message_data(brw, insn, data); +} + +void +brw_pixel_interpolator_query(struct brw_compile *p, + struct brw_reg dest, + struct brw_reg mrf, + bool noperspective, + GLuint mode, + GLuint data, + GLuint msg_length, + GLuint response_length) +{ + struct brw_inst *insn = next_insn(p, BRW_OPCODE_SEND); + + brw_set_dest(p, insn, dest); + brw_set_src0(p, insn, mrf); + brw_set_pixel_interpolator_query_message( + p, insn, noperspective, mode, data, msg_length, response_length); +} + /** * This instruction is generated as a single-channel align1 instruction by * both the VS and FS stages when using INTEL_DEBUG=shader_time. -- 2.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V4 1/6] i965: Add message descriptor bit definitions for pixel interpolator
These got lost in the big brw_inst shakeup. Signed-off-by: Chris Forbes --- src/mesa/drivers/dri/i965/brw_defines.h | 5 + src/mesa/drivers/dri/i965/brw_inst.h| 11 +++ 2 files changed, 16 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 0dadcb3..e528232 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -1295,6 +1295,11 @@ enum brw_message_target { (1 << 17)) #define GEN7_DATAPORT_SCRATCH_NUM_REGS_SHIFT12 +#define GEN7_PIXEL_INTERPOLATOR_LOC_SHARED_OFFSET 0 +#define GEN7_PIXEL_INTERPOLATOR_LOC_SAMPLE1 +#define GEN7_PIXEL_INTERPOLATOR_LOC_CENTROID 2 +#define GEN7_PIXEL_INTERPOLATOR_LOC_PER_SLOT_OFFSET 3 + /* HSW */ #define HSW_DATAPORT_DC_PORT0_OWORD_BLOCK_READ 0 #define HSW_DATAPORT_DC_PORT0_UNALIGNED_OWORD_BLOCK_READ1 diff --git a/src/mesa/drivers/dri/i965/brw_inst.h b/src/mesa/drivers/dri/i965/brw_inst.h index ac00fd4..e880c9f 100644 --- a/src/mesa/drivers/dri/i965/brw_inst.h +++ b/src/mesa/drivers/dri/i965/brw_inst.h @@ -527,6 +527,17 @@ F(ts_opcode, MD( 0), MD( 0)) /** @} */ /** + * Pixel Interpolator message function control bits: + * @{ + */ +F(pi_simd_mode, MD(16), MD(16)) +F(pi_nopersp,MD(14), MD(14)) +F(pi_message_type, MD(13), MD(12)) +F(pi_slot_group, MD(11), MD(11)) +F(pi_message_data, MD(7), MD(0)) +/** @} */ + +/** * Immediates: * @{ */ -- 2.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V4 6/6] i965/fs: add support for ir_*_interpolate_at_* expressions
SIMD8-only for now. Signed-off-by: Chris Forbes --- src/mesa/drivers/dri/i965/brw_fs.h | 1 + src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 135 ++- 2 files changed, 134 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 48f1069..0bb328a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -390,6 +390,7 @@ public: const fs_reg &src0, const fs_reg &src1); bool try_emit_saturate(ir_expression *ir); bool try_emit_mad(ir_expression *ir); + void emit_interpolate_expression(ir_expression *ir); void try_replace_with_sel(); bool opt_peephole_sel(); bool opt_peephole_predicated_break(); diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 8e8affa..2f37986 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -344,6 +344,118 @@ fs_visitor::try_emit_mad(ir_expression *ir) return true; } +static int +pack_pixel_offset(float x) +{ + int n = MIN2((int)(x * 16), 7); + return n & 0xf; +} + +void +fs_visitor::emit_interpolate_expression(ir_expression *ir) +{ + /* in SIMD16 mode, the pixel interpolator returns coords interleaved +* 8 channels at a time, same as the barycentric coords presented in +* the FS payload. this requires a bit of extra work to support. +*/ + no16("interpolate_at_* not yet supported in SIMD16 mode."); + + ir_dereference * deref = ir->operands[0]->as_dereference(); + ir_swizzle * swiz = NULL; + if (!deref) { + /* the api does not allow a swizzle here, but the varying packing code + * may have pushed one into here. + */ + swiz = ir->operands[0]->as_swizzle(); + assert(swiz); + deref = swiz->val->as_dereference(); + } + assert(deref); + ir_variable * var = deref->variable_referenced(); + assert(var); + + /* 1. collect interpolation factors */ + + fs_reg dst_x = fs_reg(this, glsl_type::get_instance(ir->type->base_type, 2, 1)); + fs_reg dst_y = dst_x; + dst_y.reg_offset++; + + /* for most messages, we need one reg of ignored data; the hardware requires mlen==1 +* even when there is no payload. in the per-slot offset case, we'll replace this with +* the proper source data. */ + fs_reg src = fs_reg(this, glsl_type::float_type); + int mlen = 1; /* one reg unless overriden */ + int msg_type = 0; /* message type to be packed into the descriptor */ + int imm_data = 0; /* data to be packed into the message descriptor */ + + switch (ir->operation) { + case ir_unop_interpolate_at_centroid: + { + msg_type = GEN7_PIXEL_INTERPOLATOR_LOC_CENTROID; + } break; + + case ir_binop_interpolate_at_sample: + { + ir_constant *sample_num = ir->operands[1]->as_constant(); + assert(sample_num || !"nonconstant sample number should have been lowered."); + + msg_type = GEN7_PIXEL_INTERPOLATOR_LOC_SAMPLE; + imm_data = sample_num->value.i[0] << 4; + } break; + + case ir_binop_interpolate_at_offset: + { + ir_constant *const_offset = ir->operands[1]->as_constant(); + if (const_offset) { +msg_type = GEN7_PIXEL_INTERPOLATOR_LOC_SHARED_OFFSET; +imm_data = pack_pixel_offset(const_offset->value.f[0]) | + (pack_pixel_offset(const_offset->value.f[1]) << 4); + } else { +/* pack the operands: hw wants offsets as 4 bit signed ints */ +ir->operands[1]->accept(this); +src = fs_reg(this, glsl_type::ivec2_type); +fs_reg src2 = src; +for (int i = 0; i < 2; i++) { + fs_reg temp = fs_reg(this, glsl_type::float_type); + emit(MUL(temp, this->result, fs_reg(16.0f))); + emit(MOV(src2, temp)); /* float to int */ + fs_inst *inst = emit(BRW_OPCODE_SEL, src2, src2, fs_reg(7)); + inst->conditional_mod = BRW_CONDITIONAL_L; /* min(src2, 7) */ + + src2.reg_offset++; + this->result.reg_offset++; +} + +mlen = 2 * dispatch_width / 8; +msg_type = GEN7_PIXEL_INTERPOLATOR_LOC_PER_SLOT_OFFSET; + } + } break; + + default: + unreachable("not reached"); + } + + fs_inst *inst = emit(FS_OPCODE_PIXEL_INTERPOLATOR_QUERY, dst_x, src); + inst->mlen = mlen; + inst->regs_written = 2 * dispatch_width / 8; /* 2 floats per slot returned */ + inst->pi_noperspective = var->determine_interpolation_mode(key->flat_shade) == INTERP_QUALIFIER_NOPERSPECTIVE; + inst->pi_msg_type = msg_type; + inst->pi_msg_data = imm_data; + + /* 2. emit linterp */ + + fs_reg res(this, ir->type); + this->result = res; + + for (int i = 0; i < ir->type->vector_elements; i++) { + int ch = swiz ? ((*(int *)&swiz->mask) >> 2*i)
[Mesa-dev] [PATCH V4 2/6] i965/disasm: add support for pixel interpolator messages
V3: Rework for brw_inst changes Signed-off-by: Chris Forbes --- src/mesa/drivers/dri/i965/brw_disasm.c | 17 + 1 file changed, 17 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index f37da19..d7362c1 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -473,6 +473,13 @@ static const char *const aop[16] = { [BRW_AOP_PREDEC] = "predec", }; +static const char * const pixel_interpolator_msg_types[4] = { +[GEN7_PIXEL_INTERPOLATOR_LOC_SHARED_OFFSET] = "per_message_offset", +[GEN7_PIXEL_INTERPOLATOR_LOC_SAMPLE] = "sample_position", +[GEN7_PIXEL_INTERPOLATOR_LOC_CENTROID] = "centroid", +[GEN7_PIXEL_INTERPOLATOR_LOC_PER_SLOT_OFFSET] = "per_slot_offset", +}; + static const char *const math_function[16] = { [BRW_MATH_FUNCTION_INV]= "inv", [BRW_MATH_FUNCTION_LOG]= "log", @@ -1473,6 +1480,16 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst, /* FALLTHROUGH */ } + case GEN7_SFID_PIXEL_INTERPOLATOR: +if (brw->gen >= 7) { + format(file, " (%s, %s, 0x%02x)", + brw_inst_pi_nopersp(brw, inst) ? "linear" : "persp", + pixel_interpolator_msg_types[brw_inst_pi_message_type(brw, inst)], + brw_inst_pi_message_data(brw, inst)); + break; +} +/* FALLTHROUGH */ + default: format(file, "unsupported shared function ID %d", sfid); break; -- 2.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V4 4/6] i965/fs: add generator support for pixel interpolator query
Signed-off-by: Chris Forbes --- src/mesa/drivers/dri/i965/brw_defines.h| 1 + src/mesa/drivers/dri/i965/brw_fs.cpp | 2 ++ src/mesa/drivers/dri/i965/brw_fs.h | 4 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 19 +++ src/mesa/drivers/dri/i965/brw_shader.h | 6 ++ 5 files changed, 32 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index e528232..b4428c1 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -853,6 +853,7 @@ enum opcode { FS_OPCODE_UNPACK_HALF_2x16_SPLIT_X, FS_OPCODE_UNPACK_HALF_2x16_SPLIT_Y, FS_OPCODE_PLACEHOLDER_HALT, + FS_OPCODE_PIXEL_INTERPOLATOR_QUERY, VS_OPCODE_URB_WRITE, VS_OPCODE_PULL_CONSTANT_LOAD, diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index a3ad375..f431eff 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -370,6 +370,7 @@ fs_inst::is_send_from_grf() const { return (opcode == FS_OPCODE_VARYING_PULL_CONSTANT_LOAD_GEN7 || opcode == SHADER_OPCODE_SHADER_TIME_ADD || + opcode == FS_OPCODE_PIXEL_INTERPOLATOR_QUERY || (opcode == FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD && src[1].file == GRF) || (is_tex() && src[0].file == GRF)); @@ -837,6 +838,7 @@ fs_visitor::implied_mrf_writes(fs_inst *inst) return 2; case SHADER_OPCODE_UNTYPED_ATOMIC: case SHADER_OPCODE_UNTYPED_SURFACE_READ: + case FS_OPCODE_PIXEL_INTERPOLATOR_QUERY: return 0; default: unreachable("not reached"); diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 537f10e..48f1069 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -623,6 +623,10 @@ private: struct brw_reg offset); void generate_mov_dispatch_to_flags(fs_inst *inst); + void generate_pixel_interpolator_query(fs_inst *inst, + struct brw_reg dst, + struct brw_reg src); + void generate_set_omask(fs_inst *inst, struct brw_reg dst, struct brw_reg sample_mask); diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index eae55f0..fcc9a7d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -995,6 +995,21 @@ fs_generator::generate_mov_dispatch_to_flags(fs_inst *inst) brw_pop_insn_state(p); } +void +fs_generator::generate_pixel_interpolator_query(fs_inst *inst, +struct brw_reg dst, +struct brw_reg src) +{ + brw_pixel_interpolator_query(p, + retype(dst, BRW_REGISTER_TYPE_UW), + src, + inst->pi_noperspective, + inst->pi_msg_type, + inst->pi_msg_data, + inst->mlen, + inst->regs_written); +} + static uint32_t brw_file_from_reg(fs_reg *reg) { @@ -1730,6 +1745,10 @@ fs_generator::generate_code(exec_list *instructions) } break; + case FS_OPCODE_PIXEL_INTERPOLATOR_QUERY: + generate_pixel_interpolator_query(inst, dst, src[0]); + break; + default: if (inst->opcode < (int) ARRAY_SIZE(opcode_descs)) { _mesa_problem(ctx, "Unsupported opcode `%s' in FS", diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h index cfaea9e..6ccc148 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.h +++ b/src/mesa/drivers/dri/i965/brw_shader.h @@ -112,6 +112,12 @@ struct backend_instruction { uint8_t mlen; /**< SEND message length */ int8_t base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */ uint8_t target; /**< MRT target. */ + struct { + /* Descriptor parameters for pixel interpolator messages */ + uint32_t pi_noperspective: 1; + uint32_t pi_msg_type: 3; + uint32_t pi_msg_data: 8; + }; enum opcode opcode; /* BRW_OPCODE_* or FS_OPCODE_* */ enum brw_conditional_mod conditional_mod; /**< BRW_CONDITIONAL_* */ -- 2.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] i965/vec4: Invalidate live intervals in opt_cse, not _local.
--- src/mesa/drivers/dri/i965/brw_vec4_cse.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp index 7bb016d..83c7eb8 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp @@ -244,9 +244,6 @@ vec4_visitor::opt_cse_local(bblock_t *block) ralloc_free(cse_ctx); - if (progress) - invalidate_live_intervals(); - return progress; } @@ -265,5 +262,8 @@ vec4_visitor::opt_cse() progress = opt_cse_local(block) || progress; } + if (progress) + invalidate_live_intervals(); + return progress; } -- 1.8.5.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] i965/vec4: Move aeb list into opt_cse_local.
--- src/mesa/drivers/dri/i965/brw_vec4.h | 2 +- src/mesa/drivers/dri/i965/brw_vec4_cse.cpp | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index 87247ea..3d0df77 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -384,7 +384,7 @@ public: bool dead_code_eliminate(); bool virtual_grf_interferes(int a, int b); bool opt_copy_propagation(); - bool opt_cse_local(bblock_t *, exec_list *); + bool opt_cse_local(bblock_t *block); bool opt_cse(); bool opt_algebraic(); bool opt_register_coalesce(); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp index eeaa743..7bb016d 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp @@ -124,9 +124,10 @@ instructions_match(vec4_instruction *a, vec4_instruction *b) } bool -vec4_visitor::opt_cse_local(bblock_t *block, exec_list *aeb) +vec4_visitor::opt_cse_local(bblock_t *block) { bool progress = false; + exec_list aeb; void *cse_ctx = ralloc_context(NULL); @@ -141,7 +142,7 @@ vec4_visitor::opt_cse_local(bblock_t *block, exec_list *aeb) { bool found = false; - foreach_in_list_use_after(aeb_entry, entry, aeb) { + foreach_in_list_use_after(aeb_entry, entry, &aeb) { /* Match current instruction's expression against those in AEB. */ if (instructions_match(inst, entry->generator)) { found = true; @@ -155,7 +156,7 @@ vec4_visitor::opt_cse_local(bblock_t *block, exec_list *aeb) aeb_entry *entry = ralloc(cse_ctx, aeb_entry); entry->tmp = src_reg(); /* file will be BAD_FILE */ entry->generator = inst; -aeb->push_tail(entry); +aeb.push_tail(entry); } else { /* This is at least our second sighting of this expression. * If we don't have a temporary already, make one. @@ -196,7 +197,7 @@ vec4_visitor::opt_cse_local(bblock_t *block, exec_list *aeb) } } - foreach_in_list_safe(aeb_entry, entry, aeb) { + foreach_in_list_safe(aeb_entry, entry, &aeb) { /* Kill all AEB entries that write a different value to or read from * the flag register if we just wrote it. */ @@ -260,9 +261,8 @@ vec4_visitor::opt_cse() for (int b = 0; b < cfg.num_blocks; b++) { bblock_t *block = cfg.blocks[b]; - exec_list aeb; - progress = opt_cse_local(block, &aeb) || progress; + progress = opt_cse_local(block) || progress; } return progress; -- 1.8.5.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] i965/fs: Move aeb list into opt_cse_local.
--- src/mesa/drivers/dri/i965/brw_fs.h | 2 +- src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 537f10e..4fb73cf 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -333,7 +333,7 @@ public: void calculate_register_pressure(); bool opt_algebraic(); bool opt_cse(); - bool opt_cse_local(bblock_t *block, exec_list *aeb); + bool opt_cse_local(bblock_t *block); bool opt_copy_propagate(); bool try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry); bool opt_copy_propagate_local(void *mem_ctx, bblock_t *block, diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp index 7226aff..43f2e19 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp @@ -166,9 +166,10 @@ instructions_match(fs_inst *a, fs_inst *b) } bool -fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb) +fs_visitor::opt_cse_local(bblock_t *block) { bool progress = false; + exec_list aeb; void *cse_ctx = ralloc_context(NULL); @@ -180,7 +181,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb) { bool found = false; - foreach_in_list_use_after(aeb_entry, entry, aeb) { + foreach_in_list_use_after(aeb_entry, entry, &aeb) { /* Match current instruction's expression against those in AEB. */ if (instructions_match(inst, entry->generator)) { found = true; @@ -194,7 +195,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb) aeb_entry *entry = ralloc(cse_ctx, aeb_entry); entry->tmp = reg_undef; entry->generator = inst; -aeb->push_tail(entry); +aeb.push_tail(entry); } else { /* This is at least our second sighting of this expression. * If we don't have a temporary already, make one. @@ -264,7 +265,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb) } } - foreach_in_list_safe(aeb_entry, entry, aeb) { + foreach_in_list_safe(aeb_entry, entry, &aeb) { /* Kill all AEB entries that write a different value to or read from * the flag register if we just wrote it. */ @@ -322,9 +323,8 @@ fs_visitor::opt_cse() for (int b = 0; b < cfg.num_blocks; b++) { bblock_t *block = cfg.blocks[b]; - exec_list aeb; - progress = opt_cse_local(block, &aeb) || progress; + progress = opt_cse_local(block) || progress; } return progress; -- 1.8.5.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] i965/fs: Invalidate live intervals in opt_cse, not _local.
--- src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp index 43f2e19..d435d84 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp @@ -307,9 +307,6 @@ fs_visitor::opt_cse_local(bblock_t *block) ralloc_free(cse_ctx); - if (progress) - invalidate_live_intervals(); - return progress; } @@ -327,5 +324,8 @@ fs_visitor::opt_cse() progress = opt_cse_local(block) || progress; } + if (progress) + invalidate_live_intervals(); + return progress; } -- 1.8.5.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V4 3/6] i965: add low-level support for send to pixel interpolator
On Saturday, July 12, 2014 03:20:12 PM Chris Forbes wrote: > Signed-off-by: Chris Forbes > --- > src/mesa/drivers/dri/i965/brw_eu.h | 10 > src/mesa/drivers/dri/i965/brw_eu_emit.c | 43 + > 2 files changed, 53 insertions(+) > > diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h > index 3164c80..9ae09d7 100644 > --- a/src/mesa/drivers/dri/i965/brw_eu.h > +++ b/src/mesa/drivers/dri/i965/brw_eu.h > @@ -372,6 +372,16 @@ brw_untyped_surface_read(struct brw_compile *p, > unsigned msg_length, > unsigned response_length); > > +void > +brw_pixel_interpolator_query(struct brw_compile *p, > + struct brw_reg dest, > + struct brw_reg mrf, > + bool noperspective, > + GLuint mode, > + GLuint data, > + GLuint msg_length, > + GLuint response_length); > + > /*** > * brw_eu_util.c: > */ > diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c > index 3f00e4d..0a1a223 100644 > --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c > +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c > @@ -2633,6 +2633,49 @@ brw_untyped_surface_read(struct brw_compile *p, >brw_inst_access_mode(brw, insn) == BRW_ALIGN_1); > } > > +static void > +brw_set_pixel_interpolator_query_message(struct brw_compile *p, > + struct brw_inst *insn, > + bool noperspective, > + GLuint mode, > + GLuint data, > + GLuint msg_length, > + GLuint response_length) > +{ > + const struct brw_context *brw = p->brw; > + const unsigned dispatch_width = > + (brw_inst_exec_size(brw, insn) == BRW_EXECUTE_16 ? 16 : 8); > + > + brw_set_message_descriptor(p, insn, GEN7_SFID_PIXEL_INTERPOLATOR, > + msg_length, response_length, > + false /* header is never present for PI */, > + false); > + > + brw_inst_set_pi_simd_mode(brw, insn, dispatch_width == 16); > + brw_inst_set_pi_slot_group(brw, insn, 0); /* zero unless 32/64px dispatch */ > + brw_inst_set_pi_nopersp(brw, insn, noperspective); > + brw_inst_set_pi_message_type(brw, insn, mode); > + brw_inst_set_pi_message_data(brw, insn, data); > +} > + > +void > +brw_pixel_interpolator_query(struct brw_compile *p, > + struct brw_reg dest, > + struct brw_reg mrf, > + bool noperspective, > + GLuint mode, > + GLuint data, > + GLuint msg_length, > + GLuint response_length) > +{ > + struct brw_inst *insn = next_insn(p, BRW_OPCODE_SEND); > + > + brw_set_dest(p, insn, dest); > + brw_set_src0(p, insn, mrf); > + brw_set_pixel_interpolator_query_message( > + p, insn, noperspective, mode, data, msg_length, response_length); > +} > + > /** > * This instruction is generated as a single-channel align1 instruction by > * both the VS and FS stages when using INTEL_DEBUG=shader_time. > What do you think about combining these two functions? I know we've always defined separate brw_set_*_message functions, but I'm not really convinced that it's useful to do so. I can't imagine brw_set_pixel_interpolator_query_message would be called by anything other than brw_pixel_interpolator_query. Either way's fine - it's just an idea. Patches 1-3 are: Reviewed-by: Kenneth Graunke signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V4 1/6] i965: Add message descriptor bit definitions for pixel interpolator
On Saturday, July 12, 2014 03:20:10 PM Chris Forbes wrote: > These got lost in the big brw_inst shakeup. > > Signed-off-by: Chris Forbes > --- > src/mesa/drivers/dri/i965/brw_defines.h | 5 + > src/mesa/drivers/dri/i965/brw_inst.h| 11 +++ > 2 files changed, 16 insertions(+) > > diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h > index 0dadcb3..e528232 100644 > --- a/src/mesa/drivers/dri/i965/brw_defines.h > +++ b/src/mesa/drivers/dri/i965/brw_defines.h > @@ -1295,6 +1295,11 @@ enum brw_message_target { > (1 << 17)) > #define GEN7_DATAPORT_SCRATCH_NUM_REGS_SHIFT12 > > +#define GEN7_PIXEL_INTERPOLATOR_LOC_SHARED_OFFSET 0 > +#define GEN7_PIXEL_INTERPOLATOR_LOC_SAMPLE1 > +#define GEN7_PIXEL_INTERPOLATOR_LOC_CENTROID 2 > +#define GEN7_PIXEL_INTERPOLATOR_LOC_PER_SLOT_OFFSET 3 > + > /* HSW */ > #define HSW_DATAPORT_DC_PORT0_OWORD_BLOCK_READ 0 > #define HSW_DATAPORT_DC_PORT0_UNALIGNED_OWORD_BLOCK_READ1 > diff --git a/src/mesa/drivers/dri/i965/brw_inst.h b/src/mesa/drivers/dri/i965/brw_inst.h > index ac00fd4..e880c9f 100644 > --- a/src/mesa/drivers/dri/i965/brw_inst.h > +++ b/src/mesa/drivers/dri/i965/brw_inst.h > @@ -527,6 +527,17 @@ F(ts_opcode, MD( 0), MD( 0)) > /** @} */ > > /** > + * Pixel Interpolator message function control bits: > + * @{ > + */ > +F(pi_simd_mode, MD(16), MD(16)) > +F(pi_nopersp,MD(14), MD(14)) > +F(pi_message_type, MD(13), MD(12)) > +F(pi_slot_group, MD(11), MD(11)) > +F(pi_message_data, MD(7), MD(0)) Most other messages call this msg_control (so, pi_msg_control). Any particular reason not to do that here? I guess it's more payload data than message control bits, but... Whatever you want to do is fine. > +/** @} */ > + > +/** > * Immediates: > * @{ > */ > signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V4 5/6] i965/fs: Skip channel expressions splitting for interpolation
On Saturday, July 12, 2014 03:20:14 PM Chris Forbes wrote: > The backend will have to do a message send, so we want to keep these in > one piece, just like texture ops. > > Signed-off-by: Chris Forbes > --- > .../dri/i965/brw_fs_channel_expressions.cpp| 25 ++ > 1 file changed, 25 insertions(+) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp > index 9fe0ffc..4113f47 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp > @@ -75,6 +75,18 @@ channel_expressions_predicate(ir_instruction *ir) > if (!expr) >return false; > > + switch (expr->operation) { > + /* these opcodes need to act on the whole vector, > + * just like texturing. > + */ > + case ir_unop_interpolate_at_centroid: > + case ir_binop_interpolate_at_offset: > + case ir_binop_interpolate_at_sample: > + return false; > + default: > + break; > + } > + > for (i = 0; i < expr->get_num_operands(); i++) { >if (expr->operands[i]->type->is_vector()) >return true; > @@ -153,6 +165,16 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) > if (!found_vector) >return visit_continue; > > + switch (expr->operation) { > + case ir_unop_interpolate_at_centroid: > + case ir_binop_interpolate_at_offset: > + case ir_binop_interpolate_at_sample: > + return visit_continue; > + > + default: > + break; > + } > + > /* Store the expression operands in temps so we can use them > * multiple times. > */ > @@ -414,6 +436,9 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) > case ir_unop_unpack_half_2x16_split_x: > case ir_unop_unpack_half_2x16_split_y: > case ir_binop_pack_half_2x16_split: > + case ir_unop_interpolate_at_centroid: > + case ir_binop_interpolate_at_offset: > + case ir_binop_interpolate_at_sample: >unreachable("not reached: expression operates on scalars only"); > } > > Reviewed-by: Kenneth Graunke signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev