mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 22:00:11 +01:00
gfxstream: kumquat: unmap memory when needed
Forgot this. Reviewed-by: Aaron Ruby <aruby@blackberry.com> Acked-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
parent
f240f5677a
commit
aa4e85ab42
3 changed files with 16 additions and 9 deletions
|
|
@ -40,7 +40,6 @@ class VirtGpuKumquatResource : public std::enable_shared_from_this<VirtGpuKumqua
|
|||
// Not owned. Really should use a ScopedFD for this, but doesn't matter since we have a
|
||||
// singleton deviceimplemenentation anyways.
|
||||
struct virtgpu_kumquat* mVirtGpu = nullptr;
|
||||
;
|
||||
|
||||
uint32_t mBlobHandle;
|
||||
uint32_t mResourceHandle;
|
||||
|
|
@ -49,13 +48,15 @@ class VirtGpuKumquatResource : public std::enable_shared_from_this<VirtGpuKumqua
|
|||
|
||||
class VirtGpuKumquatResourceMapping : public VirtGpuResourceMapping {
|
||||
public:
|
||||
VirtGpuKumquatResourceMapping(VirtGpuResourcePtr blob, uint8_t* ptr, uint64_t size);
|
||||
VirtGpuKumquatResourceMapping(VirtGpuResourcePtr blob, struct virtgpu_kumquat* virtGpu,
|
||||
uint8_t* ptr, uint64_t size);
|
||||
~VirtGpuKumquatResourceMapping(void);
|
||||
|
||||
uint8_t* asRawPtr(void) override;
|
||||
|
||||
private:
|
||||
VirtGpuResourcePtr mBlob;
|
||||
struct virtgpu_kumquat* mVirtGpu = nullptr;
|
||||
uint8_t* mPtr;
|
||||
uint64_t mSize;
|
||||
};
|
||||
|
|
@ -78,6 +79,5 @@ class VirtGpuKumquatDevice : public VirtGpuDevice {
|
|||
|
||||
private:
|
||||
struct virtgpu_kumquat* mVirtGpu = nullptr;
|
||||
;
|
||||
struct VirtGpuCaps mCaps;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ VirtGpuResourceMappingPtr VirtGpuKumquatResource::createMapping() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return std::make_shared<VirtGpuKumquatResourceMapping>(shared_from_this(), (uint8_t*)map.ptr,
|
||||
mSize);
|
||||
return std::make_shared<VirtGpuKumquatResourceMapping>(shared_from_this(), mVirtGpu,
|
||||
(uint8_t*)map.ptr, mSize);
|
||||
}
|
||||
|
||||
int VirtGpuKumquatResource::exportBlob(struct VirtGpuExternalHandle& handle) {
|
||||
|
|
|
|||
|
|
@ -15,11 +15,18 @@
|
|||
*/
|
||||
|
||||
#include "VirtGpuKumquat.h"
|
||||
#include "cutils/log.h"
|
||||
|
||||
VirtGpuKumquatResourceMapping::VirtGpuKumquatResourceMapping(VirtGpuResourcePtr blob, uint8_t* ptr,
|
||||
uint64_t size)
|
||||
: mBlob(blob), mPtr(ptr), mSize(size) {}
|
||||
VirtGpuKumquatResourceMapping::VirtGpuKumquatResourceMapping(VirtGpuResourcePtr blob,
|
||||
struct virtgpu_kumquat* virtGpu,
|
||||
uint8_t* ptr, uint64_t size)
|
||||
: mBlob(blob), mVirtGpu(virtGpu), mPtr(ptr), mSize(size) {}
|
||||
|
||||
VirtGpuKumquatResourceMapping::~VirtGpuKumquatResourceMapping(void) { return; }
|
||||
VirtGpuKumquatResourceMapping::~VirtGpuKumquatResourceMapping(void) {
|
||||
int32_t ret = virtgpu_kumquat_resource_unmap(mVirtGpu, mBlob->getBlobHandle());
|
||||
if (ret) {
|
||||
ALOGE("failed to unmap buffer");
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t* VirtGpuKumquatResourceMapping::asRawPtr(void) { return mPtr; }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue