|
Packit |
1244b8 |
/*
|
|
Packit |
1244b8 |
* Copyright (C) 2015 Intel Corporation. All rights reserved.
|
|
Packit |
1244b8 |
*
|
|
Packit |
1244b8 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit |
1244b8 |
* you may not use this file except in compliance with the License.
|
|
Packit |
1244b8 |
* You may obtain a copy of the License at
|
|
Packit |
1244b8 |
*
|
|
Packit |
1244b8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
1244b8 |
*
|
|
Packit |
1244b8 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
1244b8 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
1244b8 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
1244b8 |
* See the License for the specific language governing permissions and
|
|
Packit |
1244b8 |
* limitations under the License.
|
|
Packit |
1244b8 |
*/
|
|
Packit |
1244b8 |
#ifndef oclcontext_h
|
|
Packit |
1244b8 |
#define oclcontext_h
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
#include "VideoCommonDefs.h"
|
|
Packit |
1244b8 |
#include "common/lock.h"
|
|
Packit |
1244b8 |
#include <CL/opencl.h>
|
|
Packit |
1244b8 |
#include <CL/cl_intel.h>
|
|
Packit |
1244b8 |
#include <map>
|
|
Packit |
1244b8 |
#include <string>
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
namespace YamiMediaCodec{
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
class OclDevice;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
typedef std::map<std::string, cl_kernel> OclKernelMap;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
class OclContext
|
|
Packit |
1244b8 |
{
|
|
Packit |
1244b8 |
public:
|
|
Packit |
1244b8 |
static SharedPtr<OclContext> create();
|
|
Packit |
1244b8 |
bool createKernel(const char* name, OclKernelMap& kernelMap);
|
|
Packit |
1244b8 |
bool releaseKernel(OclKernelMap& kernelMap);
|
|
Packit |
1244b8 |
YamiStatus createImageFromFdIntel(const cl_import_image_info_intel* info, cl_mem* mem);
|
|
Packit |
1244b8 |
YamiStatus createBufferFromFdIntel(const cl_import_buffer_info_intel* info, cl_mem* mem);
|
|
Packit |
1244b8 |
~OclContext();
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
cl_context m_context;
|
|
Packit |
1244b8 |
cl_command_queue m_queue;
|
|
Packit |
1244b8 |
private:
|
|
Packit |
1244b8 |
OclContext();
|
|
Packit |
1244b8 |
bool init();
|
|
Packit |
1244b8 |
SharedPtr<OclDevice> m_device;
|
|
Packit |
1244b8 |
DISALLOW_COPY_AND_ASSIGN(OclContext)
|
|
Packit |
1244b8 |
};
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
bool checkOclStatus(cl_int status, const char* err);
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
}
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
#endif //oclcontext_h
|