[Mesa-dev] [PATCH 1/2] glx: Simplify __glxGetMscRate, it only needs the screen, not a drawable
Useful in its own right, but also needed for adaptive vsync. Last mail was accidentally wrapped. Signed-off-by: Lauri Kasanen --- src/glx/dri_common.c | 2 +- src/glx/glxclient.h | 2 +- src/glx/glxcmds.c| 6 ++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 22ba248..b5058c9 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -223,7 +223,7 @@ __driGetMSCRate(__DRIdrawable *draw, { __GLXDRIdrawable *glxDraw = loaderPrivate; - return __glxGetMscRate(glxDraw, numerator, denominator); + return __glxGetMscRate(glxDraw->psc, numerator, denominator); } _X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = { diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index e33dba6..a7118af 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -781,7 +781,7 @@ extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) extern GLboolean -__glxGetMscRate(__GLXDRIdrawable *glxDraw, +__glxGetMscRate(struct glx_screen *psc, int32_t * numerator, int32_t * denominator); /* So that dri2.c:DRI2WireToEvent() can access diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 06c4c16..b5377c2 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -2095,16 +2095,14 @@ __glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable, #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) _X_HIDDEN GLboolean -__glxGetMscRate(__GLXDRIdrawable *glxDraw, +__glxGetMscRate(struct glx_screen *psc, int32_t * numerator, int32_t * denominator) { #ifdef XF86VIDMODE - struct glx_screen *psc; XF86VidModeModeLine mode_line; int dot_clock; int i; - psc = glxDraw->psc; if (XF86VidModeQueryVersion(psc->dpy, &i, &i) && XF86VidModeGetModeLine(psc->dpy, psc->scr, &dot_clock, &mode_line)) { unsigned n = dot_clock * 1000; @@ -2180,7 +2178,7 @@ __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, if (draw == NULL) return False; - return __glxGetMscRate(draw, numerator, denominator); + return __glxGetMscRate(draw->psc, numerator, denominator); #else (void) dpy; (void) drawable; -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] glx/dri2: Add support for adaptive vsync
There is a GLX extension for this behavior, glx_swap_control_tear, which mesa doesn't support ATM. But as usual, even after it becomes supported, there will be thousands of applications that won't add support for it, necessitating the need for a user override. v2: - Removed mistaken EGL X11 lines - Added hysteresis - Faster sync Signed-off-by: Lauri Kasanen --- src/egl/drivers/dri2/egl_dri2.h | 1 + src/egl/drivers/dri2/platform_wayland.c | 3 ++ src/egl/drivers/dri2/platform_x11.c | 3 ++ src/glx/dri2_glx.c | 63 + src/glx/dri2_priv.h | 1 + src/glx/dri3_glx.c | 3 ++ src/glx/dri3_priv.h | 1 + src/mesa/drivers/dri/common/xmlpool/t_options.h | 4 +- 8 files changed, 78 insertions(+), 1 deletion(-) diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index d29dd98..d710e84 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -225,6 +225,7 @@ struct dri2_egl_image #define DRI_CONF_VBLANK_DEF_INTERVAL_0 1 #define DRI_CONF_VBLANK_DEF_INTERVAL_1 2 #define DRI_CONF_VBLANK_ALWAYS_SYNC 3 +#define DRI_CONF_VBLANK_ADAPTIVE 4 /* standard typecasts */ _EGL_DRIVER_STANDARD_TYPECASTS(dri2_egl) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 5c8440d..1d28fe7 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -941,6 +941,9 @@ dri2_setup_swap_interval(struct dri2_egl_display *dri2_dpy) dri2_dpy->max_swap_interval = 1; dri2_dpy->default_swap_interval = 0; break; + case DRI_CONF_VBLANK_ADAPTIVE: + fprintf(stderr, "Adaptive vsync is not supported for this platform.\n"); + /* fall-through */ default: case DRI_CONF_VBLANK_DEF_INTERVAL_1: dri2_dpy->min_swap_interval = 0; diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index d3397d4..4679830 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1097,6 +1097,9 @@ dri2_setup_swap_interval(struct dri2_egl_display *dri2_dpy) dri2_dpy->max_swap_interval = arbitrary_max_interval; dri2_dpy->default_swap_interval = 0; break; + case DRI_CONF_VBLANK_ADAPTIVE: + fprintf(stderr, "Adaptive vsync is not supported for this platform.\n"); + /* fall-through */ default: case DRI_CONF_VBLANK_DEF_INTERVAL_1: dri2_dpy->min_swap_interval = 0; diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index bfeebed..b41dd1e 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -57,6 +57,7 @@ #define DRI_CONF_VBLANK_DEF_INTERVAL_0 1 #define DRI_CONF_VBLANK_DEF_INTERVAL_1 2 #define DRI_CONF_VBLANK_ALWAYS_SYNC 3 +#define DRI_CONF_VBLANK_ADAPTIVE 4 #undef DRI2_MINOR #define DRI2_MINOR 1 @@ -95,9 +96,15 @@ struct dri2_drawable int have_back; int have_fake_front; int swap_interval; + int adaptive_swap; + /* For show_fps */ uint64_t previous_time; unsigned frames; + + /* For adaptive_vsync */ + uint64_t adaptive_previous_time; + unsigned adaptive_frames; }; static const struct glx_context_vtable dri2_context_vtable; @@ -377,12 +384,17 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable, pdraw->bufferCount = 0; pdraw->swap_interval = 1; /* default may be overridden below */ pdraw->have_back = 0; + pdraw->adaptive_swap = 0; if (psc->config) psc->config->configQueryi(psc->driScreen, "vblank_mode", &vblank_mode); switch (vblank_mode) { + case DRI_CONF_VBLANK_ADAPTIVE: + pdraw->swap_interval = 0; + pdraw->adaptive_swap = 1; + break; case DRI_CONF_VBLANK_NEVER: case DRI_CONF_VBLANK_DEF_INTERVAL_0: pdraw->swap_interval = 0; @@ -770,6 +782,42 @@ static void show_fps(struct dri2_drawable *draw) } } +static void adaptive_vsync(struct dri2_drawable *draw) +{ + const struct dri2_screen *scr = (struct dri2_screen *) draw->base.psc; + + unsigned int rate = scr->refresh_rate ? scr->refresh_rate : 60; + unsigned int high, low; + struct timeval tv; + uint64_t current_time; + + rate /= 2; + + /* Hysteresis */ + high = rate * 1.1f; + low = rate * 0.9f; + + gettimeofday(&tv, 0); + current_time = (uint64_t)tv.tv_sec*100 + (uint64_t)tv.tv_usec; + + draw->adaptive_frames++; + + if (draw->adaptive_previous_time + 50 <= current_time) { + if (draw->adaptive_frames >= high) { + /* Enable vsync */ + if (scr->vtable.setSwapInterval) +scr->vtable.setSwapInterval(&draw->base, 1); + } else if (draw->adaptive_frames <= low) { + /* Disable vsync */ + if (scr->vtable.setSwapInterval) +scr->vtable.setSwapInterval(&draw->base, 0); + } + + draw->adaptive_fra
[Mesa-dev] [PATCH] mesa: update khrplatform.h for Win64 support
Signed-off-by: Jonathan Liu --- include/KHR/khrplatform.h | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/KHR/khrplatform.h b/include/KHR/khrplatform.h index 4479539..46730cd 100644 --- a/include/KHR/khrplatform.h +++ b/include/KHR/khrplatform.h @@ -26,7 +26,7 @@ /* Khronos platform-specific types and definitions. * - * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ + * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ * * Adopters may modify this file to suit their platform. Adopters are * encouraged to submit platform specific modifications to the Khronos @@ -229,10 +229,23 @@ typedef signed char khronos_int8_t; typedef unsigned char khronos_uint8_t; typedef signed short int khronos_int16_t; typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else typedef signed long int khronos_intptr_t; typedef unsigned long int khronos_uintptr_t; typedef signed long int khronos_ssize_t; typedef unsigned long int khronos_usize_t; +#endif #if KHRONOS_SUPPORT_FLOAT /* -- 1.8.5.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/1] i915: Add support for gl_FragData[0] reads.
Similar to 556a47a2621073185be83a0a721a8ba93392bedb, without this reading from gl_FragData[0] would cause a software fallback. Bugzilla: https://bugs.winehq.org/show_bug.cgi?id=33964 Signed-off-by: Henri Verbeet Cc: 10.0 9.2 9.1 --- src/mesa/drivers/dri/i915/i915_fragprog.c |1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index dff4b9f..34df6fc 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -146,6 +146,7 @@ src_vector(struct i915_fragment_program *p, case PROGRAM_OUTPUT: switch (source->Index) { case FRAG_RESULT_COLOR: + case FRAG_RESULT_DATA0: src = UREG(REG_TYPE_OC, 0); break; case FRAG_RESULT_DEPTH: -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 50754] Building 32 bit mesa on 64 bit OS fails since change for automake
https://bugs.freedesktop.org/show_bug.cgi?id=50754 --- Comment #27 from Alexandre Demers --- The proposed patch here is a trivial change. It fixes the reported bug by moving LT_INIT where it should be according to the documentation (it needs to know the full content of (AM_)C(XX)FLAGS variables). Could someone review it and push it if it is ok with them? Otherwise, please explain why it can't be. -- 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 0/3] Buffer creation and consistency
Hi, this series fixes clCreatBUffer and buffer-flags piglit tests. The first two patches add just error checking, the last patch fixes memory initialization when using CL_MEM_USE_HOST_PTR flag. regards, Jan Jan Vesely (3): clover: Check invalid flag combinations in clCreateBuffer. clover: Check allocation size against context maximum clover: Append buffers that use CL_MEM_USE_HOST_PTR src/gallium/state_trackers/clover/api/memory.cpp | 17 - src/gallium/state_trackers/clover/core/context.cpp | 11 +++ src/gallium/state_trackers/clover/core/context.hpp | 2 ++ src/gallium/state_trackers/clover/core/memory.cpp | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] clover: Append buffers that use CL_MEM_USE_HOST_PTR
Specs say it's legal for implementations to use internal copies, and the write synchronization seems to work. Fixes clCreateBuffer (together with previous patches) and buffer-flags piglits. Signed-off-by: Jan Vesely --- src/gallium/state_trackers/clover/core/memory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/clover/core/memory.cpp b/src/gallium/state_trackers/clover/core/memory.cpp index 87a9f7a..1db3f68 100644 --- a/src/gallium/state_trackers/clover/core/memory.cpp +++ b/src/gallium/state_trackers/clover/core/memory.cpp @@ -31,7 +31,7 @@ memory_obj::memory_obj(context &ctx, cl_mem_flags flags, ctx(ctx), _flags(flags), _size(size), _host_ptr(host_ptr), _destroy_notify([]{}) { - if (flags & CL_MEM_COPY_HOST_PTR) + if (flags & (CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR)) data.append((char *)host_ptr, size); } -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] clover: Check allocation size against context maximum
From: Jan Vesely Check maximum size across all devices in the context Signed-off-by: Jan Vesely --- src/gallium/state_trackers/clover/api/memory.cpp | 2 +- src/gallium/state_trackers/clover/core/context.cpp | 11 +++ src/gallium/state_trackers/clover/core/context.hpp | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/clover/api/memory.cpp b/src/gallium/state_trackers/clover/api/memory.cpp index 15f5b7f..b5b75cd 100644 --- a/src/gallium/state_trackers/clover/api/memory.cpp +++ b/src/gallium/state_trackers/clover/api/memory.cpp @@ -35,7 +35,7 @@ clCreateBuffer(cl_context d_ctx, cl_mem_flags flags, size_t size, CL_MEM_COPY_HOST_PTR))) throw error(CL_INVALID_HOST_PTR); - if (!size) + if (!size || size > ctx.max_mem_alloc_size()) throw error(CL_INVALID_BUFFER_SIZE); if (flags & ~(CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | diff --git a/src/gallium/state_trackers/clover/core/context.cpp b/src/gallium/state_trackers/clover/core/context.cpp index e2658f2..d00c5b5 100644 --- a/src/gallium/state_trackers/clover/core/context.cpp +++ b/src/gallium/state_trackers/clover/core/context.cpp @@ -48,3 +48,14 @@ context::device_range context::devs() const { return map(derefs(), _devs); } + +static bool max_alloc_comp(const clover::device *a, const clover::device *b) +{ + return a->max_mem_alloc_size() < b->max_mem_alloc_size(); +} + +cl_ulong context::max_mem_alloc_size() const { + const clover::device *dev = + *(std::max_element(_devs.begin(), _devs.end(), max_alloc_comp)); + return dev->max_mem_alloc_size(); +} diff --git a/src/gallium/state_trackers/clover/core/context.hpp b/src/gallium/state_trackers/clover/core/context.hpp index 0b5cf8a..0bb5953 100644 --- a/src/gallium/state_trackers/clover/core/context.hpp +++ b/src/gallium/state_trackers/clover/core/context.hpp @@ -50,6 +50,8 @@ namespace clover { device_range devs() const; + + cl_ulong max_mem_alloc_size() const; private: property_list _props; -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] clover: Check invalid flag combinations in clCreateBuffer.
Signed-off-by: Jan Vesely --- src/gallium/state_trackers/clover/api/memory.cpp | 15 +++ 1 file changed, 15 insertions(+) diff --git a/src/gallium/state_trackers/clover/api/memory.cpp b/src/gallium/state_trackers/clover/api/memory.cpp index 785a509..15f5b7f 100644 --- a/src/gallium/state_trackers/clover/api/memory.cpp +++ b/src/gallium/state_trackers/clover/api/memory.cpp @@ -43,6 +43,21 @@ clCreateBuffer(cl_context d_ctx, cl_mem_flags flags, size_t size, CL_MEM_COPY_HOST_PTR)) throw error(CL_INVALID_VALUE); + if ((flags & CL_MEM_WRITE_ONLY) && (flags & CL_MEM_READ_ONLY)) + throw error(CL_INVALID_VALUE); + + if ((flags & CL_MEM_READ_WRITE) && (flags & CL_MEM_READ_ONLY)) + throw error(CL_INVALID_VALUE); + + if ((flags & CL_MEM_READ_WRITE) && (flags & CL_MEM_WRITE_ONLY)) + throw error(CL_INVALID_VALUE); + + if ((flags & CL_MEM_COPY_HOST_PTR) && (flags & CL_MEM_USE_HOST_PTR)) + throw error(CL_INVALID_VALUE); + + if ((flags & CL_MEM_ALLOC_HOST_PTR) && (flags & CL_MEM_USE_HOST_PTR)) + throw error(CL_INVALID_VALUE); + ret_error(r_errcode, CL_SUCCESS); return new root_buffer(ctx, flags, size, host_ptr); -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 72708] Master fails to build with older gcc due to -msse4.1
https://bugs.freedesktop.org/show_bug.cgi?id=72708 --- Comment #1 from Matt Turner --- -msse4.1 has existed in gcc since 4.3. 4.3 was released five and a half years ago. Why are you using something older than that? Sounds like you've got a good idea how to solve it. Send a patch and I'll review it. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] glBlitFramebuffer and sRGB vs piglit
Hi everybody, There is an inconsistence in the piglit glBlitFramebuffer tests. If both src and dst are sRGB, piglit expects this from glBlitFramebuffer: if (dst.num_samples == 1 && src.num_samples > 1) { enable the sRGB->linear conversion for src reads and the linear->sRGB conversion for dst writes; } else { disable the sRGB conversions; } Is this the intended behavior? Regardless of the GL spec, what behavior do applications expect? (if somebody knows) Also most of the piglit BlitFramebuffer tests with sRGB formats expect the opposite than what GL 4.4 specifies, and if we implemented the GL 4.4 behavior, all those tests would fail. For reference, GL 4.4 requires this: - if src.format is sRGB, do the sRGB->linear conversion for reads. (I think it can only be disabled with texture views.) - if dst.format is sRGB and GL_FRAMEBUFFER_SRGB is enabled, do the linear->sRGB conversion for dst writes. st/mesa does this: - Always disable the sRGB conversions. I think the older GL specs specify a different behavior for sRGB blits, which roughly corresponds to how st/mesa does it. Yeah, it's a pretty messy situation. So, do you have any answers to the 2 questions above? Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] llvmpipe: use pipe_sampler_view_release() to avoid segfault
This fixes another case of faulting when freeing a pipe_sampler_view that belongs to a previously destroyed context. Signed-off-by: Jonathan Liu --- src/gallium/drivers/llvmpipe/lp_state_sampler.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 1d3db0f..ff498f7 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -136,6 +136,12 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe, /* set the new sampler views */ for (i = 0; i < num; i++) { + /* Note: we're using pipe_sampler_view_release() here to work around + * a possible crash when the old view belongs to another context that + * was already destroyed. + */ + pipe_sampler_view_release(pipe, +&llvmpipe->sampler_views[shader][start + i]); pipe_sampler_view_reference(&llvmpipe->sampler_views[shader][start + i], views[i]); } -- 1.8.5.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] configure.ac: remove -fcolor-diagnostics from LLVM flags
When LLVM is build with Clang, "llvm-config --cxxflags" contains the -fcolor-diagnostics flag. It is not recognized by gcc and the build fails. Fix by removing the flag. Signed-off-by: Markus Trippelsdorf diff --git a/configure.ac b/configure.ac index c14d39a285a6..da8be8b02f3e 100644 --- a/configure.ac +++ b/configure.ac @@ -1546,6 +1546,7 @@ strip_unwanted_llvm_flags() { -e 's/-O.\>//g' \ -e 's/-g\>//g' \ -e 's/-Wall\>//g' \ + -e 's/-fcolor-diagnostics\>//g' \ -e 's/-fomit-frame-pointer\>//g' } -- Markus ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] gallium endianness and hw drivers
So the llvmpipe endian work broke the nouveau nv40 support for the nv43 in the ppc G5 a few people have, Now I'm not really sure how this is supposed to be fixed, the gallium driver exports the formats it supports, which doesn't include the translated formats for PIPE_FORMAT_BGRA and PIPE_FORMAT_8BGRX which end up like PIPE_FORMAT_A8R8G8B8_UNORM this. This means no 8-bit visuals and ensuing fail. Now I'm not sure the hw has any swappers or anything to facilitate these formats for rendering to, so it seems to me the pipe driver is doing the right thing, so my thinking is the state tracker should probably be dealing with this better, but again I'm not really sure how, maybe this just all worked in the past by luck. So should dri_fill_in_modes be doing a bit more on big endian? so if it can't find any formats the way it wants, it tries the other way, and reports those back so X gets different visuals with the masks all moved about? Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] clover: Check invalid flag combinations in clCreateBuffer.
Jan Vesely writes: > Signed-off-by: Jan Vesely > --- > src/gallium/state_trackers/clover/api/memory.cpp | 15 +++ > 1 file changed, 15 insertions(+) > > diff --git a/src/gallium/state_trackers/clover/api/memory.cpp > b/src/gallium/state_trackers/clover/api/memory.cpp > index 785a509..15f5b7f 100644 > --- a/src/gallium/state_trackers/clover/api/memory.cpp > +++ b/src/gallium/state_trackers/clover/api/memory.cpp > @@ -43,6 +43,21 @@ clCreateBuffer(cl_context d_ctx, cl_mem_flags flags, > size_t size, > CL_MEM_COPY_HOST_PTR)) >throw error(CL_INVALID_VALUE); > > + if ((flags & CL_MEM_WRITE_ONLY) && (flags & CL_MEM_READ_ONLY)) > + throw error(CL_INVALID_VALUE); > + > + if ((flags & CL_MEM_READ_WRITE) && (flags & CL_MEM_READ_ONLY)) > + throw error(CL_INVALID_VALUE); > + > + if ((flags & CL_MEM_READ_WRITE) && (flags & CL_MEM_WRITE_ONLY)) > + throw error(CL_INVALID_VALUE); > + > + if ((flags & CL_MEM_COPY_HOST_PTR) && (flags & CL_MEM_USE_HOST_PTR)) > + throw error(CL_INVALID_VALUE); > + > + if ((flags & CL_MEM_ALLOC_HOST_PTR) && (flags & CL_MEM_USE_HOST_PTR)) > + throw error(CL_INVALID_VALUE); > + Wouldn't it be easier to do something like: | if (util_bitcount(flags & (CL_MEM_READ_ONLY | CL_MEM_WRITE_ONLY | | CL_MEM_READ_WRITE)) > 1) | throw error(CL_INVALID_VALUE); | | if ((flags & CL_MEM_USE_HOST_PTR) && | (flags & (CL_MEM_COPY_HOST_PTR | CL_MEM_ALLOC_HOST_PTR))) | throw error(CL_INVALID_VALUE); With that fixed, Reviewed-by: Francisco Jerez > ret_error(r_errcode, CL_SUCCESS); > return new root_buffer(ctx, flags, size, host_ptr); > > -- > 1.8.3.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev pgpmiO0VYtCB5.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] clover: Check allocation size against context maximum
Jan Vesely writes: > From: Jan Vesely > > Check maximum size across all devices in the context > > Signed-off-by: Jan Vesely > --- > src/gallium/state_trackers/clover/api/memory.cpp | 2 +- > src/gallium/state_trackers/clover/core/context.cpp | 11 +++ > src/gallium/state_trackers/clover/core/context.hpp | 2 ++ > 3 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/src/gallium/state_trackers/clover/api/memory.cpp > b/src/gallium/state_trackers/clover/api/memory.cpp > index 15f5b7f..b5b75cd 100644 > --- a/src/gallium/state_trackers/clover/api/memory.cpp > +++ b/src/gallium/state_trackers/clover/api/memory.cpp > @@ -35,7 +35,7 @@ clCreateBuffer(cl_context d_ctx, cl_mem_flags flags, size_t > size, > CL_MEM_COPY_HOST_PTR))) >throw error(CL_INVALID_HOST_PTR); > > - if (!size) > + if (!size || size > ctx.max_mem_alloc_size()) >throw error(CL_INVALID_BUFFER_SIZE); > Can you avoid defining a new single-use method for this and do the calculation right here instead? Like: | if (!size || | size > fold(maximum(), 0u, | map(std::mem_fn(&device::max_mem_alloc_size), ctx.devs()) | )) | throw error(CL_INVALID_BUFFER_SIZE); With that fixed, Reviewed-by: Francisco Jerez > if (flags & ~(CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | > diff --git a/src/gallium/state_trackers/clover/core/context.cpp > b/src/gallium/state_trackers/clover/core/context.cpp > index e2658f2..d00c5b5 100644 > --- a/src/gallium/state_trackers/clover/core/context.cpp > +++ b/src/gallium/state_trackers/clover/core/context.cpp > @@ -48,3 +48,14 @@ context::device_range > context::devs() const { > return map(derefs(), _devs); > } > + > +static bool max_alloc_comp(const clover::device *a, const clover::device *b) > +{ > + return a->max_mem_alloc_size() < b->max_mem_alloc_size(); > +} > + > +cl_ulong context::max_mem_alloc_size() const { > + const clover::device *dev = > + *(std::max_element(_devs.begin(), _devs.end(), max_alloc_comp)); > + return dev->max_mem_alloc_size(); > +} > diff --git a/src/gallium/state_trackers/clover/core/context.hpp > b/src/gallium/state_trackers/clover/core/context.hpp > index 0b5cf8a..0bb5953 100644 > --- a/src/gallium/state_trackers/clover/core/context.hpp > +++ b/src/gallium/state_trackers/clover/core/context.hpp > @@ -50,6 +50,8 @@ namespace clover { > >device_range >devs() const; > + > + cl_ulong max_mem_alloc_size() const; > > private: >property_list _props; > -- > 1.8.3.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev pgpSMmMUbI5rP.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] clover: Append buffers that use CL_MEM_USE_HOST_PTR
Jan Vesely writes: > Specs say it's legal for implementations to use internal copies, > and the write synchronization seems to work. > Fixes clCreateBuffer (together with previous patches) > and buffer-flags piglits. > > Signed-off-by: Jan Vesely > --- > src/gallium/state_trackers/clover/core/memory.cpp | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/gallium/state_trackers/clover/core/memory.cpp > b/src/gallium/state_trackers/clover/core/memory.cpp > index 87a9f7a..1db3f68 100644 > --- a/src/gallium/state_trackers/clover/core/memory.cpp > +++ b/src/gallium/state_trackers/clover/core/memory.cpp > @@ -31,7 +31,7 @@ memory_obj::memory_obj(context &ctx, cl_mem_flags flags, > ctx(ctx), _flags(flags), > _size(size), _host_ptr(host_ptr), > _destroy_notify([]{}) { > - if (flags & CL_MEM_COPY_HOST_PTR) > + if (flags & (CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR)) >data.append((char *)host_ptr, size); > } > There are a couple of places more left to fix for our host_ptr handling to be fully compliant with the spec, but, as this makes piglit happy: Acked-by: Francisco Jerez > -- > 1.8.3.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev pgpoJHH2ZBG1l.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev