diff options
Diffstat (limited to 'lib/mesa/src/gallium/state_trackers')
72 files changed, 624 insertions, 1060 deletions
diff --git a/lib/mesa/src/gallium/state_trackers/clover/Makefile.sources b/lib/mesa/src/gallium/state_trackers/clover/Makefile.sources index 38f94981f..10bbda02d 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/Makefile.sources +++ b/lib/mesa/src/gallium/state_trackers/clover/Makefile.sources @@ -13,6 +13,7 @@ CPP_SOURCES := \ api/sampler.cpp \ api/transfer.cpp \ api/util.hpp \ + core/compiler.hpp \ core/context.cpp \ core/context.hpp \ core/device.cpp \ @@ -53,16 +54,7 @@ CPP_SOURCES := \ util/tuple.hpp LLVM_SOURCES := \ - llvm/codegen/bitcode.cpp \ - llvm/codegen/common.cpp \ - llvm/codegen/native.cpp \ - llvm/codegen.hpp \ - llvm/compat.hpp \ - llvm/invocation.cpp \ - llvm/invocation.hpp \ - llvm/metadata.hpp \ - llvm/util.hpp + llvm/invocation.cpp -SPIRV_SOURCES := \ - spirv/invocation.cpp \ - spirv/invocation.hpp +TGSI_SOURCES := \ + tgsi/compiler.cpp diff --git a/lib/mesa/src/gallium/state_trackers/clover/api/context.cpp b/lib/mesa/src/gallium/state_trackers/clover/api/context.cpp index c0cd2d32b..021eea36f 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/api/context.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/api/context.cpp @@ -45,13 +45,8 @@ clCreateContext(const cl_context_properties *d_props, cl_uint num_devs, throw error(CL_INVALID_PROPERTY); } - const auto notify = (!pfn_notify ? context::notify_action() : - [=](const char *s) { - pfn_notify(s, NULL, 0, user_data); - }); - ret_error(r_errcode, CL_SUCCESS); - return desc(new context(props, devs, notify)); + return desc(new context(props, devs)); } catch (error &e) { ret_error(r_errcode, e); diff --git a/lib/mesa/src/gallium/state_trackers/clover/api/event.cpp b/lib/mesa/src/gallium/state_trackers/clover/api/event.cpp index 3f89644d0..5d1a0e52c 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/api/event.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/api/event.cpp @@ -126,8 +126,7 @@ clSetEventCallback(cl_event d_ev, cl_int type, void *user_data) try { auto &ev = obj(d_ev); - if (!pfn_notify || - (type != CL_COMPLETE && type != CL_SUBMITTED && type != CL_RUNNING)) + if (!pfn_notify || type != CL_COMPLETE) throw error(CL_INVALID_VALUE); // Create a temporary soft event that depends on ev, with diff --git a/lib/mesa/src/gallium/state_trackers/clover/api/memory.cpp b/lib/mesa/src/gallium/state_trackers/clover/api/memory.cpp index df4b9baa1..1efb95b5c 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/api/memory.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/api/memory.cpp @@ -28,58 +28,37 @@ using namespace clover; namespace { - cl_mem_flags - validate_flags(cl_mem d_parent, cl_mem_flags d_flags) { - const cl_mem_flags dev_access_flags = - CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY; - const cl_mem_flags host_ptr_flags = - CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR; - const cl_mem_flags host_access_flags = - CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS; - const cl_mem_flags valid_flags = - dev_access_flags | host_access_flags | (d_parent ? 0 : host_ptr_flags); - - if ((d_flags & ~valid_flags) || - util_bitcount(d_flags & dev_access_flags) > 1 || - util_bitcount(d_flags & host_access_flags) > 1) + const cl_mem_flags dev_access_flags = + CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY; + const cl_mem_flags host_ptr_flags = + CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR; + const cl_mem_flags host_access_flags = + CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS; + const cl_mem_flags all_mem_flags = + dev_access_flags | host_ptr_flags | host_access_flags; + + void + validate_flags(cl_mem_flags flags, cl_mem_flags valid) { + if ((flags & ~valid) || + util_bitcount(flags & dev_access_flags) > 1 || + util_bitcount(flags & host_access_flags) > 1) throw error(CL_INVALID_VALUE); - if ((d_flags & CL_MEM_USE_HOST_PTR) && - (d_flags & (CL_MEM_COPY_HOST_PTR | CL_MEM_ALLOC_HOST_PTR))) + if ((flags & CL_MEM_USE_HOST_PTR) && + (flags & (CL_MEM_COPY_HOST_PTR | CL_MEM_ALLOC_HOST_PTR))) throw error(CL_INVALID_VALUE); - - if (d_parent) { - const auto &parent = obj(d_parent); - const cl_mem_flags flags = (d_flags | - (d_flags & dev_access_flags ? 0 : - parent.flags() & dev_access_flags) | - (d_flags & host_access_flags ? 0 : - parent.flags() & host_access_flags) | - (parent.flags() & host_ptr_flags)); - - if (~flags & parent.flags() & (dev_access_flags & ~CL_MEM_READ_WRITE)) - throw error(CL_INVALID_VALUE); - - // Check if new host access flags cause a mismatch between - // host-read/write-only. - if (!(flags & CL_MEM_HOST_NO_ACCESS) && - (~flags & parent.flags() & host_access_flags)) - throw error(CL_INVALID_VALUE); - - return flags; - - } else { - return d_flags | (d_flags & dev_access_flags ? 0 : CL_MEM_READ_WRITE); - } } } CLOVER_API cl_mem clCreateBuffer(cl_context d_ctx, cl_mem_flags d_flags, size_t size, void *host_ptr, cl_int *r_errcode) try { - const cl_mem_flags flags = validate_flags(NULL, d_flags); + const cl_mem_flags flags = d_flags | + (d_flags & dev_access_flags ? 0 : CL_MEM_READ_WRITE); auto &ctx = obj(d_ctx); + validate_flags(d_flags, all_mem_flags); + if (bool(host_ptr) != bool(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR))) throw error(CL_INVALID_HOST_PTR); @@ -103,7 +82,16 @@ clCreateSubBuffer(cl_mem d_mem, cl_mem_flags d_flags, cl_buffer_create_type op, const void *op_info, cl_int *r_errcode) try { auto &parent = obj<root_buffer>(d_mem); - const cl_mem_flags flags = validate_flags(d_mem, d_flags); + const cl_mem_flags flags = d_flags | + (d_flags & dev_access_flags ? 0 : parent.flags() & dev_access_flags) | + (d_flags & host_access_flags ? 0 : parent.flags() & host_access_flags) | + (parent.flags() & host_ptr_flags); + + validate_flags(d_flags, dev_access_flags | host_access_flags); + + if (~flags & parent.flags() & + ((dev_access_flags & ~CL_MEM_READ_WRITE) | host_access_flags)) + throw error(CL_INVALID_VALUE); if (op == CL_BUFFER_CREATE_TYPE_REGION) { auto reg = reinterpret_cast<const cl_buffer_region *>(op_info); @@ -129,90 +117,35 @@ clCreateSubBuffer(cl_mem d_mem, cl_mem_flags d_flags, } CLOVER_API cl_mem -clCreateImage(cl_context d_ctx, cl_mem_flags d_flags, - const cl_image_format *format, - const cl_image_desc *desc, - void *host_ptr, cl_int *r_errcode) try { +clCreateImage2D(cl_context d_ctx, cl_mem_flags d_flags, + const cl_image_format *format, + size_t width, size_t height, size_t row_pitch, + void *host_ptr, cl_int *r_errcode) try { + const cl_mem_flags flags = d_flags | + (d_flags & dev_access_flags ? 0 : CL_MEM_READ_WRITE); auto &ctx = obj(d_ctx); + validate_flags(d_flags, all_mem_flags); + if (!any_of(std::mem_fn(&device::image_support), ctx.devices())) throw error(CL_INVALID_OPERATION); if (!format) throw error(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR); - if (!desc) - throw error(CL_INVALID_IMAGE_DESCRIPTOR); - - if (desc->image_array_size == 0 && - (desc->image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY || - desc->image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY)) - throw error(CL_INVALID_IMAGE_DESCRIPTOR); - - if (!host_ptr && - (desc->image_row_pitch || desc->image_slice_pitch)) - throw error(CL_INVALID_IMAGE_DESCRIPTOR); - - if (desc->num_mip_levels || desc->num_samples) - throw error(CL_INVALID_IMAGE_DESCRIPTOR); - - if (bool(desc->buffer) != (desc->image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER)) - throw error(CL_INVALID_IMAGE_DESCRIPTOR); + if (width < 1 || height < 1) + throw error(CL_INVALID_IMAGE_SIZE); - if (bool(host_ptr) != bool(d_flags & (CL_MEM_USE_HOST_PTR | - CL_MEM_COPY_HOST_PTR))) + if (bool(host_ptr) != bool(flags & (CL_MEM_USE_HOST_PTR | + CL_MEM_COPY_HOST_PTR))) throw error(CL_INVALID_HOST_PTR); - const cl_mem_flags flags = validate_flags(desc->buffer, d_flags); - - if (!supported_formats(ctx, desc->image_type).count(*format)) + if (!supported_formats(ctx, CL_MEM_OBJECT_IMAGE2D).count(*format)) throw error(CL_IMAGE_FORMAT_NOT_SUPPORTED); ret_error(r_errcode, CL_SUCCESS); - - switch (desc->image_type) { - case CL_MEM_OBJECT_IMAGE2D: - if (!desc->image_width || !desc->image_height) - throw error(CL_INVALID_IMAGE_SIZE); - - if (all_of([=](const device &dev) { - const size_t max = 1 << dev.max_image_levels_2d(); - return (desc->image_width > max || - desc->image_height > max); - }, ctx.devices())) - throw error(CL_INVALID_IMAGE_SIZE); - - return new image2d(ctx, flags, format, - desc->image_width, desc->image_height, - desc->image_row_pitch, host_ptr); - - case CL_MEM_OBJECT_IMAGE3D: - if (!desc->image_width || !desc->image_height || !desc->image_depth) - throw error(CL_INVALID_IMAGE_SIZE); - - if (all_of([=](const device &dev) { - const size_t max = 1 << dev.max_image_levels_3d(); - return (desc->image_width > max || - desc->image_height > max || - desc->image_depth > max); - }, ctx.devices())) - throw error(CL_INVALID_IMAGE_SIZE); - - return new image3d(ctx, flags, format, - desc->image_width, desc->image_height, - desc->image_depth, desc->image_row_pitch, - desc->image_slice_pitch, host_ptr); - - case CL_MEM_OBJECT_IMAGE1D: - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - case CL_MEM_OBJECT_IMAGE1D_BUFFER: - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - // XXX - Not implemented. - throw error(CL_IMAGE_FORMAT_NOT_SUPPORTED); - - default: - throw error(CL_INVALID_IMAGE_DESCRIPTOR); - } + return new image2d(ctx, flags, format, width, height, + row_pitch, host_ptr); } catch (error &e) { ret_error(r_errcode, e); @@ -220,26 +153,40 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags, } CLOVER_API cl_mem -clCreateImage2D(cl_context d_ctx, cl_mem_flags d_flags, - const cl_image_format *format, - size_t width, size_t height, size_t row_pitch, - void *host_ptr, cl_int *r_errcode) { - const cl_image_desc desc = { CL_MEM_OBJECT_IMAGE2D, width, height, 0, 0, - row_pitch, 0, 0, 0, NULL }; - - return clCreateImage(d_ctx, d_flags, format, &desc, host_ptr, r_errcode); -} - -CLOVER_API cl_mem clCreateImage3D(cl_context d_ctx, cl_mem_flags d_flags, const cl_image_format *format, size_t width, size_t height, size_t depth, size_t row_pitch, size_t slice_pitch, - void *host_ptr, cl_int *r_errcode) { - const cl_image_desc desc = { CL_MEM_OBJECT_IMAGE3D, width, height, depth, 0, - row_pitch, slice_pitch, 0, 0, NULL }; + void *host_ptr, cl_int *r_errcode) try { + const cl_mem_flags flags = d_flags | + (d_flags & dev_access_flags ? 0 : CL_MEM_READ_WRITE); + auto &ctx = obj(d_ctx); + + validate_flags(d_flags, all_mem_flags); + + if (!any_of(std::mem_fn(&device::image_support), ctx.devices())) + throw error(CL_INVALID_OPERATION); + + if (!format) + throw error(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR); + + if (width < 1 || height < 1 || depth < 2) + throw error(CL_INVALID_IMAGE_SIZE); + + if (bool(host_ptr) != bool(flags & (CL_MEM_USE_HOST_PTR | + CL_MEM_COPY_HOST_PTR))) + throw error(CL_INVALID_HOST_PTR); - return clCreateImage(d_ctx, d_flags, format, &desc, host_ptr, r_errcode); + if (!supported_formats(ctx, CL_MEM_OBJECT_IMAGE3D).count(*format)) + throw error(CL_IMAGE_FORMAT_NOT_SUPPORTED); + + ret_error(r_errcode, CL_SUCCESS); + return new image3d(ctx, flags, format, width, height, depth, + row_pitch, slice_pitch, host_ptr); + +} catch (error &e) { + ret_error(r_errcode, e); + return NULL; } CLOVER_API cl_int @@ -249,7 +196,7 @@ clGetSupportedImageFormats(cl_context d_ctx, cl_mem_flags flags, auto &ctx = obj(d_ctx); auto formats = supported_formats(ctx, type); - validate_flags(NULL, flags); + validate_flags(flags, all_mem_flags); if (r_buf && !r_count) throw error(CL_INVALID_VALUE); @@ -405,6 +352,16 @@ clSetMemObjectDestructorCallback(cl_mem d_mem, return e.get(); } +CLOVER_API cl_mem +clCreateImage(cl_context d_ctx, cl_mem_flags flags, + const cl_image_format *format, + const cl_image_desc *image_desc, + void *host_ptr, cl_int *r_errcode) { + CLOVER_NOT_SUPPORTED_UNTIL("1.2"); + ret_error(r_errcode, CL_INVALID_OPERATION); + return NULL; +} + CLOVER_API cl_int clEnqueueFillBuffer(cl_command_queue command_queue, cl_mem buffer, const void *pattern, size_t pattern_size, diff --git a/lib/mesa/src/gallium/state_trackers/clover/api/transfer.cpp b/lib/mesa/src/gallium/state_trackers/clover/api/transfer.cpp index 34559042a..f7046253b 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/api/transfer.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/api/transfer.cpp @@ -295,9 +295,6 @@ clEnqueueReadBuffer(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, &mem, obj_origin, obj_pitch, region)); - if (blocking) - hev().wait_signalled(); - ret_object(rd_ev, hev); return CL_SUCCESS; @@ -328,9 +325,6 @@ clEnqueueWriteBuffer(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, ptr, {}, obj_pitch, region)); - if (blocking) - hev().wait_signalled(); - ret_object(rd_ev, hev); return CL_SUCCESS; @@ -368,9 +362,6 @@ clEnqueueReadBufferRect(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, &mem, obj_origin, obj_pitch, region)); - if (blocking) - hev().wait_signalled(); - ret_object(rd_ev, hev); return CL_SUCCESS; @@ -408,9 +399,6 @@ clEnqueueWriteBufferRect(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, ptr, host_origin, host_pitch, region)); - if (blocking) - hev().wait_signalled(); - ret_object(rd_ev, hev); return CL_SUCCESS; @@ -516,9 +504,6 @@ clEnqueueReadImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, &img, src_origin, src_pitch, region)); - if (blocking) - hev().wait_signalled(); - ret_object(rd_ev, hev); return CL_SUCCESS; @@ -553,9 +538,6 @@ clEnqueueWriteImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, ptr, {}, src_pitch, region)); - if (blocking) - hev().wait_signalled(); - ret_object(rd_ev, hev); return CL_SUCCESS; @@ -685,11 +667,7 @@ clEnqueueMapBuffer(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, void *map = mem.resource(q).add_map(q, flags, blocking, obj_origin, region); - auto hev = create<hard_event>(q, CL_COMMAND_MAP_BUFFER, deps); - if (blocking) - hev().wait_signalled(); - - ret_object(rd_ev, hev); + ret_object(rd_ev, create<hard_event>(q, CL_COMMAND_MAP_BUFFER, deps)); ret_error(r_errcode, CL_SUCCESS); return map; @@ -717,11 +695,7 @@ clEnqueueMapImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, void *map = img.resource(q).add_map(q, flags, blocking, origin, region); - auto hev = create<hard_event>(q, CL_COMMAND_MAP_IMAGE, deps); - if (blocking) - hev().wait_signalled(); - - ret_object(rd_ev, hev); + ret_object(rd_ev, create<hard_event>(q, CL_COMMAND_MAP_IMAGE, deps)); ret_error(r_errcode, CL_SUCCESS); return map; diff --git a/lib/mesa/src/gallium/state_trackers/clover/api/util.hpp b/lib/mesa/src/gallium/state_trackers/clover/api/util.hpp index 66bd12597..31e20e424 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/api/util.hpp +++ b/lib/mesa/src/gallium/state_trackers/clover/api/util.hpp @@ -68,17 +68,6 @@ namespace clover { *p = desc(v()); } } - - /// - /// Return an API object from an intrusive reference to a Clover object, - /// incrementing the reference count of the object. - /// - template<typename T> - typename T::descriptor_type * - ret_object(const intrusive_ref<T> &v) { - v().retain(); - return desc(v()); - } } #endif diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/context.cpp b/lib/mesa/src/gallium/state_trackers/clover/core/context.cpp index c3e208293..bf4df39dc 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/context.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/context.cpp @@ -25,9 +25,8 @@ using namespace clover; context::context(const property_list &props, - const ref_vector<device> &devs, - const notify_action ¬ify) : - notify(notify), props(props), devs(devs) { + const ref_vector<device> &devs) : + props(props), devs(devs) { } bool diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/context.hpp b/lib/mesa/src/gallium/state_trackers/clover/core/context.hpp index 7b22ccae7..0ec4ff4a2 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/context.hpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/context.hpp @@ -36,10 +36,7 @@ namespace clover { typedef clover::property_list<cl_context_properties> property_list; public: - typedef std::function<void (const char *)> notify_action; - - context(const property_list &props, const ref_vector<device> &devs, - const notify_action ¬ify); + context(const property_list &props, const ref_vector<device> &devs); context(const context &ctx) = delete; context & @@ -56,8 +53,6 @@ namespace clover { device_range devices() const; - const notify_action notify; - private: property_list props; const std::vector<intrusive_ref<device>> devs; diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/error.hpp b/lib/mesa/src/gallium/state_trackers/clover/core/error.hpp index 0490c19a2..59a5af4c7 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/error.hpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/error.hpp @@ -65,16 +65,11 @@ namespace clover { cl_int code; }; - class invalid_build_options_error : public error { + class compile_error : public error { public: - invalid_build_options_error(const std::string &what = "") : - error(CL_INVALID_BUILD_OPTIONS, what) {} - }; - - class build_error : public error { - public: - build_error(const std::string &what = "") : - error(CL_BUILD_PROGRAM_FAILURE, what) {} + compile_error(const std::string &what = "") : + error(CL_COMPILE_PROGRAM_FAILURE, what) { + } }; template<typename O> diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/event.cpp b/lib/mesa/src/gallium/state_trackers/clover/core/event.cpp index 3d313ce89..d75b83977 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/event.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/event.cpp @@ -27,7 +27,7 @@ using namespace clover; event::event(clover::context &ctx, const ref_vector<event> &deps, action action_ok, action action_fail) : - context(ctx), _wait_count(1), _status(0), + context(ctx), wait_count(1), _status(0), action_ok(action_ok), action_fail(action_fail) { for (auto &ev : deps) ev.chain(*this); @@ -41,22 +41,23 @@ event::trigger_self() { std::lock_guard<std::mutex> lock(mutex); std::vector<intrusive_ref<event>> evs; - if (_wait_count && !--_wait_count) + if (!--wait_count) std::swap(_chain, evs); - cv.notify_all(); return evs; } void -event::trigger() try { - if (wait_count() == 1) +event::trigger() { + auto evs = trigger_self(); + + if (signalled()) { action_ok(*this); + cv.notify_all(); + } - for (event &ev : trigger_self()) + for (event &ev : evs) ev.trigger(); -} catch (error &e) { - abort(e.get()); } std::vector<intrusive_ref<event>> @@ -65,30 +66,25 @@ event::abort_self(cl_int status) { std::vector<intrusive_ref<event>> evs; _status = status; - _wait_count = 0; std::swap(_chain, evs); - cv.notify_all(); return evs; } void event::abort(cl_int status) { + auto evs = abort_self(status); + action_fail(*this); - for (event &ev : abort_self(status)) + for (event &ev : evs) ev.abort(status); } -unsigned -event::wait_count() const { - std::lock_guard<std::mutex> lock(mutex); - return _wait_count; -} - bool event::signalled() const { - return !wait_count(); + std::lock_guard<std::mutex> lock(mutex); + return !wait_count; } cl_int @@ -103,25 +99,20 @@ event::chain(event &ev) { std::unique_lock<std::mutex> lock_ev(ev.mutex, std::defer_lock); std::lock(lock, lock_ev); - if (_wait_count) { - ev._wait_count++; + if (wait_count) { + ev.wait_count++; _chain.push_back(ev); } ev.deps.push_back(*this); } void -event::wait_signalled() const { - std::unique_lock<std::mutex> lock(mutex); - cv.wait(lock, [=]{ return !_wait_count; }); -} - -void event::wait() const { for (event &ev : deps) ev.wait(); - wait_signalled(); + std::unique_lock<std::mutex> lock(mutex); + cv.wait(lock, [=]{ return !wait_count; }); } hard_event::hard_event(command_queue &q, cl_command_type command, @@ -150,7 +141,7 @@ hard_event::status() const { else if (!_fence) return CL_QUEUED; - else if (!screen->fence_finish(screen, NULL, _fence, 0)) + else if (!screen->fence_finish(screen, _fence, 0)) return CL_SUBMITTED; else @@ -177,7 +168,7 @@ hard_event::wait() const { queue()->flush(); if (!_fence || - !screen->fence_finish(screen, NULL, _fence, PIPE_TIMEOUT_INFINITE)) + !screen->fence_finish(screen, _fence, PIPE_TIMEOUT_INFINITE)) throw error(CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST); } diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/event.hpp b/lib/mesa/src/gallium/state_trackers/clover/core/event.hpp index 03c97bcf4..6469e483c 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/event.hpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/event.hpp @@ -69,7 +69,6 @@ namespace clover { virtual cl_int status() const; virtual command_queue *queue() const = 0; virtual cl_command_type command() const = 0; - void wait_signalled() const; virtual void wait() const; virtual struct pipe_fence_handle *fence() const { @@ -86,9 +85,8 @@ namespace clover { private: std::vector<intrusive_ref<event>> trigger_self(); std::vector<intrusive_ref<event>> abort_self(cl_int status); - unsigned wait_count() const; - unsigned _wait_count; + unsigned wait_count; cl_int _status; action action_ok; action action_fail; diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/format.cpp b/lib/mesa/src/gallium/state_trackers/clover/core/format.cpp index dee1872c8..aee1cc9c7 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/format.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/format.cpp @@ -147,12 +147,14 @@ namespace clover { std::set<cl_image_format> s; pipe_texture_target target = translate_target(type); unsigned bindings = (PIPE_BIND_SAMPLER_VIEW | - PIPE_BIND_COMPUTE_RESOURCE); + PIPE_BIND_COMPUTE_RESOURCE | + PIPE_BIND_TRANSFER_READ | + PIPE_BIND_TRANSFER_WRITE); for (auto f : formats) { if (all_of([=](const device &dev) { return dev.pipe->is_format_supported( - dev.pipe, f.second, target, 1, 1, bindings); + dev.pipe, f.second, target, 1, bindings); }, ctx.devices())) s.insert(f.first); } diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/kernel.hpp b/lib/mesa/src/gallium/state_trackers/clover/core/kernel.hpp index 5d46854d6..4ba6ff467 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/kernel.hpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/kernel.hpp @@ -93,7 +93,6 @@ namespace clover { /// Free any resources that were allocated in bind(). virtual void unbind(exec_context &ctx) = 0; - virtual ~argument() {}; protected: argument(); diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/memory.cpp b/lib/mesa/src/gallium/state_trackers/clover/core/memory.cpp index ed13d92c2..b852e6896 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/memory.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/memory.cpp @@ -22,7 +22,7 @@ #include "core/memory.hpp" #include "core/resource.hpp" -#include "util/format/u_format.h" +#include "util/u_format.h" using namespace clover; diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/object.hpp b/lib/mesa/src/gallium/state_trackers/clover/core/object.hpp index 8fc2175d2..e3a5ab7fa 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/object.hpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/object.hpp @@ -51,7 +51,7 @@ namespace clover { "ICD requires CL API objects to be standard layout."); } - const cl_icd_dispatch *dispatch; + const _cl_icd_dispatch *dispatch; }; struct default_tag; diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/platform.cpp b/lib/mesa/src/gallium/state_trackers/clover/core/platform.cpp index ddd63fc5a..328b71cdc 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/platform.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/platform.cpp @@ -32,15 +32,9 @@ platform::platform() : adaptor_range(evals(), devs) { for (pipe_loader_device *ldev : ldevs) { try { - if (ldev) - devs.push_back(create<device>(*this, ldev)); + devs.push_back(create<device>(*this, ldev)); } catch (error &) { pipe_loader_release(&ldev, 1); } } } - -std::string -platform::supported_extensions() const { - return "cl_khr_icd"; -} diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/platform.hpp b/lib/mesa/src/gallium/state_trackers/clover/core/platform.hpp index b94434c98..e849645bb 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/platform.hpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/platform.hpp @@ -40,8 +40,6 @@ namespace clover { platform & operator=(const platform &platform) = delete; - std::string supported_extensions() const; - protected: std::vector<intrusive_ref<device>> devs; }; diff --git a/lib/mesa/src/gallium/state_trackers/clover/core/queue.cpp b/lib/mesa/src/gallium/state_trackers/clover/core/queue.cpp index c91b97ad1..87f9dcc64 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/core/queue.cpp +++ b/lib/mesa/src/gallium/state_trackers/clover/core/queue.cpp @@ -24,39 +24,15 @@ #include "core/event.hpp" #include "pipe/p_screen.h" #include "pipe/p_context.h" -#include "pipe/p_state.h" using namespace clover; -namespace { - void - debug_notify_callback(void *data, - unsigned *id, - enum pipe_debug_type type, - const char *fmt, - va_list args) { - const command_queue *queue = (const command_queue *)data; - char buffer[1024]; - vsnprintf(buffer, sizeof(buffer), fmt, args); - queue->context().notify(buffer); - } -} - command_queue::command_queue(clover::context &ctx, clover::device &dev, cl_command_queue_properties props) : context(ctx), device(dev), props(props) { - pipe = dev.pipe->context_create(dev.pipe, NULL, PIPE_CONTEXT_COMPUTE_ONLY); + pipe = dev.pipe->context_create(dev.pipe, NULL); if (!pipe) throw error(CL_INVALID_DEVICE); - - if (ctx.notify) { - struct pipe_debug_callback cb; - memset(&cb, 0, sizeof(cb)); - cb.debug_message = &debug_notify_callback; - cb.data = this; - if (pipe->set_debug_callback) - pipe->set_debug_callback(pipe, &cb); - } } command_queue::~command_queue() { diff --git a/lib/mesa/src/gallium/state_trackers/clover/util/functional.hpp b/lib/mesa/src/gallium/state_trackers/clover/util/functional.hpp index fc281c5c7..ed69155c4 100644 --- a/lib/mesa/src/gallium/state_trackers/clover/util/functional.hpp +++ b/lib/mesa/src/gallium/state_trackers/clover/util/functional.hpp @@ -311,27 +311,6 @@ namespace clover { } }; - template<typename T> - class equals_t { - public: - equals_t(T &&x) : x(x) {} - - template<typename S> - bool - operator()(S &&y) const { - return x == y; - } - - private: - T x; - }; - - template<typename T> - equals_t<T> - equals(T &&x) { - return { std::forward<T>(x) }; - } - class name_equals { public: name_equals(const std::string &name) : name(name) { @@ -347,21 +326,6 @@ namespace clover { const std::string &name; }; - class id_equals { - public: - id_equals(const uint32_t id) : id(id) { - } - - template<typename T> - bool - operator()(const T &x) const { - return x.id == id; - } - - private: - const uint32_t id; - }; - template<typename T> class key_equals_t { public: diff --git a/lib/mesa/src/gallium/state_trackers/dri/dri_context.h b/lib/mesa/src/gallium/state_trackers/dri/dri_context.h index 96e21e069..96f06442f 100644 --- a/lib/mesa/src/gallium/state_trackers/dri/dri_context.h +++ b/lib/mesa/src/gallium/state_trackers/dri/dri_context.h @@ -84,11 +84,14 @@ dri_get_current(__DRIscreen * driScreenPriv); boolean dri_create_context(gl_api api, - const struct gl_config * visual, - __DRIcontext * driContextPriv, - const struct __DriverContextConfig *ctx_config, - unsigned *error, - void *sharedContextPrivate); + const struct gl_config * visual, + __DRIcontext * driContextPriv, + unsigned major_version, + unsigned minor_version, + uint32_t flags, + bool notify_reset, + unsigned *error, + void *sharedContextPrivate); #endif diff --git a/lib/mesa/src/gallium/state_trackers/dri/dri_drawable.h b/lib/mesa/src/gallium/state_trackers/dri/dri_drawable.h index d57ff1d84..1f9842ea5 100644 --- a/lib/mesa/src/gallium/state_trackers/dri/dri_drawable.h +++ b/lib/mesa/src/gallium/state_trackers/dri/dri_drawable.h @@ -36,6 +36,10 @@ struct pipe_surface; struct st_framebuffer; struct dri_context; +#define DRI_SWAP_FENCES_MAX 4 +#define DRI_SWAP_FENCES_MASK 3 +#define DRI_SWAP_FENCES_DEFAULT 1 + struct dri_drawable { struct st_framebuffer_iface base; @@ -52,15 +56,16 @@ struct dri_drawable unsigned old_w; unsigned old_h; - struct pipe_box *damage_rects; - unsigned int num_damage_rects; - struct pipe_resource *textures[ST_ATTACHMENT_COUNT]; struct pipe_resource *msaa_textures[ST_ATTACHMENT_COUNT]; unsigned int texture_mask, texture_stamp; - struct pipe_fence_handle *throttle_fence; - bool flushing; /* prevents recursion in dri_flush */ + struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX]; + unsigned int cur_fences; + unsigned int head; + unsigned int tail; + unsigned int desired_fences; + boolean flushing; /* prevents recursion in dri_flush */ /* used only by DRISW */ struct pipe_surface *drisw_surface; @@ -80,8 +85,6 @@ struct dri_drawable void (*update_tex_buffer)(struct dri_drawable *drawable, struct dri_context *ctx, struct pipe_resource *res); - void (*flush_swapbuffers)(struct dri_context *ctx, - struct dri_drawable *drawable); }; static inline struct dri_drawable * @@ -94,10 +97,10 @@ dri_drawable(__DRIdrawable * driDrawPriv) /*********************************************************************** * dri_drawable.c */ -bool +boolean dri_create_buffer(__DRIscreen * sPriv, __DRIdrawable * dPriv, - const struct gl_config * visual, bool isPixmap); + const struct gl_config * visual, boolean isPixmap); void dri_destroy_buffer(__DRIdrawable * dPriv); diff --git a/lib/mesa/src/gallium/state_trackers/dri/dri_query_renderer.c b/lib/mesa/src/gallium/state_trackers/dri/dri_query_renderer.c index 2417f40a6..ea31b6c1e 100644 --- a/lib/mesa/src/gallium/state_trackers/dri/dri_query_renderer.c +++ b/lib/mesa/src/gallium/state_trackers/dri/dri_query_renderer.c @@ -52,16 +52,10 @@ dri2_query_renderer_integer(__DRIscreen *_screen, int param, value[0] = screen->base.screen->is_format_supported(screen->base.screen, PIPE_FORMAT_B8G8R8A8_SRGB, - PIPE_TEXTURE_2D, 0, 0, + PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET); return 0; - case __DRI2_RENDERER_HAS_CONTEXT_PRIORITY: - value[0] = - screen->base.screen->get_param(screen->base.screen, - PIPE_CAP_CONTEXT_PRIORITY_MASK); - if (!value[0]) - return -1; - return 0; + default: return driQueryRendererIntegerCommon(_screen, param, value); } diff --git a/lib/mesa/src/gallium/state_trackers/glx/xlib/glx_getproc.c b/lib/mesa/src/gallium/state_trackers/glx/xlib/glx_getproc.c index 6b94f2c19..e7564ad9c 100644 --- a/lib/mesa/src/gallium/state_trackers/glx/xlib/glx_getproc.c +++ b/lib/mesa/src/gallium/state_trackers/glx/xlib/glx_getproc.c @@ -43,7 +43,7 @@ struct name_address_pair { }; -static const struct name_address_pair GLX_functions[] = { +static struct name_address_pair GLX_functions[] = { /*** GLX_VERSION_1_0 ***/ { "glXChooseVisual", (__GLXextFuncPtr) glXChooseVisual }, { "glXCopyContext", (__GLXextFuncPtr) glXCopyContext }, @@ -147,6 +147,13 @@ static const struct name_address_pair GLX_functions[] = { { "glXAssociateDMPbufferSGIX", (__GLXextFuncPtr) glXAssociateDMPbufferSGIX }, #endif + /*** GLX_SGIX_swap_group ***/ + { "glXJoinSwapGroupSGIX", (__GLXextFuncPtr) glXJoinSwapGroupSGIX }, + + /*** GLX_SGIX_swap_barrier ***/ + { "glXBindSwapBarrierSGIX", (__GLXextFuncPtr) glXBindSwapBarrierSGIX }, + { "glXQueryMaxSwapBarriersSGIX", (__GLXextFuncPtr) glXQueryMaxSwapBarriersSGIX }, + /*** GLX_SUN_get_transparent_index ***/ { "glXGetTransparentIndexSUN", (__GLXextFuncPtr) glXGetTransparentIndexSUN }, diff --git a/lib/mesa/src/gallium/state_trackers/glx/xlib/glx_usefont.c b/lib/mesa/src/gallium/state_trackers/glx/xlib/glx_usefont.c index 9d35054b4..b3e9c79ce 100644 --- a/lib/mesa/src/gallium/state_trackers/glx/xlib/glx_usefont.c +++ b/lib/mesa/src/gallium/state_trackers/glx/xlib/glx_usefont.c @@ -29,11 +29,10 @@ * Fake implementation of glXUseXFont(). */ -#include <stdlib.h> -#include <string.h> + #include <stdio.h> +#include "main/core.h" #include <GL/glx.h> -#include "main/errors.h" /* Some debugging info. */ diff --git a/lib/mesa/src/gallium/state_trackers/glx/xlib/xm_st.h b/lib/mesa/src/gallium/state_trackers/glx/xlib/xm_st.h index 0a15afcd7..e95d7e0d5 100644 --- a/lib/mesa/src/gallium/state_trackers/glx/xlib/xm_st.h +++ b/lib/mesa/src/gallium/state_trackers/glx/xlib/xm_st.h @@ -59,7 +59,7 @@ xmesa_get_attachment(struct st_framebuffer_iface *stfbi, struct pipe_context* xmesa_get_context(struct st_framebuffer_iface* stfbi); -bool +boolean xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi, unsigned width, unsigned height, unsigned mask); diff --git a/lib/mesa/src/gallium/state_trackers/nine/authenticatedchannel9.c b/lib/mesa/src/gallium/state_trackers/nine/authenticatedchannel9.c index 45fca3a29..44ad87c95 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/authenticatedchannel9.c +++ b/lib/mesa/src/gallium/state_trackers/nine/authenticatedchannel9.c @@ -24,14 +24,14 @@ #define DBG_CHANNEL DBG_AUTHENTICATEDCHANNEL -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_GetCertificateSize( struct NineAuthenticatedChannel9 *This, UINT *pCertificateSize ) { STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_GetCertificate( struct NineAuthenticatedChannel9 *This, UINT CertifacteSize, BYTE *ppCertificate ) @@ -39,7 +39,7 @@ NineAuthenticatedChannel9_GetCertificate( struct NineAuthenticatedChannel9 *This STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_NegotiateKeyExchange( struct NineAuthenticatedChannel9 *This, UINT DataSize, void *pData ) @@ -47,7 +47,7 @@ NineAuthenticatedChannel9_NegotiateKeyExchange( struct NineAuthenticatedChannel9 STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_Query( struct NineAuthenticatedChannel9 *This, UINT InputSize, const void *pInput, @@ -57,7 +57,7 @@ NineAuthenticatedChannel9_Query( struct NineAuthenticatedChannel9 *This, STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_Configure( struct NineAuthenticatedChannel9 *This, UINT InputSize, const void *pInput, diff --git a/lib/mesa/src/gallium/state_trackers/nine/authenticatedchannel9.h b/lib/mesa/src/gallium/state_trackers/nine/authenticatedchannel9.h index b18848235..63cb2269d 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/authenticatedchannel9.h +++ b/lib/mesa/src/gallium/state_trackers/nine/authenticatedchannel9.h @@ -35,28 +35,28 @@ NineAuthenticatedChannel9( void *data ) return (struct NineAuthenticatedChannel9 *)data; } -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_GetCertificateSize( struct NineAuthenticatedChannel9 *This, UINT *pCertificateSize ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_GetCertificate( struct NineAuthenticatedChannel9 *This, UINT CertifacteSize, BYTE *ppCertificate ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_NegotiateKeyExchange( struct NineAuthenticatedChannel9 *This, UINT DataSize, void *pData ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_Query( struct NineAuthenticatedChannel9 *This, UINT InputSize, const void *pInput, UINT OutputSize, void *pOutput ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineAuthenticatedChannel9_Configure( struct NineAuthenticatedChannel9 *This, UINT InputSize, const void *pInput, diff --git a/lib/mesa/src/gallium/state_trackers/nine/cryptosession9.c b/lib/mesa/src/gallium/state_trackers/nine/cryptosession9.c index c656f72a2..2622f2b32 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/cryptosession9.c +++ b/lib/mesa/src/gallium/state_trackers/nine/cryptosession9.c @@ -24,14 +24,14 @@ #define DBG_CHANNEL DBG_CRYPTOSESSION -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_GetCertificateSize( struct NineCryptoSession9 *This, UINT *pCertificateSize ) { STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_GetCertificate( struct NineCryptoSession9 *This, UINT CertifacteSize, BYTE *ppCertificate ) @@ -39,7 +39,7 @@ NineCryptoSession9_GetCertificate( struct NineCryptoSession9 *This, STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_NegotiateKeyExchange( struct NineCryptoSession9 *This, UINT DataSize, void *pData ) @@ -47,7 +47,7 @@ NineCryptoSession9_NegotiateKeyExchange( struct NineCryptoSession9 *This, STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_EncryptionBlt( struct NineCryptoSession9 *This, IDirect3DSurface9 *pSrcSurface, IDirect3DSurface9 *pDstSurface, @@ -57,7 +57,7 @@ NineCryptoSession9_EncryptionBlt( struct NineCryptoSession9 *This, STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This, IDirect3DSurface9 *pSrcSurface, IDirect3DSurface9 *pDstSurface, @@ -69,7 +69,7 @@ NineCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This, STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_GetSurfacePitch( struct NineCryptoSession9 *This, IDirect3DSurface9 *pSrcSurface, UINT *pSurfacePitch ) @@ -77,7 +77,7 @@ NineCryptoSession9_GetSurfacePitch( struct NineCryptoSession9 *This, STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_StartSessionKeyRefresh( struct NineCryptoSession9 *This, void *pRandomNumber, UINT RandomNumberSize ) @@ -85,13 +85,13 @@ NineCryptoSession9_StartSessionKeyRefresh( struct NineCryptoSession9 *This, STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_FinishSessionKeyRefresh( struct NineCryptoSession9 *This ) { STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_GetEncryptionBltKey( struct NineCryptoSession9 *This, void *pReadbackKey, UINT KeySize ) diff --git a/lib/mesa/src/gallium/state_trackers/nine/cryptosession9.h b/lib/mesa/src/gallium/state_trackers/nine/cryptosession9.h index 9904455a0..d1eab72eb 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/cryptosession9.h +++ b/lib/mesa/src/gallium/state_trackers/nine/cryptosession9.h @@ -35,28 +35,28 @@ NineCryptoSession9( void *data ) return (struct NineCryptoSession9 *)data; } -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_GetCertificateSize( struct NineCryptoSession9 *This, UINT *pCertificateSize ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_GetCertificate( struct NineCryptoSession9 *This, UINT CertifacteSize, BYTE *ppCertificate ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_NegotiateKeyExchange( struct NineCryptoSession9 *This, UINT DataSize, void *pData ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_EncryptionBlt( struct NineCryptoSession9 *This, IDirect3DSurface9 *pSrcSurface, IDirect3DSurface9 *pDstSurface, UINT DstSurfaceSize, void *pIV ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This, IDirect3DSurface9 *pSrcSurface, IDirect3DSurface9 *pDstSurface, @@ -65,20 +65,20 @@ NineCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This, void *pContentKey, void *pIV ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_GetSurfacePitch( struct NineCryptoSession9 *This, IDirect3DSurface9 *pSrcSurface, UINT *pSurfacePitch ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_StartSessionKeyRefresh( struct NineCryptoSession9 *This, void *pRandomNumber, UINT RandomNumberSize ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_FinishSessionKeyRefresh( struct NineCryptoSession9 *This ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCryptoSession9_GetEncryptionBltKey( struct NineCryptoSession9 *This, void *pReadbackKey, UINT KeySize ); diff --git a/lib/mesa/src/gallium/state_trackers/nine/cubetexture9.h b/lib/mesa/src/gallium/state_trackers/nine/cubetexture9.h index 129789d0d..999715c0a 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/cubetexture9.h +++ b/lib/mesa/src/gallium/state_trackers/nine/cubetexture9.h @@ -48,18 +48,18 @@ NineCubeTexture9_new( struct NineDevice9 *pDevice, struct NineCubeTexture9 **ppOut, HANDLE *pSharedHandle ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCubeTexture9_GetLevelDesc( struct NineCubeTexture9 *This, UINT Level, D3DSURFACE_DESC *pDesc ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCubeTexture9_GetCubeMapSurface( struct NineCubeTexture9 *This, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9 **ppCubeMapSurface ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCubeTexture9_LockRect( struct NineCubeTexture9 *This, D3DCUBEMAP_FACES FaceType, UINT Level, @@ -67,12 +67,12 @@ NineCubeTexture9_LockRect( struct NineCubeTexture9 *This, const RECT *pRect, DWORD Flags ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCubeTexture9_UnlockRect( struct NineCubeTexture9 *This, D3DCUBEMAP_FACES FaceType, UINT Level ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This, D3DCUBEMAP_FACES FaceType, const RECT *pDirtyRect ); diff --git a/lib/mesa/src/gallium/state_trackers/nine/device9ex.h b/lib/mesa/src/gallium/state_trackers/nine/device9ex.h index 3306f238b..8375622d8 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/device9ex.h +++ b/lib/mesa/src/gallium/state_trackers/nine/device9ex.h @@ -44,17 +44,16 @@ NineDevice9Ex_new( struct pipe_screen *pScreen, IDirect3D9Ex *pD3D9Ex, ID3DPresentGroup *pPresentationGroup, struct d3dadapter9_context *pCTX, - struct NineDevice9Ex **ppOut, - int minorVersionNum ); + struct NineDevice9Ex **ppOut ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_SetConvolutionMonoKernel( struct NineDevice9Ex *This, UINT width, UINT height, float *rows, float *columns ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_ComposeRects( struct NineDevice9Ex *This, IDirect3DSurface9 *pSrc, IDirect3DSurface9 *pDst, @@ -65,7 +64,7 @@ NineDevice9Ex_ComposeRects( struct NineDevice9Ex *This, int Xoffset, int Yoffset ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_PresentEx( struct NineDevice9Ex *This, const RECT *pSourceRect, const RECT *pDestRect, @@ -73,43 +72,36 @@ NineDevice9Ex_PresentEx( struct NineDevice9Ex *This, const RGNDATA *pDirtyRegion, DWORD dwFlags ); -HRESULT NINE_WINAPI -NineDevice9Ex_Present( struct NineDevice9Ex *This, - const RECT *pSourceRect, - const RECT *pDestRect, - HWND hDestWindowOverride, - const RGNDATA *pDirtyRegion ); - -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_GetGPUThreadPriority( struct NineDevice9Ex *This, INT *pPriority ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_SetGPUThreadPriority( struct NineDevice9Ex *This, INT Priority ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_WaitForVBlank( struct NineDevice9Ex *This, UINT iSwapChain ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_CheckResourceResidency( struct NineDevice9Ex *This, IDirect3DResource9 **pResourceArray, UINT32 NumResources ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_SetMaximumFrameLatency( struct NineDevice9Ex *This, UINT MaxLatency ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_GetMaximumFrameLatency( struct NineDevice9Ex *This, UINT *pMaxLatency ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_CheckDeviceState( struct NineDevice9Ex *This, HWND hDestinationWindow ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This, UINT Width, UINT Height, @@ -121,7 +113,7 @@ NineDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This, HANDLE *pSharedHandle, DWORD Usage ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This, UINT Width, UINT Height, @@ -131,7 +123,7 @@ NineDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This, HANDLE *pSharedHandle, DWORD Usage ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This, UINT Width, UINT Height, @@ -143,22 +135,15 @@ NineDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This, HANDLE *pSharedHandle, DWORD Usage ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_ResetEx( struct NineDevice9Ex *This, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode ); -HRESULT NINE_WINAPI -NineDevice9Ex_Reset( struct NineDevice9Ex *This, - D3DPRESENT_PARAMETERS *pPresentationParameters ); - -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Ex_GetDisplayModeEx( struct NineDevice9Ex *This, UINT iSwapChain, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation ); -HRESULT NINE_WINAPI -NineDevice9Ex_TestCooperativeLevel( struct NineDevice9Ex *This ); - #endif /* _NINE_DEVICE9EX_H_ */ diff --git a/lib/mesa/src/gallium/state_trackers/nine/device9video.c b/lib/mesa/src/gallium/state_trackers/nine/device9video.c index 2e8e94a26..65cc6a05c 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/device9video.c +++ b/lib/mesa/src/gallium/state_trackers/nine/device9video.c @@ -24,7 +24,7 @@ #define DBG_CHANNEL DBG_DEVICEVIDEO -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Video_GetContentProtectionCaps( struct NineDevice9Video *This, const GUID *pCryptoType, const GUID *pDecodeProfile, @@ -33,7 +33,7 @@ NineDevice9Video_GetContentProtectionCaps( struct NineDevice9Video *This, STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Video_CreateAuthenticatedChannel( struct NineDevice9Video *This, D3DAUTHENTICATEDCHANNELTYPE ChannelType, IDirect3DAuthenticatedChannel9 **ppAuthenticatedChannel, @@ -42,7 +42,7 @@ NineDevice9Video_CreateAuthenticatedChannel( struct NineDevice9Video *This, STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Video_CreateCryptoSession( struct NineDevice9Video *This, const GUID *pCryptoType, const GUID *pDecodeProfile, diff --git a/lib/mesa/src/gallium/state_trackers/nine/device9video.h b/lib/mesa/src/gallium/state_trackers/nine/device9video.h index d77fd5ec5..fc2faeb62 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/device9video.h +++ b/lib/mesa/src/gallium/state_trackers/nine/device9video.h @@ -35,19 +35,19 @@ NineDevice9Video( void *data ) return (struct NineDevice9Video *)data; } -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Video_GetContentProtectionCaps( struct NineDevice9Video *This, const GUID *pCryptoType, const GUID *pDecodeProfile, D3DCONTENTPROTECTIONCAPS *pCaps ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Video_CreateAuthenticatedChannel( struct NineDevice9Video *This, D3DAUTHENTICATEDCHANNELTYPE ChannelType, IDirect3DAuthenticatedChannel9 **ppAuthenticatedChannel, HANDLE *pChannelHandle ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineDevice9Video_CreateCryptoSession( struct NineDevice9Video *This, const GUID *pCryptoType, const GUID *pDecodeProfile, diff --git a/lib/mesa/src/gallium/state_trackers/nine/guid.c b/lib/mesa/src/gallium/state_trackers/nine/guid.c index 5e63d2f66..5034feb4d 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/guid.c +++ b/lib/mesa/src/gallium/state_trackers/nine/guid.c @@ -20,7 +20,6 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include <stdio.h> #include "guid.h" const GUID IID_IUnknown = { 0x00000000, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; @@ -65,20 +64,3 @@ GUID_equal( const GUID *a, } return TRUE; } - -char* GUID_sprintf(char *guid_str, REFGUID id) { - sprintf( guid_str, - "{%08X,%04X,%04X,%02X%02X%02X%02X%02X%02X%02X%02X}", - id->Data1, - id->Data2, - id->Data3, - id->Data4[0], - id->Data4[1], - id->Data4[2], - id->Data4[3], - id->Data4[4], - id->Data4[5], - id->Data4[6], - id->Data4[7]); - return guid_str; -} diff --git a/lib/mesa/src/gallium/state_trackers/nine/guid.h b/lib/mesa/src/gallium/state_trackers/nine/guid.h index af8f081bf..1f9ff009a 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/guid.h +++ b/lib/mesa/src/gallium/state_trackers/nine/guid.h @@ -33,8 +33,4 @@ boolean GUID_equal( const GUID *a, const GUID *b ); -char* -GUID_sprintf( char *guid_str, - REFGUID id ); - #endif /* _NINE_GUID_H_ */ diff --git a/lib/mesa/src/gallium/state_trackers/nine/nine_defines.h b/lib/mesa/src/gallium/state_trackers/nine/nine_defines.h index 26aa064b1..4f61982a7 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/nine_defines.h +++ b/lib/mesa/src/gallium/state_trackers/nine/nine_defines.h @@ -54,12 +54,4 @@ uint16_t nine_d3d9_to_nine_declusage(unsigned usage, unsigned index); #define NINED3DCLEAR_DEPTHSTENCIL (D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL) -#define NINE_BIND_BACKBUFFER_FLAGS (PIPE_BIND_RENDER_TARGET |\ - PIPE_BIND_SAMPLER_VIEW) - -#define NINE_BIND_PRESENTBUFFER_FLAGS (PIPE_BIND_RENDER_TARGET |\ - PIPE_BIND_DISPLAY_TARGET |\ - PIPE_BIND_SCANOUT |\ - PIPE_BIND_SHARED) - #endif /* _NINE_DEFINES_H_ */ diff --git a/lib/mesa/src/gallium/state_trackers/nine/nine_dump.c b/lib/mesa/src/gallium/state_trackers/nine/nine_dump.c index 85ee266de..1ca550586 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/nine_dump.c +++ b/lib/mesa/src/gallium/state_trackers/nine/nine_dump.c @@ -8,7 +8,7 @@ #include "nine_dump.h" -#if defined(DEBUG) || !defined(NDEBUG) +#ifdef DEBUG static char __thread tls[128]; @@ -810,4 +810,4 @@ nine_dump_D3DCAPS9(unsigned ch, const D3DCAPS9 *caps) FREE(s); } -#endif /* DEBUG || !NDEBUG */ +#endif /* DEBUG */ diff --git a/lib/mesa/src/gallium/state_trackers/nine/nine_dump.h b/lib/mesa/src/gallium/state_trackers/nine/nine_dump.h index 72342557d..a0ffe7bf6 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/nine_dump.h +++ b/lib/mesa/src/gallium/state_trackers/nine/nine_dump.h @@ -16,7 +16,7 @@ const char *nine_D3DPRESENTFLAG_to_str(DWORD); const char *nine_D3DLOCK_to_str(DWORD); const char *nine_D3DSAMP_to_str(DWORD); -#if defined(DEBUG) || !defined(NDEBUG) +#ifdef DEBUG void nine_dump_D3DADAPTER_IDENTIFIER9(unsigned, const D3DADAPTER_IDENTIFIER9 *); @@ -29,7 +29,7 @@ nine_dump_D3DMATERIAL9(unsigned, const D3DMATERIAL9 *); void nine_dump_D3DTSS_value(unsigned, D3DTEXTURESTAGESTATETYPE, DWORD); -#else /* !DEBUG && NDEBUG */ +#else /* !DEBUG */ static inline void nine_dump_D3DADAPTER_IDENTIFIER9(unsigned ch, const D3DADAPTER_IDENTIFIER9 *id) @@ -47,6 +47,6 @@ static inline void nine_dump_D3DTSS_value(unsigned ch, D3DTEXTURESTAGESTATETYPE tss, DWORD value) { } -#endif /* DEBUG || !NDEBUG */ +#endif /* DEBUG */ #endif /* _NINE_DUMP_H_H_ */ diff --git a/lib/mesa/src/gallium/state_trackers/nine/nine_helpers.h b/lib/mesa/src/gallium/state_trackers/nine/nine_helpers.h index c14dd1c04..b382c5b72 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/nine_helpers.h +++ b/lib/mesa/src/gallium/state_trackers/nine/nine_helpers.h @@ -86,33 +86,6 @@ static inline void _nine_bind(void **dst, void *obj) __params.dtor = (void *)Nine##nine##_dtor; \ __params.container = NULL; \ __params.device = dev; \ - __params.start_with_bind_not_ref = false; \ - { \ - HRESULT __hr = Nine##nine##_ctor(__data, &__params, ## __VA_ARGS__); \ - if (FAILED(__hr)) { \ - Nine##nine##_dtor(__data); \ - return __hr; \ - } \ - } \ - \ - *(out) = __data; \ - } \ - return D3D_OK - -#define NINE_DEVICE_CHILD_BIND_NEW(nine, out, dev, ...) \ - { \ - struct NineUnknownParams __params; \ - struct Nine##nine *__data; \ - \ - __data = CALLOC_STRUCT(Nine##nine); \ - if (!__data) { return E_OUTOFMEMORY; } \ - \ - __params.vtable = ((dev)->params.BehaviorFlags & D3DCREATE_MULTITHREADED) ? &Lock##nine##_vtable : &Nine##nine##_vtable; \ - __params.guids = Nine##nine##_IIDs; \ - __params.dtor = (void *)Nine##nine##_dtor; \ - __params.container = NULL; \ - __params.device = dev; \ - __params.start_with_bind_not_ref = true; \ { \ HRESULT __hr = Nine##nine##_ctor(__data, &__params, ## __VA_ARGS__); \ if (FAILED(__hr)) { \ @@ -138,7 +111,6 @@ static inline void _nine_bind(void **dst, void *obj) __params.dtor = (void *)Nine##nine##_dtor; \ __params.container = NULL; \ __params.device = NULL; \ - __params.start_with_bind_not_ref = false; \ { \ HRESULT __hr = Nine##nine##_ctor(__data, &__params, ## __VA_ARGS__); \ if (FAILED(__hr)) { \ diff --git a/lib/mesa/src/gallium/state_trackers/nine/nine_pdata.h b/lib/mesa/src/gallium/state_trackers/nine/nine_pdata.h index 92e50c8a7..7bdd702cf 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/nine_pdata.h +++ b/lib/mesa/src/gallium/state_trackers/nine/nine_pdata.h @@ -5,8 +5,8 @@ struct pheader { boolean unknown; - GUID guid; DWORD size; + char data[1]; }; static int @@ -35,9 +35,8 @@ ht_guid_delete( void *key, void *data ) { struct pheader *header = value; - void *header_data = (void *)header + sizeof(*header); - if (header->unknown) { IUnknown_Release(*(IUnknown **)header_data); } + if (header->unknown) { IUnknown_Release(*(IUnknown **)header->data); } FREE(header); return PIPE_OK; diff --git a/lib/mesa/src/gallium/state_trackers/nine/nineexoverlayextension.c b/lib/mesa/src/gallium/state_trackers/nine/nineexoverlayextension.c index 6a4f287e9..2253f8d97 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/nineexoverlayextension.c +++ b/lib/mesa/src/gallium/state_trackers/nine/nineexoverlayextension.c @@ -24,7 +24,7 @@ #define DBG_CHANNEL DBG_OVERLAYEXTENSION -HRESULT NINE_WINAPI +HRESULT WINAPI Nine9ExOverlayExtension_CheckDeviceOverlayType( struct Nine9ExOverlayExtension *This, UINT Adapter, D3DDEVTYPE DevType, diff --git a/lib/mesa/src/gallium/state_trackers/nine/nineexoverlayextension.h b/lib/mesa/src/gallium/state_trackers/nine/nineexoverlayextension.h index f528f1d3c..1616ed053 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/nineexoverlayextension.h +++ b/lib/mesa/src/gallium/state_trackers/nine/nineexoverlayextension.h @@ -35,7 +35,7 @@ Nine9ExOverlayExtension( void *data ) return (struct Nine9ExOverlayExtension *)data; } -HRESULT NINE_WINAPI +HRESULT WINAPI Nine9ExOverlayExtension_CheckDeviceOverlayType( struct Nine9ExOverlayExtension *This, UINT Adapter, D3DDEVTYPE DevType, diff --git a/lib/mesa/src/gallium/state_trackers/nine/resource9.h b/lib/mesa/src/gallium/state_trackers/nine/resource9.h index f6310f158..906f90806 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/resource9.h +++ b/lib/mesa/src/gallium/state_trackers/nine/resource9.h @@ -43,7 +43,8 @@ struct NineResource9 struct pipe_resource info; /* resource configuration */ - long long size; + /* for [GS]etPrivateData/FreePrivateData */ + struct util_hash_table *pdata; }; static inline struct NineResource9 * NineResource9( void *data ) @@ -73,17 +74,34 @@ NineResource9_GetPool( struct NineResource9 *This ); /*** Direct3D public methods ***/ -DWORD NINE_WINAPI +HRESULT WINAPI +NineResource9_SetPrivateData( struct NineResource9 *This, + REFGUID refguid, + const void *pData, + DWORD SizeOfData, + DWORD Flags ); + +HRESULT WINAPI +NineResource9_GetPrivateData( struct NineResource9 *This, + REFGUID refguid, + void *pData, + DWORD *pSizeOfData ); + +HRESULT WINAPI +NineResource9_FreePrivateData( struct NineResource9 *This, + REFGUID refguid ); + +DWORD WINAPI NineResource9_SetPriority( struct NineResource9 *This, DWORD PriorityNew ); -DWORD NINE_WINAPI +DWORD WINAPI NineResource9_GetPriority( struct NineResource9 *This ); -void NINE_WINAPI +void WINAPI NineResource9_PreLoad( struct NineResource9 *This ); -D3DRESOURCETYPE NINE_WINAPI +D3DRESOURCETYPE WINAPI NineResource9_GetType( struct NineResource9 *This ); #endif /* _NINE_RESOURCE9_H_ */ diff --git a/lib/mesa/src/gallium/state_trackers/nine/stateblock9.h b/lib/mesa/src/gallium/state_trackers/nine/stateblock9.h index ffcc2d99a..a580c6a23 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/stateblock9.h +++ b/lib/mesa/src/gallium/state_trackers/nine/stateblock9.h @@ -62,10 +62,10 @@ NineStateBlock9_ctor( struct NineStateBlock9 *, void NineStateBlock9_dtor( struct NineStateBlock9 * ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineStateBlock9_Capture( struct NineStateBlock9 *This ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineStateBlock9_Apply( struct NineStateBlock9 *This ); #endif /* _NINE_STATEBLOCK9_H_ */ diff --git a/lib/mesa/src/gallium/state_trackers/nine/swapchain9ex.c b/lib/mesa/src/gallium/state_trackers/nine/swapchain9ex.c index 309402cbb..bcf627f4c 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/swapchain9ex.c +++ b/lib/mesa/src/gallium/state_trackers/nine/swapchain9ex.c @@ -51,21 +51,21 @@ NineSwapChain9Ex_dtor( struct NineSwapChain9Ex *This ) NineSwapChain9_dtor(&This->base); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex *This, UINT *pLastPresentCount ) { STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex *This, D3DPRESENTSTATS *pPresentationStatistics ) { STUB(D3DERR_INVALIDCALL); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineSwapChain9Ex_GetDisplayModeEx( struct NineSwapChain9Ex *This, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation ) diff --git a/lib/mesa/src/gallium/state_trackers/nine/swapchain9ex.h b/lib/mesa/src/gallium/state_trackers/nine/swapchain9ex.h index a15d9d2c0..075f88352 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/swapchain9ex.h +++ b/lib/mesa/src/gallium/state_trackers/nine/swapchain9ex.h @@ -45,15 +45,15 @@ NineSwapChain9Ex_new( struct NineDevice9 *pDevice, D3DDISPLAYMODEEX *mode, struct NineSwapChain9Ex **ppOut ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex *This, UINT *pLastPresentCount ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex *This, D3DPRESENTSTATS *pPresentationStatistics ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineSwapChain9Ex_GetDisplayModeEx( struct NineSwapChain9Ex *This, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation ); diff --git a/lib/mesa/src/gallium/state_trackers/nine/texture9.h b/lib/mesa/src/gallium/state_trackers/nine/texture9.h index 3911f26d4..6f80be9cc 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/texture9.h +++ b/lib/mesa/src/gallium/state_trackers/nine/texture9.h @@ -48,28 +48,28 @@ NineTexture9_new( struct NineDevice9 *pDevice, struct NineTexture9 **ppOut, HANDLE *pSharedHandle ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineTexture9_GetLevelDesc( struct NineTexture9 *This, UINT Level, D3DSURFACE_DESC *pDesc ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineTexture9_GetSurfaceLevel( struct NineTexture9 *This, UINT Level, IDirect3DSurface9 **ppSurfaceLevel ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineTexture9_LockRect( struct NineTexture9 *This, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineTexture9_UnlockRect( struct NineTexture9 *This, UINT Level ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineTexture9_AddDirtyRect( struct NineTexture9 *This, const RECT *pDirtyRect ); diff --git a/lib/mesa/src/gallium/state_trackers/nine/threadpool.c b/lib/mesa/src/gallium/state_trackers/nine/threadpool.c index 3ce6cd575..2a9653743 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/threadpool.c +++ b/lib/mesa/src/gallium/state_trackers/nine/threadpool.c @@ -37,7 +37,6 @@ #include "os/os_thread.h" #include "threadpool.h" -/* POSIX thread function */ static void * threadpool_worker(void *data) { @@ -52,8 +51,10 @@ threadpool_worker(void *data) while (!pool->workqueue && !pool->shutdown) pthread_cond_wait(&pool->new_work, &pool->m); - if (pool->shutdown) - break; + if (pool->shutdown) { + pthread_mutex_unlock(&pool->m); + return NULL; + } /* Pull the first task from the list. We don't free it -- it now lacks * a reference other than the worker creator's, whose responsibility it @@ -75,17 +76,8 @@ threadpool_worker(void *data) return NULL; } -/* Windows thread function */ -static DWORD NINE_WINAPI -wthreadpool_worker(void *data) -{ - threadpool_worker(data); - - return 0; -} - struct threadpool * -_mesa_threadpool_create(struct NineSwapChain9 *swapchain) +_mesa_threadpool_create(void) { struct threadpool *pool = calloc(1, sizeof(*pool)); @@ -95,18 +87,13 @@ _mesa_threadpool_create(struct NineSwapChain9 *swapchain) pthread_mutex_init(&pool->m, NULL); pthread_cond_init(&pool->new_work, NULL); - /* This uses WINE's CreateThread, so the thread function needs to use - * the Windows ABI */ - pool->wthread = NineSwapChain9_CreateThread(swapchain, wthreadpool_worker, pool); - if (!pool->wthread) { - /* using pthread as fallback */ - pthread_create(&pool->pthread, NULL, threadpool_worker, pool); - } + pthread_create(&pool->thread, NULL, threadpool_worker, pool); + return pool; } void -_mesa_threadpool_destroy(struct NineSwapChain9 *swapchain, struct threadpool *pool) +_mesa_threadpool_destroy(struct threadpool *pool) { if (!pool) return; @@ -116,11 +103,7 @@ _mesa_threadpool_destroy(struct NineSwapChain9 *swapchain, struct threadpool *po pthread_cond_broadcast(&pool->new_work); pthread_mutex_unlock(&pool->m); - if (pool->wthread) { - NineSwapChain9_WaitForThread(swapchain, pool->wthread); - } else { - pthread_join(pool->pthread, NULL); - } + pthread_join(pool->thread, NULL); pthread_cond_destroy(&pool->new_work); pthread_mutex_destroy(&pool->m); diff --git a/lib/mesa/src/gallium/state_trackers/nine/threadpool.h b/lib/mesa/src/gallium/state_trackers/nine/threadpool.h index 6f8f8c455..00ad25e1b 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/threadpool.h +++ b/lib/mesa/src/gallium/state_trackers/nine/threadpool.h @@ -24,18 +24,13 @@ #ifndef _THREADPOOL_H_ #define _THREADPOOL_H_ -#include <pthread.h> - -struct NineSwapChain9; - #define MAXTHREADS 1 struct threadpool { pthread_mutex_t m; pthread_cond_t new_work; - HANDLE wthread; - pthread_t pthread; + pthread_t thread; struct threadpool_task *workqueue; BOOL shutdown; }; @@ -50,11 +45,11 @@ struct threadpool_task { BOOL finished; }; -struct threadpool *_mesa_threadpool_create(struct NineSwapChain9 *swapchain); -void _mesa_threadpool_destroy(struct NineSwapChain9 *swapchain, struct threadpool *pool); +struct threadpool *_mesa_threadpool_create(void); +void _mesa_threadpool_destroy(struct threadpool *pool); struct threadpool_task *_mesa_threadpool_queue_task(struct threadpool *pool, threadpool_task_func func, void *data); void _mesa_threadpool_wait_for_task(struct threadpool *pool, struct threadpool_task **task); -#endif +#endif
\ No newline at end of file diff --git a/lib/mesa/src/gallium/state_trackers/nine/vertexdeclaration9.c b/lib/mesa/src/gallium/state_trackers/nine/vertexdeclaration9.c index 9beeff290..2047b91ab 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/vertexdeclaration9.c +++ b/lib/mesa/src/gallium/state_trackers/nine/vertexdeclaration9.c @@ -24,12 +24,12 @@ #include "vertexbuffer9.h" #include "device9.h" #include "nine_helpers.h" -#include "nine_shader.h" #include "pipe/p_format.h" #include "pipe/p_context.h" #include "util/u_math.h" -#include "util/format/u_format.h" +#include "util/u_format.h" +#include "util/u_box.h" #include "translate/translate.h" #define DBG_CHANNEL DBG_VERTEXDECLARATION @@ -174,24 +174,24 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This, const D3DVERTEXELEMENT9 *pElements ) { const D3DCAPS9 *caps; - unsigned i, nelems; + unsigned i; + DBG("This=%p pParams=%p pElements=%p\n", This, pParams, pElements); + HRESULT hr = NineUnknown_ctor(&This->base, pParams); + if (FAILED(hr)) { return hr; } + /* wine */ - for (nelems = 0; - pElements[nelems].Stream != 0xFF; - ++nelems) { - user_assert(pElements[nelems].Type != D3DDECLTYPE_UNUSED, E_FAIL); - user_assert(!(pElements[nelems].Offset & 3), E_FAIL); + for (This->nelems = 0; + pElements[This->nelems].Stream != 0xFF; + ++This->nelems) { + user_assert(pElements[This->nelems].Type != D3DDECLTYPE_UNUSED, E_FAIL); + user_assert(!(pElements[This->nelems].Offset & 3), E_FAIL); } - caps = NineDevice9_GetCaps(pParams->device); - user_assert(nelems <= caps->MaxStreams, D3DERR_INVALIDCALL); + caps = NineDevice9_GetCaps(This->base.device); + user_assert(This->nelems <= caps->MaxStreams, D3DERR_INVALIDCALL); - HRESULT hr = NineUnknown_ctor(&This->base, pParams); - if (FAILED(hr)) { return hr; } - - This->nelems = nelems; This->decls = CALLOC(This->nelems+1, sizeof(D3DVERTEXELEMENT9)); This->elems = CALLOC(This->nelems, sizeof(struct pipe_vertex_element)); This->usage_map = CALLOC(This->nelems, sizeof(uint16_t)); @@ -203,9 +203,6 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This, This->decls[i].UsageIndex); This->usage_map[i] = usage; - if (This->decls[i].Usage == D3DDECLUSAGE_POSITIONT) - This->position_t = TRUE; - This->elems[i].src_offset = This->decls[i].Offset; This->elems[i].instance_divisor = 0; This->elems[i].vertex_buffer_index = This->decls[i].Stream; @@ -226,8 +223,6 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This, void NineVertexDeclaration9_dtor( struct NineVertexDeclaration9 *This ) { - DBG("This=%p\n", This); - FREE(This->decls); FREE(This->elems); FREE(This->usage_map); @@ -235,7 +230,7 @@ NineVertexDeclaration9_dtor( struct NineVertexDeclaration9 *This ) NineUnknown_dtor(&This->base); } -HRESULT NINE_WINAPI +HRESULT WINAPI NineVertexDeclaration9_GetDeclaration( struct NineVertexDeclaration9 *This, D3DVERTEXELEMENT9 *pElement, UINT *pNumElements ) @@ -409,53 +404,6 @@ NineVertexDeclaration9_new_from_fvf( struct NineDevice9 *pDevice, NINE_DEVICE_CHILD_NEW(VertexDeclaration9, ppOut, /* args */ pDevice, elems); } -void -NineVertexDeclaration9_FillStreamOutputInfo( - struct NineVertexDeclaration9 *This, - struct nine_vs_output_info *ShaderOutputsInfo, - unsigned numOutputs, - struct pipe_stream_output_info *so ) -{ - unsigned so_outputs = 0; - int i, j; - - memset(so, 0, sizeof(struct pipe_stream_output_info)); - - for (i = 0; i < numOutputs; i++) { - BYTE output_semantic = ShaderOutputsInfo[i].output_semantic; - unsigned output_semantic_index = ShaderOutputsInfo[i].output_semantic_index; - - for (j = 0; j < This->nelems; j++) { - if ((This->decls[j].Usage == output_semantic || - (output_semantic == D3DDECLUSAGE_POSITION && - This->decls[j].Usage == D3DDECLUSAGE_POSITIONT)) && - This->decls[j].UsageIndex == output_semantic_index) { - DBG("Matching %s %d: o%d -> %d\n", - nine_declusage_name(nine_d3d9_to_nine_declusage(This->decls[j].Usage, 0)), - This->decls[j].UsageIndex, i, j); - so->output[so_outputs].register_index = ShaderOutputsInfo[i].output_index; - so->output[so_outputs].start_component = 0; - if (ShaderOutputsInfo[i].mask & 8) - so->output[so_outputs].num_components = 4; - else if (ShaderOutputsInfo[i].mask & 4) - so->output[so_outputs].num_components = 3; - else if (ShaderOutputsInfo[i].mask & 2) - so->output[so_outputs].num_components = 2; - else - so->output[so_outputs].num_components = 1; - so->output[so_outputs].output_buffer = 0; - so->output[so_outputs].dst_offset = so_outputs * sizeof(float[4])/4; - so->output[so_outputs].stream = 0; - so_outputs++; - break; - } - } - } - - so->num_outputs = so_outputs; - so->stride[0] = so_outputs * sizeof(float[4])/4; -} - /* ProcessVertices runs stream output into a temporary buffer to capture * all outputs. * Now we have to convert them to the format and order set by the vertex @@ -469,13 +417,17 @@ NineVertexDeclaration9_ConvertStreamOutput( struct NineVertexBuffer9 *pDstBuf, UINT DestIndex, UINT VertexCount, - void *pSrcBuf, + struct pipe_resource *pSrcBuf, const struct pipe_stream_output_info *so ) { + struct pipe_context *pipe = This->base.device->pipe; + struct pipe_transfer *transfer = NULL; struct translate *translate; struct translate_key transkey; + struct pipe_box box; HRESULT hr; unsigned i; + void *src_map; void *dst_map; DBG("This=%p pDstBuf=%p DestIndex=%u VertexCount=%u pSrcBuf=%p so=%p\n", @@ -520,12 +472,20 @@ NineVertexDeclaration9_ConvertStreamOutput( if (FAILED(hr)) goto out; - translate->set_buffer(translate, 0, pSrcBuf, so->stride[0] * 4, ~0); + src_map = pipe->transfer_map(pipe, pSrcBuf, 0, PIPE_TRANSFER_READ, &box, + &transfer); + if (!src_map) { + hr = D3DERR_DRIVERINTERNALERROR; + goto out; + } + translate->set_buffer(translate, 0, src_map, so->stride[0], ~0); translate->run(translate, 0, VertexCount, 0, 0, dst_map); NineVertexBuffer9_Unlock(pDstBuf); out: + if (transfer) + pipe->transfer_unmap(pipe, transfer); translate->release(translate); /* TODO: cache these */ return hr; } diff --git a/lib/mesa/src/gallium/state_trackers/nine/vertexdeclaration9.h b/lib/mesa/src/gallium/state_trackers/nine/vertexdeclaration9.h index 7b94f846f..655bcfbf1 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/vertexdeclaration9.h +++ b/lib/mesa/src/gallium/state_trackers/nine/vertexdeclaration9.h @@ -31,7 +31,6 @@ struct pipe_vertex_element; struct pipe_stream_output_info; struct NineDevice9; struct NineVertexBuffer9; -struct nine_vs_output_info; struct NineVertexDeclaration9 { @@ -47,8 +46,6 @@ struct NineVertexDeclaration9 D3DVERTEXELEMENT9 *decls; DWORD fvf; - - BOOL position_t; }; static inline struct NineVertexDeclaration9 * NineVertexDeclaration9( void *data ) @@ -74,18 +71,11 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This, void NineVertexDeclaration9_dtor( struct NineVertexDeclaration9 *This ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineVertexDeclaration9_GetDeclaration( struct NineVertexDeclaration9 *This, D3DVERTEXELEMENT9 *pElement, UINT *pNumElements ); -void -NineVertexDeclaration9_FillStreamOutputInfo( - struct NineVertexDeclaration9 *This, - struct nine_vs_output_info *ShaderOutputsInfo, - unsigned numOutputs, - struct pipe_stream_output_info *so ); - /* Convert stream output data to the vertex declaration's format. */ HRESULT NineVertexDeclaration9_ConvertStreamOutput( @@ -93,7 +83,7 @@ NineVertexDeclaration9_ConvertStreamOutput( struct NineVertexBuffer9 *pDstBuf, UINT DestIndex, UINT VertexCount, - void *pSrcBuf, + struct pipe_resource *pSrcBuf, const struct pipe_stream_output_info *so ); #endif /* _NINE_VERTEXDECLARATION9_H_ */ diff --git a/lib/mesa/src/gallium/state_trackers/nine/volumetexture9.h b/lib/mesa/src/gallium/state_trackers/nine/volumetexture9.h index dfe564cfc..b8f250ad7 100644 --- a/lib/mesa/src/gallium/state_trackers/nine/volumetexture9.h +++ b/lib/mesa/src/gallium/state_trackers/nine/volumetexture9.h @@ -47,28 +47,28 @@ NineVolumeTexture9_new( struct NineDevice9 *pDevice, struct NineVolumeTexture9 **ppOut, HANDLE *pSharedHandle ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineVolumeTexture9_GetLevelDesc( struct NineVolumeTexture9 *This, UINT Level, D3DVOLUME_DESC *pDesc ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineVolumeTexture9_GetVolumeLevel( struct NineVolumeTexture9 *This, UINT Level, IDirect3DVolume9 **ppVolumeLevel ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineVolumeTexture9_LockBox( struct NineVolumeTexture9 *This, UINT Level, D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, DWORD Flags ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This, UINT Level ); -HRESULT NINE_WINAPI +HRESULT WINAPI NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This, const D3DBOX *pDirtyBox ); diff --git a/lib/mesa/src/gallium/state_trackers/va/Makefile.sources b/lib/mesa/src/gallium/state_trackers/va/Makefile.sources index bd43100a8..d281cdecc 100644 --- a/lib/mesa/src/gallium/state_trackers/va/Makefile.sources +++ b/lib/mesa/src/gallium/state_trackers/va/Makefile.sources @@ -5,16 +5,6 @@ C_SOURCES := \ display.c \ image.c \ picture.c \ - picture_mpeg12.c \ - picture_mpeg4.c \ - picture_h264.c \ - picture_h264_enc.c \ - picture_hevc.c \ - picture_hevc_enc.c \ - picture_vc1.c \ - picture_mjpeg.c \ - picture_vp9.c \ - postproc.c \ subpicture.c \ surface.c \ va_private.h diff --git a/lib/mesa/src/gallium/state_trackers/vdpau/ftab.c b/lib/mesa/src/gallium/state_trackers/vdpau/ftab.c index 31786229b..add465983 100644 --- a/lib/mesa/src/gallium/state_trackers/vdpau/ftab.c +++ b/lib/mesa/src/gallium/state_trackers/vdpau/ftab.c @@ -107,12 +107,10 @@ static void* ftab_winsys[1] = &vlVdpPresentationQueueTargetCreateX11 /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 */ }; -static void* ftab_driver[4] = +static void* ftab_driver[2] = { &vlVdpVideoSurfaceGallium, /* VDP_FUNC_ID_SURFACE_GALLIUM */ - &vlVdpOutputSurfaceGallium, /* VDP_FUNC_ID_OUTPUT_SURFACE_GALLIUM */ - &vlVdpVideoSurfaceDMABuf, /* VDP_FUNC_ID_VIDEO_SURFACE_DMA_BUF */ - &vlVdpOutputSurfaceDMABuf /* VDP_FUNC_ID_OUTPUT_SURFACE_DMA_BUF */ + &vlVdpOutputSurfaceGallium /* VDP_FUNC_ID_OUTPUT_SURFACE_GALLIUM */ }; boolean vlGetFuncFTAB(VdpFuncId function_id, void **func) @@ -121,17 +119,17 @@ boolean vlGetFuncFTAB(VdpFuncId function_id, void **func) *func = NULL; if (function_id < VDP_FUNC_ID_BASE_WINSYS) { - if (function_id < ARRAY_SIZE(ftab)) + if (function_id < Elements(ftab)) *func = ftab[function_id]; } else if (function_id < VDP_FUNC_ID_BASE_DRIVER) { function_id -= VDP_FUNC_ID_BASE_WINSYS; - if (function_id < ARRAY_SIZE(ftab_winsys)) + if (function_id < Elements(ftab_winsys)) *func = ftab_winsys[function_id]; } else { function_id -= VDP_FUNC_ID_BASE_DRIVER; - if (function_id < ARRAY_SIZE(ftab_driver)) + if (function_id < Elements(ftab_driver)) *func = ftab_driver[function_id]; } diff --git a/lib/mesa/src/gallium/state_trackers/wgl/Makefile.sources b/lib/mesa/src/gallium/state_trackers/wgl/Makefile.sources index 2630b445d..1e00caf97 100644 --- a/lib/mesa/src/gallium/state_trackers/wgl/Makefile.sources +++ b/lib/mesa/src/gallium/state_trackers/wgl/Makefile.sources @@ -5,7 +5,6 @@ C_SOURCES := \ stw_ext_extensionsstring.c \ stw_ext_pbuffer.c \ stw_ext_pixelformat.c \ - stw_ext_rendertexture.c \ stw_ext_swapinterval.c \ stw_framebuffer.c \ stw_getprocaddress.c \ diff --git a/lib/mesa/src/gallium/state_trackers/wgl/SConscript b/lib/mesa/src/gallium/state_trackers/wgl/SConscript index bbf5ebd97..6c604a0f2 100644 --- a/lib/mesa/src/gallium/state_trackers/wgl/SConscript +++ b/lib/mesa/src/gallium/state_trackers/wgl/SConscript @@ -12,10 +12,12 @@ env.Append(CPPPATH = [ env.AppendUnique(CPPDEFINES = [ '_GDI32_', # prevent wgl* being declared __declspec(dllimport) - 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers + 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers 'WIN32_LEAN_AND_MEAN', # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx - '_GLAPI_NO_EXPORTS', # prevent _glapi_* from being declared __declspec(dllimport) ]) +if not env['gles']: + # prevent _glapi_* from being declared __declspec(dllimport) + env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS']) wgl = env.ConvenienceLibrary( target ='wgl', diff --git a/lib/mesa/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c b/lib/mesa/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c index 02ccb76e2..0bd60c064 100644 --- a/lib/mesa/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c +++ b/lib/mesa/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c @@ -35,8 +35,6 @@ #include "pipe/p_defines.h" #include "pipe/p_screen.h" -#include "util/u_debug.h" - #include "stw_device.h" #include "stw_pixelformat.h" #include "stw_framebuffer.h" @@ -86,9 +84,6 @@ wglCreatePbufferARB(HDC hCurrentDC, int iDisplayablePixelFormat; PIXELFORMATDESCRIPTOR pfd; BOOL bRet; - int textureFormat = WGL_NO_TEXTURE_ARB; - int textureTarget = WGL_NO_TEXTURE_ARB; - BOOL textureMipmap = FALSE; info = stw_pixelformat_get_info(iPixelFormat - 1); if (!info) { @@ -101,47 +96,15 @@ wglCreatePbufferARB(HDC hCurrentDC, return 0; } - if (piAttribList) { - for (piAttrib = piAttribList; *piAttrib; piAttrib++) { - switch (*piAttrib) { - case WGL_PBUFFER_LARGEST_ARB: - piAttrib++; - useLargest = *piAttrib; - break; - case WGL_TEXTURE_FORMAT_ARB: - /* WGL_ARB_render_texture */ - piAttrib++; - textureFormat = *piAttrib; - if (textureFormat != WGL_TEXTURE_RGB_ARB && - textureFormat != WGL_TEXTURE_RGBA_ARB && - textureFormat != WGL_NO_TEXTURE_ARB) { - SetLastError(ERROR_INVALID_DATA); - return 0; - } - break; - case WGL_TEXTURE_TARGET_ARB: - /* WGL_ARB_render_texture */ - piAttrib++; - textureTarget = *piAttrib; - if (textureTarget != WGL_TEXTURE_CUBE_MAP_ARB && - textureTarget != WGL_TEXTURE_1D_ARB && - textureTarget != WGL_TEXTURE_2D_ARB && - textureTarget != WGL_NO_TEXTURE_ARB) { - SetLastError(ERROR_INVALID_DATA); - return 0; - } - break; - case WGL_MIPMAP_TEXTURE_ARB: - /* WGL_ARB_render_texture */ - piAttrib++; - textureMipmap = !!*piAttrib; - break; - default: - SetLastError(ERROR_INVALID_DATA); - debug_printf("wgl: Unsupported attribute 0x%x in %s\n", - *piAttrib, __func__); - return 0; - } + for (piAttrib = piAttribList; *piAttrib; piAttrib++) { + switch (*piAttrib) { + case WGL_PBUFFER_LARGEST_ARB: + piAttrib++; + useLargest = *piAttrib; + break; + default: + SetLastError(ERROR_INVALID_DATA); + return 0; } } @@ -255,15 +218,9 @@ wglCreatePbufferARB(HDC hCurrentDC, } fb->bPbuffer = TRUE; - - /* WGL_ARB_render_texture fields */ - fb->textureTarget = textureTarget; - fb->textureFormat = textureFormat; - fb->textureMipmap = textureMipmap; - iDisplayablePixelFormat = fb->iDisplayablePixelFormat; - stw_framebuffer_unlock(fb); + stw_framebuffer_release(fb); /* * We need to set a displayable pixel format on the hidden window DC @@ -287,7 +244,7 @@ wglGetPbufferDCARB(HPBUFFERARB hPbuffer) return NULL; } - fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer); + fb = (struct stw_framebuffer *)hPbuffer; hDC = GetDC(fb->hWnd); @@ -306,7 +263,7 @@ wglReleasePbufferDCARB(HPBUFFERARB hPbuffer, return 0; } - fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer); + fb = (struct stw_framebuffer *)hPbuffer; return ReleaseDC(fb->hWnd, hDC); } @@ -322,7 +279,7 @@ wglDestroyPbufferARB(HPBUFFERARB hPbuffer) return FALSE; } - fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer); + fb = (struct stw_framebuffer *)hPbuffer; /* This will destroy all our data */ return DestroyWindow(fb->hWnd); @@ -341,7 +298,7 @@ wglQueryPbufferARB(HPBUFFERARB hPbuffer, return FALSE; } - fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer); + fb = (struct stw_framebuffer *)hPbuffer; switch (iAttribute) { case WGL_PBUFFER_WIDTH_ARB: @@ -354,22 +311,6 @@ wglQueryPbufferARB(HPBUFFERARB hPbuffer, /* We assume that no content is ever lost due to display mode change */ *piValue = FALSE; return TRUE; - /* WGL_ARB_render_texture */ - case WGL_TEXTURE_TARGET_ARB: - *piValue = fb->textureTarget; - return TRUE; - case WGL_TEXTURE_FORMAT_ARB: - *piValue = fb->textureFormat; - return TRUE; - case WGL_MIPMAP_TEXTURE_ARB: - *piValue = fb->textureMipmap; - return TRUE; - case WGL_MIPMAP_LEVEL_ARB: - *piValue = fb->textureLevel; - return TRUE; - case WGL_CUBE_MAP_FACE_ARB: - *piValue = fb->textureFace + WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; - return TRUE; default: SetLastError(ERROR_INVALID_DATA); return FALSE; diff --git a/lib/mesa/src/gallium/state_trackers/wgl/stw_pixelformat.h b/lib/mesa/src/gallium/state_trackers/wgl/stw_pixelformat.h index 06753b09e..58ef7442a 100644 --- a/lib/mesa/src/gallium/state_trackers/wgl/stw_pixelformat.h +++ b/lib/mesa/src/gallium/state_trackers/wgl/stw_pixelformat.h @@ -43,10 +43,6 @@ struct stw_pixelformat_info PIXELFORMATDESCRIPTOR pfd; struct st_visual stvis; - - /** WGL_ARB_render_texture */ - boolean bindToTextureRGB; - boolean bindToTextureRGBA; }; void diff --git a/lib/mesa/src/gallium/state_trackers/wgl/stw_st.h b/lib/mesa/src/gallium/state_trackers/wgl/stw_st.h index 6bc218285..1c855a0a2 100644 --- a/lib/mesa/src/gallium/state_trackers/wgl/stw_st.h +++ b/lib/mesa/src/gallium/state_trackers/wgl/stw_st.h @@ -34,9 +34,6 @@ struct stw_framebuffer; -bool -stw_own_mutex(const CRITICAL_SECTION *cs); - struct st_api * stw_st_create_api(void); @@ -46,7 +43,7 @@ stw_st_create_framebuffer(struct stw_framebuffer *fb); void stw_st_destroy_framebuffer_locked(struct st_framebuffer_iface *stfb); -bool +boolean stw_st_swap_framebuffer_locked(HDC hdc, struct st_framebuffer_iface *stfb); struct pipe_resource * diff --git a/lib/mesa/src/gallium/state_trackers/wgl/stw_tls.c b/lib/mesa/src/gallium/state_trackers/wgl/stw_tls.c index 9b7d60c6d..041066f50 100644 --- a/lib/mesa/src/gallium/state_trackers/wgl/stw_tls.c +++ b/lib/mesa/src/gallium/state_trackers/wgl/stw_tls.c @@ -50,7 +50,7 @@ static CRITICAL_SECTION g_mutex = { static struct stw_tls_data *g_pendingTlsData = NULL; -static struct stw_tls_data * +static inline struct stw_tls_data * stw_tls_data_create(DWORD dwThreadId); static struct stw_tls_data * @@ -111,7 +111,7 @@ stw_tls_init(void) /** * Install windows hook for a given thread (not necessarily the current one). */ -static struct stw_tls_data * +static inline struct stw_tls_data * stw_tls_data_create(DWORD dwThreadId) { struct stw_tls_data *data; diff --git a/lib/mesa/src/gallium/state_trackers/xa/xa_composite.c b/lib/mesa/src/gallium/state_trackers/xa/xa_composite.c index 34d78027e..7cfd1e136 100644 --- a/lib/mesa/src/gallium/state_trackers/xa/xa_composite.c +++ b/lib/mesa/src/gallium/state_trackers/xa/xa_composite.c @@ -78,12 +78,10 @@ static const struct xa_composite_blend xa_blends[] = { 0, 0, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE}, }; + /* - * The alpha value stored in a L8 texture is read by the - * hardware as color, and R8 is read as red. The source alpha value - * at the end of the fragment shader is stored in all color channels, - * so the correct approach is to blend using DST_COLOR instead of - * DST_ALPHA and then output any color channel (L8) or the red channel (R8). + * The alpha value stored in a luminance texture is read by the + * hardware as color. */ static unsigned xa_convert_blend_for_luminance(unsigned factor) @@ -99,6 +97,7 @@ xa_convert_blend_for_luminance(unsigned factor) return factor; } + static boolean blend_for_op(struct xa_composite_blend *blend, enum xa_composite_op op, @@ -112,6 +111,12 @@ blend_for_op(struct xa_composite_blend *blend, boolean supported = FALSE; /* + * Temporarily disable component alpha since it appears buggy. + */ + if (mask_pic && mask_pic->component_alpha) + return FALSE; + + /* * our default in case something goes wrong */ *blend = xa_blends[XA_BLEND_OP_OVER]; @@ -120,23 +125,15 @@ blend_for_op(struct xa_composite_blend *blend, if (xa_blends[i].op == op) { *blend = xa_blends[i]; supported = TRUE; - break; } } - /* - * No component alpha yet. - */ - if (mask_pic && mask_pic->component_alpha && blend->alpha_src) - return FALSE; - if (!dst_pic->srf) return supported; - if ((dst_pic->srf->tex->format == PIPE_FORMAT_L8_UNORM || - dst_pic->srf->tex->format == PIPE_FORMAT_R8_UNORM)) { - blend->rgb_src = xa_convert_blend_for_luminance(blend->rgb_src); - blend->rgb_dst = xa_convert_blend_for_luminance(blend->rgb_dst); + if (dst_pic->srf->tex->format == PIPE_FORMAT_L8_UNORM) { + blend->rgb_src = xa_convert_blend_for_luminance(blend->rgb_src); + blend->rgb_dst = xa_convert_blend_for_luminance(blend->rgb_dst); } /* @@ -151,6 +148,21 @@ blend_for_op(struct xa_composite_blend *blend, blend->rgb_src = PIPE_BLENDFACTOR_ZERO; } + /* + * If the source alpha is being used, then we should only be in a case where + * the source blend factor is 0, and the source blend value is the mask + * channels multiplied by the source picture's alpha. + */ + if (mask_pic && mask_pic->component_alpha && + xa_format_rgb(mask_pic->pict_format) && + blend->alpha_src) { + if (blend->rgb_dst == PIPE_BLENDFACTOR_SRC_ALPHA) { + blend->rgb_dst = PIPE_BLENDFACTOR_SRC_COLOR; + } else if (blend->rgb_dst == PIPE_BLENDFACTOR_INV_SRC_ALPHA) { + blend->rgb_dst = PIPE_BLENDFACTOR_INV_SRC_COLOR; + } + } + return supported; } @@ -200,53 +212,43 @@ xa_is_filter_accelerated(struct xa_picture *pic) return 1; } -/** - * xa_src_pict_is_accelerated - Check whether we support acceleration - * of the given src_pict type - * - * \param src_pic[in]: Pointer to a union xa_source_pict to check. - * - * \returns TRUE if accelerated, FALSE otherwise. - */ -static boolean -xa_src_pict_is_accelerated(const union xa_source_pict *src_pic) -{ - if (!src_pic) - return TRUE; - - if (src_pic->type == xa_src_pict_solid_fill || - src_pic->type == xa_src_pict_float_solid_fill) - return TRUE; - - return FALSE; -} - XA_EXPORT int xa_composite_check_accelerated(const struct xa_composite *comp) { - struct xa_picture *src_pic = comp->src; - struct xa_picture *mask_pic = comp->mask; struct xa_composite_blend blend; + struct xa_picture *src_pic = comp->src; if (!xa_is_filter_accelerated(src_pic) || !xa_is_filter_accelerated(comp->mask)) { return -XA_ERR_INVAL; } - if (!xa_src_pict_is_accelerated(src_pic->src_pict) || - (mask_pic && !xa_src_pict_is_accelerated(mask_pic->src_pict))) - return -XA_ERR_INVAL; - if (!blend_for_op(&blend, comp->op, comp->src, comp->mask, comp->dst)) - return -XA_ERR_INVAL; + if (src_pic->src_pict) { + if (src_pic->src_pict->type != xa_src_pict_solid_fill) + return -XA_ERR_INVAL; - /* - * No component alpha yet. - */ - if (mask_pic && mask_pic->component_alpha && blend.alpha_src) - return -XA_ERR_INVAL; + /* + * Currently we don't support solid fill with a mask. + * We can easily do that, but that would require shader, + * sampler view setup and vertex setup modification. + */ + if (comp->mask) + return -XA_ERR_INVAL; + } - return XA_ERR_NONE; + if (blend_for_op(&blend, comp->op, comp->src, comp->mask, comp->dst)) { + struct xa_picture *mask = comp->mask; + if (mask && mask->component_alpha && + xa_format_rgb(mask->pict_format)) { + if (blend.alpha_src && blend.rgb_src != PIPE_BLENDFACTOR_ZERO) { + return -XA_ERR_INVAL; + } + } + + return XA_ERR_NONE; + } + return -XA_ERR_INVAL; } static int @@ -289,15 +291,14 @@ picture_format_fixups(struct xa_picture *src_pic, src_hw_format = xa_surface_format(src); src_pic_format = src_pic->pict_format; - set_alpha = (xa_format_type_is_color(src_hw_format) && + set_alpha = (xa_format_type_is_color(src_pic_format) && xa_format_a(src_pic_format) == 0); if (set_alpha) ret |= mask ? FS_MASK_SET_ALPHA : FS_SRC_SET_ALPHA; if (src_hw_format == src_pic_format) { - if (src->tex->format == PIPE_FORMAT_L8_UNORM || - src->tex->format == PIPE_FORMAT_R8_UNORM) + if (src->tex->format == PIPE_FORMAT_L8_UNORM) return ((mask) ? FS_MASK_LUMINANCE : FS_SRC_LUMINANCE); return ret; @@ -320,61 +321,6 @@ picture_format_fixups(struct xa_picture *src_pic, return ret; } -static void -xa_src_in_mask(float src[4], const float mask[4]) -{ - src[0] *= mask[3]; - src[1] *= mask[3]; - src[2] *= mask[3]; - src[3] *= mask[3]; -} - -/** - * xa_handle_src_pict - Set up xa_context state and fragment shader - * input based on scr_pict type - * - * \param ctx[in, out]: Pointer to the xa context. - * \param src_pict[in]: Pointer to the union xa_source_pict to consider. - * \param is_mask[in]: Whether we're considering a mask picture. - * - * \returns TRUE if succesful, FALSE otherwise. - * - * This function computes some xa_context state used to determine whether - * to upload the solid color and also the solid color itself used as an input - * to the fragment shader. - */ -static boolean -xa_handle_src_pict(struct xa_context *ctx, - const union xa_source_pict *src_pict, - boolean is_mask) -{ - float solid_color[4]; - - switch(src_pict->type) { - case xa_src_pict_solid_fill: - xa_pixel_to_float4(src_pict->solid_fill.color, solid_color); - break; - case xa_src_pict_float_solid_fill: - memcpy(solid_color, src_pict->float_solid_fill.color, - sizeof(solid_color)); - break; - default: - return FALSE; - } - - if (is_mask && ctx->has_solid_src) - xa_src_in_mask(ctx->solid_color, solid_color); - else - memcpy(ctx->solid_color, solid_color, sizeof(solid_color)); - - if (is_mask) - ctx->has_solid_mask = TRUE; - else - ctx->has_solid_src = TRUE; - - return TRUE; -} - static int bind_shaders(struct xa_context *ctx, const struct xa_composite *comp) { @@ -382,58 +328,51 @@ bind_shaders(struct xa_context *ctx, const struct xa_composite *comp) struct xa_shader shader; struct xa_picture *src_pic = comp->src; struct xa_picture *mask_pic = comp->mask; - struct xa_picture *dst_pic = comp->dst; - ctx->has_solid_src = FALSE; - ctx->has_solid_mask = FALSE; - - if (dst_pic && xa_format_type(dst_pic->pict_format) != - xa_format_type(xa_surface_format(dst_pic->srf))) - return -XA_ERR_INVAL; + ctx->has_solid_color = FALSE; if (src_pic) { if (src_pic->wrap == xa_wrap_clamp_to_border && src_pic->has_transform) fs_traits |= FS_SRC_REPEAT_NONE; - fs_traits |= FS_COMPOSITE; - vs_traits |= VS_COMPOSITE; - if (src_pic->src_pict) { - if (!xa_handle_src_pict(ctx, src_pic->src_pict, false)) - return -XA_ERR_INVAL; - fs_traits |= FS_SRC_SRC; - vs_traits |= VS_SRC_SRC; - } else - fs_traits |= picture_format_fixups(src_pic, 0); + if (src_pic->src_pict->type == xa_src_pict_solid_fill) { + fs_traits |= FS_SOLID_FILL | FS_FILL; + vs_traits |= VS_SOLID_FILL; + xa_pixel_to_float4(src_pic->src_pict->solid_fill.color, + ctx->solid_color); + ctx->has_solid_color = TRUE; + } + } else { + fs_traits |= FS_COMPOSITE; + vs_traits |= VS_COMPOSITE; + } + + fs_traits |= picture_format_fixups(src_pic, 0); } if (mask_pic) { vs_traits |= VS_MASK; fs_traits |= FS_MASK; - if (mask_pic->component_alpha) - fs_traits |= FS_CA; - if (mask_pic->src_pict) { - if (!xa_handle_src_pict(ctx, mask_pic->src_pict, true)) - return -XA_ERR_INVAL; - - if (ctx->has_solid_src) { - vs_traits &= ~VS_MASK; - fs_traits &= ~FS_MASK; - } else { - vs_traits |= VS_MASK_SRC; - fs_traits |= FS_MASK_SRC; - } - } else { - if (mask_pic->wrap == xa_wrap_clamp_to_border && - mask_pic->has_transform) - fs_traits |= FS_MASK_REPEAT_NONE; - - fs_traits |= picture_format_fixups(mask_pic, 1); - } + if (mask_pic->wrap == xa_wrap_clamp_to_border && + mask_pic->has_transform) + fs_traits |= FS_MASK_REPEAT_NONE; + + if (mask_pic->component_alpha) { + struct xa_composite_blend blend; + if (!blend_for_op(&blend, comp->op, src_pic, mask_pic, NULL)) + return -XA_ERR_INVAL; + + if (blend.alpha_src) { + fs_traits |= FS_CA_SRCALPHA; + } else + fs_traits |= FS_CA_FULL; + } + + fs_traits |= picture_format_fixups(mask_pic, 1); } - if (ctx->srf->format == PIPE_FORMAT_L8_UNORM || - ctx->srf->format == PIPE_FORMAT_R8_UNORM) + if (ctx->srf->format == PIPE_FORMAT_L8_UNORM) fs_traits |= FS_DST_LUMINANCE; shader = xa_shaders_get(ctx->shaders, vs_traits, fs_traits); @@ -453,35 +392,42 @@ bind_samplers(struct xa_context *ctx, struct pipe_context *pipe = ctx->pipe; struct xa_picture *src_pic = comp->src; struct xa_picture *mask_pic = comp->mask; - int num_samplers = 0; - xa_ctx_sampler_views_destroy(ctx); + ctx->num_bound_samplers = 0; + memset(&src_sampler, 0, sizeof(struct pipe_sampler_state)); memset(&mask_sampler, 0, sizeof(struct pipe_sampler_state)); - if (src_pic && !ctx->has_solid_src) { - unsigned src_wrap = xa_repeat_to_gallium(src_pic->wrap); - int filter; - - (void) xa_filter_to_gallium(src_pic->filter, &filter); - - src_sampler.wrap_s = src_wrap; - src_sampler.wrap_t = src_wrap; - src_sampler.min_img_filter = filter; - src_sampler.mag_img_filter = filter; - src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; - src_sampler.normalized_coords = 1; - samplers[0] = &src_sampler; - u_sampler_view_default_template(&view_templ, - src_pic->srf->tex,+ src_pic->srf->tex->format); - src_view = pipe->create_sampler_view(pipe, src_pic->srf->tex, - &view_templ); - ctx->bound_sampler_views[0] = src_view; - num_samplers++; + if (src_pic) { + if (ctx->has_solid_color) { + samplers[0] = NULL; + pipe_sampler_view_reference(&ctx->bound_sampler_views[0], NULL); + } else { + unsigned src_wrap = xa_repeat_to_gallium(src_pic->wrap); + int filter; + + (void) xa_filter_to_gallium(src_pic->filter, &filter); + + src_sampler.wrap_s = src_wrap; + src_sampler.wrap_t = src_wrap; + src_sampler.min_img_filter = filter; + src_sampler.mag_img_filter = filter; + src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; + src_sampler.normalized_coords = 1; + samplers[0] = &src_sampler; + ctx->num_bound_samplers = 1; + u_sampler_view_default_template(&view_templ, + src_pic->srf->tex, + src_pic->srf->tex->format); + src_view = pipe->create_sampler_view(pipe, src_pic->srf->tex, + &view_templ); + pipe_sampler_view_reference(&ctx->bound_sampler_views[0], NULL); + ctx->bound_sampler_views[0] = src_view; + } } - if (mask_pic && !ctx->has_solid_mask) { - unsigned mask_wrap = xa_repeat_to_gallium(mask_pic->wrap); + if (mask_pic) { + unsigned mask_wrap = xa_repeat_to_gallium(mask_pic->wrap); int filter; (void) xa_filter_to_gallium(mask_pic->filter, &filter); @@ -492,21 +438,31 @@ bind_samplers(struct xa_context *ctx, mask_sampler.mag_img_filter = filter; src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; mask_sampler.normalized_coords = 1; - samplers[num_samplers] = &mask_sampler; + samplers[1] = &mask_sampler; + ctx->num_bound_samplers = 2; u_sampler_view_default_template(&view_templ, mask_pic->srf->tex, mask_pic->srf->tex->format); src_view = pipe->create_sampler_view(pipe, mask_pic->srf->tex, &view_templ); - ctx->bound_sampler_views[num_samplers] = src_view; - num_samplers++; + pipe_sampler_view_reference(&ctx->bound_sampler_views[1], NULL); + ctx->bound_sampler_views[1] = src_view; + + + /* + * If src is a solid color, we have no src view, so set up a + * dummy one that will not be used anyway. + */ + if (ctx->bound_sampler_views[0] == NULL) + pipe_sampler_view_reference(&ctx->bound_sampler_views[0], + src_view); + } - cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, num_samplers, + cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, ctx->num_bound_samplers, (const struct pipe_sampler_state **)samplers); - cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, num_samplers, + cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, ctx->num_bound_samplers, ctx->bound_sampler_views); - ctx->num_bound_samplers = num_samplers; } XA_EXPORT int @@ -516,6 +472,9 @@ xa_composite_prepare(struct xa_context *ctx, struct xa_surface *dst_srf = comp->dst->srf; int ret; + if (comp->mask && !comp->mask->srf) + return -XA_ERR_INVAL; + ret = xa_ctx_srf_create(ctx, dst_srf); if (ret != XA_ERR_NONE) return ret; @@ -548,8 +507,8 @@ xa_composite_rect(struct xa_context *ctx, int dstX, int dstY, int width, int height) { if (ctx->num_bound_samplers == 0 ) { /* solid fill */ - xa_scissor_update(ctx, dstX, dstY, dstX + width, dstY + height); - renderer_solid(ctx, dstX, dstY, dstX + width, dstY + height); + renderer_solid(ctx, dstX, dstY, dstX + width, dstY + height, + ctx->solid_color); } else { const struct xa_composite *comp = ctx->comp; int pos[6] = {srcX, srcY, maskX, maskY, dstX, dstY}; @@ -574,8 +533,7 @@ xa_composite_done(struct xa_context *ctx) renderer_draw_flush(ctx); ctx->comp = NULL; - ctx->has_solid_src = FALSE; - ctx->has_solid_mask = FALSE; + ctx->has_solid_color = FALSE; xa_ctx_sampler_views_destroy(ctx); } diff --git a/lib/mesa/src/gallium/state_trackers/xa/xa_composite.h b/lib/mesa/src/gallium/state_trackers/xa/xa_composite.h index 7e3737a63..d16ef89eb 100644 --- a/lib/mesa/src/gallium/state_trackers/xa/xa_composite.h +++ b/lib/mesa/src/gallium/state_trackers/xa/xa_composite.h @@ -74,34 +74,18 @@ enum xa_composite_wrap { * Src picture types. */ enum xa_composite_src_pict_type { - xa_src_pict_solid_fill, - xa_src_pict_float_solid_fill + xa_src_pict_solid_fill }; - -/* - * struct xa_pict_solid_fill - Description of a solid_fill picture - * Deprecated. Use struct xa_pict_float_solid_fill instead. - */ struct xa_pict_solid_fill { enum xa_composite_src_pict_type type; unsigned int class; uint32_t color; }; -/* - * struct xa_pict_solid_fill - Description of a solid_fill picture - * with color channels represented by floats. - */ -struct xa_pict_float_solid_fill { - enum xa_composite_src_pict_type type; - float color[4]; /* R, G, B, A */ -}; - union xa_source_pict { - enum xa_composite_src_pict_type type; + unsigned int type; struct xa_pict_solid_fill solid_fill; - struct xa_pict_float_solid_fill float_solid_fill; }; struct xa_picture { diff --git a/lib/mesa/src/gallium/state_trackers/xa/xa_priv.h b/lib/mesa/src/gallium/state_trackers/xa/xa_priv.h index f368de3b8..13a0e86f6 100644 --- a/lib/mesa/src/gallium/state_trackers/xa/xa_priv.h +++ b/lib/mesa/src/gallium/state_trackers/xa/xa_priv.h @@ -74,6 +74,8 @@ struct xa_surface { struct xa_tracker { enum xa_formats *supported_formats; unsigned int format_map[XA_LAST_SURFACE_TYPE][2]; + int d_depth_bits_last; + int ds_depth_bits_last; struct pipe_loader_device *dev; struct pipe_screen *screen; struct xa_context *default_ctx; @@ -113,8 +115,7 @@ struct xa_context { int simple_copy; - int has_solid_src; - int has_solid_mask; + int has_solid_color; float solid_color[4]; unsigned int num_bound_samplers; @@ -146,27 +147,35 @@ xa_scissor_update(struct xa_context *ctx, unsigned minx, unsigned miny, enum xa_vs_traits { VS_COMPOSITE = 1 << 0, VS_MASK = 1 << 1, - VS_SRC_SRC = 1 << 2, - VS_MASK_SRC = 1 << 3, - VS_YUV = 1 << 4, + VS_SOLID_FILL = 1 << 2, + VS_LINGRAD_FILL = 1 << 3, + VS_RADGRAD_FILL = 1 << 4, + VS_YUV = 1 << 5, + + VS_FILL = (VS_SOLID_FILL | VS_LINGRAD_FILL | VS_RADGRAD_FILL) }; enum xa_fs_traits { FS_COMPOSITE = 1 << 0, FS_MASK = 1 << 1, - FS_SRC_SRC = 1 << 2, - FS_MASK_SRC = 1 << 3, - FS_YUV = 1 << 4, - FS_SRC_REPEAT_NONE = 1 << 5, - FS_MASK_REPEAT_NONE = 1 << 6, - FS_SRC_SWIZZLE_RGB = 1 << 7, - FS_MASK_SWIZZLE_RGB = 1 << 8, - FS_SRC_SET_ALPHA = 1 << 9, - FS_MASK_SET_ALPHA = 1 << 10, - FS_SRC_LUMINANCE = 1 << 11, - FS_MASK_LUMINANCE = 1 << 12, - FS_DST_LUMINANCE = 1 << 13, - FS_CA = 1 << 14, + FS_SOLID_FILL = 1 << 2, + FS_LINGRAD_FILL = 1 << 3, + FS_RADGRAD_FILL = 1 << 4, + FS_CA_FULL = 1 << 5, /* src.rgba * mask.rgba */ + FS_CA_SRCALPHA = 1 << 6, /* src.aaaa * mask.rgba */ + FS_YUV = 1 << 7, + FS_SRC_REPEAT_NONE = 1 << 8, + FS_MASK_REPEAT_NONE = 1 << 9, + FS_SRC_SWIZZLE_RGB = 1 << 10, + FS_MASK_SWIZZLE_RGB = 1 << 11, + FS_SRC_SET_ALPHA = 1 << 12, + FS_MASK_SET_ALPHA = 1 << 13, + FS_SRC_LUMINANCE = 1 << 14, + FS_MASK_LUMINANCE = 1 << 15, + FS_DST_LUMINANCE = 1 << 16, + + FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | FS_RADGRAD_FILL), + FS_COMPONENT_ALPHA = (FS_CA_FULL | FS_CA_SRCALPHA) }; struct xa_shader { @@ -275,7 +284,7 @@ void renderer_draw_flush(struct xa_context *r); void renderer_begin_solid(struct xa_context *r); void renderer_solid(struct xa_context *r, - int x0, int y0, int x1, int y1); + int x0, int y0, int x1, int y1, float *color); void renderer_begin_textures(struct xa_context *r); diff --git a/lib/mesa/src/gallium/state_trackers/xa/xa_renderer.c b/lib/mesa/src/gallium/state_trackers/xa/xa_renderer.c index 582a5fa13..fda07e5b6 100644 --- a/lib/mesa/src/gallium/state_trackers/xa/xa_renderer.c +++ b/lib/mesa/src/gallium/state_trackers/xa/xa_renderer.c @@ -46,14 +46,14 @@ renderer_set_constants(struct xa_context *r, int shader_type, const float *params, int param_bytes); static inline boolean -is_affine(const float *matrix) +is_affine(float *matrix) { return floatIsZero(matrix[2]) && floatIsZero(matrix[5]) && floatsEqual(matrix[8], 1); } static inline void -map_point(const float *mat, float x, float y, float *out_x, float *out_y) +map_point(float *mat, float x, float y, float *out_x, float *out_y) { if (!mat) { *out_x = x; @@ -121,8 +121,7 @@ renderer_init_state(struct xa_context *r) memset(&raster, 0, sizeof(struct pipe_rasterizer_state)); raster.half_pixel_center = 1; raster.bottom_edge_rule = 1; - raster.depth_clip_near = 1; - raster.depth_clip_far = 1; + raster.depth_clip = 1; raster.scissor = 1; cso_set_rasterizer(r->cso, &raster); @@ -137,7 +136,7 @@ renderer_init_state(struct xa_context *r) } static inline void -add_vertex_none(struct xa_context *r, float x, float y) +add_vertex_color(struct xa_context *r, float x, float y, float color[4]) { float *vertex = r->buffer + r->buffer_size; @@ -146,7 +145,12 @@ add_vertex_none(struct xa_context *r, float x, float y) vertex[2] = 0.f; /*z */ vertex[3] = 1.f; /*w */ - r->buffer_size += 4; + vertex[4] = color[0]; /*r */ + vertex[5] = color[1]; /*g */ + vertex[6] = color[2]; /*b */ + vertex[7] = color[3]; /*a */ + + r->buffer_size += 8; } static inline void @@ -192,55 +196,47 @@ add_vertex_2tex(struct xa_context *r, } static void -compute_src_coords(float sx, float sy, const struct pipe_resource *src, - const float *src_matrix, - float width, float height, - float tc0[2], float tc1[2], float tc2[2], float tc3[2]) +add_vertex_data1(struct xa_context *r, + float srcX, float srcY, float dstX, float dstY, + float width, float height, + struct pipe_resource *src, const float *src_matrix) { - tc0[0] = sx; - tc0[1] = sy; - tc1[0] = sx + width; - tc1[1] = sy; - tc2[0] = sx + width; - tc2[1] = sy + height; - tc3[0] = sx; - tc3[1] = sy + height; + float s0, t0, s1, t1, s2, t2, s3, t3; + float pt0[2], pt1[2], pt2[2], pt3[2]; + + pt0[0] = srcX; + pt0[1] = srcY; + pt1[0] = (srcX + width); + pt1[1] = srcY; + pt2[0] = (srcX + width); + pt2[1] = (srcY + height); + pt3[0] = srcX; + pt3[1] = (srcY + height); if (src_matrix) { - map_point(src_matrix, tc0[0], tc0[1], &tc0[0], &tc0[1]); - map_point(src_matrix, tc1[0], tc1[1], &tc1[0], &tc1[1]); - map_point(src_matrix, tc2[0], tc2[1], &tc2[0], &tc2[1]); - map_point(src_matrix, tc3[0], tc3[1], &tc3[0], &tc3[1]); + map_point((float *)src_matrix, pt0[0], pt0[1], &pt0[0], &pt0[1]); + map_point((float *)src_matrix, pt1[0], pt1[1], &pt1[0], &pt1[1]); + map_point((float *)src_matrix, pt2[0], pt2[1], &pt2[0], &pt2[1]); + map_point((float *)src_matrix, pt3[0], pt3[1], &pt3[0], &pt3[1]); } - tc0[0] /= src->width0; - tc1[0] /= src->width0; - tc2[0] /= src->width0; - tc3[0] /= src->width0; - tc0[1] /= src->height0; - tc1[1] /= src->height0; - tc2[1] /= src->height0; - tc3[1] /= src->height0; -} + s0 = pt0[0] / src->width0; + s1 = pt1[0] / src->width0; + s2 = pt2[0] / src->width0; + s3 = pt3[0] / src->width0; + t0 = pt0[1] / src->height0; + t1 = pt1[1] / src->height0; + t2 = pt2[1] / src->height0; + t3 = pt3[1] / src->height0; -static void -add_vertex_data1(struct xa_context *r, - float srcX, float srcY, float dstX, float dstY, - float width, float height, - const struct pipe_resource *src, const float *src_matrix) -{ - float tc0[2], tc1[2], tc2[2], tc3[2]; - - compute_src_coords(srcX, srcY, src, src_matrix, width, height, - tc0, tc1, tc2, tc3); /* 1st vertex */ - add_vertex_1tex(r, dstX, dstY, tc0[0], tc0[1]); + add_vertex_1tex(r, dstX, dstY, s0, t0); /* 2nd vertex */ - add_vertex_1tex(r, dstX + width, dstY, tc1[0], tc1[1]); + add_vertex_1tex(r, dstX + width, dstY, s1, t1); /* 3rd vertex */ - add_vertex_1tex(r, dstX + width, dstY + height, tc2[0], tc2[1]); + add_vertex_1tex(r, dstX + width, dstY + height, s2, t2); /* 4th vertex */ - add_vertex_1tex(r, dstX, dstY + height, tc3[0], tc3[1]); + add_vertex_1tex(r, dstX, dstY + height, s3, t3); } static void @@ -251,26 +247,53 @@ add_vertex_data2(struct xa_context *r, struct pipe_resource *mask, const float *src_matrix, const float *mask_matrix) { - float spt0[2], spt1[2], spt2[2], spt3[2]; - float mpt0[2], mpt1[2], mpt2[2], mpt3[2]; + float src_s0, src_t0, src_s1, src_t1; + float mask_s0, mask_t0, mask_s1, mask_t1; + float spt0[2], spt1[2]; + float mpt0[2], mpt1[2]; + + spt0[0] = srcX; + spt0[1] = srcY; + spt1[0] = srcX + width; + spt1[1] = srcY + height; + + mpt0[0] = maskX; + mpt0[1] = maskY; + mpt1[0] = maskX + width; + mpt1[1] = maskY + height; + + if (src_matrix) { + map_point((float *)src_matrix, spt0[0], spt0[1], &spt0[0], &spt0[1]); + map_point((float *)src_matrix, spt1[0], spt1[1], &spt1[0], &spt1[1]); + } - compute_src_coords(srcX, srcY, src, src_matrix, width, height, - spt0, spt1, spt2, spt3); - compute_src_coords(maskX, maskY, mask, mask_matrix, width, height, - mpt0, mpt1, mpt2, mpt3); + if (mask_matrix) { + map_point((float *)mask_matrix, mpt0[0], mpt0[1], &mpt0[0], &mpt0[1]); + map_point((float *)mask_matrix, mpt1[0], mpt1[1], &mpt1[0], &mpt1[1]); + } + + src_s0 = spt0[0] / src->width0; + src_t0 = spt0[1] / src->height0; + src_s1 = spt1[0] / src->width0; + src_t1 = spt1[1] / src->height0; + + mask_s0 = mpt0[0] / mask->width0; + mask_t0 = mpt0[1] / mask->height0; + mask_s1 = mpt1[0] / mask->width0; + mask_t1 = mpt1[1] / mask->height0; /* 1st vertex */ add_vertex_2tex(r, dstX, dstY, - spt0[0], spt0[1], mpt0[0], mpt0[1]); + src_s0, src_t0, mask_s0, mask_t0); /* 2nd vertex */ add_vertex_2tex(r, dstX + width, dstY, - spt1[0], spt1[1], mpt1[0], mpt1[1]); + src_s1, src_t0, mask_s1, mask_t0); /* 3rd vertex */ add_vertex_2tex(r, dstX + width, dstY + height, - spt2[0], spt2[1], mpt2[0], mpt2[1]); + src_s1, src_t1, mask_s1, mask_t1); /* 4th vertex */ add_vertex_2tex(r, dstX, dstY + height, - spt3[0], spt3[1], mpt3[0], mpt3[1]); + src_s0, src_t1, mask_s0, mask_t1); } static void @@ -370,10 +393,9 @@ renderer_set_constants(struct xa_context *r, &r->fs_const_buffer; pipe_resource_reference(cbuf, NULL); - *cbuf = pipe_buffer_create_const0(r->pipe->screen, - PIPE_BIND_CONSTANT_BUFFER, - PIPE_USAGE_DEFAULT, - param_bytes); + *cbuf = pipe_buffer_create(r->pipe->screen, + PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_DEFAULT, + param_bytes); if (*cbuf) { pipe_buffer_write(r->pipe, *cbuf, 0, param_bytes, params); @@ -394,7 +416,7 @@ renderer_copy_prepare(struct xa_context *r, uint32_t fs_traits = FS_COMPOSITE; assert(screen->is_format_supported(screen, dst_surface->format, - PIPE_TEXTURE_2D, 0, 0, + PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET)); (void)screen; @@ -443,11 +465,9 @@ renderer_copy_prepare(struct xa_context *r, } /* shaders */ - if (src_texture->format == PIPE_FORMAT_L8_UNORM || - src_texture->format == PIPE_FORMAT_R8_UNORM) + if (src_texture->format == PIPE_FORMAT_L8_UNORM) fs_traits |= FS_SRC_LUMINANCE; - if (dst_surface->format == PIPE_FORMAT_L8_UNORM || - dst_surface->format == PIPE_FORMAT_R8_UNORM) + if (dst_surface->format == PIPE_FORMAT_L8_UNORM) fs_traits |= FS_DST_LUMINANCE; if (xa_format_a(dst_xa_format) != 0 && xa_format_a(src_xa_format) == 0) @@ -530,29 +550,27 @@ void renderer_begin_solid(struct xa_context *r) { r->buffer_size = 0; - r->attrs_per_vertex = 1; - renderer_set_constants(r, PIPE_SHADER_FRAGMENT, r->solid_color, - 4 * sizeof(float)); + r->attrs_per_vertex = 2; } void renderer_solid(struct xa_context *r, - int x0, int y0, int x1, int y1) + int x0, int y0, int x1, int y1, float *color) { /* * debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n", * x0, y0, x1, y1, color[0], color[1], color[2], color[3]); */ - renderer_draw_conditional(r, 4 * 4); + renderer_draw_conditional(r, 4 * 8); /* 1st vertex */ - add_vertex_none(r, x0, y0); + add_vertex_color(r, x0, y0, color); /* 2nd vertex */ - add_vertex_none(r, x1, y0); + add_vertex_color(r, x1, y0, color); /* 3rd vertex */ - add_vertex_none(r, x1, y1); + add_vertex_color(r, x1, y1, color); /* 4th vertex */ - add_vertex_none(r, x0, y1); + add_vertex_color(r, x0, y1, color); } void @@ -566,9 +584,6 @@ renderer_begin_textures(struct xa_context *r) { r->attrs_per_vertex = 1 + r->num_bound_samplers; r->buffer_size = 0; - if (r->has_solid_src || r->has_solid_mask) - renderer_set_constants(r, PIPE_SHADER_FRAGMENT, r->solid_color, - 4 * sizeof(float)); } void @@ -598,19 +613,11 @@ renderer_texture(struct xa_context *r, switch(r->attrs_per_vertex) { case 2: renderer_draw_conditional(r, 4 * 8); - if (!r->has_solid_src) { - add_vertex_data1(r, - pos[0], pos[1], /* src */ - pos[4], pos[5], /* dst */ - width, height, - sampler_view[0]->texture, src_matrix); - } else { - add_vertex_data1(r, - pos[2], pos[3], /* mask */ - pos[4], pos[5], /* dst */ - width, height, - sampler_view[0]->texture, mask_matrix); - } + add_vertex_data1(r, + pos[0], pos[1], /* src */ + pos[4], pos[5], /* dst */ + width, height, + sampler_view[0]->texture, src_matrix); break; case 3: renderer_draw_conditional(r, 4 * 12); diff --git a/lib/mesa/src/gallium/state_trackers/xvmc/attributes.c b/lib/mesa/src/gallium/state_trackers/xvmc/attributes.c index 6e4d78a9a..2d8f00ba7 100644 --- a/lib/mesa/src/gallium/state_trackers/xvmc/attributes.c +++ b/lib/mesa/src/gallium/state_trackers/xvmc/attributes.c @@ -90,15 +90,15 @@ Status XvMCSetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int if (!attr) return XvMCBadContext; - if (strcmp(attr, XV_BRIGHTNESS) == 0) + if (strcmp(attr, XV_BRIGHTNESS)) context_priv->procamp.brightness = value / 1000.0f; - else if (strcmp(attr, XV_CONTRAST) == 0) + else if (strcmp(attr, XV_CONTRAST)) context_priv->procamp.contrast = value / 1000.0f + 1.0f; - else if (strcmp(attr, XV_SATURATION) == 0) + else if (strcmp(attr, XV_SATURATION)) context_priv->procamp.saturation = value / 1000.0f + 1.0f; - else if (strcmp(attr, XV_HUE) == 0) + else if (strcmp(attr, XV_HUE)) context_priv->procamp.hue = value / 1000.0f; - else if (strcmp(attr, XV_COLORSPACE) == 0) + else if (strcmp(attr, XV_COLORSPACE)) context_priv->color_standard = value ? VL_CSC_COLOR_STANDARD_BT_601 : VL_CSC_COLOR_STANDARD_BT_709; @@ -110,7 +110,7 @@ Status XvMCSetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int context_priv->color_standard, &context_priv->procamp, true, &csc ); - vl_compositor_set_csc_matrix(&context_priv->cstate, (const vl_csc_matrix *)&csc, 1.0f, 0.0f); + vl_compositor_set_csc_matrix(&context_priv->cstate, (const vl_csc_matrix *)&csc); XVMC_MSG(XVMC_TRACE, "[XvMC] Set attribute %s to value %d.\n", attr, value); @@ -134,15 +134,15 @@ Status XvMCGetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int if (!attr) return XvMCBadContext; - if (strcmp(attr, XV_BRIGHTNESS) == 0) + if (strcmp(attr, XV_BRIGHTNESS)) *value = context_priv->procamp.brightness * 1000; - else if (strcmp(attr, XV_CONTRAST) == 0) + else if (strcmp(attr, XV_CONTRAST)) *value = context_priv->procamp.contrast * 1000 - 1000; - else if (strcmp(attr, XV_SATURATION) == 0) + else if (strcmp(attr, XV_SATURATION)) *value = context_priv->procamp.saturation * 1000 + 1000; - else if (strcmp(attr, XV_HUE) == 0) + else if (strcmp(attr, XV_HUE)) *value = context_priv->procamp.hue * 1000; - else if (strcmp(attr, XV_COLORSPACE) == 0) + else if (strcmp(attr, XV_COLORSPACE)) *value = context_priv->color_standard == VL_CSC_COLOR_STANDARD_BT_709; else return BadName; diff --git a/lib/mesa/src/gallium/state_trackers/xvmc/surface.c b/lib/mesa/src/gallium/state_trackers/xvmc/surface.c index c450a2737..15eae59ff 100644 --- a/lib/mesa/src/gallium/state_trackers/xvmc/surface.c +++ b/lib/mesa/src/gallium/state_trackers/xvmc/surface.c @@ -34,7 +34,6 @@ #include "pipe/p_video_state.h" #include "pipe/p_state.h" -#include "util/macros.h" #include "util/u_inlines.h" #include "util/u_memory.h" #include "util/u_math.h" @@ -227,8 +226,8 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur XvMCContextPrivate *context_priv; XvMCSurfacePrivate *target_surface_priv; - ASSERTED XvMCSurfacePrivate *past_surface_priv; - ASSERTED XvMCSurfacePrivate *future_surface_priv; + XvMCSurfacePrivate *past_surface_priv; + XvMCSurfacePrivate *future_surface_priv; XvMCMacroBlock *xvmc_mb; XVMC_MSG(XVMC_TRACE, "[XvMC] Rendering to surface %p, with past %p and future %p\n", @@ -356,7 +355,6 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, struct pipe_context *pipe; struct vl_compositor *compositor; struct vl_compositor_state *cstate; - struct vl_screen *vscreen; XvMCSurfacePrivate *surface_priv; XvMCContextPrivate *context_priv; @@ -388,10 +386,9 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, pipe = context_priv->pipe; compositor = &context_priv->compositor; cstate = &context_priv->cstate; - vscreen = context_priv->vscreen; - tex = vscreen->texture_from_drawable(vscreen, (void *)drawable); - dirty_area = vscreen->get_dirty_area(vscreen); + tex = vl_screen_texture_from_drawable(context_priv->vscreen, drawable); + dirty_area = vl_screen_get_dirty_area(context_priv->vscreen); memset(&surf_templ, 0, sizeof(surf_templ)); surf_templ.format = tex->format; @@ -447,8 +444,11 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display. Pushing to front buffer.\n", surface); - pipe->screen->flush_frontbuffer(pipe->screen, tex, 0, 0, - vscreen->get_private(vscreen), NULL); + pipe->screen->flush_frontbuffer + ( + pipe->screen, tex, 0, 0, + vl_screen_get_private(context_priv->vscreen), NULL + ); if(dump_window == -1) { dump_window = debug_get_num_option("XVMC_DUMP", 0); @@ -489,7 +489,7 @@ Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status) *status = 0; if (surface_priv->fence) - if (!pipe->screen->fence_finish(pipe->screen, NULL, surface_priv->fence, 0)) + if (!pipe->screen->fence_finish(pipe->screen, surface_priv->fence, 0)) *status |= XVMC_RENDERING; return Success; diff --git a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_blocks.c b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_blocks.c index 53c29bc5a..a35838f33 100644 --- a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_blocks.c +++ b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_blocks.c @@ -25,8 +25,6 @@ * **************************************************************************/ -/* Force assertions, even on release builds. */ -#undef NDEBUG #include <assert.h> #include <stdio.h> #include <stdlib.h> diff --git a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_context.c b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_context.c index 81d26fcff..344ac76de 100644 --- a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_context.c +++ b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_context.c @@ -25,8 +25,6 @@ * **************************************************************************/ -/* Force assertions, even on release builds. */ -#undef NDEBUG #include <assert.h> #include <stdio.h> #include <stdlib.h> diff --git a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_rendering.c b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_rendering.c index c5494ecc8..b3b379481 100644 --- a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_rendering.c +++ b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_rendering.c @@ -25,8 +25,6 @@ * **************************************************************************/ -/* Force assertions, even on release builds. */ -#undef NDEBUG #include <assert.h> #include <stdio.h> #include <string.h> diff --git a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_subpicture.c b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_subpicture.c index 006972fa8..57ba1c751 100644 --- a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_subpicture.c +++ b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_subpicture.c @@ -25,8 +25,6 @@ * **************************************************************************/ -/* Force assertions, even on release builds. */ -#undef NDEBUG #include <assert.h> #include <stdio.h> #include <stdlib.h> diff --git a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_surface.c b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_surface.c index d5a121d5a..964ca82c5 100644 --- a/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_surface.c +++ b/lib/mesa/src/gallium/state_trackers/xvmc/tests/test_surface.c @@ -25,8 +25,6 @@ * **************************************************************************/ -/* Force assertions, even on release builds. */ -#undef NDEBUG #include <assert.h> #include <stdio.h> #include <stdlib.h> diff --git a/lib/mesa/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c b/lib/mesa/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c index dbd705639..4dc95babc 100644 --- a/lib/mesa/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c +++ b/lib/mesa/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c @@ -25,8 +25,6 @@ * **************************************************************************/ -/* Force assertions, even on release builds. */ -#undef NDEBUG #include <assert.h> #include <stdio.h> #include <string.h> @@ -123,11 +121,11 @@ void ParseArgs(int argc, char **argv, struct Config *config) while (token && !fail) { - if (strcmp(token, "i") == 0) + if (strcmp(token, "i")) config->mb_types |= MB_TYPE_I; - else if (strcmp(token, "p") == 0) + else if (strcmp(token, "p")) config->mb_types |= MB_TYPE_P; - else if (strcmp(token, "b") == 0) + else if (strcmp(token, "b")) config->mb_types |= MB_TYPE_B; else fail = 1; |