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
269 라인
6.3 KiB
C++
269 라인
6.3 KiB
C++
//
|
|
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
|
|
//
|
|
|
|
#ifndef OBJECT_HPP_
|
|
#define OBJECT_HPP_
|
|
|
|
#include "top.hpp"
|
|
#include "os/alloc.hpp"
|
|
#include "thread/monitor.hpp"
|
|
#include "utils/util.hpp"
|
|
|
|
#define CL_TYPES_DO(F) \
|
|
/* OpenCL type Runtime type */ \
|
|
F(cl_context, Context) \
|
|
F(cl_event, Event) \
|
|
F(cl_command_queue, CommandQueue) \
|
|
F(cl_kernel, Kernel) \
|
|
F(cl_program, Program) \
|
|
F(cl_device_id, Device) \
|
|
F(cl_mem, Memory) \
|
|
F(cl_sampler, Sampler) \
|
|
F(cl_counter_amd, Counter) \
|
|
F(cl_perfcounter_amd, PerfCounter) \
|
|
F(cl_threadtrace_amd, ThreadTrace)
|
|
|
|
// Forward declare ::cl_* types and amd::Class types
|
|
//
|
|
|
|
#define DECLARE_CL_TYPES(CL,AMD) \
|
|
namespace amd { class AMD; } \
|
|
typedef struct _##CL { } * CL;
|
|
|
|
CL_TYPES_DO(DECLARE_CL_TYPES);
|
|
|
|
#undef DECLARE_CL_TYPES
|
|
|
|
struct KHRicdVendorDispatchRec;
|
|
|
|
namespace amd {
|
|
|
|
// Define the cl_*_type tokens for type checking.
|
|
//
|
|
|
|
#define DEFINE_CL_TOKENS(CL,ignored) T##CL,
|
|
|
|
enum cl_token
|
|
{
|
|
Tinvalid = 0,
|
|
CL_TYPES_DO(DEFINE_CL_TOKENS)
|
|
numTokens
|
|
};
|
|
|
|
#undef DEFINE_CL_TOKENS
|
|
|
|
const size_t RuntimeObjectAlignment =
|
|
NextPowerOfTwo<numTokens>::value;
|
|
|
|
//! \cond ignore
|
|
template <typename T>
|
|
struct as_internal
|
|
{ typedef void type; };
|
|
|
|
template <typename T>
|
|
struct as_external
|
|
{ typedef void type; };
|
|
|
|
template <typename T>
|
|
struct class_token
|
|
{ static const cl_token value = Tinvalid; };
|
|
|
|
#define DEFINE_CL_TRAITS(CL,AMD) \
|
|
\
|
|
template <> \
|
|
struct class_token<AMD> \
|
|
{ static const cl_token value = T##CL; }; \
|
|
\
|
|
template <> \
|
|
struct as_internal<_##CL> \
|
|
{ typedef AMD type; }; \
|
|
template <> \
|
|
struct as_internal<const _##CL> \
|
|
{ typedef AMD const type; }; \
|
|
\
|
|
template <> \
|
|
struct as_external<AMD> \
|
|
{ typedef _##CL type; }; \
|
|
template <> \
|
|
struct as_external<const AMD> \
|
|
{ typedef _##CL const type; };
|
|
|
|
CL_TYPES_DO(DEFINE_CL_TRAITS);
|
|
|
|
#undef DEFINE_CL_TRAITS
|
|
//! \endcond
|
|
|
|
struct ICDDispatchedObject
|
|
{
|
|
static struct KHRicdVendorDispatchRec icdVendorDispatch_[];
|
|
const struct KHRicdVendorDispatchRec* const dispatch_;
|
|
|
|
protected:
|
|
ICDDispatchedObject() : dispatch_(icdVendorDispatch_) { }
|
|
|
|
public:
|
|
static bool isValidHandle(const void* handle)
|
|
{
|
|
return handle != NULL;
|
|
}
|
|
|
|
const void* handle() const
|
|
{
|
|
return static_cast<const ICDDispatchedObject*>(this);
|
|
}
|
|
void* handle()
|
|
{
|
|
return static_cast<ICDDispatchedObject*>(this);
|
|
}
|
|
|
|
template<typename T>
|
|
static const T* fromHandle(const void *handle)
|
|
{
|
|
return static_cast<const T*>(
|
|
reinterpret_cast<const ICDDispatchedObject*>(handle));
|
|
}
|
|
template<typename T>
|
|
static T* fromHandle(void *handle)
|
|
{
|
|
return static_cast<T*>(
|
|
reinterpret_cast<ICDDispatchedObject*>(handle));
|
|
}
|
|
};
|
|
|
|
#define OCL_MAX_KEYS 8
|
|
|
|
/*! The object metadata container.
|
|
*/
|
|
class ObjectMetadata
|
|
{
|
|
|
|
public:
|
|
typedef size_t Key;
|
|
typedef void* Value;
|
|
|
|
private:
|
|
typedef void (CL_CALLBACK * Destructor)(Value);
|
|
|
|
static Atomic<Key> nextKey_;
|
|
static Destructor destructors_[OCL_MAX_KEYS];
|
|
|
|
Atomic<Value*> values_;
|
|
|
|
public:
|
|
static bool check(Key key);
|
|
|
|
static Key createKey(Destructor destructor = NULL);
|
|
|
|
ObjectMetadata() : values_(NULL) { }
|
|
~ObjectMetadata();
|
|
|
|
Value getValueForKey(Key key) const;
|
|
|
|
bool setValueForKey(Key key, Value value);
|
|
};
|
|
|
|
/*! \brief For all OpenCL/Runtime objects.
|
|
*/
|
|
class RuntimeObject : public ReferenceCountedObject, public ICDDispatchedObject
|
|
{
|
|
private:
|
|
ObjectMetadata metadata_;
|
|
|
|
public:
|
|
|
|
enum ObjectType {
|
|
ObjectTypeContext = 0,
|
|
ObjectTypeDevice = 1,
|
|
ObjectTypeMemory = 2,
|
|
ObjectTypeKernel = 3,
|
|
ObjectTypeCounter = 4,
|
|
ObjectTypePerfCounter = 5,
|
|
ObjectTypeEvent = 6,
|
|
ObjectTypeProgram = 7,
|
|
ObjectTypeQueue = 8,
|
|
ObjectTypeSampler = 9,
|
|
ObjectTypeThreadTrace = 10
|
|
};
|
|
|
|
ObjectMetadata& metadata() { return metadata_; }
|
|
virtual ObjectType objectType() const =0 ;
|
|
};
|
|
|
|
template <typename T>
|
|
class SharedReference : public EmbeddedObject
|
|
{
|
|
private:
|
|
T& reference_;
|
|
|
|
private:
|
|
// do not copy shared references.
|
|
SharedReference<T>& operator = (const SharedReference<T>& sref);
|
|
|
|
public:
|
|
explicit SharedReference(T& reference)
|
|
: reference_(reference)
|
|
{
|
|
reference_.retain();
|
|
}
|
|
|
|
~SharedReference()
|
|
{
|
|
reference_.release();
|
|
}
|
|
|
|
T& operator ()() const { return reference_; }
|
|
};
|
|
|
|
/*! \brief A 1,2 or 3D coordinate.
|
|
*!
|
|
*! Note, dimensionality is only defined for sizes, and is given by the number
|
|
*! of non-zero elements. (i.e. a 1D line is not the same as a 2D plane with width 1)
|
|
*/
|
|
|
|
struct Coord3D
|
|
{
|
|
size_t c[3];
|
|
|
|
Coord3D(size_t d0, size_t d1 = 0, size_t d2 = 0)
|
|
{
|
|
c[0]=d0; c[1]=d1; c[2]=d2;
|
|
}
|
|
const size_t& operator[] (size_t idx) const
|
|
{
|
|
assert(idx < 3);
|
|
return c[idx];
|
|
}
|
|
bool operator== (const Coord3D& rhs) const
|
|
{
|
|
return c[0] == rhs.c[0] && c[1] == rhs.c[1] && c[2] == rhs.c[2];
|
|
}
|
|
};
|
|
|
|
} // namespace amd
|
|
|
|
template <typename CL>
|
|
typename amd::as_internal<CL>::type*
|
|
as_amd(CL* cl_obj)
|
|
{
|
|
return cl_obj == NULL ? NULL : amd::RuntimeObject::fromHandle<
|
|
typename amd::as_internal<CL>::type>(static_cast<void*>(cl_obj));
|
|
}
|
|
|
|
template <typename AMD>
|
|
typename amd::as_external<AMD>::type*
|
|
as_cl(AMD* amd_obj)
|
|
{
|
|
return amd_obj == NULL ? NULL : static_cast<
|
|
typename amd::as_external<AMD>::type*>(amd_obj->handle());
|
|
}
|
|
|
|
template <typename CL>
|
|
bool
|
|
is_valid(CL* handle)
|
|
{
|
|
return amd::as_internal<CL>::type::isValidHandle(handle);
|
|
}
|
|
|
|
#endif /*OBJECT_HPP_*/
|