d0b51ccdbf
EPR #421679 - remove all source code related to open video Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/Makefile#3 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.cpp#15 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.def#5 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.h#7 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.rc#2 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecodeTypes.h#6 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVEncode.cpp#37 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVEncode.h#11 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVEncodeTypes.h#16 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.cpp#6 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.def#3 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.h#5 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.rc#3 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.sln#5 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.vcxproj#11 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.vcxproj.filters#3 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo_2008.sln#2 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo_2008.vcproj#2 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/atiumdva.cap#2 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build.bat#2 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build/Makefile#6 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build/Makefile.ov#18 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build/Makefile.ovd#27 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/buildOV/Makefile#5 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/res/OpenVideo.rc2#2 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#113 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_common.hpp#17 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#43 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_device.cpp#59 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_open_video.cpp#35 delete ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_open_video_amd.h#20 delete ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.cpp#273 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.hpp#91 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuvirtual.cpp#24 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuvirtual.hpp#12 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#247 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#512 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#145 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#311 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.hpp#91 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#366 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#130 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp#73 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.h#45 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.cpp#92 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.hpp#49 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsavirtual.hpp#28 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#34 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#15 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsavirtual.hpp#20 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#78 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#21 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.hpp#16 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/object.hpp#15 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/video_session.hpp#13 delete ... //depot/stg/opencl/drivers/opencl/runtime/top.hpp#22 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#235 edit
245 wiersze
7.2 KiB
C++
245 wiersze
7.2 KiB
C++
//
|
|
// Copyright 2012 Advanced Micro Devices, Inc. All rights reserved.
|
|
//
|
|
|
|
/*! \file commandqueue.hpp
|
|
* \brief Declarations CommandQueue object.
|
|
*
|
|
* \author Laurent Morichetti (laurent.morichetti@amd.com)
|
|
* \date October 2008
|
|
*/
|
|
|
|
#ifndef COMMAND_QUEUE_HPP_
|
|
#define COMMAND_QUEUE_HPP_
|
|
|
|
#include "thread/thread.hpp"
|
|
#include "platform/object.hpp"
|
|
#include "platform/command.hpp"
|
|
/*! \brief Holds commands that will be executed on a specific device.
|
|
*
|
|
* \details A command queue is created on a specific device in
|
|
* a Context. A new virtual device will be instantiated from the given
|
|
* device and an execution environment (a thread) will be created to run
|
|
* the CommandQueue::loop() function.
|
|
*/
|
|
|
|
namespace amd {
|
|
|
|
class HostQueue;
|
|
class DeviceQueue;
|
|
|
|
class CommandQueue : public RuntimeObject
|
|
{
|
|
public:
|
|
struct Properties
|
|
{
|
|
typedef cl_command_queue_properties value_type;
|
|
const value_type mask_;
|
|
value_type value_;
|
|
|
|
Properties(value_type mask, value_type value) :
|
|
mask_(mask), value_(value & mask)
|
|
{ }
|
|
|
|
bool set(value_type bits) {
|
|
if ((mask_ & bits) != bits) {
|
|
return false;
|
|
}
|
|
value_ |= bits;
|
|
return true;
|
|
}
|
|
|
|
bool clear(value_type bits) {
|
|
if ((mask_ & bits) != bits) {
|
|
return false;
|
|
}
|
|
value_ &= ~bits;
|
|
return true;
|
|
}
|
|
|
|
bool test(value_type bits) const {
|
|
return (value_ & bits) != 0;
|
|
}
|
|
};
|
|
|
|
//! Return the context this command queue is part of.
|
|
Context& context() const { return context_(); }
|
|
|
|
//! Return the device for this command queue.
|
|
Device& device() const { return device_; }
|
|
|
|
//! Return the command queue properties.
|
|
Properties properties() const { return properties_; }
|
|
Properties& properties() { return properties_; }
|
|
|
|
//! Returns the base class object
|
|
CommandQueue* asCommandQueue() { return this; }
|
|
|
|
virtual ~CommandQueue() {}
|
|
|
|
//! Returns TRUE if the object was successfully created
|
|
virtual bool create() = 0;
|
|
|
|
//! RTTI internal implementation
|
|
virtual ObjectType objectType() const { return ObjectTypeQueue; }
|
|
|
|
//! Rturns HostQueue object
|
|
virtual HostQueue* asHostQueue() { return NULL; }
|
|
|
|
//! Returns DeviceQueue object
|
|
virtual DeviceQueue* asDeviceQueue() { return NULL; }
|
|
|
|
//! Returns the number or requested real time CUs
|
|
uint rtCUs() const { return rtCUs_; }
|
|
|
|
protected:
|
|
//! CommandQueue constructor is protected
|
|
//! to keep the CommandQueue class as a virtual interface
|
|
CommandQueue(
|
|
Context& context, //!< Context object
|
|
Device& device, //!< Device object
|
|
cl_command_queue_properties properties, //!< Queue properties
|
|
cl_command_queue_properties propMask, //!< Queue properties mask
|
|
uint rtCUs = 0 //!< Avaialble real time compute units
|
|
)
|
|
: properties_(propMask, properties)
|
|
, rtCUs_(rtCUs)
|
|
, queueLock_("CommandQueue::queueLock")
|
|
, device_(device)
|
|
, context_(context) {}
|
|
|
|
Properties properties_; //!< Queue properties
|
|
uint rtCUs_; //!< The number of used RT compute units
|
|
Monitor queueLock_; //!< Lock protecting the queue
|
|
Device& device_; //!< The device
|
|
SharedReference<Context> context_; //!< The context of this command queue
|
|
|
|
private:
|
|
//! Disable copy constructor
|
|
CommandQueue(const CommandQueue&);
|
|
|
|
//! Disable assignment
|
|
CommandQueue& operator=(const CommandQueue&);
|
|
};
|
|
|
|
|
|
class HostQueue : public CommandQueue
|
|
{
|
|
class Thread : public amd::Thread
|
|
{
|
|
public:
|
|
//! True if this command queue thread is accepting commands.
|
|
volatile bool acceptingCommands_;
|
|
|
|
//! Create a new thread
|
|
Thread() : amd::Thread("Command Queue Thread", CQ_THREAD_STACK_SIZE),
|
|
acceptingCommands_(false), virtualDevice_(NULL)
|
|
{ }
|
|
|
|
//! The command queue thread entry point.
|
|
void run(void *data) {
|
|
HostQueue* queue = static_cast<HostQueue*>(data);
|
|
virtualDevice_ = queue->device().createVirtualDevice(queue);
|
|
if (virtualDevice_ != NULL) {
|
|
queue->loop(virtualDevice_);
|
|
if (virtualDevice_->terminate()) {
|
|
delete virtualDevice_;
|
|
}
|
|
}
|
|
else {
|
|
acceptingCommands_ = false;
|
|
queue->flush();
|
|
}
|
|
}
|
|
|
|
//! Get virtual device for the current thread
|
|
device::VirtualDevice* vdev() const { return virtualDevice_; }
|
|
|
|
private:
|
|
device::VirtualDevice* virtualDevice_; //!< Virtual device for this thread
|
|
|
|
} thread_; //!< The command queue thread instance.
|
|
|
|
private:
|
|
ConcurrentLinkedQueue<Command*> queue_; //!< The queue.
|
|
|
|
//! Await commands and execute them as they become ready.
|
|
void loop(device::VirtualDevice* virtualDevice);
|
|
|
|
protected:
|
|
virtual bool terminate();
|
|
|
|
public:
|
|
/*! \brief Construct a new host queue.
|
|
*
|
|
* \note A new virtual device instance will be created from the
|
|
* given device.
|
|
*/
|
|
HostQueue(
|
|
Context& context,
|
|
Device& device,
|
|
cl_command_queue_properties properties,
|
|
uint queueRTCUs = 0
|
|
);
|
|
|
|
//! Returns TRUE if this command queue can accept commands.
|
|
virtual bool create() { return thread_.acceptingCommands_; }
|
|
|
|
//! Append the given command to the queue.
|
|
void append(Command& command);
|
|
|
|
//! Return the thread object running the command loop.
|
|
const Thread& thread() const { return thread_; }
|
|
|
|
//! Signal to start processing the commands in the queue.
|
|
void flush () { ScopedLock sl(queueLock_); queueLock_.notify(); }
|
|
|
|
//! Finish all queued commands
|
|
void finish();
|
|
|
|
//! Get virtual device for the current command queue
|
|
device::VirtualDevice* vdev() const { return thread_.vdev(); }
|
|
|
|
//! Return the current queue as the HostQueue
|
|
virtual HostQueue* asHostQueue() { return this; }
|
|
};
|
|
|
|
|
|
class DeviceQueue : public CommandQueue
|
|
{
|
|
public:
|
|
DeviceQueue(
|
|
Context& context, //!< Context object
|
|
Device& device, //!< Device object
|
|
cl_command_queue_properties properties, //!< Queue properties
|
|
uint size //!< Device queue size
|
|
)
|
|
: CommandQueue(context, device, properties, device.info().queueOnDeviceProperties_
|
|
| CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT)
|
|
, size_(size)
|
|
, virtualDevice_(NULL) {}
|
|
|
|
virtual ~DeviceQueue();
|
|
|
|
//! Returns TRUE if device queue was successfully created
|
|
virtual bool create();
|
|
|
|
//! Return the current queue as the DeviceQueue
|
|
virtual DeviceQueue* asDeviceQueue() { return this; }
|
|
|
|
//! Returns the size of device queue
|
|
uint size() const { return size_; }
|
|
|
|
//! Returns virtual device for this device queue
|
|
device::VirtualDevice* vDev() const { return virtualDevice_; }
|
|
|
|
//! Returns the queue lock
|
|
Monitor& lock() { return queueLock_; }
|
|
|
|
private:
|
|
uint size_; //!< Device queue size
|
|
device::VirtualDevice* virtualDevice_; //!< Virtual device for this queue
|
|
};
|
|
} //namespace amd
|
|
|
|
#endif //COMMAND_QUEUE_HPP_
|