Lines Matching full:allocation
29 Allocation::Allocation(Context *rsc, const Type *type, uint32_t usages,
43 Allocation::Allocation(Context *rsc, const Allocation *alloc, const Type *type)
55 void Allocation::operator delete(void* ptr) {
57 Allocation *a = (Allocation*) ptr;
62 Allocation * Allocation::createAllocationStrided(Context *rsc, const Type *type, uint32_t usages,
65 // Allocation objects must use allocator specified by the driver
66 void* allocMem = rsc->mHal.funcs.allocRuntimeMem(sizeof(Allocation), 0);
69 rsc->setError(RS_ERROR_FATAL_DRIVER, "Couldn't allocate memory for Allocation");
74 Allocation *a = nullptr;
76 if (rsc->mHal.funcs.allocation.initOem != nullptr) {
77 a = new (allocMem) Allocation(rsc, type, usages, mc, nullptr);
78 success = rsc->mHal.funcs.allocation.initOem(rsc, a, type->getElement()->getHasReferences(), ptr);
80 rsc->setError(RS_ERROR_FATAL_DRIVER, "Allocation Init called with USAGE_OEM but driver does not support it");
85 a = new (allocMem) Allocation(rsc, type, usages, mc, ptr);
86 success = rsc->mHal.funcs.allocation.initStrided(rsc, a, type->getElement()->getHasReferences(), requiredAlignment);
89 a = new (allocMem) Allocation(rsc, type, usages, mc, ptr);
90 success = rsc->mHal.funcs.allocation.init(rsc, a, type->getElement()->getHasReferences());
94 rsc->setError(RS_ERROR_FATAL_DRIVER, "Allocation::Allocation, alloc failure");
102 Allocation * Allocation::createAllocation(Context *rsc, const Type *type, uint32_t usages,
104 return Allocation::createAllocationStrided(rsc, type, usages, mc, ptr, kMinimumRSAlignment);
107 Allocation * Allocation::createAdapter(Context *rsc, const Allocation *alloc, const Type *type) {
108 // Allocation objects must use allocator specified by the driver
109 void* allocMem = rsc->mHal.funcs.allocRuntimeMem(sizeof(Allocation), 0);
112 rsc->setError(RS_ERROR_FATAL_DRIVER, "Couldn't allocate memory for Allocation");
116 Allocation *a = new (allocMem) Allocation(rsc, alloc, type);
118 if (!rsc->mHal.funcs.allocation.initAdapter(rsc, a)) {
119 rsc->setError(RS_ERROR_FATAL_DRIVER, "Allocation::Allocation, alloc failure");
127 void Allocation::adapterOffset(Context *rsc, const uint32_t *offsets, size_t len) {
140 rsc->mHal.funcs.allocation.adapterOffset(rsc, this);
145 void Allocation::updateCache() {
154 Allocation::~Allocation() {
163 mRSC->mHal.funcs.allocation.destroy(mRSC, this);
166 void Allocation::syncAll(Context *rsc, RsAllocationUsageType src) {
167 rsc->mHal.funcs.allocation.syncAll(rsc, this, src);
170 void * Allocation::getPointer(const Context *rsc, uint32_t lod, RsAllocationCubemapFace face,
180 if (mRSC->mHal.funcs.allocation.getPointer != nullptr) {
182 mRSC->mHal.funcs.allocation.getPointer(rsc, this, lod, face, z, array);
192 void Allocation::data(Context *rsc, uint32_t xoff, uint32_t lod,
198 sprintf(buf, "Allocation::subData called with mismatched size expected %zu, got %zu",
205 rsc->mHal.funcs.allocation.data1D(rsc, this, xoff, lod, count, data, sizeBytes);
209 void Allocation::data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
211 rsc->mHal.funcs.allocation.data2D(rsc, this, xoff, yoff, lod, face, w, h, data, sizeBytes, stride);
215 void Allocation::data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff,
218 rsc->mHal.funcs.allocation.data3D(rsc, this, xoff, yoff, zoff, lod, w, h, d, data, sizeBytes, stride);
222 void Allocation::read(Context *rsc, uint32_t xoff, uint32_t lod,
228 sprintf(buf, "Allocation::read called with mismatched size expected %zu, got %zu",
235 rsc->mHal.funcs.allocation.read1D(rsc, this, xoff, lod, count, data, sizeBytes);
238 void Allocation::read(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
247 sprintf(buf, "Allocation size mismatch, expected %zu, got %zu", (lineSize * h), sizeBytes);
253 rsc->mHal.funcs.allocation.read2D(rsc, this, xoff, yoff, lod, face, w, h, data, sizeBytes, stride);
256 void Allocation::read(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
264 rsc->mHal.funcs.allocation.read3D(rsc, this, xoff, yoff, zoff, lod, w, h, d, data, sizeBytes, stride);
268 void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y, uint32_t z,
299 rsc->mHal.funcs.allocation.elementData(rsc, this, x, y, z, data, cIdx, sizeBytes);
303 void Allocation::elementRead(Context *rsc, uint32_t x, uint32_t y, uint32_t z,
334 rsc->mHal.funcs.allocation.elementRead(rsc, this, x, y, z, data, cIdx, sizeBytes);
337 void Allocation::addProgramToDirty(const Program *p) {
341 void Allocation::removeProgramToDirty(const Program *p) {
351 void Allocation::dumpLOGV(const char *prefix) const {
361 ALOGV("%s allocation ptr=%p mUsageFlags=0x04%x, mMipmapControl=0x%04x",
365 uint32_t Allocation::getPackedSize() const {
370 void Allocation::writePackedData(Context *rsc, const Type *type,
419 void Allocation::unpackVec3Allocation(Context *rsc, const void *data, size_t dataSize) {
421 uint8_t *dst = (uint8_t *)rsc->mHal.funcs.allocation.lock1D(rsc, this);
424 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
427 void Allocation::packVec3Allocation(Context *rsc, OStream *stream) const {
432 const uint8_t *src = (const uint8_t*)rsc->mHal.funcs.allocation.lock1D(rsc, this);
439 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
442 void Allocation::serialize(Context *rsc, OStream *stream) const {
458 stream->addByteArray(rsc->mHal.funcs.allocation.lock1D(rsc, this), dataSize);
459 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
466 Allocation *Allocation::createFromStream(Context *rsc, IStream *stream) {
471 "allocation loading failed due to corrupt file. (invalid id)\n");
483 Allocation *alloc = Allocation::createAllocation(rsc, type, RS_ALLOCATION_USAGE_SCRIPT);
486 // Number of bytes we wrote out for this allocation
493 "allocation loading failed due to corrupt file. (invalid size)\n");
502 // Read in all of our allocation data
512 void Allocation::sendDirty(const Context *rsc) const {
518 mRSC->mHal.funcs.allocation.markDirty(rsc, this);
521 void Allocation::incRefs(const void *ptr, size_t ct, size_t startOff) const {
525 void Allocation::decRefs(const void *ptr, size_t ct, size_t startOff) const {
532 void Allocation::callUpdateCacheObject(const Context *rsc, void *dstObj) const {
533 if (rsc->mHal.funcs.allocation.updateCachedObject != nullptr) {
534 rsc->mHal.funcs.allocation.updateCachedObject(rsc, this, (rs_allocation *)dstObj);
541 void Allocation::freeChildrenUnlocked () {
542 void *ptr = mRSC->mHal.funcs.allocation.lock1D(mRSC, this);
544 mRSC->mHal.funcs.allocation.unlock1D(mRSC, this);
547 bool Allocation::freeChildren() {
556 void Allocation::copyRange1D(Context *rsc, const Allocation *src, int32_t srcOff, int32_t destOff, int32_t len) {
559 void Allocation::resize1D(Context *rsc, uint32_t dimX) {
567 decRefs(rsc->mHal.funcs.allocation.lock1D(rsc, this), oldDimX - dimX, dimX);
568 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
570 rsc->mHal.funcs.allocation.resize(rsc, this, t.get(), mHal.state.hasReferences);
575 void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {
580 Allocation::NewBufferListener::NewBufferListener(uint32_t numAlloc) {
581 alloc = new const Allocation *[numAlloc];
588 Allocation::NewBufferListener::~NewBufferListener() {
592 void Allocation::NewBufferListener::onFrameAvailable(const BufferItem& /* item */) {
602 void Allocation::setupGrallocConsumer(const Context *rsc, uint32_t numAlloc) {
623 void * Allocation::getSurface(const Context *rsc) {
637 //return rsc->mHal.funcs.allocation.getSurface(rsc, this);
640 void Allocation::shareBufferQueue(const Context *rsc, const Allocation *alloc) {
657 void Allocation::setSurface(const Context *rsc, RsNativeWindow sur) {
659 rsc->mHal.funcs.allocation.setSurface(rsc, this, nw);
662 void Allocation::ioSend(const Context *rsc) {
663 rsc->mHal.funcs.allocation.ioSend(rsc, this);
666 void Allocation::ioReceive(const Context *rsc) {
674 rsc->mHal.funcs.allocation.ioReceive(rsc, this);
685 bool Allocation::hasSameDims(const Allocation *other) const {
706 Allocation *a = static_cast<Allocation *>(va);
712 Allocation *alloc = static_cast<Allocation *>(va);
713 rsc->mHal.funcs.allocation.generateMipmaps(rsc, alloc);
717 Allocation *a = static_cast<Allocation *>(va);
725 Allocation *a = static_cast<Allocation *>(va);
731 Allocation *a = static_cast<Allocation *>(va);
737 Allocation *a = static_cast<Allocation *>(va);
743 Allocation *a = static_cast<Allocation *>(va);
749 Allocation *a = static_cast<Allocation *>(va);
755 Allocation *a = static_cast<Allocation *>(va);
770 Allocation *a = static_cast<Allocation *>(va);
775 Allocation *a = static_cast<Allocation *>(va);
782 Allocation * alloc = Allocation::createAllocation(rsc, static_cast<Type *>(vtype), usages, mipmaps, (void*)ptr);
794 Allocation * alloc = Allocation::createAllocationStrided(rsc, static_cast<Type *>(vtype), usages, mipmaps,
809 Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc);
811 ALOGE("Memory allocation failure");
818 rsc->mHal.funcs.allocation.generateMipmaps(rsc, texAlloc);
830 // Cubemap allocation's faces should be Width by Width each.
834 Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc);
836 ALOGE("Memory allocation failure");
856 rsc->mHal.funcs.allocation.generateMipmaps(rsc, texAlloc);
871 Allocation *dst = static_cast<Allocation *>(dstAlloc);
872 Allocation *src= static_cast<Allocation *>(srcAlloc);
873 rsc->mHal.funcs.allocation.allocData2D(rsc, dst, dstXoff, dstYoff, dstMip,
888 Allocation *dst = static_cast<Allocation *>(dstAlloc);
889 AllocationAllocation *>(srcAlloc);
890 rsc->mHal.funcs.allocation.allocData3D(rsc, dst, dstXoff, dstYoff, dstZoff, dstMip,
896 Allocation *alloc = static_cast<Allocation *>(valloc);
901 Allocation *alloc = static_cast<Allocation *>(valloc);
907 Allocation *alloc1 = static_cast<Allocation *>(valloc1);
908 Allocation *alloc2 = static_cast<Allocation *>(valloc2);
913 Allocation *alloc = static_cast<Allocation *>(valloc);
918 Allocation *alloc = static_cast<Allocation *>(valloc);
923 Allocation *alloc = static_cast<Allocation *>(valloc);
931 Allocation *alloc = static_cast<Allocation *>(valloc);
939 Allocation *a = static_cast<Allocation *>(va);
940 rsc->mHal.funcs.allocation.read1D(rsc, a, xoff, lod, count, data, sizeBytes);
945 Allocation *a = static_cast<Allocation *>(va);
952 Allocation *a = static_cast<Allocation *>(va);
960 Allocation *a = static_cast<Allocation *>(va);
967 Allocation * alloc = Allocation::createAdapter(rsc,
968 static_cast<Allocation *>(vbase), static_cast<Type *>(vwindow));
977 Allocation *a = static_cast<Allocation *>(va);