Lines Matching refs:rsc
29 Allocation::Allocation(Context *rsc, const Type *type, uint32_t usages,
31 : ObjectBase(rsc) {
43 Allocation::Allocation(Context *rsc, const Allocation *alloc, const Type *type)
44 : ObjectBase(rsc) {
62 Allocation * Allocation::createAllocationStrided(Context *rsc, const Type *type, uint32_t usages,
66 void* allocMem = rsc->mHal.funcs.allocRuntimeMem(sizeof(Allocation), 0);
69 rsc->setError(RS_ERROR_FATAL_DRIVER, "Couldn't allocate memory for Allocation");
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) {
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);
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,
182 mRSC->mHal.funcs.allocation.getPointer(rsc, this, lod, face, z, array);
192 void Allocation::data(Context *rsc, uint32_t xoff, uint32_t lod,
200 rsc->setError(RS_ERROR_BAD_VALUE, buf);
205 rsc->mHal.funcs.allocation.data1D(rsc, this, xoff, lod, count, data, sizeBytes);
206 sendDirty(rsc);
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);
212 sendDirty(rsc);
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);
219 sendDirty(rsc);
222 void Allocation::read(Context *rsc, uint32_t xoff, uint32_t lod,
230 rsc->setError(RS_ERROR_BAD_VALUE, buf);
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,
248 rsc->setError(RS_ERROR_BAD_VALUE, buf);
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,
273 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
278 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData Y offset out of range.");
283 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData Z offset out of range.");
288 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
295 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
299 rsc->mHal.funcs.allocation.elementData(rsc, this, x, y, z, data, cIdx, sizeBytes);
300 sendDirty(rsc);
303 void Allocation::elementRead(Context *rsc, uint32_t x, uint32_t y, uint32_t z,
308 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
313 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData Y offset out of range.");
318 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData Z offset out of range.");
323 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
330 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
334 rsc->mHal.funcs.allocation.elementRead(rsc, this, x, y, z, data, cIdx, sizeBytes);
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);
423 writePackedData(rsc, getType(), dst, src, true);
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);
435 writePackedData(rsc, getType(), dst, src, false);
439 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
442 void Allocation::serialize(Context *rsc, OStream *stream) const {
449 mHal.state.type->serialize(rsc, stream);
458 stream->addByteArray(rsc->mHal.funcs.allocation.lock1D(rsc, this), dataSize);
459 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
462 packVec3Allocation(rsc, stream);
466 Allocation *Allocation::createFromStream(Context *rsc, IStream *stream) {
470 rsc->setError(RS_ERROR_FATAL_DRIVER,
477 Type *type = Type::createFromStream(rsc, stream);
483 Allocation *alloc = Allocation::createAllocation(rsc, type, RS_ALLOCATION_USAGE_SCRIPT);
492 rsc->setError(RS_ERROR_FATAL_DRIVER,
503 alloc->data(rsc, 0, 0, count, stream->getPtr() + stream->getPos(), dataSize);
505 alloc->unpackVec3Allocation(rsc, stream->getPtr() + stream->getPos(), dataSize);
512 void Allocation::sendDirty(const Context *rsc) const {
518 mRSC->mHal.funcs.allocation.markDirty(rsc, this);
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);
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) {
565 ObjectBaseRef<Type> t = mHal.state.type->cloneAndResize1D(rsc, 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) {
576 rsc->setError(RS_ERROR_FATAL_DRIVER, "resize2d not implemented");
596 rsc->sendMessageToClient(&ip, RS_MESSAGE_TO_CLIENT_NEW_BUFFER, 0, sizeof(ip), true);
602 void Allocation::setupGrallocConsumer(const Context *rsc, uint32_t numAlloc) {
606 rsc->setError(RS_ERROR_FATAL_DRIVER, "resize2d not implemented");
614 mBufferListener->rsc = rsc;
623 void * Allocation::getSurface(const Context *rsc) {
630 setupGrallocConsumer(rsc, 1);
637 //return rsc->mHal.funcs.allocation.getSurface(rsc, this);
640 void Allocation::shareBufferQueue(const Context *rsc, const Allocation *alloc) {
645 rsc->setError(RS_ERROR_DRIVER, "Maximum allocations attached to a BufferQueue");
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);
678 rsc->setError(RS_ERROR_DRIVER, "Error receiving IO input buffer.");
705 void rsi_AllocationSyncAll(Context *rsc, RsAllocation va, RsAllocationUsageType src) {
707 a->sendDirty(rsc);
708 a->syncAll(rsc, src);
711 void rsi_AllocationGenerateMipmaps(Context *rsc, RsAllocation va) {
713 rsc->mHal.funcs.allocation.generateMipmaps(rsc, alloc);
716 void rsi_AllocationCopyToBitmap(Context *rsc, RsAllocation va, void *data, size_t sizeBytes) {
719 a->read(rsc, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X,
723 void rsi_Allocation1DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t lod,
726 a->data(rsc, xoff, lod, count, data, sizeBytes);
729 void rsi_Allocation1DElementData(Context *rsc, RsAllocation va, uint32_t x,
732 a->elementData(rsc, x, 0, 0, data, eoff, sizeBytes);
735 void rsi_AllocationElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t y, uint32_t z,
738 a->elementData(rsc, x, y, z, data, eoff, sizeBytes);
741 void rsi_Allocation2DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
744 a->data(rsc, xoff, yoff, lod, face, w, h, data, sizeBytes, stride);
747 void rsi_Allocation3DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
750 a->data(rsc, xoff, yoff, zoff, lod, w, h, d, data, sizeBytes, stride);
754 void rsi_AllocationRead(Context *rsc, RsAllocation va, void *data, size_t sizeBytes) {
758 a->read(rsc, 0, 0, 0, 0, t->getDimX(), t->getDimY(), t->getDimZ(),
761 a->read(rsc, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X,
764 a->read(rsc, 0, 0, t->getDimX(), data, sizeBytes);
769 void rsi_AllocationResize1D(Context *rsc, RsAllocation va, uint32_t dimX) {
771 a->resize1D(rsc, dimX);
774 void rsi_AllocationResize2D(Context *rsc, RsAllocation va, uint32_t dimX, uint32_t dimY) {
776 a->resize2D(rsc, dimX, dimY);
779 RsAllocation rsi_AllocationCreateTyped(Context *rsc, RsType vtype,
782 Allocation * alloc = Allocation::createAllocation(rsc, static_cast<Type *>(vtype), usages, mipmaps, (void*)ptr);
790 RsAllocation rsi_AllocationCreateStrided(Context *rsc, RsType vtype,
794 Allocation * alloc = Allocation::createAllocationStrided(rsc, static_cast<Type *>(vtype), usages, mipmaps,
803 RsAllocation rsi_AllocationCreateFromBitmap(Context *rsc, RsType vtype,
808 RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mipmaps, usages, 0);
815 texAlloc->data(rsc, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X,
818 rsc->mHal.funcs.allocation.generateMipmaps(rsc, texAlloc);
821 texAlloc->sendDirty(rsc);
825 RsAllocation rsi_AllocationCubeCreateFromBitmap(Context *rsc, RsType vtype,
833 RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mipmaps, usages, 0);
847 texAlloc->data(rsc, 0, dI, 0, (RsAllocationCubemapFace)face,
856 rsc->mHal.funcs.allocation.generateMipmaps(rsc, texAlloc);
859 texAlloc->sendDirty(rsc);
863 void rsi_AllocationCopy2DRange(Context *rsc,
873 rsc->mHal.funcs.allocation.allocData2D(rsc, dst, dstXoff, dstYoff, dstMip,
880 void rsi_AllocationCopy3DRange(Context *rsc,
890 rsc->mHal.funcs.allocation.allocData3D(rsc, dst, dstXoff, dstYoff, dstZoff, dstMip,
895 void rsi_AllocationSetupBufferQueue(Context *rsc, RsAllocation valloc, uint32_t numAlloc) {
897 alloc->setupGrallocConsumer(rsc, numAlloc);
900 void * rsi_AllocationGetSurface(Context *rsc, RsAllocation valloc) {
902 void *s = alloc->getSurface(rsc);
906 void rsi_AllocationShareBufferQueue(Context *rsc, RsAllocation valloc1, RsAllocation valloc2) {
909 alloc1->shareBufferQueue(rsc, alloc2);
912 void rsi_AllocationSetSurface(Context *rsc, RsAllocation valloc, RsNativeWindow sur) {
914 alloc->setSurface(rsc, sur);
917 void rsi_AllocationIoSend(Context *rsc, RsAllocation valloc) {
919 alloc->ioSend(rsc);
922 int64_t rsi_AllocationIoReceive(Context *rsc, RsAllocation valloc) {
924 alloc->ioReceive(rsc);
928 void *rsi_AllocationGetPointer(Context *rsc, RsAllocation valloc,
934 return alloc->getPointer(rsc, lod, face, z, array, stride);
937 void rsi_Allocation1DRead(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t lod,
940 rsc->mHal.funcs.allocation.read1D(rsc, a, xoff, lod, count, data, sizeBytes);
943 void rsi_AllocationElementRead(Context *rsc, RsAllocation va, uint32_t x, uint32_t y, uint32_t z,
946 a->elementRead(rsc, x, y, z, data, eoff, sizeBytes);
949 void rsi_Allocation2DRead(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t yoff,
953 a->read(rsc, xoff, yoff, lod, face, w, h, data, sizeBytes, stride);
956 void rsi_Allocation3DRead(Context *rsc, RsAllocation va,
961 a->read(rsc, xoff, yoff, zoff, lod, w, h, d, data, sizeBytes, stride);
964 RsAllocation rsi_AllocationAdapterCreate(Context *rsc, RsType vwindow, RsAllocation vbase) {
967 Allocation * alloc = Allocation::createAdapter(rsc,
976 void rsi_AllocationAdapterOffset(Context *rsc, RsAllocation va, const uint32_t *offsets, size_t len) {
978 a->adapterOffset(rsc, offsets, len);