2018-02-18 05:26:28 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-02-18 05:26:28 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-02-18 05:26:28 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "runtime/helpers/properties_helper.h"
|
|
|
|
|
|
|
|
#include <mutex>
|
2019-02-27 18:39:32 +08:00
|
|
|
#include <vector>
|
2018-02-18 05:26:28 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-02-18 05:26:28 +08:00
|
|
|
|
|
|
|
class MapOperationsHandler {
|
|
|
|
public:
|
|
|
|
virtual ~MapOperationsHandler() = default;
|
|
|
|
|
2018-04-04 15:29:48 +08:00
|
|
|
bool add(void *ptr, size_t ptrLength, cl_map_flags &mapFlags, MemObjSizeArray &size, MemObjOffsetArray &offset, uint32_t mipLevel);
|
2018-02-18 05:26:28 +08:00
|
|
|
void remove(void *mappedPtr);
|
|
|
|
bool find(void *mappedPtr, MapInfo &outMapInfo);
|
|
|
|
size_t size() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool isOverlapping(MapInfo &inputMapInfo);
|
|
|
|
std::vector<MapInfo> mappedPointers;
|
|
|
|
mutable std::mutex mtx;
|
|
|
|
};
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|