[Mesa-dev] [PATCH] Channels alive in fast clear
When deciding if a clear color is suitable for fast clear, take into account if a color channel is active in the buffer format. --- src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp index fd18b45..d16da97 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp @@ -153,7 +153,8 @@ is_color_fast_clear_compatible(struct brw_context *brw, return false; for (int i = 0; i 4; i++) { - if (color-f[i] != 0.0 color-f[i] != 1.0) { + if (color-f[i] != 0.0 color-f[i] != 1.0 + _mesa_format_has_color_component(format, i)) { perf_debug(Clear color unsupported by fast color clear. Falling back to slow clear.\n); return false; -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] EXTERNAL: Re: OpenCL/clover buffers vs images
I realized as I was lying in bed last night trying to sleep that the Dissassembly I posted below was a version in which I replaced a lot of the PV and PS references with names to help me decode. Here is the original ISA: ; Disassembly 00 ALU: ADDR(32) CNT(18) KCACHE0(CB1:0-15) KCACHE1(CB2:0-15) 0 z: BFE_UINTT0.z, KC1[0].x, 0x0005, 1 w: AND_INT T0.w, KC1[0].x, 1 t: I_TO_F , KC0[0].x 1 x: LSHRR1.x, KC0[2].x, 2 z: CNDE_INT, PV0.w, 1065353216, PS0 t: I_TO_F , KC0[0].y 2 x: MUL_e T0.x, PV1.z, 1.0f y: CNDE_INT, T0.w, 1065353216, PS1 3 y: FLOOR , PV2.x w: MUL_e T0.w, PV2.y, 1.0f 4 x: FLOOR , PV3.w w: CNDE_INT, T0.z, PV3.y, T0.x 5 x: MUL_e R0.x, KC0[1].x, PV4.w z: CNDE_INT, T0.z, PV4.x, T0.w 6 y: MUL_e R0.y, KC0[1].y, PV5.z 01 TEX: ADDR(64) CNT(1) 7 SAMPLE R0, R0.xy0x, t0, s0 02 MEM_RAT_CACHELESS_STORE_RAW: RAT(11)[R1], R0, ARRAY_SIZE(4) VPM END_OF_PROGRAM -Original Message- From: mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] On Behalf Of Dorrington, Albert Sent: Monday, March 24, 2014 6:54 PM To: Tom Stellard Cc: mesa-dev@lists.freedesktop.org Subject: Re: [Mesa-dev] EXTERNAL: Re: OpenCL/clover buffers vs images The kernel I'm working with is rather simple: const sampler_t s_nearest = CLK_FILTER_NEAREST | CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE; __kernel void image_test (__read_only image2d_t im, __global float4 *out) { out[ 0] = read_imagef (im, s_nearest, (int2) (0, 0)); } Using the Catalyst compiler to produce the ISA (with a -O0 compile flag) I get the following, which includes my notes/comments on the right side: ; Disassembly 00 ALU: ADDR(32) CNT(18) KCACHE0(CB1:0-15) KCACHE1(CB2:0-15) 0 z: BFE_UINTT0.z, KC1[0].x, 0x0005, 1 ; Linear Filter Flag w: AND_INT T0.w, KC1[0].x, 1 ; Normalized Flag t: I_TO_F , KC0[0].x ; convert Int to Float (Width?) 1 x: LSHRR1.x, KC0[2].x, 2 ; KC0[2].x / 4 - R1.x z: CNDE_INT, PV0.w, 1.0f, ImgWidth; if Not Normalized then 1.0f else ImgWidth t: I_TO_F , KC0[0].y ; convert int to float (Height?) 2 x: MUL_e T0.x, PV1.z, xCoord ; Scale xCoord - T0.x y: CNDE_INT, T0.w, 1.0f, ImgHeight; if Not Normalized then 1.0f else ImgHeight 3 y: FLOOR , PV2.x ; floor(xCoord) w: MUL_e T0.w, PV2.y, yCoord ; Scale yCoord - T0.w 4 x: FLOOR , PV3.w ; Floor(yCoord) w: CNDE_INT, T0.z, PV3.y, T0.x; If Not Linear then floor(xCoord) else Scaled(xCoord) 5 x: MUL_e R0.x, KC0[1].x, PV4.w ; R0.x = KC0[1].x * xCoord (floored/scaled) z: CNDE_INT, T0.z, PV4.x, T0.w; If Not Linear then floor(xCoord) else Scaled(yCoord) 6 y: MUL_e R0.y, KC0[1].y, PV5.z ; R0.y = KC0[1].y * yCoord (floored/scaled) 01 TEX: ADDR(64) CNT(1) 7 SAMPLE R0, R0.xy0x, t0, s0 02 MEM_RAT_CACHELESS_STORE_RAW: RAT(11)[R1], R0, ARRAY_SIZE(4) VPM END_OF_PROGRAM I am fairly certain that KC1[0] is the Sampler value. And that KC0[0] and KC0[1] are image parameters while KC0[2] is the output pointer parameter The fields I'm unsure of are KC0[1].x and KC0[1].y. I'm fairly certain that they are pitch or stride values, but since I'm not sure if the texture memory is linear or tiled, I'm not sure. I was trying to use the sampler set as CLK_ADDRESS_NONE, in an attempt to look 'outside' of the image dimensions, to see what else might be in the memory buffer - but I'm guessing that doesn't work as I suspected, because I keep seeing clamped values anyway. I've started reviewing the changes you made. I'm happy to see that I made a lot of the same changes as you implemented (makes me think I actually understand some of this!) Although I'm not sure I quite yet follow what you did in evergreen_set_compute_resources(), where you removed the vertex buffer setup. -Al -Original Message- From: Tom Stellard [mailto:t...@stellard.net] Sent: Monday, March 24, 2014 4:16 PM To: Dorrington, Albert Cc: mesa-dev@lists.freedesktop.org Subject: EXTERNAL: Re: [Mesa-dev] OpenCL/clover buffers vs images On Mon, Mar 24, 2014 at 02:35:04PM +, Dorrington, Albert wrote: I have been experimenting with adding image support to the clover implementation, and have been trying to understand the
[Mesa-dev] [PATCH] gbm: Set errno on errors
From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com This should give the caller some information of what called the error. For the gbm_bo_import() case, for instance, it is possible to know if the import is not supported or the error was caused by an invalid parameter. --- src/gbm/backends/dri/gbm_dri.c | 38 ++ src/gbm/main/gbm.c | 20 +--- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index acf6b24..92b6fac 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -30,6 +30,7 @@ #include stddef.h #include stdint.h #include string.h +#include errno.h #include limits.h #include sys/types.h @@ -353,8 +354,10 @@ gbm_dri_bo_write(struct gbm_bo *_bo, const void *buf, size_t count) { struct gbm_dri_bo *bo = gbm_dri_bo(_bo); - if (bo-image != NULL) + if (bo-image != NULL) { + errno = EINVAL; return -1; + } memcpy(bo-map, buf, count); @@ -417,8 +420,10 @@ gbm_dri_bo_import(struct gbm_device *gbm, int gbm_format; /* Required for query image WIDTH HEIGHT */ - if (dri-image-base.version 4) + if (dri-image-base.version 4) { + errno = ENOSYS; return NULL; + } switch (type) { #if HAVE_WAYLAND_PLATFORM @@ -426,12 +431,16 @@ gbm_dri_bo_import(struct gbm_device *gbm, { struct wl_drm_buffer *wb; - if (!dri-wl_drm) + if (!dri-wl_drm) { + errno = EINVAL; return NULL; + } wb = wayland_drm_buffer_get(dri-wl_drm, (struct wl_resource *) buffer); - if (!wb) + if (!wb) { + errno = EINVAL; return NULL; + } image = wb-driver_buffer; @@ -458,18 +467,23 @@ gbm_dri_bo_import(struct gbm_device *gbm, case GBM_BO_IMPORT_EGL_IMAGE: { int dri_format; - if (dri-lookup_image == NULL) + if (dri-lookup_image == NULL) { + errno = EINVAL; return NULL; + } image = dri-lookup_image(dri-screen, buffer, dri-lookup_user_data); dri-image-queryImage(image, __DRI_IMAGE_ATTRIB_FORMAT, dri_format); gbm_format = gbm_dri_to_gbm_format(dri_format); - if (gbm_format == 0) + if (gbm_format == 0) { + errno = EINVAL; return NULL; + } break; } default: + errno = ENOSYS; return NULL; } @@ -486,6 +500,7 @@ gbm_dri_bo_import(struct gbm_device *gbm, dri_use |= __DRI_IMAGE_USE_CURSOR; if (dri-image-base.version = 2 !dri-image-validateUsage(bo-image, dri_use)) { + errno = EINVAL; free(bo); return NULL; } @@ -517,10 +532,14 @@ create_dumb(struct gbm_device *gbm, struct drm_mode_destroy_dumb destroy_arg; int ret; - if (!(usage GBM_BO_USE_CURSOR_64X64)) + if (!(usage GBM_BO_USE_CURSOR_64X64)) { + errno = EINVAL; return NULL; - if (format != GBM_FORMAT_ARGB) + } + if (format != GBM_FORMAT_ARGB) { + errno = EINVAL; return NULL; + } bo = calloc(1, sizeof *bo); if (bo == NULL) @@ -611,6 +630,7 @@ gbm_dri_bo_create(struct gbm_device *gbm, dri_format = __DRI_IMAGE_FORMAT_XRGB2101010; break; default: + errno = EINVAL; goto failed; } @@ -690,6 +710,8 @@ dri_device_create(int fd) int ret; dri = calloc(1, sizeof *dri); + if (!dri) + return NULL; dri-base.base.fd = fd; dri-base.base.bo_create = gbm_dri_bo_create; diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index 30785a6..7ce2ae2 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -36,6 +36,7 @@ #include sys/types.h #include sys/stat.h #include unistd.h +#include errno.h #include gbm.h #include gbmint.h @@ -109,7 +110,7 @@ _gbm_mesa_get_device(int fd) int i; if (fd 0 || fstat(fd, buf) 0 || !S_ISCHR(buf.st_mode)) { - fprintf(stderr, _gbm_mesa_get_device: invalid fd: %d\n, fd); + errno = EINVAL; return NULL; } @@ -145,7 +146,7 @@ gbm_create_device(int fd) struct stat buf; if (fd 0 || fstat(fd, buf) 0 || !S_ISCHR(buf.st_mode)) { - fprintf(stderr, gbm_create_device: invalid fd: %d\n, fd); + errno = EINVAL; return NULL; } @@ -241,7 +242,7 @@ gbm_bo_get_handle(struct gbm_bo *bo) * \param bo The buffer object * \param buf The data to write * \param count The number of bytes to write - * \return Returns -1 on error, 0 otherwise + * \return Returns 0 on success, otherwise -1 is returned an errno set */ GBM_EXPORT int gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count) @@ -315,7 +316,7 @@ gbm_bo_destroy(struct gbm_bo *bo) * * \return A newly allocated buffer that should be freed with gbm_bo_destroy() * when no longer needed. If an error occurs during allocation %NULL will be - * returned. + * returned and errno set. * * \sa enum gbm_bo_format for the
[Mesa-dev] [Bug 76577] egl_dri2.c:507:27: error: 'EGL_OPENGL_ES3_BIT_KHR' undeclared (first use in this function)
https://bugs.freedesktop.org/show_bug.cgi?id=76577 --- Comment #2 from Emil Velikov emil.l.veli...@gmail.com --- Created attachment 96363 -- https://bugs.freedesktop.org/attachment.cgi?id=96363action=edit egl: do not use system egl headers, make use of the one we provide Well this is kind of our fault as well. We should not be including the system headers, but the ones we provide. Feel free to give the patch 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] [Bug 76489] Mesa git (011569b5b7) compilation issue: render2.c:49:4: error: implicit declaration of function '__glMap1d_size' [-Werror=implicit-function-declaration]
https://bugs.freedesktop.org/show_bug.cgi?id=76489 Emil Velikov emil.l.veli...@gmail.com changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|INVALID |--- --- Comment #9 from Emil Velikov emil.l.veli...@gmail.com --- (In reply to comment #8) SOLVED! Can you believe the problem was caused by an old version of indent lying around? Do you recall which version of indent was causing the problem, which one works correctly ? We can check in configure.ac and fall-back to using cat rather than causing such nuisance. Did you still need to use -D__GNU__ ? -- 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 76577] egl_dri2.c:507:27: error: 'EGL_OPENGL_ES3_BIT_KHR' undeclared (first use in this function)
https://bugs.freedesktop.org/show_bug.cgi?id=76577 Emil Velikov emil.l.veli...@gmail.com changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|INVALID |--- -- 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 02/14] glx: remove unused __glXClientInfo()
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/glx/glxcmds.c | 13 - 1 file changed, 13 deletions(-) diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 4b17d7c..7984715 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -1378,19 +1378,6 @@ glXQueryServerString(Display * dpy, int screen, int name) return *str; } -void -__glXClientInfo(Display * dpy, int opcode) -{ - char *ext_str = __glXGetClientGLExtensionString(); - int size = strlen(ext_str) + 1; - - xcb_connection_t *c = XGetXCBConnection(dpy); - xcb_glx_client_info(c, - GLX_MAJOR_VERSION, GLX_MINOR_VERSION, size, ext_str); - - free(ext_str); -} - /* ** EXT_import_context -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/14] mesa: add missing null check in _mesa_NewHashTable()
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/main/hash.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 4c92005..21da652 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -115,10 +115,20 @@ _mesa_NewHashTable(void) if (table) { table-ht = _mesa_hash_table_create(NULL, uint_key_compare); + if (table-ht == NULL) { + FREE(table); + _mesa_error_no_memory(__FUNCTION__); + return NULL; + } + _mesa_hash_table_set_deleted_key(table-ht, uint_key(DELETED_KEY_VALUE)); mtx_init(table-Mutex, mtx_plain); mtx_init(table-WalkMutex, mtx_plain); } + else { + _mesa_error_no_memory(__FUNCTION__); + } + return table; } -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/14] glsl: add missing null check in tfeedback_decl::init()
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/glsl/link_varyings.cpp | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index c925c00..d0a9d75 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -278,6 +278,12 @@ tfeedback_decl::init(struct gl_context *ctx, const void *mem_ctx, const char *base_name_end; long subscript = parse_program_resource_name(input, base_name_end); this-var_name = ralloc_strndup(mem_ctx, input, base_name_end - input); + + if (this-var_name == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return; + } + if (subscript = 0) { this-array_subscript = subscript; this-is_subscripted = true; -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 00/14] Klocwork patches
Again fixed my Klocwork set. I reworked Ian's patch because my set depend on it and Ian's patch seem to have vanished in the void. It needed a small update because it was breaking make check. Matt, about glsl: add missing null check in tfeedback_decl::init(), ralloc_strndup failure would be coming from calloc returning null. I changed the patch to report memory error instead of just retuning null. When calloc start to return null things anyhow already are in bad shape so I would guess somehow correct behavior would be to return control for calling program asap. /Juha-Pekka Ian Romanick (1): mesa: Add _mesa_error_no_memory for logging out-of-memory messages Juha-Pekka Heikkila (13): glx: remove unused __glXClientInfo() glx: add extra null check in getFBConfigs mesa: Prevent negative indexing on noise2, noise3 and noise4 mesa: Add missing null check in _mesa_parse_arb_program() mesa: remove redundant running of check_symbol_table() mesa: add missing null checks in _tnl_register_fastpath() mesa: add extra null checks in vbo_rebase_prims() mesa: In emit_texenv() type mismatch was forced with typecast mesa: Add missing null checks into prog_hash_table.c glsl: add missing null check in tfeedback_decl::init() mesa: add missing null check in _mesa_NewHashTable() i965: check malloc return value in intel_resolve_map_set() mesa: add null checks in symbol_table.c src/glsl/Makefile.am | 13 ++--- src/glsl/link_varyings.cpp| 6 + src/glsl/main.cpp | 6 + src/glsl/tests/common.c | 30 + src/glx/glxcmds.c | 13 - src/glx/glxext.c | 4 +++ src/mesa/drivers/dri/i965/intel_resolve_map.c | 7 + src/mesa/main/errors.c| 6 + src/mesa/main/errors.h| 3 +++ src/mesa/main/ff_fragment_shader.cpp | 19 +++-- src/mesa/main/hash.c | 10 +++ src/mesa/program/prog_hash_table.c| 10 +++ src/mesa/program/prog_noise.c | 36 - src/mesa/program/program_parse.y | 5 src/mesa/program/symbol_table.c | 39 +++ src/mesa/tnl/t_vertex.c | 14 -- src/mesa/vbo/vbo_rebase.c | 25 ++--- 17 files changed, 193 insertions(+), 53 deletions(-) create mode 100644 src/glsl/tests/common.c -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/14] mesa: remove redundant running of check_symbol_table()
Nested for loops running through tables against which they finally do an assert were ran also with optimized builds. Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/program/symbol_table.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c index 2f41322..9462978 100644 --- a/src/mesa/program/symbol_table.c +++ b/src/mesa/program/symbol_table.c @@ -115,7 +115,7 @@ struct _mesa_symbol_table { static void check_symbol_table(struct _mesa_symbol_table *table) { -#if 1 +#if !defined(NDEBUG) struct scope_level *scope; for (scope = table-current_scope; scope != NULL; scope = scope-next) { @@ -134,7 +134,9 @@ check_symbol_table(struct _mesa_symbol_table *table) } } } -#endif +#else +(void) table; +#endif /* !defined(NDEBUG) */ } void -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/14] mesa: add extra null checks in vbo_rebase_prims()
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/vbo/vbo_rebase.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c index f3fe5f7..7aa8d08 100644 --- a/src/mesa/vbo/vbo_rebase.c +++ b/src/mesa/vbo/vbo_rebase.c @@ -60,10 +60,15 @@ static void *rebase_##TYPE( const void *ptr, \ { \ const TYPE *in = (TYPE *)ptr; \ TYPE *tmp_indices = malloc(count * sizeof(TYPE)); \ - GLuint i; \ + if (tmp_indices != NULL) { \ + GLuint i;\ \ - for (i = 0; i count; i++) \ - tmp_indices[i] = in[i] - min_index; \ + for (i = 0; i count; i++) \ + tmp_indices[i] = in[i] - min_index; \ + } \ + else { \ + _mesa_error_no_memory(__FUNCTION__); \ + } \ \ return (void *)tmp_indices; \ } @@ -148,6 +153,11 @@ void vbo_rebase_prims( struct gl_context *ctx, */ tmp_prims = malloc(sizeof(*prim) * nr_prims); + if (tmp_prims == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return; + } + for (i = 0; i nr_prims; i++) { tmp_prims[i] = prim[i]; tmp_prims[i].basevertex -= min_index; @@ -186,6 +196,10 @@ void vbo_rebase_prims( struct gl_context *ctx, if (map_ib) ctx-Driver.UnmapBuffer(ctx, ib-obj, MAP_INTERNAL); + if (tmp_indices == NULL) { + return; + } + tmp_ib.obj = ctx-Shared-NullBufferObj; tmp_ib.ptr = tmp_indices; tmp_ib.count = ib-count; @@ -198,6 +212,11 @@ void vbo_rebase_prims( struct gl_context *ctx, */ tmp_prims = malloc(sizeof(*prim) * nr_prims); + if (tmp_prims == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return; + } + for (i = 0; i nr_prims; i++) { /* If this fails, it could indicate an application error: */ -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/14] mesa: add null checks in symbol_table.c
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/program/symbol_table.c | 33 ++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c index 9462978..9c3556a 100644 --- a/src/mesa/program/symbol_table.c +++ b/src/mesa/program/symbol_table.c @@ -172,9 +172,14 @@ _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table) { struct scope_level *const scope = calloc(1, sizeof(*scope)); -scope-next = table-current_scope; -table-current_scope = scope; -table-depth++; +if (scope) { + scope-next = table-current_scope; + table-current_scope = scope; + table-depth++; +} +else { + _mesa_error_no_memory(__FUNCTION__); +} } @@ -254,6 +259,12 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, if (hdr == NULL) { hdr = calloc(1, sizeof(*hdr)); + + if (hdr == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return -1; + } + hdr-name = strdup(name); hash_table_insert(table-ht, hdr, hdr-name); @@ -276,6 +287,12 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, return -1; sym = calloc(1, sizeof(*sym)); + +if (sym == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return -1; +} + sym-next_with_same_name = hdr-symbols; sym-next_with_same_scope = table-current_scope-symbols; sym-hdr = hdr; @@ -311,6 +328,11 @@ _mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *table, if (hdr == NULL) { hdr = calloc(1, sizeof(*hdr)); +if (hdr == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return -1; +} + hdr-name = strdup(name); hash_table_insert(table-ht, hdr, hdr-name); @@ -340,6 +362,11 @@ _mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *table, } sym = calloc(1, sizeof(*sym)); +if (sym == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return -1; +} + sym-next_with_same_scope = top_scope-symbols; sym-hdr = hdr; sym-name_space = name_space; -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/14] mesa: add missing null checks in _tnl_register_fastpath()
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/tnl/t_vertex.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index b3deac0..5cdf743 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -83,12 +83,22 @@ void _tnl_register_fastpath( struct tnl_clipspace *vtx, struct tnl_clipspace_fastpath *fastpath = CALLOC_STRUCT(tnl_clipspace_fastpath); GLuint i; + if (fastpath == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return; + } + fastpath-vertex_size = vtx-vertex_size; fastpath-attr_count = vtx-attr_count; fastpath-match_strides = match_strides; fastpath-func = vtx-emit; - fastpath-attr = - malloc(vtx-attr_count * sizeof(fastpath-attr[0])); + fastpath-attr = malloc(vtx-attr_count * sizeof(fastpath-attr[0])); + + if (fastpath-attr == NULL) { + FREE(fastpath); + _mesa_error_no_memory(__FUNCTION__); + return; + } for (i = 0; i vtx-attr_count; i++) { fastpath-attr[i].format = vtx-attr[i].format; -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/14] mesa: Prevent negative indexing on noise2, noise3 and noise4
% operator could return negative value which would cause indexing before perm table. Change %256 to 0xff Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/program/prog_noise.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mesa/program/prog_noise.c b/src/mesa/program/prog_noise.c index c258c5e..ac920c2 100644 --- a/src/mesa/program/prog_noise.c +++ b/src/mesa/program/prog_noise.c @@ -257,12 +257,12 @@ _mesa_noise2(GLfloat x, GLfloat y) float y0 = y - Y0; float x1, y1, x2, y2; - int ii, jj; + unsigned int ii, jj; float t0, t1, t2; /* For the 2D case, the simplex shape is an equilateral triangle. */ /* Determine which simplex we are in. */ - int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */ + unsigned int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */ if (x0 y0) { i1 = 1; j1 = 0; @@ -282,8 +282,8 @@ _mesa_noise2(GLfloat x, GLfloat y) y2 = y0 - 1.0f + 2.0f * G2; /* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */ - ii = i % 256; - jj = j % 256; + ii = i 0xff; + jj = j 0xff; /* Calculate the contribution from the three corners */ t0 = 0.5f - x0 * x0 - y0 * y0; @@ -344,13 +344,13 @@ _mesa_noise3(GLfloat x, GLfloat y, GLfloat z) float z0 = z - Z0; float x1, y1, z1, x2, y2, z2, x3, y3, z3; - int ii, jj, kk; + unsigned int ii, jj, kk; float t0, t1, t2, t3; /* For the 3D case, the simplex shape is a slightly irregular tetrahedron. */ /* Determine which simplex we are in. */ - int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */ - int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */ + unsigned int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */ + unsigned int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */ /* This code would benefit from a backport from the GLSL version! */ if (x0 = y0) { @@ -423,9 +423,9 @@ _mesa_noise3(GLfloat x, GLfloat y, GLfloat z) z3 = z0 - 1.0f + 3.0f * G3; /* Wrap the integer indices at 256 to avoid indexing perm[] out of bounds */ - ii = i % 256; - jj = j % 256; - kk = k % 256; + ii = i 0xff; + jj = j 0xff; + kk = k 0xff; /* Calculate the contribution from the four corners */ t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0; @@ -522,12 +522,12 @@ _mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w) int c6 = (z0 w0) ? 1 : 0; int c = c1 + c2 + c3 + c4 + c5 + c6; - int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */ - int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */ - int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */ + unsigned int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */ + unsigned int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */ + unsigned int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */ float x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4; - int ii, jj, kk, ll; + unsigned int ii, jj, kk, ll; float t0, t1, t2, t3, t4; /* @@ -573,10 +573,10 @@ _mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w) w4 = w0 - 1.0f + 4.0f * G4; /* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */ - ii = i % 256; - jj = j % 256; - kk = k % 256; - ll = l % 256; + ii = i 0xff; + jj = j 0xff; + kk = k 0xff; + ll = l 0xff; /* Calculate the contribution from the five corners */ t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0; -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/14] i965: check malloc return value in intel_resolve_map_set()
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/drivers/dri/i965/intel_resolve_map.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/drivers/dri/i965/intel_resolve_map.c b/src/mesa/drivers/dri/i965/intel_resolve_map.c index 04b5c94..a338c5e 100644 --- a/src/mesa/drivers/dri/i965/intel_resolve_map.c +++ b/src/mesa/drivers/dri/i965/intel_resolve_map.c @@ -22,6 +22,7 @@ */ #include intel_resolve_map.h +#include main/imports.h #include assert.h #include stdlib.h @@ -51,6 +52,12 @@ intel_resolve_map_set(struct intel_resolve_map *head, } *tail = malloc(sizeof(**tail)); + + if (*tail == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return; + } + (*tail)-prev = prev; (*tail)-next = NULL; (*tail)-level = level; -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/14] mesa: Add _mesa_error_no_memory for logging out-of-memory messages
From: Ian Romanick ian.d.roman...@intel.com This can be called from locations that don't have a context pointer handy. This patch also adds enough infrastructure so that the unit tests for the GLSL compiler and the stand-alone compiler will build and function. This patch was originally signed off by Ian Romanick, now v2 fixed from breaking the build by Juha-Pekka Heikkilä Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com Cc: Ian Romanick ian.d.roman...@intel.com --- src/glsl/Makefile.am| 13 + src/glsl/main.cpp | 6 ++ src/glsl/tests/common.c | 30 ++ src/mesa/main/errors.c | 6 ++ src/mesa/main/errors.h | 3 +++ 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 src/glsl/tests/common.c diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am index 534eaa3..2cd98a5 100644 --- a/src/glsl/Makefile.am +++ b/src/glsl/Makefile.am @@ -61,7 +61,8 @@ tests_general_ir_test_SOURCES = \ $(GLSL_SRCDIR)/standalone_scaffolding.cpp \ tests/builtin_variable_test.cpp \ tests/invalidate_locations_test.cpp \ - tests/general_ir_test.cpp + tests/general_ir_test.cpp \ + tests/common.c tests_general_ir_test_CFLAGS = \ $(PTHREAD_CFLAGS) tests_general_ir_test_LDADD = \ @@ -76,7 +77,8 @@ tests_uniform_initializer_test_SOURCES = \ $(top_srcdir)/src/mesa/program/symbol_table.c \ tests/copy_constant_to_storage_tests.cpp\ tests/set_uniform_initializer_tests.cpp \ - tests/uniform_initializer_utils.cpp + tests/uniform_initializer_utils.cpp \ + tests/common.c tests_uniform_initializer_test_CFLAGS =\ $(PTHREAD_CFLAGS) tests_uniform_initializer_test_LDADD = \ @@ -95,7 +97,8 @@ tests_ralloc_test_LDADD = \ tests_sampler_types_test_SOURCES = \ $(top_srcdir)/src/mesa/program/prog_hash_table.c\ $(top_srcdir)/src/mesa/program/symbol_table.c \ - tests/sampler_types_test.cpp + tests/sampler_types_test.cpp\ + tests/common.c tests_sampler_types_test_CFLAGS = \ $(PTHREAD_CFLAGS) tests_sampler_types_test_LDADD = \ @@ -110,7 +113,8 @@ libglcpp_la_SOURCES = \ glcpp_glcpp_SOURCES = \ glcpp/glcpp.c \ - $(top_srcdir)/src/mesa/program/prog_hash_table.c + $(top_srcdir)/src/mesa/program/prog_hash_table.c \ + tests/common.c glcpp_glcpp_LDADD =\ libglcpp.la \ -lm @@ -138,6 +142,7 @@ glsl_test_SOURCES = \ $(top_srcdir)/src/mesa/program/prog_hash_table.c \ $(top_srcdir)/src/mesa/program/symbol_table.c \ $(GLSL_SRCDIR)/standalone_scaffolding.cpp \ + tests/common.c \ test.cpp \ test_optpass.cpp diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 4ae8f09..a4452e0 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -40,6 +40,12 @@ static int glsl_version = 330; +extern C void +_mesa_error_no_memory(const char *caller) +{ + fprintf(stderr, Mesa error: out of memory in %s, caller); +} + static void initialize_context(struct gl_context *ctx, gl_api api) { diff --git a/src/glsl/tests/common.c b/src/glsl/tests/common.c new file mode 100644 index 000..d69f54d --- /dev/null +++ b/src/glsl/tests/common.c @@ -0,0 +1,30 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include stdio.h +#include main/errors.h + +void
[Mesa-dev] [PATCH 03/14] glx: add extra null check in getFBConfigs
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/glx/glxext.c | 4 1 file changed, 4 insertions(+) diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 4a195bd..0838cd1 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -677,6 +677,10 @@ static GLboolean psc-serverGLXexts = __glXQueryServerString(dpy, priv-majorOpcode, screen, GLX_EXTENSIONS); + if (psc-serverGLXexts == NULL) { + return GL_FALSE; + } + LockDisplay(dpy); psc-configs = NULL; -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/14] mesa: In emit_texenv() type mismatch was forced with typecast
Type mismatch caused random memory to be copied when casted memory area was smaller than expected type. Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/main/ff_fragment_shader.cpp | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index cad67aa..1138fd9 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -888,14 +888,17 @@ emit_texenv(texenv_fragment_program *p, GLuint unit) shift = new(p-mem_ctx) ir_constant((float)(1 rgb_shift)); } else { -float const_data[4] = { - float(1 rgb_shift), - float(1 rgb_shift), - float(1 rgb_shift), - float(1 alpha_shift) -}; -shift = new(p-mem_ctx) ir_constant(glsl_type::vec4_type, -(ir_constant_data *)const_data); + ir_constant_data const_data = { +.f = { + float(1 rgb_shift), + float(1 rgb_shift), + float(1 rgb_shift), + float(1 alpha_shift) +} + }; + + shift = new(p-mem_ctx) ir_constant(glsl_type::vec4_type, + const_data); } return saturate(mul(deref, shift)); -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/14] mesa: Add missing null check in _mesa_parse_arb_program()
Add missing null check in program_parse.tab.c through program_parse.y Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/program/program_parse.y | 5 + 1 file changed, 5 insertions(+) diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index 6dde69d..1664740 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -2749,6 +2749,11 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st */ state-prog-Instructions = _mesa_alloc_instructions(state-prog-NumInstructions + 1); + + if (state-prog-Instructions == NULL) { + goto error; + } + inst = state-inst_head; for (i = 0; i state-prog-NumInstructions; i++) { struct asm_instruction *const temp = inst-next; -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/14] mesa: Add missing null checks into prog_hash_table.c
Check calloc return values in hash_table_insert() and hash_table_replace() Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/program/prog_hash_table.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/program/prog_hash_table.c b/src/mesa/program/prog_hash_table.c index f45ed46..39ffb7a 100644 --- a/src/mesa/program/prog_hash_table.c +++ b/src/mesa/program/prog_hash_table.c @@ -143,6 +143,11 @@ hash_table_insert(struct hash_table *ht, void *data, const void *key) node = calloc(1, sizeof(*node)); +if (node == NULL) { + _mesa_error_no_memory(__FUNCTION__); + return; +} + node-data = data; node-key = key; @@ -168,6 +173,11 @@ hash_table_replace(struct hash_table *ht, void *data, const void *key) hn = calloc(1, sizeof(*hn)); +if (hn != NULL) { + _mesa_error_no_memory(__FUNCTION__); + return false; +} + hn-data = data; hn-key = key; -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 76489] Mesa git (011569b5b7) compilation issue: render2.c:49:4: error: implicit declaration of function '__glMap1d_size' [-Werror=implicit-function-declaration]
https://bugs.freedesktop.org/show_bug.cgi?id=76489 --- Comment #10 from Dâniel Fraga frag...@gmail.com --- (In reply to comment #9) Do you recall which version of indent was causing the problem, which one works correctly ? We can check in configure.ac and fall-back to using cat rather than causing such nuisance. Did you still need to use -D__GNU__ ? The indent version was so old (from 2003) it doesn't even give a version number with --version parameter. But since even the latest version of GNU indent (2.2.10) is old (from 2009) I think you can require it during configure without problems since everyone should be using the latest version by now. And I don't need to use -D__GNU__ 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] [Bug 76577] egl_dri2.c:507:27: error: 'EGL_OPENGL_ES3_BIT_KHR' undeclared (first use in this function)
https://bugs.freedesktop.org/show_bug.cgi?id=76577 --- Comment #3 from Dâniel Fraga frag...@gmail.com --- (In reply to comment #2) Created attachment 96363 [details] [review] egl: do not use system egl headers, make use of the one we provide Well this is kind of our fault as well. We should not be including the system headers, but the ones we provide. Feel free to give the patch a try. Hi Emil. I tried your patch and it didn't work. If you want to test yourself there, just put some old Mesa 8.0.5 header files in /usr/xorg/include/EGL (or whatever you use): eglext.h egl.h eglmesaext.h eglplatform.h But it's nice to see this will change, because I thought it was very strange for Mesa to use the system header files. Thank you very much! Ps: I think this change will have to be made for GL header files too, because I had to remove the GL system header files otherwise it would give errors. Ps2: if you want me to test other patch, just ask. -- 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] gallivm: fix no-op n:n lp_build_resize()
- Original Message - From: Roland Scheidegger srol...@vmware.com This can get called in some circumstances if both src type and dst type have same width (seen with float32-unorm32). While this particular case was bogus anyway let's just fix that as it can work trivially (due to the way it was called it actually worked anyway apart from the assert). --- src/gallium/auxiliary/gallivm/lp_bld_pack.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.c b/src/gallium/auxiliary/gallivm/lp_bld_pack.c index 22a4f5a8..2b0a1fb 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_pack.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.c @@ -710,9 +710,6 @@ lp_build_resize(struct gallivm_state *gallivm, /* We must not loose or gain channels. Only precision */ assert(src_type.length * num_srcs == dst_type.length * num_dsts); - /* We don't support M:N conversion, only 1:N, M:1, or 1:1 */ - assert(num_srcs == 1 || num_dsts == 1); - assert(src_type.length = LP_MAX_VECTOR_LENGTH); assert(dst_type.length = LP_MAX_VECTOR_LENGTH); assert(num_srcs = LP_MAX_VECTOR_LENGTH); @@ -723,6 +720,7 @@ lp_build_resize(struct gallivm_state *gallivm, * Truncate bit width. */ + /* Conversion must be M:1 */ assert(num_dsts == 1); if (src_type.width * src_type.length == dst_type.width * dst_type.length) { @@ -775,6 +773,7 @@ lp_build_resize(struct gallivm_state *gallivm, * Expand bit width. */ + /* Conversion must be 1:N */ assert(num_srcs == 1); if (src_type.width * src_type.length == dst_type.width * dst_type.length) { @@ -813,10 +812,11 @@ lp_build_resize(struct gallivm_state *gallivm, * No-op */ - assert(num_srcs == 1); - assert(num_dsts == 1); + /* Conversion must be N:N */ + assert(num_srcs == num_dsts); - tmp[0] = src[0]; + for(i = 0; i num_dsts; ++i) + tmp[i] = src[i]; } for(i = 0; i num_dsts; ++i) -- 1.7.9.5 -- Reviewed-by: Jose Fonseca jfons...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 76489] Mesa git (011569b5b7) compilation issue: render2.c:49:4: error: implicit declaration of function '__glMap1d_size' [-Werror=implicit-function-declaration]
https://bugs.freedesktop.org/show_bug.cgi?id=76489 Emil Velikov emil.l.veli...@gmail.com changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |WONTFIX --- Comment #11 from Emil Velikov emil.l.veli...@gmail.com --- (In reply to comment #10) The indent version was so old (from 2003) it doesn't even give a version number with --version parameter. But since even the latest version of GNU indent (2.2.10) is old (from 2009) I think you can require it during configure without problems since everyone should be using the latest version by now. A few interesting bits - indent returns 1, on --version and --any-unknown-switch - the changelog/news file does not indicate when --version was introduced - some distros ship a version 2.2.11 which according to the gnu website does not exist With those said I'm going to close this as won't fix. If anyone is willing to have fun with this dinosaur, feel free to reopen and send us a patch. And I don't need to use -D__GNU__ anymore. ;) Glad to hear, thanks. -- 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] [PIGLIT,radeonsi] crash in spec/glsl-1.50/execution/geometry/max-input-components – who's bug is it?
Brian Paul schrieb am 24.03.2014 15:45: On 03/22/2014 01:53 PM, Kai Wasserbäch wrote: Dear Mesa devs, I'm not sure whether this is a bug in Mesa, LLVM or in eglibc. The crash happens in _int_malloc, but since that is certainly one of the more often used functions, I'm not yet convinced, the fault lies indeed with eglibc. Therefore I'm attaching the full backtrace of the crash in spec/glsl-1.50/execution/geometry/max-input-components (it takes a very long time until the crash actually happens, Piglit recorded an execution time of 1538.0506579875946) and hope you can point me to the right bug tracker. I'm unable to tell, whether this is a regression or not, since today was the first time I was able to run a full Piglit quick test, without crashing my X on this machine with the radeonsi. My graphics stack is: GPU: PITCAIRN (ChipID = 0x6819) Linux: 3.13.6 libdrm: 2.4.52-1 LLVM: SVN:trunk/r204517 libclc: Git:master/1e278a7b04 Mesa: Git:master/4c79f088c0 GLAMOR: Git:master/a4fbc7732a (Standalone) DDX: Git:master/ea6d0affe5 X: 1.15.0-2 Let me know if you need further information. While it would take even longer, running with valgrind might help to isolate the location of a memory error. Ok, I'll do that over the weekend, since I haven't been able to get the output within five hours yesterday in the evening. If there is a particular set of options I should pass to valgrind, please let me know. Cheers, Kai -- Kai Wasserbäch (Kai Wasserbaech) E-Mail: k...@dev.carbon-project.org signature.asc Description: OpenPGP digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mapi/glapi: Use ElementTree instead of libxml2.
From: José Fonseca jfons...@vmware.com It is quite hard to meet the dependency of the libxml2 python bindings out side Linux, and in particularly on MacOSX; whereas ElementTree is part of Python's standard library. ElementTree is more limited than libxml2: no DTD verification, defaults from DTD, or XInclude support, but none of this limitations is serious enough to justify libxml2. In fact, it was easier to refactor the code to use ElementTree than to try to get libxml2 python bindings... In the process, gl_item_factory class was refactored so that there is one method for each kind of object to be created, as it simplified things substantially. I confirmed that precisely the same output is generated for GL/GLX/GLES. --- SConstruct | 7 -- configure.ac | 1 - docs/README.WIN32 | 16 ++- docs/install.html | 4 - src/mapi/glapi/gen/glX_XML.py | 55 - src/mapi/glapi/gen/glX_proto_common.py | 13 +- src/mapi/glapi/gen/gl_XML.py | 217 - 7 files changed, 141 insertions(+), 172 deletions(-) diff --git a/SConstruct b/SConstruct index de735e9..0e10818 100644 --- a/SConstruct +++ b/SConstruct @@ -59,13 +59,6 @@ else: Help(opts.GenerateHelpText(env)) -# fail early for a common error on windows -if env['gles']: -try: -import libxml2 -except ImportError: -raise SCons.Errors.UserError, GLES requires libxml2-python to build - ### # Environment setup diff --git a/configure.ac b/configure.ac index c5042f9..04bf711 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,6 @@ AM_PROG_CC_C_O AM_PROG_AS AC_CHECK_PROGS([MAKE], [gmake make]) AC_CHECK_PROGS([PYTHON2], [python2 python]) -AX_PYTHON_MODULE([libxml2], [needed]) AC_PROG_SED AC_PROG_MKDIR_P diff --git a/docs/README.WIN32 b/docs/README.WIN32 index 0cd007c..c8759f6 100644 --- a/docs/README.WIN32 +++ b/docs/README.WIN32 @@ -36,17 +36,15 @@ Recipe Building on windows requires several open-source packages. These are steps that work as of this writing. -1) install python 2.7 -2) install scons (latest) -3) install mingw, flex, and bison -4) install libxml2 from here: http://www.lfd.uci.edu/~gohlke/pythonlibs - get libxml2-python-2.9.1.win-amd64-py2.7.exe -5) install pywin32 from here: http://www.lfd.uci.edu/~gohlke/pythonlibs +- install python 2.7 +- install scons (latest) +- install mingw, flex, and bison +- install pywin32 from here: http://www.lfd.uci.edu/~gohlke/pythonlibs get pywin32-218.4.win-amd64-py2.7.exe -6) install git -7) download mesa from git +- install git +- download mesa from git see http://www.mesa3d.org/repository.html -8) run scons +- run scons General --- diff --git a/docs/install.html b/docs/install.html index 24492a7..5061ede 100644 --- a/docs/install.html +++ b/docs/install.html @@ -44,10 +44,6 @@ On Windows with MinGW, install flex and bison with: /li lipython - Python is needed for building the Gallium components. Version 2.6.4 or later should work. -br -br -To build OpenGL ES 1.1 and 2.0 you'll also need -a href=http://xmlsoft.org/sources/win32/python/libxml2-python-2.7.7.win32-py2.7.exe;libxml2-python/a. /li /ul diff --git a/src/mapi/glapi/gen/glX_XML.py b/src/mapi/glapi/gen/glX_XML.py index 03a35b7..12ff291 100644 --- a/src/mapi/glapi/gen/glX_XML.py +++ b/src/mapi/glapi/gen/glX_XML.py @@ -33,29 +33,27 @@ import sys, getopt, string class glx_item_factory(gl_XML.gl_item_factory): Factory to create GLX protocol oriented objects derived from gl_item. -def create_item(self, name, element, context): -if name == function: -return glx_function(element, context) -elif name == enum: -return glx_enum(element, context) -elif name == api: -return glx_api(self) -else: -return gl_XML.gl_item_factory.create_item(self, name, element, context) +def create_function(self, element, context): +return glx_function(element, context) + +def create_enum(self, element, context, category): +return glx_enum(element, context, category) + +def create_api(self): +return glx_api(self) class glx_enum(gl_XML.gl_enum): -def __init__(self, element, context): -gl_XML.gl_enum.__init__(self, element, context) +def __init__(self, element, context, category): +gl_XML.gl_enum.__init__(self, element, context, category) self.functions = {} -child = element.children -while child: -if child.type == element and child.name == size: -n = child.nsProp( name, None ) -c = child.nsProp( count, None ) -m = child.nsProp( mode, None ) +for child in element.getchildren(): +if child.tag == size: +n = child.get( name ) +
[Mesa-dev] [Bug 76601] New: [llvmpipe] [softpipe] piglit glean pixelFormats regression
https://bugs.freedesktop.org/show_bug.cgi?id=76601 Priority: medium Bug ID: 76601 Keywords: regression CC: bri...@vmware.com, chr...@ijw.co.nz Assignee: mesa-dev@lists.freedesktop.org Summary: [llvmpipe] [softpipe] piglit glean pixelFormats regression Severity: normal Classification: Unclassified OS: Linux (All) Reporter: v...@freedesktop.org Hardware: x86-64 (AMD64) Status: NEW Version: git Component: Mesa core Product: Mesa mesa: b995a010e688bc4d4557e973e5e28091c378e881 (master 10.2.0-devel) $ ./bin/glean -t pixelFormats --quick pixelFormats failed at pixel (0,0), color channel 0: Expected: 0xff 0x00 0x00 0xff Found:0xff 0xff 0xff 0xff Format: GL_RED Type: GL_UNSIGNED_SHORT Internal Format: glDrawPixels EnvMode: GL_COMBINE_ARB pixelFormats: FAIL rgba8, db, z24, s8, win+pmap, id 33 21499 tests passed, 1 tests failed. 40d7b5195351d3e4199e7a840615a595a6dbaefc is the first bad commit commit 40d7b5195351d3e4199e7a840615a595a6dbaefc Author: Chris Forbes chr...@ijw.co.nz Date: Sun Mar 23 22:07:02 2014 +1300 mesa: Fix format matching checks for GL_INTENSITY* internalformats. GL_INTENSITY has never been valid as a pixel format -- to get the memcpy pack/unpack paths, the app needs to specify GL_RED as the pixel format (or GL_RED_INTEGER for the integer formats). Signed-off-by: Chris Forbes chr...@ijw.co.nz Reviewed-by: Brian Paul bri...@vmware.com :04 04 f6c61704eb29883f7f1f6b3ca0a0b33c3b37abfd cb5fa6fcaea7036f0792067e35567f9cc4147151 Msrc bisect run success -- 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 2/2] st/mesa: improve sampler view handling
From: Christian König christian.koe...@amd.com Keep a dynamically increasing array of all the views created for a texture instead of just the last one. Signed-off-by: Christian König christian.koe...@amd.com --- src/mesa/state_tracker/st_atom_sampler.c | 21 --- src/mesa/state_tracker/st_atom_texture.c | 53 +--- src/mesa/state_tracker/st_cb_eglimage.c | 2 +- src/mesa/state_tracker/st_cb_texture.c | 20 +-- src/mesa/state_tracker/st_gen_mipmap.c | 2 +- src/mesa/state_tracker/st_texture.c | 60 ++-- src/mesa/state_tracker/st_texture.h | 16 +++-- src/mesa/state_tracker/st_vdpau.c| 11 +++--- 8 files changed, 129 insertions(+), 56 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index ec2bab2..f89013f 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -182,15 +182,26 @@ convert_sampler(struct st_context *st, msamp-BorderColor.ui[3]) { const struct st_texture_object *stobj = st_texture_object_const(texobj); const GLboolean is_integer = texobj-_IsIntegerFormat; + const struct pipe_sampler_view *sv = NULL; union pipe_color_union border_color; + GLuint i; + + /* Just search for the first used view */ + /* XXX: clean that up to not use the sampler view at all */ + for (i = 0; i stobj-num_sampler_views; ++i) { + if (stobj-sampler_views[i]) { +sv = stobj-sampler_views[i]; +break; + } + } - if (st-apply_texture_swizzle_to_border_color stobj-sampler_view) { + if (st-apply_texture_swizzle_to_border_color sv) { const unsigned char swz[4] = { -stobj-sampler_view-swizzle_r, -stobj-sampler_view-swizzle_g, -stobj-sampler_view-swizzle_b, -stobj-sampler_view-swizzle_a, +sv-swizzle_r, +sv-swizzle_g, +sv-swizzle_b, +sv-swizzle_a, }; st_translate_color(msamp-BorderColor, diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 75e6fac..245e615 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -186,40 +186,47 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, static struct pipe_sampler_view * -st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj, - struct pipe_context *pipe, +st_get_texture_sampler_view_from_stobj(struct st_context *st, + struct st_texture_object *stObj, const struct gl_sampler_object *samp, enum pipe_format format) { + struct pipe_sampler_view **sv; + if (!stObj || !stObj-pt) { return NULL; } - if (!stObj-sampler_view) { - stObj-sampler_view = - st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format); + sv = st_texture_get_sampler_view(st, stObj); + + /* if sampler view has changed dereference it */ + if (*sv) { + if (check_sampler_swizzle(*sv, stObj-base._Swizzle, stObj-base.DepthMode) || + (format != (*sv)-format) || + stObj-base.BaseLevel != (*sv)-u.tex.first_level) { +pipe_sampler_view_reference(sv, NULL); + } + } + + if (!*sv) { + *sv = st_create_texture_sampler_view_from_stobj(st-pipe, stObj, samp, format); - } else if (stObj-sampler_view-context != pipe) { + } else if ((*sv)-context != st-pipe) { /* Recreate view in correct context, use existing view as template */ - /* XXX: This isn't optimal, we should try to use more than one view. - Otherwise we create/destroy the view all the time - */ - struct pipe_sampler_view *sv = - pipe-create_sampler_view(pipe, stObj-pt, stObj-sampler_view); - pipe_sampler_view_reference(stObj-sampler_view, NULL); - stObj-sampler_view = sv; + struct pipe_sampler_view *new_sv = + st-pipe-create_sampler_view(st-pipe, stObj-pt, *sv); + pipe_sampler_view_reference(sv, NULL); + *sv = new_sv; } - return stObj-sampler_view; + return *sv; } - static GLboolean update_single_texture(struct st_context *st, struct pipe_sampler_view **sampler_view, GLuint texUnit) { - struct pipe_context *pipe = st-pipe; struct gl_context *ctx = st-ctx; const struct gl_sampler_object *samp; struct gl_texture_object *texObj; @@ -258,19 +265,7 @@ update_single_texture(struct st_context *st, } } - /* if sampler view has changed dereference it */ - if (stObj-sampler_view) { - if (check_sampler_swizzle(stObj-sampler_view, - stObj-base._Swizzle, -
[Mesa-dev] [PATCH 1/2] st/mesa: fix sampler view handling with shared textures v4
From: Christian König christian.koe...@amd.com Release the references to the sampler views before destroying the pipe context. v2: remove TODO and unrelated change v3: move to st_texture.[ch], rename callback, add comment v4: fix rebase mess up and add further cleanups Signed-off-by: Christian König christian.koe...@amd.com Cc: 10.0 10.1 mesa-sta...@lists.freedesktop.org --- src/mesa/state_tracker/st_context.c | 17 + src/mesa/state_tracker/st_texture.c | 7 +++ src/mesa/state_tracker/st_texture.h | 4 3 files changed, 28 insertions(+) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 0ffc762..807a86f 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -33,6 +33,7 @@ #include main/shaderobj.h #include main/version.h #include main/vtxfmt.h +#include main/hash.h #include program/prog_cache.h #include vbo/vbo.h #include glapi/glapi.h @@ -66,6 +67,7 @@ #include st_gen_mipmap.h #include st_program.h #include st_vdpau.h +#include st_texture.h #include pipe/p_context.h #include util/u_inlines.h #include util/u_upload_mgr.h @@ -280,6 +282,19 @@ static void st_destroy_context_priv( struct st_context *st ) free( st ); } + +/** + * Callback to release the sampler view attached to a texture object. + * Called by _mesa_HashWalk(). + */ +static void +destroy_tex_sampler_cb(GLuint id, void *data, void *userData) +{ + struct gl_texture_object *texObj = (struct gl_texture_object *) data; + struct st_context *st = (struct st_context *) userData; + + st_texture_release_sampler_view(st, st_texture_object(texObj)); +} void st_destroy_context( struct st_context *st ) { @@ -288,6 +303,8 @@ void st_destroy_context( struct st_context *st ) struct gl_context *ctx = st-ctx; GLuint i; + _mesa_HashWalk(ctx-Shared-TexObjects, destroy_tex_sampler_cb, st); + /* need to unbind and destroy CSO objects before anything else */ cso_release_all(st-cso_context); diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index b5ccc76..a3b3453 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -412,3 +412,10 @@ st_create_color_map_texture(struct gl_context *ctx) return pt; } +void +st_texture_release_sampler_view(struct st_context *st, +struct st_texture_object *stObj) +{ + if (stObj-sampler_view stObj-sampler_view-context == st-pipe) + pipe_sampler_view_reference(stObj-sampler_view, NULL); +} diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index bce2a09..b4a27a0 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -227,4 +227,8 @@ st_texture_image_copy(struct pipe_context *pipe, extern struct pipe_resource * st_create_color_map_texture(struct gl_context *ctx); +extern void +st_texture_release_sampler_view(struct st_context *st, +struct st_texture_object *stObj); + #endif -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] st/mesa: recreate sampler view on context change v2
Will you try to implement the linked list? Sure, shouldn't be to much of a problem. It actually turned out to be easier as a small dynamically resized array. Patches are on the list CCing you, please review. Thanks, Christian. Am 24.03.2014 17:56, schrieb Christian König: Am 24.03.2014 17:13, schrieb Brian Paul: On 03/24/2014 10:04 AM, Christian König wrote: Am 24.03.2014 16:36, schrieb Brian Paul: On 03/24/2014 08:06 AM, Christian König wrote: From: Christian König christian.koe...@amd.com With shared glx contexts it is possible that a texture is create and used in one context and then used in another one resulting in incorrect sampler view usage. v2: avoid template copy Signed-off-by: Christian König christian.koe...@amd.com Cc: 10.0 10.1 mesa-sta...@lists.freedesktop.org --- src/mesa/state_tracker/st_atom_texture.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 3557a3f..dc7f635 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -198,6 +198,13 @@ st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj, if (!stObj-sampler_view) { stObj-sampler_view = st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format); + + } else if (stObj-sampler_view-context != pipe) { + /* Recreate view in correct context, use existing view as template */ + struct pipe_sampler_view *sv = + pipe-create_sampler_view(pipe, stObj-pt, stObj-sampler_view); + pipe_sampler_view_reference(stObj-sampler_view, NULL); + stObj-sampler_view = sv; } return stObj-sampler_view; My concern with this is if there really are multiple contexts using one texture, we're going to continuously destroy and create sampler views when we validate state. Right? Yes that's correct and it also concerned me as well. Ultimately, the right solution might be to have a list of sampler views per texture, one sampler view per context. Since there usually aren't too many contexts sharing textures, a linked list would probably be OK. Completely agree, but this patchset is meant to be a bugfix for the crashes we experience with 10.x. For master a solution with a linked list should work better indeed. OK, let's put a 'XXX' comment describing that solution in the code for now. With that, Reviewed-by: Brian Paul bri...@vmware.com Thanks, I've added the comment and pushed the result upstream. What about the other two patches? I would like to push at least #2 as well, cause it is clearly a bugfix. Will you try to implement the linked list? Sure, shouldn't be to much of a problem. Christian. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] RFC: Fixing XBMC crash with NV_vdpau_interop
Am 24.03.2014 18:54, schrieb Roland Scheidegger: Am 23.03.2014 12:36, schrieb Christian König: Am 22.03.2014 23:33, schrieb Brian Paul: On Sat, Mar 22, 2014 at 2:49 PM, Christian König deathsim...@vodafone.de mailto:deathsim...@vodafone.de wrote: Hi guys, recently some XBMC users complained about crashes with the relatively new NV_vdpau_interop support. That turned out to be a problem with how st_atom_texture.c caches the sampler view for a texture. Since the texture in question is shared between two GLX contexts the pipe object the sampler view was originally created for doesn't necessary match the pipe object it is used with. Now my question is am I missing something or is this case really not correctly supported? Where is the check if a texture is used in more than one context? The attached patch fixes the issue, but I'm not sure if it is the right approach. I've run into this too. I think the best thing to do (short of removing the sampler view from the st_texture_object) is to walk over all the textures in the share group at context-destroy time, looking for sampler views belonging to the context being destroyed, then free those sampler views. Yeah, that's also a problem, but not what I'm currently dealing with. My problem is that we pass a sampler view to a pipe context which doesn't belong to this context. Surprisingly the driver doesn't crash immediately, but instead works fine for at least some time. Our radeonsi driver keeps an internal reference to all sample views bound to it, and so when some times later a new sampler view is bound we unreference the sampler view in question and crash because the context where this sampler view was created with no longer exists. So it's reference inside the driver that crashes, not the one in the mesa state tracker. So there is probably nothing I can do except for what the attached patch does and try to never bind a sampler view to a context it doesn't belong to. I could probably whip up a patch next week. Would you mind if I try to fix that? Doesn't sounds so complicated to me. Some texture sharing problems crop up from time to time due to this (textures being sharable by GL, but sampler views are strictly per-context in gallium). If the sampler view would be destroyed when the context is destroyed, wouldn't that also get rid of the reference in the driver (though I guess you should unbind that texture if it's still bound at that point)? Though arguably, you are not supposed to use sampler views belonging to another context even if said context still exists. So, I think recreating the sampler view when the current one belongs to a different context is fine, though maybe it would be better if the views would be separated from the st_texture_object and stored somewhere else in the context. Roland Completely agree. I just send out two patches to the list to fix this. The first one now properly destroys the sampler views when the contexts are destroyed. The second one adds a small dynamically increasing array of samplers views to the texture, so that each context gets it's own entry in that array. Please review, Christian. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mapi/glapi: Use ElementTree instead of libxml2.
On Tue, Mar 25, 2014 at 9:34 AM, jfons...@vmware.com wrote: diff --git a/configure.ac b/configure.ac index c5042f9..04bf711 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,6 @@ AM_PROG_CC_C_O AM_PROG_AS AC_CHECK_PROGS([MAKE], [gmake make]) AC_CHECK_PROGS([PYTHON2], [python2 python]) -AX_PYTHON_MODULE([libxml2], [needed]) This is the only use of AX_PYTHON_MODULE, so you can remove m4/ax_python_module.m4 too, I think. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/14] Klocwork patches
On Tue, Mar 25, 2014 at 5:40 AM, Juha-Pekka Heikkila juhapekka.heikk...@gmail.com wrote: Again fixed my Klocwork set. I reworked Ian's patch because my set depend on it and Ian's patch seem to have vanished in the void. It needed a small update because it was breaking make check. I already reviewed a hand-full of these, but none my my R-b tags are on the patches. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2] i965: fix dma_buf import with non-zero offset.
Pushed to git master after r-b on IRC (#intel-gfx) a few days ago. Thanks. 2014-03-14 18:46 GMT+01:00 Gwenole Beauchesne gb.de...@gmail.com: Fix eglCreateImage() from a packed dma_buf surface with a non-zero offset to pixels data. In particular, this fixes support for planar YUV surfaces when they are individually mapped on a per-plane basis, i.e. when the OES_EGL_image_external is not used and user application wants to use its own shader code for composition, or processing on individual plane (OCL). v2: fixed check for tile boundary. Signed-off-by: Gwenole Beauchesne gwenole.beauche...@intel.com --- src/mesa/drivers/dri/i965/intel_screen.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 1e3d58f..5005b5c 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -737,6 +737,13 @@ intel_create_image_from_fds(__DRIscreen *screen, image-strides[index] = strides[index]; } + if (f-nplanes == 1) { + image-offset = image-offsets[0]; + if (image-region-tiling != I915_TILING_NONE (image-offset 0xfff)) + _mesa_warning(NULL, + intel_create_image_from_fds: offset not on tile boundary); + } + intel_setup_image_from_dimensions(image); return image; -- 1.7.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] i965: Use intel_upload_map/unmap for pull constant uploads.
This also happens to fix a leak of the current GS pull constant BO on context destroy, by just not holding on to the pull const bos after the surface state is generated. No statistically significant performance difference on GLB2.7 on HSW at 1024x768 (n=40) or 320x240 (n=44), or on BYT at 320x240 (n=47). v2: Rebase on intel_upload simplification. --- src/mesa/drivers/dri/i965/brw_context.c | 2 -- src/mesa/drivers/dri/i965/brw_context.h | 3 --- src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 26 +--- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 19 +++-- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 9a76ee1..e113654 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -821,8 +821,6 @@ intelDestroyContext(__DRIcontext * driContextPriv) brw_draw_destroy(brw); drm_intel_bo_unreference(brw-curbe.curbe_bo); - drm_intel_bo_unreference(brw-vs.base.const_bo); - drm_intel_bo_unreference(brw-wm.base.const_bo); free(brw-curbe.last_buf); free(brw-curbe.next_buf); diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index e119682..dbe504a 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -933,9 +933,6 @@ struct brw_stage_state */ drm_intel_bo *scratch_bo; - /** Pull constant buffer */ - drm_intel_bo *const_bo; - /** Offset in the program cache to the program */ uint32_t prog_offset; diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c index bd97a22..cbe88ea 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -34,7 +34,7 @@ #include brw_context.h #include brw_state.h - +#include intel_buffer_objects.h void brw_upload_vec4_pull_constants(struct brw_context *brw, @@ -52,9 +52,7 @@ brw_upload_vec4_pull_constants(struct brw_context *brw, _mesa_load_state_parameters(brw-ctx, prog-Parameters); if (!prog_data-base.nr_pull_params) { - if (stage_state-const_bo) { -drm_intel_bo_unreference(stage_state-const_bo); -stage_state-const_bo = NULL; + if (stage_state-surf_offset[surf_index]) { stage_state-surf_offset[surf_index] = 0; brw-state.dirty.brw |= brw_new_constbuf; } @@ -62,32 +60,28 @@ brw_upload_vec4_pull_constants(struct brw_context *brw, } /* _NEW_PROGRAM_CONSTANTS */ - drm_intel_bo_unreference(stage_state-const_bo); uint32_t size = prog_data-base.nr_pull_params * 4; - stage_state-const_bo = drm_intel_bo_alloc(brw-bufmgr, vec4_const_buffer, - size, 64); - - drm_intel_gem_bo_map_gtt(stage_state-const_bo); + drm_intel_bo *const_bo = NULL; + uint32_t const_offset; + float *constants = intel_upload_space(brw, size, 64, + const_bo, const_offset); for (i = 0; i prog_data-base.nr_pull_params; i++) { - memcpy(stage_state-const_bo-virtual + i * 4, -prog_data-base.pull_param[i], -4); + constants[i] = *prog_data-base.pull_param[i]; } if (0) { for (i = 0; i ALIGN(prog_data-base.nr_pull_params, 4) / 4; i++) { -float *row = (float *)stage_state-const_bo-virtual + i * 4; +float *row = constants[i * 4]; fprintf(stderr, const surface %3d: %4.3f %4.3f %4.3f %4.3f\n, i, row[0], row[1], row[2], row[3]); } } - drm_intel_gem_bo_unmap_gtt(stage_state-const_bo); - - brw_create_constant_surface(brw, stage_state-const_bo, 0, size, + brw_create_constant_surface(brw, const_bo, const_offset, size, stage_state-surf_offset[surf_index], false); + drm_intel_bo_unreference(const_bo); brw-state.dirty.brw |= brw_new_constbuf; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 61f7ba5..443820b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -467,37 +467,32 @@ brw_upload_wm_pull_constants(struct brw_context *brw) const int size = brw-wm.prog_data-base.nr_pull_params * sizeof(float); const int surf_index = brw-wm.prog_data-base.binding_table.pull_constants_start; - float *constants; unsigned int i; _mesa_load_state_parameters(ctx, params); /* CACHE_NEW_WM_PROG */ if (brw-wm.prog_data-base.nr_pull_params == 0) { - if (brw-wm.base.const_bo) { -drm_intel_bo_unreference(brw-wm.base.const_bo); -brw-wm.base.const_bo = NULL; + if (brw-wm.base.surf_offset[surf_index]) { brw-wm.base.surf_offset[surf_index] = 0;
Re: [Mesa-dev] [PATCH 01/10] mesa: Add entry for extension ARB_texture_stencil8
On 03/21/2014 03:01 PM, Anuj Phogat wrote: Cc: mesa-sta...@lists.freedesktop.org Why is this tagged for stable? Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/mesa/main/mtypes.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a0d893c..0b754b1 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3535,6 +3535,7 @@ struct gl_extensions GLboolean ARB_shading_language_420pack; GLboolean ARB_shadow; GLboolean ARB_stencil_texturing; + GLboolean ARB_texture_stencil8; Alphabetize. :) GLboolean ARB_sync; GLboolean ARB_texture_border_clamp; GLboolean ARB_texture_buffer_object; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] i965: Massively simplify the intel_upload implementation.
The implementation kept a page-sized area for uploading data, and uploaded chunks from that to a 64kb-sized streamed buffer. This wasted cache footprint (and extra state tracking to do so) when we want to just write our data into the buffer immediately. Instead, build it around an interface like brw_state_batch() that just gets you a pointer to BO memory to upload your stuff immediately. Improves OpenArena on HSW by 1.62209% +/- 0.355299% (n=61) and on BYT by 1.7916% +/- 0.415743% (n=31). v2: Rebase on Mesa master, drop old prototypes. Re-do performance comparison on a kernel that doesn't punish CPU efficiency improvements. --- src/mesa/drivers/dri/i965/brw_context.h | 5 +- src/mesa/drivers/dri/i965/brw_draw_upload.c | 10 +- src/mesa/drivers/dri/i965/intel_buffer_objects.h | 21 +-- src/mesa/drivers/dri/i965/intel_upload.c | 167 +-- 4 files changed, 77 insertions(+), 126 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 04af5d0..e119682 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1041,10 +1041,7 @@ struct brw_context struct { drm_intel_bo *bo; - GLuint offset; - uint32_t buffer_len; - uint32_t buffer_offset; - char buffer[4096]; + uint32_t next_offset; } upload; /** diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index e261163..a579025 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -381,21 +381,17 @@ copy_array_to_vbo_array(struct brw_context *brw, const unsigned char *src = element-glarray-Ptr + min * src_stride; int count = max - min + 1; GLuint size = count * dst_stride; + uint8_t *dst = intel_upload_space(brw, size, dst_stride, + buffer-bo, buffer-offset); if (dst_stride == src_stride) { - intel_upload_data(brw, src, size, dst_stride, - buffer-bo, buffer-offset); + memcpy(dst, src, size); } else { - char * const map = intel_upload_map(brw, size, dst_stride); - char *dst = map; - while (count--) { memcpy(dst, src, dst_stride); src += src_stride; dst += dst_stride; } - intel_upload_unmap(brw, map, size, dst_stride, -buffer-bo, buffer-offset); } buffer-stride = dst_stride; } diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.h b/src/mesa/drivers/dri/i965/intel_buffer_objects.h index b27d25f..5eaf9dc 100644 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.h +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.h @@ -90,16 +90,17 @@ drm_intel_bo *intel_bufferobj_buffer(struct brw_context *brw, uint32_t size); void intel_upload_data(struct brw_context *brw, - const void *ptr, GLuint size, GLuint align, - drm_intel_bo **return_bo, - GLuint *return_offset); - -void *intel_upload_map(struct brw_context *brw, - GLuint size, GLuint align); -void intel_upload_unmap(struct brw_context *brw, - const void *ptr, GLuint size, GLuint align, - drm_intel_bo **return_bo, - GLuint *return_offset); + const void *data, + uint32_t size, + uint32_t alignment, + drm_intel_bo **out_bo, + uint32_t *out_offset); + +void *intel_upload_space(struct brw_context *brw, + uint32_t size, + uint32_t alignment, + drm_intel_bo **out_bo, + uint32_t *out_offset); void intel_upload_finish(struct brw_context *brw); diff --git a/src/mesa/drivers/dri/i965/intel_upload.c b/src/mesa/drivers/dri/i965/intel_upload.c index ec3109b..bb3f615 100644 --- a/src/mesa/drivers/dri/i965/intel_upload.c +++ b/src/mesa/drivers/dri/i965/intel_upload.c @@ -57,127 +57,84 @@ intel_upload_finish(struct brw_context *brw) if (!brw-upload.bo) return; - if (brw-upload.buffer_len) { - drm_intel_bo_subdata(brw-upload.bo, - brw-upload.buffer_offset, - brw-upload.buffer_len, - brw-upload.buffer); - brw-upload.buffer_len = 0; - } - + drm_intel_bo_unmap(brw-upload.bo); drm_intel_bo_unreference(brw-upload.bo); brw-upload.bo = NULL; + brw-upload.next_offset = 0; } -static void -wrap_buffers(struct brw_context *brw, GLuint size) -{ - intel_upload_finish(brw); - - if (size INTEL_UPLOAD_SIZE) - size = INTEL_UPLOAD_SIZE; - - brw-upload.bo = drm_intel_bo_alloc(brw-bufmgr, upload, size, 0); - brw-upload.offset = 0; -} -
Re: [Mesa-dev] [PATCH 00/14] Klocwork patches
On Tue, Mar 25, 2014 at 7:46 PM, Matt Turner matts...@gmail.com wrote: On Tue, Mar 25, 2014 at 5:40 AM, Juha-Pekka Heikkila juhapekka.heikk...@gmail.com wrote: Again fixed my Klocwork set. I reworked Ian's patch because my set depend on it and Ian's patch seem to have vanished in the void. It needed a small update because it was breaking make check. I already reviewed a hand-full of these, but none my my R-b tags are on the patches. Ah, my bad. I knew I was forgetting something from the patches today. I will resend tomorrow with correct tags. /Juha-Pekka ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 75797] EGL application crashes with BadDrawable at SwapBuffers
https://bugs.freedesktop.org/show_bug.cgi?id=75797 --- Comment #2 from Armin K kre...@email.com --- Is this patch submitted to mesa-dev list? -- 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 01/10] mesa: Add entry for extension ARB_texture_stencil8
On Tue, Mar 25, 2014 at 11:41 AM, Ian Romanick i...@freedesktop.org wrote: On 03/21/2014 03:01 PM, Anuj Phogat wrote: Cc: mesa-sta...@lists.freedesktop.org Why is this tagged for stable? [Patch 2 / 10] is a bug fix tagged for stable and it requires this change. Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/mesa/main/mtypes.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a0d893c..0b754b1 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3535,6 +3535,7 @@ struct gl_extensions GLboolean ARB_shading_language_420pack; GLboolean ARB_shadow; GLboolean ARB_stencil_texturing; + GLboolean ARB_texture_stencil8; Alphabetize. :) ok GLboolean ARB_sync; GLboolean ARB_texture_border_clamp; GLboolean ARB_texture_buffer_object; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] st/mesa: fix sampler view handling with shared textures v4
On 03/25/2014 11:28 AM, Christian König wrote: From: Christian König christian.koe...@amd.com Release the references to the sampler views before destroying the pipe context. v2: remove TODO and unrelated change v3: move to st_texture.[ch], rename callback, add comment v4: fix rebase mess up and add further cleanups Signed-off-by: Christian König christian.koe...@amd.com Cc: 10.0 10.1 mesa-sta...@lists.freedesktop.org --- src/mesa/state_tracker/st_context.c | 17 + src/mesa/state_tracker/st_texture.c | 7 +++ src/mesa/state_tracker/st_texture.h | 4 3 files changed, 28 insertions(+) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 0ffc762..807a86f 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -33,6 +33,7 @@ #include main/shaderobj.h #include main/version.h #include main/vtxfmt.h +#include main/hash.h #include program/prog_cache.h #include vbo/vbo.h #include glapi/glapi.h @@ -66,6 +67,7 @@ #include st_gen_mipmap.h #include st_program.h #include st_vdpau.h +#include st_texture.h #include pipe/p_context.h #include util/u_inlines.h #include util/u_upload_mgr.h @@ -280,6 +282,19 @@ static void st_destroy_context_priv( struct st_context *st ) free( st ); } + +/** + * Callback to release the sampler view attached to a texture object. + * Called by _mesa_HashWalk(). + */ +static void +destroy_tex_sampler_cb(GLuint id, void *data, void *userData) +{ + struct gl_texture_object *texObj = (struct gl_texture_object *) data; + struct st_context *st = (struct st_context *) userData; + + st_texture_release_sampler_view(st, st_texture_object(texObj)); +} void st_destroy_context( struct st_context *st ) { @@ -288,6 +303,8 @@ void st_destroy_context( struct st_context *st ) struct gl_context *ctx = st-ctx; GLuint i; + _mesa_HashWalk(ctx-Shared-TexObjects, destroy_tex_sampler_cb, st); + /* need to unbind and destroy CSO objects before anything else */ cso_release_all(st-cso_context); diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index b5ccc76..a3b3453 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -412,3 +412,10 @@ st_create_color_map_texture(struct gl_context *ctx) return pt; } +void +st_texture_release_sampler_view(struct st_context *st, +struct st_texture_object *stObj) +{ + if (stObj-sampler_view stObj-sampler_view-context == st-pipe) + pipe_sampler_view_reference(stObj-sampler_view, NULL); +} diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index bce2a09..b4a27a0 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -227,4 +227,8 @@ st_texture_image_copy(struct pipe_context *pipe, extern struct pipe_resource * st_create_color_map_texture(struct gl_context *ctx); +extern void +st_texture_release_sampler_view(struct st_context *st, +struct st_texture_object *stObj); + #endif Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] st/mesa: improve sampler view handling
Minor nits below. On 03/25/2014 11:28 AM, Christian König wrote: From: Christian König christian.koe...@amd.com Keep a dynamically increasing array of all the views created for a texture instead of just the last one. Signed-off-by: Christian König christian.koe...@amd.com --- src/mesa/state_tracker/st_atom_sampler.c | 21 --- src/mesa/state_tracker/st_atom_texture.c | 53 +--- src/mesa/state_tracker/st_cb_eglimage.c | 2 +- src/mesa/state_tracker/st_cb_texture.c | 20 +-- src/mesa/state_tracker/st_gen_mipmap.c | 2 +- src/mesa/state_tracker/st_texture.c | 60 ++-- src/mesa/state_tracker/st_texture.h | 16 +++-- src/mesa/state_tracker/st_vdpau.c| 11 +++--- 8 files changed, 129 insertions(+), 56 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index ec2bab2..f89013f 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -182,15 +182,26 @@ convert_sampler(struct st_context *st, msamp-BorderColor.ui[3]) { const struct st_texture_object *stobj = st_texture_object_const(texobj); const GLboolean is_integer = texobj-_IsIntegerFormat; + const struct pipe_sampler_view *sv = NULL; union pipe_color_union border_color; + GLuint i; + + /* Just search for the first used view */ /* We can do this because the swizzle is per-texture, not per context. */ + /* XXX: clean that up to not use the sampler view at all */ + for (i = 0; i stobj-num_sampler_views; ++i) { + if (stobj-sampler_views[i]) { +sv = stobj-sampler_views[i]; +break; + } + } - if (st-apply_texture_swizzle_to_border_color stobj-sampler_view) { + if (st-apply_texture_swizzle_to_border_color sv) { const unsigned char swz[4] = { -stobj-sampler_view-swizzle_r, -stobj-sampler_view-swizzle_g, -stobj-sampler_view-swizzle_b, -stobj-sampler_view-swizzle_a, +sv-swizzle_r, +sv-swizzle_g, +sv-swizzle_b, +sv-swizzle_a, }; st_translate_color(msamp-BorderColor, diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 75e6fac..245e615 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -186,40 +186,47 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, static struct pipe_sampler_view * -st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj, - struct pipe_context *pipe, +st_get_texture_sampler_view_from_stobj(struct st_context *st, + struct st_texture_object *stObj, const struct gl_sampler_object *samp, enum pipe_format format) { + struct pipe_sampler_view **sv; + if (!stObj || !stObj-pt) { return NULL; } - if (!stObj-sampler_view) { - stObj-sampler_view = - st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format); + sv = st_texture_get_sampler_view(st, stObj); + + /* if sampler view has changed dereference it */ + if (*sv) { + if (check_sampler_swizzle(*sv, stObj-base._Swizzle, stObj-base.DepthMode) || + (format != (*sv)-format) || + stObj-base.BaseLevel != (*sv)-u.tex.first_level) { +pipe_sampler_view_reference(sv, NULL); + } + } + + if (!*sv) { + *sv = st_create_texture_sampler_view_from_stobj(st-pipe, stObj, samp, format); - } else if (stObj-sampler_view-context != pipe) { + } else if ((*sv)-context != st-pipe) { /* Recreate view in correct context, use existing view as template */ - /* XXX: This isn't optimal, we should try to use more than one view. - Otherwise we create/destroy the view all the time - */ - struct pipe_sampler_view *sv = - pipe-create_sampler_view(pipe, stObj-pt, stObj-sampler_view); - pipe_sampler_view_reference(stObj-sampler_view, NULL); - stObj-sampler_view = sv; + struct pipe_sampler_view *new_sv = + st-pipe-create_sampler_view(st-pipe, stObj-pt, *sv); + pipe_sampler_view_reference(sv, NULL); + *sv = new_sv; } - return stObj-sampler_view; + return *sv; } - static GLboolean update_single_texture(struct st_context *st, struct pipe_sampler_view **sampler_view, GLuint texUnit) { - struct pipe_context *pipe = st-pipe; struct gl_context *ctx = st-ctx; const struct gl_sampler_object *samp; struct gl_texture_object *texObj; @@ -258,19 +265,7 @@ update_single_texture(struct st_context *st, } } - /* if sampler view
[Mesa-dev] [Bug 76602] [llvmpipe] [softpipe] piglit draw-pixels regression
https://bugs.freedesktop.org/show_bug.cgi?id=76602 --- Comment #1 from Brian Paul bri...@vmware.com --- Chris, how about reverting your patch? I assumed you tested your change with piglit. Let's be more careful about that in the future. -- 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 76602] [llvmpipe] [softpipe] piglit draw-pixels regression
https://bugs.freedesktop.org/show_bug.cgi?id=76602 --- Comment #2 from Chris Forbes chr...@ijw.co.nz --- This works on i965 and swrast. I don't usually build softpipe or llvmpipe, so I didn't see this problem. Let's revert it for now, though. I'll continue unraveling the breakage this is exposing and propose a new series soon. -- 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 2/2] i965: Use intel_upload_map/unmap for pull constant uploads.
On 03/25/2014 11:27 AM, Eric Anholt wrote: This also happens to fix a leak of the current GS pull constant BO on context destroy, by just not holding on to the pull const bos after the surface state is generated. We should fix that separately so we have a patch which can be cherry-picked to 10.1 or 10.0. Otherwise, this looks good to me. Even though it apparently didn't help performance, I'm still fine with doing it. If anything, it decreases code complexity a little bit. Reviewed-by: Kenneth Graunke kenn...@whitecape.org No statistically significant performance difference on GLB2.7 on HSW at 1024x768 (n=40) or 320x240 (n=44), or on BYT at 320x240 (n=47). v2: Rebase on intel_upload simplification. --- src/mesa/drivers/dri/i965/brw_context.c | 2 -- src/mesa/drivers/dri/i965/brw_context.h | 3 --- src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 26 +--- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 19 +++-- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 9a76ee1..e113654 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -821,8 +821,6 @@ intelDestroyContext(__DRIcontext * driContextPriv) brw_draw_destroy(brw); drm_intel_bo_unreference(brw-curbe.curbe_bo); - drm_intel_bo_unreference(brw-vs.base.const_bo); - drm_intel_bo_unreference(brw-wm.base.const_bo); free(brw-curbe.last_buf); free(brw-curbe.next_buf); diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index e119682..dbe504a 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -933,9 +933,6 @@ struct brw_stage_state */ drm_intel_bo *scratch_bo; - /** Pull constant buffer */ - drm_intel_bo *const_bo; - /** Offset in the program cache to the program */ uint32_t prog_offset; diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c index bd97a22..cbe88ea 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -34,7 +34,7 @@ #include brw_context.h #include brw_state.h - +#include intel_buffer_objects.h void brw_upload_vec4_pull_constants(struct brw_context *brw, @@ -52,9 +52,7 @@ brw_upload_vec4_pull_constants(struct brw_context *brw, _mesa_load_state_parameters(brw-ctx, prog-Parameters); if (!prog_data-base.nr_pull_params) { - if (stage_state-const_bo) { - drm_intel_bo_unreference(stage_state-const_bo); - stage_state-const_bo = NULL; + if (stage_state-surf_offset[surf_index]) { stage_state-surf_offset[surf_index] = 0; brw-state.dirty.brw |= brw_new_constbuf; } @@ -62,32 +60,28 @@ brw_upload_vec4_pull_constants(struct brw_context *brw, } /* _NEW_PROGRAM_CONSTANTS */ - drm_intel_bo_unreference(stage_state-const_bo); uint32_t size = prog_data-base.nr_pull_params * 4; - stage_state-const_bo = drm_intel_bo_alloc(brw-bufmgr, vec4_const_buffer, - size, 64); - - drm_intel_gem_bo_map_gtt(stage_state-const_bo); + drm_intel_bo *const_bo = NULL; + uint32_t const_offset; + float *constants = intel_upload_space(brw, size, 64, + const_bo, const_offset); for (i = 0; i prog_data-base.nr_pull_params; i++) { - memcpy(stage_state-const_bo-virtual + i * 4, - prog_data-base.pull_param[i], - 4); + constants[i] = *prog_data-base.pull_param[i]; } if (0) { for (i = 0; i ALIGN(prog_data-base.nr_pull_params, 4) / 4; i++) { - float *row = (float *)stage_state-const_bo-virtual + i * 4; + float *row = constants[i * 4]; fprintf(stderr, const surface %3d: %4.3f %4.3f %4.3f %4.3f\n, i, row[0], row[1], row[2], row[3]); } } - drm_intel_gem_bo_unmap_gtt(stage_state-const_bo); - - brw_create_constant_surface(brw, stage_state-const_bo, 0, size, + brw_create_constant_surface(brw, const_bo, const_offset, size, stage_state-surf_offset[surf_index], false); + drm_intel_bo_unreference(const_bo); brw-state.dirty.brw |= brw_new_constbuf; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 61f7ba5..443820b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -467,37 +467,32 @@ brw_upload_wm_pull_constants(struct brw_context *brw) const int size = brw-wm.prog_data-base.nr_pull_params * sizeof(float); const int surf_index =
[Mesa-dev] [Bug 76602] [llvmpipe] [softpipe] piglit draw-pixels regression
https://bugs.freedesktop.org/show_bug.cgi?id=76602 --- Comment #3 from Brian Paul bri...@vmware.com --- OK, thanks Chris. I hate it when a test passes with one driver but not another like 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
Re: [Mesa-dev] [PATCH 1/2] i965: Massively simplify the intel_upload implementation.
On 03/25/2014 11:27 AM, Eric Anholt wrote: The implementation kept a page-sized area for uploading data, and uploaded chunks from that to a 64kb-sized streamed buffer. This wasted cache footprint (and extra state tracking to do so) when we want to just write our data into the buffer immediately. Instead, build it around an interface like brw_state_batch() that just gets you a pointer to BO memory to upload your stuff immediately. Improves OpenArena on HSW by 1.62209% +/- 0.355299% (n=61) and on BYT by 1.7916% +/- 0.415743% (n=31). v2: Rebase on Mesa master, drop old prototypes. Re-do performance comparison on a kernel that doesn't punish CPU efficiency improvements. --- src/mesa/drivers/dri/i965/brw_context.h | 5 +- src/mesa/drivers/dri/i965/brw_draw_upload.c | 10 +- src/mesa/drivers/dri/i965/intel_buffer_objects.h | 21 +-- src/mesa/drivers/dri/i965/intel_upload.c | 167 +-- 4 files changed, 77 insertions(+), 126 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 04af5d0..e119682 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1041,10 +1041,7 @@ struct brw_context struct { drm_intel_bo *bo; - GLuint offset; - uint32_t buffer_len; - uint32_t buffer_offset; - char buffer[4096]; + uint32_t next_offset; } upload; /** diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index e261163..a579025 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -381,21 +381,17 @@ copy_array_to_vbo_array(struct brw_context *brw, const unsigned char *src = element-glarray-Ptr + min * src_stride; int count = max - min + 1; GLuint size = count * dst_stride; + uint8_t *dst = intel_upload_space(brw, size, dst_stride, + buffer-bo, buffer-offset); It sure seems like these references will exist across batchbuffers, meaning we may hold on to the upload buffer containing our vertex data until we do copy_array_to_vbo_array on it again. That seems unfortunate. (Or, maybe I'm wrong?) However, I'm pretty sure the old code had that same problem, so your new code is still a huge improvement. Patch 1 is: Reviewed-by: Kenneth Graunke kenn...@whitecape.org if (dst_stride == src_stride) { - intel_upload_data(brw, src, size, dst_stride, - buffer-bo, buffer-offset); + memcpy(dst, src, size); } else { - char * const map = intel_upload_map(brw, size, dst_stride); - char *dst = map; - while (count--) { memcpy(dst, src, dst_stride); src += src_stride; dst += dst_stride; } - intel_upload_unmap(brw, map, size, dst_stride, - buffer-bo, buffer-offset); } buffer-stride = dst_stride; } diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.h b/src/mesa/drivers/dri/i965/intel_buffer_objects.h index b27d25f..5eaf9dc 100644 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.h +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.h @@ -90,16 +90,17 @@ drm_intel_bo *intel_bufferobj_buffer(struct brw_context *brw, uint32_t size); void intel_upload_data(struct brw_context *brw, -const void *ptr, GLuint size, GLuint align, -drm_intel_bo **return_bo, -GLuint *return_offset); - -void *intel_upload_map(struct brw_context *brw, -GLuint size, GLuint align); -void intel_upload_unmap(struct brw_context *brw, - const void *ptr, GLuint size, GLuint align, - drm_intel_bo **return_bo, - GLuint *return_offset); + const void *data, + uint32_t size, + uint32_t alignment, + drm_intel_bo **out_bo, + uint32_t *out_offset); + +void *intel_upload_space(struct brw_context *brw, + uint32_t size, + uint32_t alignment, + drm_intel_bo **out_bo, + uint32_t *out_offset); void intel_upload_finish(struct brw_context *brw); diff --git a/src/mesa/drivers/dri/i965/intel_upload.c b/src/mesa/drivers/dri/i965/intel_upload.c index ec3109b..bb3f615 100644 --- a/src/mesa/drivers/dri/i965/intel_upload.c +++ b/src/mesa/drivers/dri/i965/intel_upload.c @@ -57,127 +57,84 @@ intel_upload_finish(struct brw_context *brw) if (!brw-upload.bo) return; - if (brw-upload.buffer_len) { - drm_intel_bo_subdata(brw-upload.bo, - brw-upload.buffer_offset, -
[Mesa-dev] [PATCH 2/3] mesa/st: Accelerate ARB_clear_buffer_object with clear_buffer
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- Note that this also ensures that the clear size is passed through even when the data is null. This preserves the validation done to make sure that size % clear size == 0. src/mesa/main/bufferobj.c| 6 +++--- src/mesa/main/bufferobj.h| 7 +++ src/mesa/state_tracker/st_cb_bufferobjects.c | 28 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 2e9e059..36acd64 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -665,7 +665,7 @@ _mesa_buffer_get_subdata( struct gl_context *ctx, GLintptrARB offset, * \sa glClearBufferSubData, glClearBufferData and * dd_function_table::ClearBufferSubData. */ -static void +void _mesa_buffer_clear_subdata(struct gl_context *ctx, GLintptr offset, GLsizeiptr size, const GLvoid *clearValue, @@ -1458,7 +1458,7 @@ _mesa_ClearBufferData(GLenum target, GLenum internalformat, GLenum format, if (data == NULL) { /* clear to zeros, per the spec */ ctx-Driver.ClearBufferSubData(ctx, 0, bufObj-Size, - NULL, 0, bufObj); + NULL, clearValueSize, bufObj); return; } @@ -1510,7 +1510,7 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat, /* clear to zeros, per the spec */ if (size 0) { ctx-Driver.ClearBufferSubData(ctx, offset, size, -NULL, 0, bufObj); +NULL, clearValueSize, bufObj); } return; } diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 9814552..c08c4fd 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -115,6 +115,13 @@ extern void _mesa_buffer_unmap_all_mappings(struct gl_context *ctx, struct gl_buffer_object *bufObj); +extern void +_mesa_buffer_clear_subdata(struct gl_context *ctx, + GLintptr offset, GLsizeiptr size, + const GLvoid *clearValue, + GLsizeiptr clearValueSize, + struct gl_buffer_object *bufObj); + /* * API functions */ diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 49c4b90..2706903 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -447,6 +447,33 @@ st_copy_buffer_subdata(struct gl_context *ctx, srcObj-buffer, 0, box); } +/** + * Called via glClearBufferSubData(). + */ +static void +st_clear_buffer_subdata(struct gl_context *ctx, +GLintptr offset, GLsizeiptr size, +const GLvoid *clearValue, +GLsizeiptr clearValueSize, +struct gl_buffer_object *bufObj) +{ + struct pipe_context *pipe = st_context(ctx)-pipe; + struct st_buffer_object *buf = st_buffer_object(bufObj); + char zeros[16] = {0}; + + if (!pipe-clear_buffer) { + _mesa_buffer_clear_subdata( +ctx, offset, size, clearValue, clearValueSize, bufObj); + return; + } + + if (!clearValue) + clearValue = zeros; + + pipe-clear_buffer(pipe, buf-buffer, offset, size, + clearValue, clearValueSize); +} + /* TODO: if buffer wasn't created with appropriate usage flags, need * to recreate it now and copy contents -- or possibly create a @@ -476,6 +503,7 @@ st_init_bufferobject_functions(struct dd_function_table *functions) functions-FlushMappedBufferRange = st_bufferobj_flush_mapped_range; functions-UnmapBuffer = st_bufferobj_unmap; functions-CopyBufferSubData = st_copy_buffer_subdata; + functions-ClearBufferSubData = st_clear_buffer_subdata; /* For GL_APPLE_vertex_array_object */ functions-NewArrayObject = _mesa_new_vao; -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] gallium: add interface to clear buffers
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- src/gallium/include/pipe/p_context.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] nv50: implement clear_buffer to accelerate ARB_clear_buffer_object
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- This passed all the arb_clear_buffer_object tests. (And it failed a bunch of them until I realized I had to pass the pitch in and not the width for RT_HORIZ.) Presumably one could be clever and try to factor the number of elements instead of just rounding, but this seems good enough. src/gallium/drivers/nouveau/nv50/nv50_surface.c | 111 1 file changed, 111 insertions(+) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c index 612649b..52f23a0 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c @@ -476,6 +476,116 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, PUSH_DATA (push, nv50-rt_array_mode); } +static void +nv50_clear_buffer(struct pipe_context *pipe, + struct pipe_resource *res, + unsigned offset, unsigned size, + const void *data, int data_size) +{ + struct nv50_context *nv50 = nv50_context(pipe); + struct nouveau_pushbuf *push = nv50-base.pushbuf; + struct nv04_resource *buf = (struct nv04_resource *)res; + union pipe_color_union color; + enum pipe_format dst_fmt; + unsigned width, height, elements; + + assert(res-target == PIPE_BUFFER); + assert(nouveau_bo_memtype(buf-bo) == 0); + + switch (data_size) { + case 16: + dst_fmt = PIPE_FORMAT_R32G32B32A32_UINT; + memcpy(color.ui, data, 16); + break; + case 8: + dst_fmt = PIPE_FORMAT_R32G32_UINT; + memcpy(color.ui, data, 8); + memset(color.ui[2], 0, 8); + break; + case 4: + dst_fmt = PIPE_FORMAT_R32_UINT; + memcpy(color.ui, data, 4); + memset(color.ui[1], 0, 12); + break; + case 2: + dst_fmt = PIPE_FORMAT_R16_UINT; + color.ui[0] = util_cpu_to_le32( +util_le16_to_cpu(*(unsigned short *)data)); + memset(color.ui[1], 0, 12); + break; + case 1: + dst_fmt = PIPE_FORMAT_R8_UINT; + color.ui[0] = util_cpu_to_le32(*(unsigned char *)data); + memset(color.ui[1], 0, 12); + break; + default: + assert(!Unsupported element size); + return; + } + + assert(size % data_size == 0); + + elements = size / data_size; + height = (elements + 8191) / 8192; + width = elements / height; + + BEGIN_NV04(push, NV50_3D(CLEAR_COLOR(0)), 4); + PUSH_DATAf(push, color.f[0]); + PUSH_DATAf(push, color.f[1]); + PUSH_DATAf(push, color.f[2]); + PUSH_DATAf(push, color.f[3]); + + if (nouveau_pushbuf_space(push, 32, 1, 0)) + return; + + PUSH_REFN(push, buf-bo, buf-domain | NOUVEAU_BO_WR); + + BEGIN_NV04(push, NV50_3D(SCREEN_SCISSOR_HORIZ), 2); + PUSH_DATA (push, width 16); + PUSH_DATA (push, height 16); + + BEGIN_NV04(push, NV50_3D(RT_CONTROL), 1); + PUSH_DATA (push, 1); + BEGIN_NV04(push, NV50_3D(RT_ADDRESS_HIGH(0)), 5); + PUSH_DATAh(push, buf-bo-offset + buf-offset + offset); + PUSH_DATA (push, buf-bo-offset + buf-offset + offset); + PUSH_DATA (push, nv50_format_table[dst_fmt].rt); + PUSH_DATA (push, 0); + PUSH_DATA (push, 0); + BEGIN_NV04(push, NV50_3D(RT_HORIZ(0)), 2); + PUSH_DATA (push, NV50_3D_RT_HORIZ_LINEAR | (width * data_size)); + PUSH_DATA (push, height); + BEGIN_NV04(push, NV50_3D(ZETA_ENABLE), 1); + PUSH_DATA (push, 0); + + /* NOTE: only works with D3D clear flag (5097/0x143c bit 4) */ + + BEGIN_NV04(push, NV50_3D(VIEWPORT_HORIZ(0)), 2); + PUSH_DATA (push, (width 16)); + PUSH_DATA (push, (height 16)); + + BEGIN_NI04(push, NV50_3D(CLEAR_BUFFERS), 1); + PUSH_DATA (push, 0x3c); + + if (width * height != elements) { + offset += width * height * data_size; + width = elements - width * height; + height = 1; + BEGIN_NV04(push, NV50_3D(RT_ADDRESS_HIGH(0)), 2); + PUSH_DATAh(push, buf-bo-offset + buf-offset + offset); + PUSH_DATA (push, buf-bo-offset + buf-offset + offset); + BEGIN_NV04(push, NV50_3D(RT_HORIZ(0)), 2); + PUSH_DATA (push, NV50_3D_RT_HORIZ_LINEAR | (width * data_size)); + PUSH_DATA (push, height); + BEGIN_NI04(push, NV50_3D(CLEAR_BUFFERS), 1); + PUSH_DATA (push, 0x3c); + } + + nouveau_fence_ref(nv50-screen-base.fence.current, buf-fence); + nouveau_fence_ref(nv50-screen-base.fence.current, buf-fence_wr); + + nv50-dirty |= NV50_NEW_FRAMEBUFFER; +} /* === BLIT CODE === */ @@ -1403,4 +1513,5 @@ nv50_init_surface_functions(struct nv50_context *nv50) pipe-flush_resource = nv50_flush_resource; pipe-clear_render_target = nv50_clear_render_target; pipe-clear_depth_stencil = nv50_clear_depth_stencil; + pipe-clear_buffer = nv50_clear_buffer; } -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/16] DRI*extension cleanups v3
Hello gents, Can anyone take a look at this series. It's kind of blocking the query-renderer support + a cleanup series that I have locally. Thanks Emil On 16/03/14 13:48, Emil Velikov wrote: Hi all, Here is the third iteration of some DRI*extension cleanup patches. This revision adds some minor updates and squashes the patches into a shorter patchset. The previous revision can be found at http://lists.freedesktop.org/archives/mesa-dev/2014-February/054327.html For people interested in testing/pulling the patches, they can be found at https://github.com/evelikov/Mesa dri-extension-cleanup-v3 Comments and review are grately appreciated. Cheers Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCHv3] configure: enable dri3 only for linux
On 21/03/14 18:09, Emil Velikov wrote: Currently only linux can make use of dri3, so it would make sense to enable it explicitly for the platform. Drop a duplicated libudev check while we're at it. v3: Properly handle dri3 and reword commit message. Would there be any objections if I slap Cc: mesa-stable... on this patch and commit it some time this week ? -Emil Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76377 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- configure.ac | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index c5042f9..af6bfa4 100644 --- a/configure.ac +++ b/configure.ac @@ -528,11 +528,20 @@ AC_ARG_ENABLE([dri], [enable DRI modules @:@default=enabled@:@])], [enable_dri=$enableval], [enable_dri=yes]) + +case $host_os in +linux*) +dri3_default=yes +;; +*) +dri3_default=no +;; +esac AC_ARG_ENABLE([dri3], [AS_HELP_STRING([--enable-dri3], -[enable DRI3 @:@default=enabled@:@])], +[enable DRI3 @:@default=auto@:@])], [enable_dri3=$enableval], -[enable_dri3=yes]) +[enable_dri3=$dri3_default]) AC_ARG_ENABLE([glx], [AS_HELP_STRING([--enable-glx], [enable GLX library @:@default=enabled@:@])], @@ -824,9 +833,6 @@ xyesno) PKG_CHECK_MODULES([DRI2PROTO], [dri2proto = $DRI2PROTO_REQUIRED]) GL_PC_REQ_PRIV=$GL_PC_REQ_PRIV libdrm = $LIBDRM_REQUIRED if test x$enable_dri3 = xyes; then -if test x$have_libudev != xyes; then - AC_MSG_ERROR([DRI3 requires libudev = $LIBUDEV_REQUIRED]) -fi PKG_CHECK_MODULES([DRI3PROTO], [dri3proto = $DRI3PROTO_REQUIRED]) PKG_CHECK_MODULES([PRESENTPROTO], [presentproto = $PRESENTPROTO_REQUIRED]) fi @@ -979,7 +985,7 @@ if test x$enable_dri = xyes; then gnu*) DEFINES=$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 DEFINES=$DEFINES -DHAVE_ALIAS - ;; +;; solaris*) DEFINES=$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 ;; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2.5/10] mesa: Add helper function _mesa_is_format_integer()
This function will be used in the following patch. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/mesa/main/formats.c | 9 + src/mesa/main/formats.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index fb2501c..5c67011 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -2035,6 +2035,15 @@ _mesa_is_format_signed(mesa_format format) } } +/** + * Is the given format an integer format? + */ +GLboolean +_mesa_is_format_integer(mesa_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + return (info-DataType == GL_INT || info-DataType == GL_UNSIGNED_INT); +} /** * Return color encoding for given format. diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 89bd021..185010e 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -445,6 +445,9 @@ _mesa_is_format_unsigned(mesa_format format); extern GLboolean _mesa_is_format_signed(mesa_format format); +extern GLboolean +_mesa_is_format_integer(mesa_format format); + extern GLenum _mesa_get_format_color_encoding(mesa_format format); -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 03/10] mesa: Add error condition for integer formats in glGetTexImage()
OpenGL 4.0 spec, page 306 suggests an INVALID_OPERATION in glGetTexImage if : format is one of the integer formats in table 3.3 and the internal format of the texture image is not integer, or format is not one of the integer formats in table 3.3 and the internal format is integer. V2: Use helper function _mesa_is_format_integer() Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/mesa/main/texgetimage.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 488b678..2747540 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -823,7 +823,7 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level, } baseFormat = _mesa_get_format_base_format(texImage-TexFormat); - + /* Make sure the requested image format is compatible with the * texture's format. */ @@ -858,6 +858,11 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level, _mesa_error(ctx, GL_INVALID_OPERATION, glGetTexImage(format mismatch)); return GL_TRUE; } + else if (_mesa_is_enum_format_integer(format) != +_mesa_is_enum_format_integer(texImage-TexFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, glGetTexImage(format mismatch)); + return GL_TRUE; + } if (!_mesa_validate_pbo_access(dimensions, ctx-Pack, texImage-Width, texImage-Height, texImage-Depth, -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 76577] egl_dri2.c:507:27: error: 'EGL_OPENGL_ES3_BIT_KHR' undeclared (first use in this function)
https://bugs.freedesktop.org/show_bug.cgi?id=76577 --- Comment #4 from Emil Velikov emil.l.veli...@gmail.com --- Seems like gcc does not handle include directives as I though it would. The only difference quoted vs angle brackets make is an extra searches for the header in the folder containing the source file. One can prevent from searching the default locations using -nostdinc, although that should not be required. Dâniel I'm kind of struggling to see(tested as well) how on earth did the system header got included in your case, pending any funny options during the compilation of gcc (other pieces of the toolchain). -I$(top_srcdir)/include is used prior to any other, which should handle things correctly. -- 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 09/10] mesa: Add support to unpack depth-stencil texture in to FLOAT_32_UNSIGNED_INT_24_8_REV
V2: Follow the new naming convention for unpack functions. Use double precision for converting Z24 to a float. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/mesa/main/format_unpack.c | 86 ++- src/mesa/main/format_unpack.h | 5 +++ 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index 7abbe46..d1a83e8 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -4264,6 +4264,86 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, } } +static void +unpack_float_32_uint_24_8_Z24_UNORM_S8_UINT(const GLuint *src, +GLuint *dst, GLuint n) +{ + GLuint i; + GLfloat *d = ((GLfloat *) dst); + const GLdouble scale = 1.0 / (GLdouble) 0xff; + + for (i = 0; i n; i++) { + const GLuint z24 = src[i] 0xff; + const GLfloat zf = z24 * scale; + const GLuint s = src[i] 0xff00; + d[i * 2] = zf; + dst[i * 2 + 1] = s; + assert(zf = 0.0f); + assert(zf = 1.0f); + } +} + +static void +unpack_float_32_uint_24_8_Z32_FLOAT_S8X24_UINT(const GLuint *src, + GLuint *dst, GLuint n) +{ + GLuint i; + GLfloat *s = ((GLfloat *) src); + GLfloat *d = ((GLfloat *) dst); + + for (i = 0; i n; i++) { + const GLfloat zf = s[i * 2 + 0]; + const GLuint s = src[i * 2 + 1] 0xff; + d[i * 2] = zf; + dst[i * 2 + 1] = s; + } +} + +static void +unpack_float_32_uint_24_8_S8_UINT_Z24_UNORM(const GLuint *src, +GLuint *dst, GLuint n) +{ + GLuint i; + GLfloat *d = ((GLfloat *) dst); + const GLdouble scale = 1.0 / (GLdouble) 0xff; + + for (i = 0; i n; i++) { + const GLuint z24 = src[i] 8; + const GLfloat zf = z24 * scale; + const GLuint s = src[i] 0xff; + d[i * 2] = zf; + dst[i * 2 + 1] = s 24; + assert(zf = 0.0f); + assert(zf = 1.0f); + } +} + +/** + * Unpack depth/stencil returning as GL_FLOAT_32_UNSIGNED_INT_24_8_REV. + * \param format the source data format + */ +void +_mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, + const void *src, GLuint *dst) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + unpack_float_32_uint_24_8_S8_UINT_Z24_UNORM(src, dst, n); + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + unpack_float_32_uint_24_8_Z24_UNORM_S8_UINT(src, dst, n); + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + unpack_float_32_uint_24_8_Z32_FLOAT_S8X24_UINT(src, dst, n); + break; + default: + _mesa_problem(NULL, +bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row, +_mesa_get_format_name(format)); + return; + } +} + /** * Unpack depth/stencil * \param format the source data format @@ -4274,12 +4354,16 @@ _mesa_unpack_depth_stencil_row(mesa_format format, GLuint n, const void *src, GLenum type, GLuint *dst) { - assert(type == GL_UNSIGNED_INT_24_8); + assert(type == GL_UNSIGNED_INT_24_8 || + type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); switch (type) { case GL_UNSIGNED_INT_24_8: _mesa_unpack_uint_24_8_depth_stencil_row(format, n, src, dst); break; + case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + _mesa_unpack_float_32_uint_24_8_depth_stencil_row(format, n, src, dst); + break; default: _mesa_problem(NULL, bad type 0x%x in _mesa_unpack_depth_stencil_row, diff --git a/src/mesa/main/format_unpack.h b/src/mesa/main/format_unpack.h index 5904a28..51f97df 100644 --- a/src/mesa/main/format_unpack.h +++ b/src/mesa/main/format_unpack.h @@ -64,6 +64,11 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, const void *src, GLuint *dst); void +_mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, + GLuint n, + const void *src, + GLuint *dst); +void _mesa_unpack_depth_stencil_row(mesa_format format, GLuint n, const void *src, GLenum type, GLuint *dst); -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCHv3] configure: enable dri3 only for linux
On 03/25/2014 02:47 PM, Emil Velikov wrote: On 21/03/14 18:09, Emil Velikov wrote: Currently only linux can make use of dri3, so it would make sense to enable it explicitly for the platform. Drop a duplicated libudev check while we're at it. v3: Properly handle dri3 and reword commit message. Would there be any objections if I slap Cc: mesa-stable... on this patch and commit it some time this week ? It looks reasonable to me. You might want an additional R-b, but it's Reviewed-by: Ian Romanick ian.d.roman...@intel.com anyway. -Emil Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76377 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- configure.ac | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index c5042f9..af6bfa4 100644 --- a/configure.ac +++ b/configure.ac @@ -528,11 +528,20 @@ AC_ARG_ENABLE([dri], [enable DRI modules @:@default=enabled@:@])], [enable_dri=$enableval], [enable_dri=yes]) + +case $host_os in +linux*) +dri3_default=yes +;; +*) +dri3_default=no +;; +esac AC_ARG_ENABLE([dri3], [AS_HELP_STRING([--enable-dri3], -[enable DRI3 @:@default=enabled@:@])], +[enable DRI3 @:@default=auto@:@])], [enable_dri3=$enableval], -[enable_dri3=yes]) +[enable_dri3=$dri3_default]) AC_ARG_ENABLE([glx], [AS_HELP_STRING([--enable-glx], [enable GLX library @:@default=enabled@:@])], @@ -824,9 +833,6 @@ xyesno) PKG_CHECK_MODULES([DRI2PROTO], [dri2proto = $DRI2PROTO_REQUIRED]) GL_PC_REQ_PRIV=$GL_PC_REQ_PRIV libdrm = $LIBDRM_REQUIRED if test x$enable_dri3 = xyes; then -if test x$have_libudev != xyes; then - AC_MSG_ERROR([DRI3 requires libudev = $LIBUDEV_REQUIRED]) -fi PKG_CHECK_MODULES([DRI3PROTO], [dri3proto = $DRI3PROTO_REQUIRED]) PKG_CHECK_MODULES([PRESENTPROTO], [presentproto = $PRESENTPROTO_REQUIRED]) fi @@ -979,7 +985,7 @@ if test x$enable_dri = xyes; then gnu*) DEFINES=$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 DEFINES=$DEFINES -DHAVE_ALIAS -;; +;; solaris*) DEFINES=$DEFINES -DUSE_EXTERNAL_DXTN_LIB=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
[Mesa-dev] [PATCH] mesa: Move declaration before code
From: Ian Romanick ian.d.roman...@intel.com Should fix MSVC build: src\mesa\main\pipelineobj.c(250) : error C2275: 'GLbitfield' : illegal use of this type as an expression C:\hudson\workspace\mesa-msvc\include\GL/gl.h(127) : see declaration of 'GLbitfield' src\mesa\main\pipelineobj.c(250) : error C2146: syntax error : missing ';' before identifier 'any_valid_stages' src\mesa\main\pipelineobj.c(250) : error C2065: 'any_valid_stages' : undeclared identifier src\mesa\main\pipelineobj.c(252) : error C2065: 'any_valid_stages' : undeclared identifier src\mesa\main\pipelineobj.c(254) : error C2065: 'any_valid_stages' : undeclared identifier How long until we can require MSVC 2013 on Windows? :( Signed-off-by: Ian Romanick ian.d.roman...@intel.com Reported-by: Brian Paul bri...@vmware.com Cc: Brian Paul bri...@vmware.com --- src/mesa/main/pipelineobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index 49fb641..f55251e 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -227,6 +227,7 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) struct gl_pipeline_object *pipe = lookup_pipeline_object(ctx, pipeline); struct gl_shader_program *shProg = NULL; + GLbitfield any_valid_stages; if (!pipe) { _mesa_error(ctx, GL_INVALID_OPERATION, glUseProgramStages(pipeline)); @@ -247,7 +248,7 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) * GL_TESS_CONTROL_SHADER_BIT * GL_TESS_EVALUATION_SHADER_BIT */ - GLbitfield any_valid_stages = GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT; + any_valid_stages = GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT; if (_mesa_has_geometry_shaders(ctx)) any_valid_stages |= GL_GEOMETRY_SHADER_BIT; -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 76577] egl_dri2.c:507:27: error: 'EGL_OPENGL_ES3_BIT_KHR' undeclared (first use in this function)
https://bugs.freedesktop.org/show_bug.cgi?id=76577 --- Comment #5 from Dâniel Fraga frag...@gmail.com --- (In reply to comment #4) Dâniel I'm kind of struggling to see(tested as well) how on earth did the system header got included in your case, pending any funny options during the compilation of gcc (other pieces of the toolchain). -I$(top_srcdir)/include is used prior to any other, which should handle things correctly. Hmmm I have the following CPPFLAGS system-wide: -I/usr/xorg/include -I/usr/local/BerkeleyDB/include As far as I remember, some software I tried to compile had trouble to find the header files. Even with CPPFLAGS set, Mesa should look for their own header files first? Or not? At least here it seems CPPFLAGS will be at the end: http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html I ran configure *without* CPPFLAGS and it worked (without your patch). So the problem is CPPFLAGS. The problem is: configure accepts CPPFLAGS. Does it mean that when CPPFLAGS is set it has precedence over Mesa include paths or no? Or Mesa should put CPPFLAGS *after* their own include paths? Maybe this would avoid this problem when user sets CPPFLAGS? -- 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] mesa: Move declaration before code
Thanks, but I already pushed a fix for this earlier. -Brian On 03/25/2014 04:23 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com Should fix MSVC build: src\mesa\main\pipelineobj.c(250) : error C2275: 'GLbitfield' : illegal use of this type as an expression C:\hudson\workspace\mesa-msvc\include\GL/gl.h(127) : see declaration of 'GLbitfield' src\mesa\main\pipelineobj.c(250) : error C2146: syntax error : missing ';' before identifier 'any_valid_stages' src\mesa\main\pipelineobj.c(250) : error C2065: 'any_valid_stages' : undeclared identifier src\mesa\main\pipelineobj.c(252) : error C2065: 'any_valid_stages' : undeclared identifier src\mesa\main\pipelineobj.c(254) : error C2065: 'any_valid_stages' : undeclared identifier How long until we can require MSVC 2013 on Windows? :( Signed-off-by: Ian Romanick ian.d.roman...@intel.com Reported-by: Brian Paul bri...@vmware.com Cc: Brian Paul bri...@vmware.com --- src/mesa/main/pipelineobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index 49fb641..f55251e 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -227,6 +227,7 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) struct gl_pipeline_object *pipe = lookup_pipeline_object(ctx, pipeline); struct gl_shader_program *shProg = NULL; + GLbitfield any_valid_stages; if (!pipe) { _mesa_error(ctx, GL_INVALID_OPERATION, glUseProgramStages(pipeline)); @@ -247,7 +248,7 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) * GL_TESS_CONTROL_SHADER_BIT * GL_TESS_EVALUATION_SHADER_BIT */ - GLbitfield any_valid_stages = GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT; + any_valid_stages = GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT; if (_mesa_has_geometry_shaders(ctx)) any_valid_stages |= GL_GEOMETRY_SHADER_BIT; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] gallium: add interface to clear buffers
Am 25.03.2014 22:36, schrieb Ilia Mirkin: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- src/gallium/include/pipe/p_context.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. Where's the docs? Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 2.5/10] mesa: Add helper function _mesa_is_format_integer()
On 03/25/2014 03:59 PM, Anuj Phogat wrote: This function will be used in the following patch. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/mesa/main/formats.c | 9 + src/mesa/main/formats.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index fb2501c..5c67011 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -2035,6 +2035,15 @@ _mesa_is_format_signed(mesa_format format) } } +/** + * Is the given format an integer format? + */ +GLboolean +_mesa_is_format_integer(mesa_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + return (info-DataType == GL_INT || info-DataType == GL_UNSIGNED_INT); +} /** * Return color encoding for given format. diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 89bd021..185010e 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -445,6 +445,9 @@ _mesa_is_format_unsigned(mesa_format format); extern GLboolean _mesa_is_format_signed(mesa_format format); +extern GLboolean +_mesa_is_format_integer(mesa_format format); + extern GLenum _mesa_get_format_color_encoding(mesa_format format); Reviewed-by: Brian Paul bri...@vmware.com Someday, all those _mesa_is_format_foo() functions could return bool instead of GLboolean. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] mesa/st: Accelerate ARB_clear_buffer_object with clear_buffer
On 03/25/2014 03:36 PM, Ilia Mirkin wrote: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- Note that this also ensures that the clear size is passed through even when the data is null. This preserves the validation done to make sure that size % clear size == 0. src/mesa/main/bufferobj.c| 6 +++--- src/mesa/main/bufferobj.h| 7 +++ src/mesa/state_tracker/st_cb_bufferobjects.c | 28 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 2e9e059..36acd64 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -665,7 +665,7 @@ _mesa_buffer_get_subdata( struct gl_context *ctx, GLintptrARB offset, * \sa glClearBufferSubData, glClearBufferData and * dd_function_table::ClearBufferSubData. */ -static void +void _mesa_buffer_clear_subdata(struct gl_context *ctx, GLintptr offset, GLsizeiptr size, const GLvoid *clearValue, @@ -1458,7 +1458,7 @@ _mesa_ClearBufferData(GLenum target, GLenum internalformat, GLenum format, if (data == NULL) { /* clear to zeros, per the spec */ ctx-Driver.ClearBufferSubData(ctx, 0, bufObj-Size, - NULL, 0, bufObj); + NULL, clearValueSize, bufObj); return; } @@ -1510,7 +1510,7 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat, /* clear to zeros, per the spec */ if (size 0) { ctx-Driver.ClearBufferSubData(ctx, offset, size, -NULL, 0, bufObj); +NULL, clearValueSize, bufObj); } return; } diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 9814552..c08c4fd 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -115,6 +115,13 @@ extern void _mesa_buffer_unmap_all_mappings(struct gl_context *ctx, struct gl_buffer_object *bufObj); +extern void +_mesa_buffer_clear_subdata(struct gl_context *ctx, + GLintptr offset, GLsizeiptr size, + const GLvoid *clearValue, + GLsizeiptr clearValueSize, + struct gl_buffer_object *bufObj); + /* * API functions */ diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 49c4b90..2706903 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -447,6 +447,33 @@ st_copy_buffer_subdata(struct gl_context *ctx, srcObj-buffer, 0, box); } +/** + * Called via glClearBufferSubData(). + */ +static void +st_clear_buffer_subdata(struct gl_context *ctx, +GLintptr offset, GLsizeiptr size, +const GLvoid *clearValue, +GLsizeiptr clearValueSize, +struct gl_buffer_object *bufObj) +{ + struct pipe_context *pipe = st_context(ctx)-pipe; + struct st_buffer_object *buf = st_buffer_object(bufObj); + char zeros[16] = {0}; that could be static const to avoid runtime setup. + + if (!pipe-clear_buffer) { + _mesa_buffer_clear_subdata( +ctx, offset, size, clearValue, clearValueSize, bufObj); We'd normally wrap a line like that as: _mesa_buffer_clear_subdata(ctx, offset, size, clearValue, clearValueSize, bufObj); + return; + } + + if (!clearValue) + clearValue = zeros; + + pipe-clear_buffer(pipe, buf-buffer, offset, size, + clearValue, clearValueSize); +} + /* TODO: if buffer wasn't created with appropriate usage flags, need * to recreate it now and copy contents -- or possibly create a @@ -476,6 +503,7 @@ st_init_bufferobject_functions(struct dd_function_table *functions) functions-FlushMappedBufferRange = st_bufferobj_flush_mapped_range; functions-UnmapBuffer = st_bufferobj_unmap; functions-CopyBufferSubData = st_copy_buffer_subdata; + functions-ClearBufferSubData = st_clear_buffer_subdata; /* For GL_APPLE_vertex_array_object */ functions-NewArrayObject = _mesa_new_vao; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] gallium: add interface to clear buffers
On Tue, Mar 25, 2014 at 6:32 PM, Roland Scheidegger srol...@vmware.com wrote: Am 25.03.2014 22:36, schrieb Ilia Mirkin: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- src/gallium/include/pipe/p_context.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. Where's the docs? Which docs? Aha, just found src/gallium/docs/source/context.rst -- is that what you're referring to? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V3 03/10] mesa: Add error condition for integer formats in glGetTexImage()
OpenGL 4.0 spec, page 306 suggests an INVALID_OPERATION in glGetTexImage if : format is one of the integer formats in table 3.3 and the internal format of the texture image is not integer, or format is not one of the integer formats in table 3.3 and the internal format is integer. V2: Use helper function _mesa_is_format_integer() Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/mesa/main/texgetimage.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 488b678..754c365 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -858,6 +858,11 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level, _mesa_error(ctx, GL_INVALID_OPERATION, glGetTexImage(format mismatch)); return GL_TRUE; } + else if (_mesa_is_enum_format_integer(format) != +_mesa_is_format_integer(texImage-TexFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, glGetTexImage(format mismatch)); + return GL_TRUE; + } if (!_mesa_validate_pbo_access(dimensions, ctx-Pack, texImage-Width, texImage-Height, texImage-Depth, -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Channels alive in fast clear
On 03/24/2014 11:37 PM, Kevin Rogovin wrote: When deciding if a clear color is suitable for fast clear, take into account if a color channel is active in the buffer format. --- src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp index fd18b45..d16da97 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp @@ -153,7 +153,8 @@ is_color_fast_clear_compatible(struct brw_context *brw, return false; for (int i = 0; i 4; i++) { - if (color-f[i] != 0.0 color-f[i] != 1.0) { + if (color-f[i] != 0.0 color-f[i] != 1.0 + _mesa_format_has_color_component(format, i)) { perf_debug(Clear color unsupported by fast color clear. Falling back to slow clear.\n); return false; Thank you for the patch. I didn't find anything immediately helped by this off-hand (in order to quote performance gains), but it's definitely a good idea. There were no Piglit regressions on Iris Pro. I changed the commit title to: i965: For fast color clears, only check the color of live channels. to match the usual style, and added my Reviewed-by. I then pushed it to master. signature.asc Description: OpenPGP digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 76577] egl_dri2.c:507:27: error: 'EGL_OPENGL_ES3_BIT_KHR' undeclared (first use in this function)
https://bugs.freedesktop.org/show_bug.cgi?id=76577 --- Comment #6 from Matt Turner matts...@gmail.com --- (In reply to comment #5) Or Mesa should put CPPFLAGS *after* their own include paths? Maybe this would avoid this problem when user sets CPPFLAGS? If the user sets his own CPPFLAGS, he gets whatever is the result. -- 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 1/3] gallium: add interface to clear buffers
Am 25.03.2014 23:48, schrieb Ilia Mirkin: On Tue, Mar 25, 2014 at 6:32 PM, Roland Scheidegger srol...@vmware.com wrote: Am 25.03.2014 22:36, schrieb Ilia Mirkin: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- src/gallium/include/pipe/p_context.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. Where's the docs? Which docs? Aha, just found src/gallium/docs/source/context.rst -- is that what you're referring to? Yes. All functions must be documented. Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 76577] egl_dri2.c:507:27: error: 'EGL_OPENGL_ES3_BIT_KHR' undeclared (first use in this function)
https://bugs.freedesktop.org/show_bug.cgi?id=76577 Emil Velikov emil.l.veli...@gmail.com changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |NOTABUG --- Comment #7 from Emil Velikov emil.l.veli...@gmail.com --- (In reply to comment #5) Hmmm I have the following CPPFLAGS system-wide: -I/usr/xorg/include -I/usr/local/BerkeleyDB/include A crucial piece of information you could have mentioned earlier :) As far as I remember, some software I tried to compile had trouble to find Report a bug with them and drop this gross hack, please. [...] Or Mesa should put CPPFLAGS *after* their own include paths? Maybe this would avoid this problem when user sets CPPFLAGS? As Matt hinted, mesa is not to blame about I'm using this hack as some other software needed it. If you have to use such workarounds use a more appropriate solution :P [1] [1] http://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html -- 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] [PATCHv2 1/3] gallium: add interface to clear buffers
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- v1 - v2: add docs section to context.rst src/gallium/docs/source/context.rst | 5 + src/gallium/include/pipe/p_context.h | 11 +++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 8e14522..efa2a1c 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -218,6 +218,11 @@ is is also possible to only clear one or the other part). While it is only possible to clear one surface at a time (which can include several layers), this surface need not be bound to the framebuffer. +``clear_buffer`` clears a PIPE_BUFFER resource with the specified clear value +(which may be multiple bytes in length). Logically this is a memset with a +multi-byte element value starting at offset bytes from resource start, going +for size bytes. It is guaranteed that size % clear_value_size == 0. + Drawing ^^^ diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCHv2 2/3] mesa/st: Accelerate ARB_clear_buffer_object with clear_buffer
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- v1 - v2: mark zeros as static const data, change line wrapping src/mesa/main/bufferobj.c| 6 +++--- src/mesa/main/bufferobj.h| 7 +++ src/mesa/state_tracker/st_cb_bufferobjects.c | 28 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 2e9e059..36acd64 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -665,7 +665,7 @@ _mesa_buffer_get_subdata( struct gl_context *ctx, GLintptrARB offset, * \sa glClearBufferSubData, glClearBufferData and * dd_function_table::ClearBufferSubData. */ -static void +void _mesa_buffer_clear_subdata(struct gl_context *ctx, GLintptr offset, GLsizeiptr size, const GLvoid *clearValue, @@ -1458,7 +1458,7 @@ _mesa_ClearBufferData(GLenum target, GLenum internalformat, GLenum format, if (data == NULL) { /* clear to zeros, per the spec */ ctx-Driver.ClearBufferSubData(ctx, 0, bufObj-Size, - NULL, 0, bufObj); + NULL, clearValueSize, bufObj); return; } @@ -1510,7 +1510,7 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat, /* clear to zeros, per the spec */ if (size 0) { ctx-Driver.ClearBufferSubData(ctx, offset, size, -NULL, 0, bufObj); +NULL, clearValueSize, bufObj); } return; } diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 9814552..c08c4fd 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -115,6 +115,13 @@ extern void _mesa_buffer_unmap_all_mappings(struct gl_context *ctx, struct gl_buffer_object *bufObj); +extern void +_mesa_buffer_clear_subdata(struct gl_context *ctx, + GLintptr offset, GLsizeiptr size, + const GLvoid *clearValue, + GLsizeiptr clearValueSize, + struct gl_buffer_object *bufObj); + /* * API functions */ diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 49c4b90..0262461 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -447,6 +447,33 @@ st_copy_buffer_subdata(struct gl_context *ctx, srcObj-buffer, 0, box); } +/** + * Called via glClearBufferSubData(). + */ +static void +st_clear_buffer_subdata(struct gl_context *ctx, +GLintptr offset, GLsizeiptr size, +const GLvoid *clearValue, +GLsizeiptr clearValueSize, +struct gl_buffer_object *bufObj) +{ + struct pipe_context *pipe = st_context(ctx)-pipe; + struct st_buffer_object *buf = st_buffer_object(bufObj); + static const char zeros[16] = {0}; + + if (!pipe-clear_buffer) { + _mesa_buffer_clear_subdata(ctx, offset, size, + clearValue, clearValueSize, bufObj); + return; + } + + if (!clearValue) + clearValue = zeros; + + pipe-clear_buffer(pipe, buf-buffer, offset, size, + clearValue, clearValueSize); +} + /* TODO: if buffer wasn't created with appropriate usage flags, need * to recreate it now and copy contents -- or possibly create a @@ -476,6 +503,7 @@ st_init_bufferobject_functions(struct dd_function_table *functions) functions-FlushMappedBufferRange = st_bufferobj_flush_mapped_range; functions-UnmapBuffer = st_bufferobj_unmap; functions-CopyBufferSubData = st_copy_buffer_subdata; + functions-ClearBufferSubData = st_clear_buffer_subdata; /* For GL_APPLE_vertex_array_object */ functions-NewArrayObject = _mesa_new_vao; -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCHv2 3/3] nv50: implement clear_buffer to accelerate ARB_clear_buffer_object
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- v1 - v2: no change src/gallium/drivers/nouveau/nv50/nv50_surface.c | 111 1 file changed, 111 insertions(+) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c index 612649b..52f23a0 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c @@ -476,6 +476,116 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, PUSH_DATA (push, nv50-rt_array_mode); } +static void +nv50_clear_buffer(struct pipe_context *pipe, + struct pipe_resource *res, + unsigned offset, unsigned size, + const void *data, int data_size) +{ + struct nv50_context *nv50 = nv50_context(pipe); + struct nouveau_pushbuf *push = nv50-base.pushbuf; + struct nv04_resource *buf = (struct nv04_resource *)res; + union pipe_color_union color; + enum pipe_format dst_fmt; + unsigned width, height, elements; + + assert(res-target == PIPE_BUFFER); + assert(nouveau_bo_memtype(buf-bo) == 0); + + switch (data_size) { + case 16: + dst_fmt = PIPE_FORMAT_R32G32B32A32_UINT; + memcpy(color.ui, data, 16); + break; + case 8: + dst_fmt = PIPE_FORMAT_R32G32_UINT; + memcpy(color.ui, data, 8); + memset(color.ui[2], 0, 8); + break; + case 4: + dst_fmt = PIPE_FORMAT_R32_UINT; + memcpy(color.ui, data, 4); + memset(color.ui[1], 0, 12); + break; + case 2: + dst_fmt = PIPE_FORMAT_R16_UINT; + color.ui[0] = util_cpu_to_le32( +util_le16_to_cpu(*(unsigned short *)data)); + memset(color.ui[1], 0, 12); + break; + case 1: + dst_fmt = PIPE_FORMAT_R8_UINT; + color.ui[0] = util_cpu_to_le32(*(unsigned char *)data); + memset(color.ui[1], 0, 12); + break; + default: + assert(!Unsupported element size); + return; + } + + assert(size % data_size == 0); + + elements = size / data_size; + height = (elements + 8191) / 8192; + width = elements / height; + + BEGIN_NV04(push, NV50_3D(CLEAR_COLOR(0)), 4); + PUSH_DATAf(push, color.f[0]); + PUSH_DATAf(push, color.f[1]); + PUSH_DATAf(push, color.f[2]); + PUSH_DATAf(push, color.f[3]); + + if (nouveau_pushbuf_space(push, 32, 1, 0)) + return; + + PUSH_REFN(push, buf-bo, buf-domain | NOUVEAU_BO_WR); + + BEGIN_NV04(push, NV50_3D(SCREEN_SCISSOR_HORIZ), 2); + PUSH_DATA (push, width 16); + PUSH_DATA (push, height 16); + + BEGIN_NV04(push, NV50_3D(RT_CONTROL), 1); + PUSH_DATA (push, 1); + BEGIN_NV04(push, NV50_3D(RT_ADDRESS_HIGH(0)), 5); + PUSH_DATAh(push, buf-bo-offset + buf-offset + offset); + PUSH_DATA (push, buf-bo-offset + buf-offset + offset); + PUSH_DATA (push, nv50_format_table[dst_fmt].rt); + PUSH_DATA (push, 0); + PUSH_DATA (push, 0); + BEGIN_NV04(push, NV50_3D(RT_HORIZ(0)), 2); + PUSH_DATA (push, NV50_3D_RT_HORIZ_LINEAR | (width * data_size)); + PUSH_DATA (push, height); + BEGIN_NV04(push, NV50_3D(ZETA_ENABLE), 1); + PUSH_DATA (push, 0); + + /* NOTE: only works with D3D clear flag (5097/0x143c bit 4) */ + + BEGIN_NV04(push, NV50_3D(VIEWPORT_HORIZ(0)), 2); + PUSH_DATA (push, (width 16)); + PUSH_DATA (push, (height 16)); + + BEGIN_NI04(push, NV50_3D(CLEAR_BUFFERS), 1); + PUSH_DATA (push, 0x3c); + + if (width * height != elements) { + offset += width * height * data_size; + width = elements - width * height; + height = 1; + BEGIN_NV04(push, NV50_3D(RT_ADDRESS_HIGH(0)), 2); + PUSH_DATAh(push, buf-bo-offset + buf-offset + offset); + PUSH_DATA (push, buf-bo-offset + buf-offset + offset); + BEGIN_NV04(push, NV50_3D(RT_HORIZ(0)), 2); + PUSH_DATA (push, NV50_3D_RT_HORIZ_LINEAR | (width * data_size)); + PUSH_DATA (push, height); + BEGIN_NI04(push, NV50_3D(CLEAR_BUFFERS), 1); + PUSH_DATA (push, 0x3c); + } + + nouveau_fence_ref(nv50-screen-base.fence.current, buf-fence); + nouveau_fence_ref(nv50-screen-base.fence.current, buf-fence_wr); + + nv50-dirty |= NV50_NEW_FRAMEBUFFER; +} /* === BLIT CODE === */ @@ -1403,4 +1513,5 @@ nv50_init_surface_functions(struct nv50_context *nv50) pipe-flush_resource = nv50_flush_resource; pipe-clear_render_target = nv50_clear_render_target; pipe-clear_depth_stencil = nv50_clear_depth_stencil; + pipe-clear_buffer = nv50_clear_buffer; } -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mapi/glapi: Use ElementTree instead of libxml2.
On 03/25/2014 09:34 AM, jfons...@vmware.com wrote: From: José Fonseca jfons...@vmware.com It is quite hard to meet the dependency of the libxml2 python bindings out side Linux, and in particularly on MacOSX; whereas ElementTree is part of Python's standard library. ElementTree is more limited than libxml2: no DTD verification, defaults from DTD, or XInclude support, but none of this limitations is serious enough to justify libxml2. In fact, it was easier to refactor the code to use ElementTree than to try to get libxml2 python bindings... In the process, gl_item_factory class was refactored so that there is one method for each kind of object to be created, as it simplified things substantially. glx_doc_item_factory (glX_doc.py) derives from glx_item_factory, and glX_proto_recv.py uses glx_item_factory. It doesn't look like glX_proto_recv.py should make any difference, but glX_doc.py is probably broken now. I had to look up WTF glX_doc.py is by 'git log --follow'... and apparently I wrote it. :) I doubt it has been used by anyone in many years, so the right fix is probably 'git rm'. However you decided to deal with glX_doc.py, the series that includes that fix is Reviewed-by: Ian Romanick ian.d.roman...@intel.com I confirmed that precisely the same output is generated for GL/GLX/GLES. --- SConstruct | 7 -- configure.ac | 1 - docs/README.WIN32 | 16 ++- docs/install.html | 4 - src/mapi/glapi/gen/glX_XML.py | 55 - src/mapi/glapi/gen/glX_proto_common.py | 13 +- src/mapi/glapi/gen/gl_XML.py | 217 - 7 files changed, 141 insertions(+), 172 deletions(-) diff --git a/SConstruct b/SConstruct index de735e9..0e10818 100644 --- a/SConstruct +++ b/SConstruct @@ -59,13 +59,6 @@ else: Help(opts.GenerateHelpText(env)) -# fail early for a common error on windows -if env['gles']: -try: -import libxml2 -except ImportError: -raise SCons.Errors.UserError, GLES requires libxml2-python to build - ### # Environment setup diff --git a/configure.ac b/configure.ac index c5042f9..04bf711 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,6 @@ AM_PROG_CC_C_O AM_PROG_AS AC_CHECK_PROGS([MAKE], [gmake make]) AC_CHECK_PROGS([PYTHON2], [python2 python]) -AX_PYTHON_MODULE([libxml2], [needed]) AC_PROG_SED AC_PROG_MKDIR_P diff --git a/docs/README.WIN32 b/docs/README.WIN32 index 0cd007c..c8759f6 100644 --- a/docs/README.WIN32 +++ b/docs/README.WIN32 @@ -36,17 +36,15 @@ Recipe Building on windows requires several open-source packages. These are steps that work as of this writing. -1) install python 2.7 -2) install scons (latest) -3) install mingw, flex, and bison -4) install libxml2 from here: http://www.lfd.uci.edu/~gohlke/pythonlibs - get libxml2-python-2.9.1.win-amd64-py2.7.exe -5) install pywin32 from here: http://www.lfd.uci.edu/~gohlke/pythonlibs +- install python 2.7 +- install scons (latest) +- install mingw, flex, and bison +- install pywin32 from here: http://www.lfd.uci.edu/~gohlke/pythonlibs get pywin32-218.4.win-amd64-py2.7.exe -6) install git -7) download mesa from git +- install git +- download mesa from git see http://www.mesa3d.org/repository.html -8) run scons +- run scons General --- diff --git a/docs/install.html b/docs/install.html index 24492a7..5061ede 100644 --- a/docs/install.html +++ b/docs/install.html @@ -44,10 +44,6 @@ On Windows with MinGW, install flex and bison with: /li lipython - Python is needed for building the Gallium components. Version 2.6.4 or later should work. -br -br -To build OpenGL ES 1.1 and 2.0 you'll also need -a href=http://xmlsoft.org/sources/win32/python/libxml2-python-2.7.7.win32-py2.7.exe;libxml2-python/a. /li /ul diff --git a/src/mapi/glapi/gen/glX_XML.py b/src/mapi/glapi/gen/glX_XML.py index 03a35b7..12ff291 100644 --- a/src/mapi/glapi/gen/glX_XML.py +++ b/src/mapi/glapi/gen/glX_XML.py @@ -33,29 +33,27 @@ import sys, getopt, string class glx_item_factory(gl_XML.gl_item_factory): Factory to create GLX protocol oriented objects derived from gl_item. -def create_item(self, name, element, context): -if name == function: -return glx_function(element, context) -elif name == enum: -return glx_enum(element, context) -elif name == api: -return glx_api(self) -else: -return gl_XML.gl_item_factory.create_item(self, name, element, context) +def create_function(self, element, context): +return glx_function(element, context) + +def create_enum(self, element, context, category): +return glx_enum(element, context, category) + +def
Re: [Mesa-dev] [PATCH 1/2] mesa: Move TextureView layer error checks before dimension checking.
On 03/20/2014 02:18 AM, Kenneth Graunke wrote: If the number of layers is invalid, we're supposed to return INVALID_VALUE. _mesa_legal_texture_dimensions detects some of these cases (i.e. number of layers not being divisible by 6 for cubes), but results in an INVALID_OPERATION error (which appears to be correct for more general dimension problems). Fixes oglconform's texture_view/negative.apiErrors test. Signed-off-by: Kenneth Graunke kenn...@whitecape.org Cc: Chris Forbes chr...@ijw.co.nz Reviewed-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/main/textureview.c | 42 +- 1 file changed, 21 insertions(+), 21 deletions(-) Applies to the 'texture_view_ext' branch of: git://github.com/chrisforbes/mesa.git diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c index 99ccafd..c7756f5 100644 --- a/src/mesa/main/textureview.c +++ b/src/mesa/main/textureview.c @@ -560,27 +560,6 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture, break; } - /* If the dimensions of the original texture are larger than the maximum -* supported dimensions of the new target, the error INVALID_OPERATION is -* generated. For example, if the original texture has a TEXTURE_2D_ARRAY -* target and its width is greater than MAX_CUBE_MAP_TEXTURE_SIZE, an error -* will be generated if TextureView is called to create a TEXTURE_CUBE_MAP -* view. -*/ - dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0, - width, height, depth, 0); - if (!dimensionsOK) { - _mesa_error(ctx, GL_INVALID_OPERATION, glTextureView(invalid width or height or depth)); - return; - } - - sizeOK = ctx-Driver.TestProxyTexImage(ctx, target, 0, texFormat, - width, height, depth, 0); - if (!sizeOK) { - _mesa_error(ctx, GL_INVALID_OPERATION, glTextureView(invalid texture size)); - return; - } - /* If target is TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_RECTANGLE, * or TEXTURE_2D_MULTISAMPLE and numlayers does not equal 1, the error * INVALID_VALUE is generated. @@ -623,6 +602,27 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture, break; } + /* If the dimensions of the original texture are larger than the maximum +* supported dimensions of the new target, the error INVALID_OPERATION is +* generated. For example, if the original texture has a TEXTURE_2D_ARRAY +* target and its width is greater than MAX_CUBE_MAP_TEXTURE_SIZE, an error +* will be generated if TextureView is called to create a TEXTURE_CUBE_MAP +* view. +*/ + dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0, + width, height, depth, 0); + if (!dimensionsOK) { + _mesa_error(ctx, GL_INVALID_OPERATION, glTextureView(invalid width or height or depth)); + return; + } + + sizeOK = ctx-Driver.TestProxyTexImage(ctx, target, 0, texFormat, + width, height, depth, 0); + if (!sizeOK) { + _mesa_error(ctx, GL_INVALID_OPERATION, glTextureView(invalid texture size)); + return; + } + /* If the new texture's target is TEXTURE_CUBE_MAP or * TEXTURE_CUBE_MAP_ARRAY, the width and height of the original texture's * levels must be equal otherwise the error INVALID_OPERATION is generated. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 76577] egl_dri2.c:507:27: error: 'EGL_OPENGL_ES3_BIT_KHR' undeclared (first use in this function)
https://bugs.freedesktop.org/show_bug.cgi?id=76577 --- Comment #8 from Dâniel Fraga frag...@gmail.com --- (In reply to comment #7) A crucial piece of information you could have mentioned earlier :) I completely forgot it ;) Sorry. As Matt hinted, mesa is not to blame about I'm using this hack as some other software needed it. If you have to use such workarounds use a more appropriate solution :P [1] [1] http://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html Ok. I'll remove that. Thank you both ;) -- 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] [PATCHv2 1/3] gallium: add interface to clear buffers
On 03/25/2014 05:23 PM, Ilia Mirkin wrote: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- v1 - v2: add docs section to context.rst src/gallium/docs/source/context.rst | 5 + src/gallium/include/pipe/p_context.h | 11 +++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 8e14522..efa2a1c 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -218,6 +218,11 @@ is is also possible to only clear one or the other part). While it is only possible to clear one surface at a time (which can include several layers), this surface need not be bound to the framebuffer. +``clear_buffer`` clears a PIPE_BUFFER resource with the specified clear value +(which may be multiple bytes in length). Logically this is a memset with a +multi-byte element value starting at offset bytes from resource start, going +for size bytes. It is guaranteed that size % clear_value_size == 0. + Drawing ^^^ diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. Looking ahead a bit, if/when we support GL_ARB_clear_texture I wonder if we'll want to have just one pipe_context function for both purposes. We'd probably replace offset and size above with a mipmap level and x,y,z,w,h,d parameters. Do you have any thoughts on that? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V3 09/10] mesa: Add support to unpack depth-stencil texture in to FLOAT_32_UNSIGNED_INT_24_8_REV
V2: Follow the new naming convention for unpack functions. Use double precision for converting Z24 to a float. V3: Unpack stencil value to most significant byte. Use 'struct z32f_x24s8' type. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/mesa/main/format_unpack.c | 80 ++- src/mesa/main/format_unpack.h | 5 +++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index 7abbe46..6e6bed8 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -4264,6 +4264,80 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, } } +static void +unpack_float_32_uint_24_8_Z24_UNORM_S8_UINT(const GLuint *src, +GLuint *dst, GLuint n) +{ + GLuint i; + struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; + const GLdouble scale = 1.0 / (GLdouble) 0xff; + + for (i = 0; i n; i++) { + const GLuint z24 = src[i] 0xff; + d[i].z = z24 * scale; + d[i].x24s8 = src[i] 0xff00; + assert(d[i].z = 0.0f); + assert(d[i].z = 1.0f); + } +} + +static void +unpack_float_32_uint_24_8_Z32_FLOAT_S8X24_UINT(const GLuint *src, + GLuint *dst, GLuint n) +{ + GLuint i; + const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; + struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; + + for (i = 0; i n; i++) { + d[i].z = s[i].z; + d[i].x24s8 = (s[i].x24s8 0xff) 24; + } +} + +static void +unpack_float_32_uint_24_8_S8_UINT_Z24_UNORM(const GLuint *src, +GLuint *dst, GLuint n) +{ + GLuint i; + struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; + const GLdouble scale = 1.0 / (GLdouble) 0xff; + + for (i = 0; i n; i++) { + const GLuint z24 = src[i] 8; + d[i].z = z24 * scale; + d[i].x24s8 = (src[i] 0xff) 24; + assert(d[i].z = 0.0f); + assert(d[i].z = 1.0f); + } +} + +/** + * Unpack depth/stencil returning as GL_FLOAT_32_UNSIGNED_INT_24_8_REV. + * \param format the source data format + */ +void +_mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, + const void *src, GLuint *dst) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + unpack_float_32_uint_24_8_S8_UINT_Z24_UNORM(src, dst, n); + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + unpack_float_32_uint_24_8_Z24_UNORM_S8_UINT(src, dst, n); + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + unpack_float_32_uint_24_8_Z32_FLOAT_S8X24_UINT(src, dst, n); + break; + default: + _mesa_problem(NULL, +bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row, +_mesa_get_format_name(format)); + return; + } +} + /** * Unpack depth/stencil * \param format the source data format @@ -4274,12 +4348,16 @@ _mesa_unpack_depth_stencil_row(mesa_format format, GLuint n, const void *src, GLenum type, GLuint *dst) { - assert(type == GL_UNSIGNED_INT_24_8); + assert(type == GL_UNSIGNED_INT_24_8 || + type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); switch (type) { case GL_UNSIGNED_INT_24_8: _mesa_unpack_uint_24_8_depth_stencil_row(format, n, src, dst); break; + case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + _mesa_unpack_float_32_uint_24_8_depth_stencil_row(format, n, src, dst); + break; default: _mesa_problem(NULL, bad type 0x%x in _mesa_unpack_depth_stencil_row, diff --git a/src/mesa/main/format_unpack.h b/src/mesa/main/format_unpack.h index 5904a28..51f97df 100644 --- a/src/mesa/main/format_unpack.h +++ b/src/mesa/main/format_unpack.h @@ -64,6 +64,11 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, const void *src, GLuint *dst); void +_mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, + GLuint n, + const void *src, + GLuint *dst); +void _mesa_unpack_depth_stencil_row(mesa_format format, GLuint n, const void *src, GLenum type, GLuint *dst); -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCHv2 1/3] gallium: add interface to clear buffers
On Tue, Mar 25, 2014 at 7:57 PM, Brian Paul bri...@vmware.com wrote: On 03/25/2014 05:23 PM, Ilia Mirkin wrote: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- v1 - v2: add docs section to context.rst src/gallium/docs/source/context.rst | 5 + src/gallium/include/pipe/p_context.h | 11 +++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 8e14522..efa2a1c 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -218,6 +218,11 @@ is is also possible to only clear one or the other part). While it is only possible to clear one surface at a time (which can include several layers), this surface need not be bound to the framebuffer. +``clear_buffer`` clears a PIPE_BUFFER resource with the specified clear value +(which may be multiple bytes in length). Logically this is a memset with a +multi-byte element value starting at offset bytes from resource start, going +for size bytes. It is guaranteed that size % clear_value_size == 0. + Drawing ^^^ diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. Looking ahead a bit, if/when we support GL_ARB_clear_texture I wonder if we'll want to have just one pipe_context function for both purposes. We'd probably replace offset and size above with a mipmap level and x,y,z,w,h,d parameters. Do you have any thoughts on that? I actually already sent a set of ARB_clear_texture patches earlier (e.g.http://patchwork.freedesktop.org/patch/21593/). And I discussed the single callback vs multiple callbacks thing with Marek on IRC -- he convinced me that having 2 separate callbacks would be better. My reasoning there is that at least for nouveau, we'd still want to have a separate if PIPE_BUFFER: do this, else, do that bit, and a shared bit. It seems reasonable to have 2 diff callbacks esp since their parameters are going to be reasonably different. (Instead of x,y,z,w,h,d, I think a box makes sense. But same basic idea.) -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] i965: Use _mesa_format_x_to_a to support more X - A blits.
There's really no reason to limit ourselves to a single format; the technique works just as well for any format in this family. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 10 ++ src/mesa/drivers/dri/i965/intel_blit.c | 16 +++- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index 9e80935..277c5ff 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -199,18 +199,12 @@ do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit, static bool color_formats_match(mesa_format src_format, mesa_format dst_format) { - mesa_format linear_src_format = _mesa_get_srgb_format_linear(src_format); - mesa_format linear_dst_format = _mesa_get_srgb_format_linear(dst_format); - /* Normally, we require the formats to be equal. However, we also support * blitting from ARGB to XRGB (discarding alpha), and from XRGB to ARGB * (overriding alpha to 1.0 via blending). */ - return linear_src_format == linear_dst_format || - (linear_src_format == MESA_FORMAT_B8G8R8X8_UNORM - linear_dst_format == MESA_FORMAT_B8G8R8A8_UNORM) || - (linear_src_format == MESA_FORMAT_B8G8R8A8_UNORM - linear_dst_format == MESA_FORMAT_B8G8R8X8_UNORM); + return _mesa_get_srgb_format_linear(_mesa_format_x_to_a(src_format)) == + _mesa_get_srgb_format_linear(_mesa_format_x_to_a(dst_format)); } static bool diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index d482272..fb10072 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -166,19 +166,17 @@ intel_miptree_blit(struct brw_context *brw, * consistent with what we want in the callers (glCopyTexSubImage(), * glBlitFramebuffer(), texture validation, etc.). */ - mesa_format src_format = _mesa_get_srgb_format_linear(src_mt-format); - mesa_format dst_format = _mesa_get_srgb_format_linear(dst_mt-format); + mesa_format src_format = + _mesa_get_srgb_format_linear(_mesa_format_x_to_a(src_mt-format)); + mesa_format dst_format = + _mesa_get_srgb_format_linear(_mesa_format_x_to_a(dst_mt-format)); /* The blitter doesn't support doing any format conversions. We do also * support blitting ARGB to XRGB (trivial, the values dropped into * the X channel don't matter), and XRGB to ARGB by setting the A * channel to 1.0 at the end. */ - if (src_format != dst_format - ((src_format != MESA_FORMAT_B8G8R8A8_UNORM -src_format != MESA_FORMAT_B8G8R8X8_UNORM) || - (dst_format != MESA_FORMAT_B8G8R8A8_UNORM -dst_format != MESA_FORMAT_B8G8R8X8_UNORM))) { + if (src_format != dst_format) { perf_debug(%s: Can't use hardware blitter from %s to %s, falling back.\n, __FUNCTION__, _mesa_get_format_name(src_format), @@ -275,8 +273,8 @@ intel_miptree_blit(struct brw_context *brw, return false; } - if (src_mt-format == MESA_FORMAT_B8G8R8X8_UNORM - dst_mt-format == MESA_FORMAT_B8G8R8A8_UNORM) { + if (src_mt-format != dst_mt-format + _mesa_format_x_to_a(src_mt-format) == dst_mt-format) { intel_miptree_set_alpha_to_one(brw, dst_mt, dst_x, dst_y, width, height); -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] i965: Support rendering to RGBX formats in general.
Previously, we supported rendering to B8G8R8X8_UNORM by overriding the rendering format to B8G8R8A8_UNORM. However, we didn't support any other formats, such as R8G8B8X8_UNORM. This patch adds format overrides for all other RGBX formats, making them renderable (assuming the equivalent RGBA format is renderable). Being able to render to more formats is helpful because it means that BLORP and Meta can accelerate operations on those formats. This makes various Piglit fbo-*-formats tests change from 'skip' to 'pass' for GL_RGB10, GL_RGB12, and GL_RGB16 internal formats, as they're now supported and work properly. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_surface_formats.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c index 3f64881..b1ea340 100644 --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c @@ -543,7 +543,15 @@ brw_init_surface_formats(struct brw_context *brw) const struct surface_format_info *rinfo, *tinfo; bool is_integer = _mesa_is_format_integer_color(format); - render = texture = brw_format_for_mesa_format(format); + texture = brw_format_for_mesa_format(format); + /* Our hardware can't natively render to RGBX formats, so we convert + * them to the equivalent RGBA format when rendering. When sampling, + * we use the original RGBX format, so the sampler will return 1.0 for + * the alpha channel, as required. We also override blend functions + * to use GL_ONE instead of GL_DST_ALPHA and GL_ZERO instead of + * GL_ONE_MINUS_DST_ALPHA. (See brw_fix_xRGB_alpha.) + */ + render = brw_format_for_mesa_format(_mesa_format_x_to_a(format)); tinfo = surface_formats[texture]; /* The value of BRW_SURFACEFORMAT_R32G32B32A32_FLOAT is 0, so don't skip @@ -571,16 +579,6 @@ brw_init_surface_formats(struct brw_context *brw) case BRW_SURFACEFORMAT_L16_FLOAT: render = BRW_SURFACEFORMAT_R16_FLOAT; break; - case BRW_SURFACEFORMAT_B8G8R8X8_UNORM: -/* XRGB is handled as ARGB because the chips in this family - * cannot render to XRGB targets. This means that we have to - * mask writes to alpha (ala glColorMask) and reconfigure the - * alpha blending hardware to use GL_ONE (or GL_ZERO) for - * cases where GL_DST_ALPHA (or GL_ONE_MINUS_DST_ALPHA) is - * used. - */ -render = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; -break; } rinfo = surface_formats[render]; -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] mesa: Add a new _mesa_format_x_to_a() function.
This translates RGBX formats to the equivalent RGBA format. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/main/formats.c | 57 + src/mesa/main/formats.h | 3 +++ 2 files changed, 60 insertions(+) diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 4fb1f11..fa310f0 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -2236,6 +2236,63 @@ _mesa_format_has_color_component(mesa_format format, int component) /** + * Converts RGBX formats to the equivalent RGBA format. + * + * For non-X formats, returns the original format. + */ +mesa_format +_mesa_format_x_to_a(mesa_format format) +{ + switch (format) { + case MESA_FORMAT_X8B8G8R8_UNORM: + return MESA_FORMAT_A8B8G8R8_UNORM; + case MESA_FORMAT_R8G8B8X8_UNORM: + return MESA_FORMAT_R8G8B8A8_UNORM; + case MESA_FORMAT_B8G8R8X8_UNORM: + return MESA_FORMAT_B8G8R8A8_UNORM; + case MESA_FORMAT_X8R8G8B8_UNORM: + return MESA_FORMAT_A8R8G8B8_UNORM; + case MESA_FORMAT_B4G4R4X4_UNORM: + return MESA_FORMAT_B4G4R4A4_UNORM; + case MESA_FORMAT_B5G5R5X1_UNORM: + return MESA_FORMAT_B5G5R5A1_UNORM; + case MESA_FORMAT_B10G10R10X2_UNORM: + return MESA_FORMAT_B10G10R10A2_UNORM; + case MESA_FORMAT_X8B8G8R8_SNORM: + return MESA_FORMAT_A8B8G8R8_SNORM; + case MESA_FORMAT_R8G8B8X8_SNORM: + return MESA_FORMAT_R8G8B8A8_SNORM; + case MESA_FORMAT_B8G8R8X8_SRGB: + return MESA_FORMAT_B8G8R8A8_SRGB; + case MESA_FORMAT_R8G8B8X8_SRGB: + return MESA_FORMAT_R8G8B8A8_SRGB; + case MESA_FORMAT_RGBX_UNORM16: + return MESA_FORMAT_RGBA_UNORM16; + case MESA_FORMAT_RGBX_SNORM16: + return MESA_FORMAT_RGBA_SNORM16; + case MESA_FORMAT_RGBX_FLOAT16: + return MESA_FORMAT_RGBA_FLOAT16; + case MESA_FORMAT_RGBX_FLOAT32: + return MESA_FORMAT_RGBA_FLOAT32; + case MESA_FORMAT_RGBX_UINT8: + return MESA_FORMAT_RGBA_UINT8; + case MESA_FORMAT_RGBX_UINT16: + return MESA_FORMAT_RGBA_UINT16; + case MESA_FORMAT_RGBX_UINT32: + return MESA_FORMAT_RGBA_UINT32; + case MESA_FORMAT_RGBX_SINT8: + return MESA_FORMAT_RGBA_SINT8; + case MESA_FORMAT_RGBX_SINT16: + return MESA_FORMAT_RGBA_SINT16; + case MESA_FORMAT_RGBX_SINT32: + return MESA_FORMAT_RGBA_SINT32; + default: + return format; + } +} + + +/** * Return number of bytes needed to store an image of the given size * in the given format. */ diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 89bd021..553fe7b 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -478,6 +478,9 @@ _mesa_format_num_components(mesa_format format); extern bool _mesa_format_has_color_component(mesa_format format, int component); +extern mesa_format +_mesa_format_x_to_a(mesa_format format); + GLboolean _mesa_format_matches_format_and_type(mesa_format mesa_format, GLenum format, GLenum type, -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCHv2 1/3] gallium: add interface to clear buffers
My reasoning was that it would be better to specify a raw clear value and clear value size for buffers, which are always untyped, and pipe_color_union for textures, which are always typed, so that drivers can easily implement the texture clearing on top of pipe_context::clear. I also suggested that clear_render_target and clear_depth_stencil should be removed in favor of a new function clear_texture(pipe, resource, level, box, pipe_color_union). For depth-stencil, we can assume that the first component of the clear color is a floating-point depth value and the second component is an unsigned integer stencil value. Marek On Wed, Mar 26, 2014 at 1:17 AM, Ilia Mirkin imir...@alum.mit.edu wrote: On Tue, Mar 25, 2014 at 7:57 PM, Brian Paul bri...@vmware.com wrote: On 03/25/2014 05:23 PM, Ilia Mirkin wrote: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- v1 - v2: add docs section to context.rst src/gallium/docs/source/context.rst | 5 + src/gallium/include/pipe/p_context.h | 11 +++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 8e14522..efa2a1c 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -218,6 +218,11 @@ is is also possible to only clear one or the other part). While it is only possible to clear one surface at a time (which can include several layers), this surface need not be bound to the framebuffer. +``clear_buffer`` clears a PIPE_BUFFER resource with the specified clear value +(which may be multiple bytes in length). Logically this is a memset with a +multi-byte element value starting at offset bytes from resource start, going +for size bytes. It is guaranteed that size % clear_value_size == 0. + Drawing ^^^ diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. Looking ahead a bit, if/when we support GL_ARB_clear_texture I wonder if we'll want to have just one pipe_context function for both purposes. We'd probably replace offset and size above with a mipmap level and x,y,z,w,h,d parameters. Do you have any thoughts on that? I actually already sent a set of ARB_clear_texture patches earlier (e.g.http://patchwork.freedesktop.org/patch/21593/). And I discussed the single callback vs multiple callbacks thing with Marek on IRC -- he convinced me that having 2 separate callbacks would be better. My reasoning there is that at least for nouveau, we'd still want to have a separate if PIPE_BUFFER: do this, else, do that bit, and a shared bit. It seems reasonable to have 2 diff callbacks esp since their parameters are going to be reasonably different. (Instead of x,y,z,w,h,d, I think a box makes sense. But same basic idea.) -ilia ___ 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] [PATCHv2 1/3] gallium: add interface to clear buffers
The first 2 patches are: Reviewed-by: Marek Olšák marek.ol...@amd.com Marek On Wed, Mar 26, 2014 at 12:23 AM, Ilia Mirkin imir...@alum.mit.edu wrote: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- v1 - v2: add docs section to context.rst src/gallium/docs/source/context.rst | 5 + src/gallium/include/pipe/p_context.h | 11 +++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 8e14522..efa2a1c 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -218,6 +218,11 @@ is is also possible to only clear one or the other part). While it is only possible to clear one surface at a time (which can include several layers), this surface need not be bound to the framebuffer. +``clear_buffer`` clears a PIPE_BUFFER resource with the specified clear value +(which may be multiple bytes in length). Logically this is a memset with a +multi-byte element value starting at offset bytes from resource start, going +for size bytes. It is guaranteed that size % clear_value_size == 0. + Drawing ^^^ diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCHv2 1/3] gallium: add interface to clear buffers
Am 26.03.2014 03:29, schrieb Marek Olšák: My reasoning was that it would be better to specify a raw clear value and clear value size for buffers, which are always untyped, and pipe_color_union for textures, which are always typed, so that drivers can easily implement the texture clearing on top of pipe_context::clear. I also suggested that clear_render_target and clear_depth_stencil should be removed in favor of a new function clear_texture(pipe, resource, level, box, pipe_color_union). For depth-stencil, we can assume that the first component of the clear color is a floating-point depth value and the second component is an unsigned integer stencil value. This could not clear only depth or stencil, though. Clear is just a mess why couldn't the apis agree a bit more what is useful... So d3d10 can only clear render target / depth stencil views, meaning your resrouces need the bind_render_target flag (not that drivers actually usually enforce this for rendering since it breaks mesa state tracker in a couple of places due to this being not required in general and hard to guess in GL). You cannot clear only parts (or rather, you can clear individual layers and such by creating a different view, but not specify coords). You can however clear only depth or stencil. And you cannot clear buffers (well you can if you make them render target bindable but this has severe limitations and isn't something you'd do just so you can clear them). GL OTOH doesn't require the resources to be renderable for clearing to work, doesn't allow to clear only depth/stencil but does allow a box. There's also another problem with the proposed parameters for d3d10, the format of the resource could be different to that you'd actually want to use for clearing (for typeless resources). Roland Marek On Wed, Mar 26, 2014 at 1:17 AM, Ilia Mirkin imir...@alum.mit.edu wrote: On Tue, Mar 25, 2014 at 7:57 PM, Brian Paul bri...@vmware.com wrote: On 03/25/2014 05:23 PM, Ilia Mirkin wrote: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu --- v1 - v2: add docs section to context.rst src/gallium/docs/source/context.rst | 5 + src/gallium/include/pipe/p_context.h | 11 +++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 8e14522..efa2a1c 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -218,6 +218,11 @@ is is also possible to only clear one or the other part). While it is only possible to clear one surface at a time (which can include several layers), this surface need not be bound to the framebuffer. +``clear_buffer`` clears a PIPE_BUFFER resource with the specified clear value +(which may be multiple bytes in length). Logically this is a memset with a +multi-byte element value starting at offset bytes from resource start, going +for size bytes. It is guaranteed that size % clear_value_size == 0. + Drawing ^^^ diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index fe3045a..bf27285 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -332,6 +332,17 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); + /** +* Clear a buffer. Runs a memset over the specified region with the element +* value passed in through clear_value of size clear_value_size. +*/ + void (*clear_buffer)(struct pipe_context *pipe, +struct pipe_resource *res, +unsigned offset, +unsigned size, +const void *clear_value, +int clear_value_size); + /** Flush draw commands * * \param flags bitfield of enum pipe_flush_flags values. Looking ahead a bit, if/when we support GL_ARB_clear_texture I wonder if we'll want to have just one pipe_context function for both purposes. We'd probably replace offset and size above with a mipmap level and x,y,z,w,h,d parameters. Do you have any thoughts on that? I actually already sent a set of ARB_clear_texture patches earlier (e.g.https://urldefense.proofpoint.com/v1/url?u=http://patchwork.freedesktop.org/patch/21593/k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0Am=iKYKx1My9ILC23eMS7aMZJ8aOb4TXcz2TFClz1D61%2BM%3D%0As=85f6dd32323392e35535685b30fadf7ce24b921536974e166a4b2f849ea3950c). And I discussed the single callback vs multiple callbacks thing with Marek on IRC -- he convinced me that having 2 separate callbacks would be better. My reasoning there is that at least for nouveau, we'd still want to have a separate if PIPE_BUFFER: do this, else, do that bit, and a shared bit. It seems reasonable to have 2 diff callbacks esp since their
[Mesa-dev] [PATCH 1/2] glsl: remove {add, get}_type_ast from glsl_symbol_table
They are not needed since 0da1a2cc369052643ccaea75a1722cc37652d82a. --- src/glsl/glsl_parser.yy| 1 - src/glsl/glsl_symbol_table.cpp | 25 - src/glsl/glsl_symbol_table.h | 2 -- 3 files changed, 28 deletions(-) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index faaf438..2d0e7be 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1901,7 +1901,6 @@ struct_specifier: $$ = new(ctx) ast_struct_specifier($2, $4); $$-set_location_range(@2, @5); state-symbols-add_type($2, glsl_type::void_type); - state-symbols-add_type_ast($2, new(ctx) ast_type_specifier($$)); } | STRUCT '{' struct_declaration_list '}' { diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index 11569f4..a052362 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -162,23 +162,6 @@ bool glsl_symbol_table::add_type(const char *name, const glsl_type *t) return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; } -static char *make_ast_name(const char *name) -{ - char *ast_name = new char[strlen(#ast.) + strlen(name) + 1]; - strcpy(ast_name, #ast.); - strcat(ast_name + strlen(#ast.), name); - return ast_name; -} - -bool glsl_symbol_table::add_type_ast(const char *name, const class ast_type_specifier *a) -{ - symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(a); - char *ast_name = make_ast_name(name); - bool ret = _mesa_symbol_table_add_symbol(table, -1, ast_name, entry) == 0; - delete [] ast_name; - return ret; -} - bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i, enum ir_variable_mode mode) { @@ -230,14 +213,6 @@ const glsl_type *glsl_symbol_table::get_type(const char *name) return entry != NULL ? entry-t : NULL; } -const class ast_type_specifier *glsl_symbol_table::get_type_ast(const char *name) -{ - char *ast_name = make_ast_name(name); - symbol_table_entry *entry = get_entry(ast_name); - delete [] ast_name; - return entry != NULL ? entry-a : NULL; -} - const glsl_type *glsl_symbol_table::get_interface(const char *name, enum ir_variable_mode mode) { diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 0e62448..f323fc3 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -98,7 +98,6 @@ public: /*@{*/ bool add_variable(ir_variable *v); bool add_type(const char *name, const glsl_type *t); - bool add_type_ast(const char *name, const class ast_type_specifier *t); bool add_function(ir_function *f); bool add_interface(const char *name, const glsl_type *i, enum ir_variable_mode mode); @@ -115,7 +114,6 @@ public: /*@{*/ ir_variable *get_variable(const char *name); const glsl_type *get_type(const char *name); - const class ast_type_specifier *get_type_ast(const char *name); ir_function *get_function(const char *name); const glsl_type *get_interface(const char *name, enum ir_variable_mode mode); -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] glsl: remove UBO fields from _mesa_glsl_parse_state
They are not needed since 514f8c7ec7cc1ab18be93cebb5b9bf970b1955a9. --- src/glsl/glsl_parser_extras.cpp | 10 -- src/glsl/glsl_parser_extras.h | 4 src/mesa/main/mtypes.h | 3 +-- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 61ae621..8422ba6 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -66,10 +66,6 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this-translation_unit.make_empty(); this-symbols = new(mem_ctx) glsl_symbol_table; - this-num_uniform_blocks = 0; - this-uniform_block_array_size = 0; - this-uniform_blocks = NULL; - this-info_log = ralloc_strdup(mem_ctx, ); this-error = false; this-loop_nesting_ast = NULL; @@ -1464,12 +1460,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, shader-IsES = state-es_shader; shader-uses_builtin_functions = state-uses_builtin_functions; - if (shader-UniformBlocks) - ralloc_free(shader-UniformBlocks); - shader-NumUniformBlocks = state-num_uniform_blocks; - shader-UniformBlocks = state-uniform_blocks; - ralloc_steal(shader, shader-UniformBlocks); - if (!state-error) set_shader_inout_layout(shader, state); diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 300d900..3ad205c 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -175,10 +175,6 @@ struct _mesa_glsl_parse_state { exec_list translation_unit; glsl_symbol_table *symbols; - unsigned num_uniform_blocks; - unsigned uniform_block_array_size; - struct gl_uniform_block *uniform_blocks; - unsigned num_supported_versions; struct { unsigned ver; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 33cb888..15c0a59 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2421,8 +2421,7 @@ struct gl_shader /** * This shader's uniform block information. * -* The offsets of the variables are assigned only for shaders in a program's -* _LinkedShaders[]. +* These fields are only set post-linking. */ struct gl_uniform_block *UniformBlocks; unsigned NumUniformBlocks; -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev