aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-08 02:00:54 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-08 02:00:54 +0000
commit60d509d4e05e18d1d2fc1cd48189cb9d050fd7ad (patch)
treecb22d8211ce4df0d12a0e857b811ad3718d36e34
parentba0d796e9029b3ee1d2e29643d530b486605f682 (diff)
parent61c9173c928e21a714ae6519e134b49363ae9875 (diff)
downloadgoldfish-opengl-60d509d4e05e18d1d2fc1cd48189cb9d050fd7ad.tar.gz
Snap for 11421850 from 61c9173c928e21a714ae6519e134b49363ae9875 to sdk-release
Change-Id: Ic439209d96469782016eb442d269d871a166147c
-rw-r--r--system/gralloc/gralloc_old.cpp24
-rw-r--r--system/hals/mapper3.cpp10
2 files changed, 33 insertions, 1 deletions
diff --git a/system/gralloc/gralloc_old.cpp b/system/gralloc/gralloc_old.cpp
index 53d4a94a..080b34c9 100644
--- a/system/gralloc/gralloc_old.cpp
+++ b/system/gralloc/gralloc_old.cpp
@@ -32,6 +32,7 @@
#include "aemu/base/threads/AndroidThread.h"
#include "glUtils.h"
#include "goldfish_address_space.h"
+#include "goldfish_dma.h"
#include "gralloc_common.h"
#if PLATFORM_SDK_VERSION < 26
@@ -228,13 +229,17 @@ struct gralloc_dmaregion_t {
sz(INITIAL_DMA_REGION_SIZE),
refcount(0),
bigbufCount(0) {
+ memset(&goldfish_dma, 0, sizeof(goldfish_dma));
pthread_mutex_init(&lock, NULL);
if (rcEnc->hasDirectMem()) {
host_memory_allocator.hostMalloc(&address_space_block, sz);
+ } else if (rcEnc->getDmaVersion() > 0) {
+ goldfish_dma_create_region(sz, &goldfish_dma);
}
}
+ goldfish_dma_context goldfish_dma;
GoldfishAddressSpaceHostMemoryAllocator host_memory_allocator;
GoldfishAddressSpaceBlock address_space_block;
uint32_t sz;
@@ -255,7 +260,7 @@ static gralloc_memregions_t* init_gralloc_memregions() {
}
static bool has_DMA_support(const ExtendedRCEncoderContext *rcEnc) {
- return false;
+ return rcEnc->getDmaVersion() > 0 || rcEnc->hasDirectMem();
}
static gralloc_dmaregion_t* init_gralloc_dmaregion(ExtendedRCEncoderContext *rcEnc) {
@@ -276,6 +281,11 @@ static void get_gralloc_region(ExtendedRCEncoderContext *rcEnc) {
}
static void resize_gralloc_dmaregion_locked(gralloc_dmaregion_t* grdma, uint32_t new_sz) {
+ if (grdma->goldfish_dma.mapped_addr) {
+ goldfish_dma_unmap(&grdma->goldfish_dma);
+ }
+ close(grdma->goldfish_dma.fd);
+ goldfish_dma_create_region(new_sz, &grdma->goldfish_dma);
grdma->sz = new_sz;
}
@@ -345,6 +355,9 @@ static void gralloc_dmaregion_register_ashmem_dma_locked(gralloc_dmaregion_t* gr
resize_gralloc_dmaregion_locked(grdma, new_sz);
}
}
+ if (!grdma->goldfish_dma.mapped_addr) {
+ goldfish_dma_map(&grdma->goldfish_dma);
+ }
}
static void gralloc_dmaregion_register_ashmem(ExtendedRCEncoderContext *rcEnc, uint32_t sz) {
@@ -543,6 +556,15 @@ static void updateHostColorBuffer(cb_handle_old_t* cb,
break;
}
+ if (grdma->address_space_block.guestPtr()) {
+ rcEnc->bindDmaDirectly(grdma->address_space_block.guestPtr(),
+ grdma->address_space_block.physAddr());
+ } else if (grdma->goldfish_dma.mapped_addr) {
+ rcEnc->bindDmaContext(&grdma->goldfish_dma);
+ } else {
+ ALOGE("%s: Unexpected DMA", __func__);
+ }
+
D("%s: call. dma update with sz=%u", __func__, send_buffer_size);
pthread_mutex_lock(&grdma->lock);
rcEnc->rcUpdateColorBufferDMA(rcEnc, cb->hostHandle,
diff --git a/system/hals/mapper3.cpp b/system/hals/mapper3.cpp
index 006292fc..8be0b492 100644
--- a/system/hals/mapper3.cpp
+++ b/system/hals/mapper3.cpp
@@ -480,6 +480,11 @@ private: // **** impl ****
}
} else {
if (rcEnc->featureInfo()->hasReadColorBufferDma) {
+ {
+ AEMU_SCOPED_TRACE("bindDmaDirectly");
+ rcEnc->bindDmaDirectly(bufferBits,
+ getMmapedPhysAddr(cb.getMmapedOffset()));
+ }
rcEnc->rcReadColorBufferDMA(rcEnc,
cb.hostHandle,
0, 0, cb.width, cb.height,
@@ -561,6 +566,11 @@ private: // **** impl ****
const HostConnectionSession conn = getHostConnectionSession();
ExtendedRCEncoderContext *const rcEnc = conn.getRcEncoder();
{
+ AEMU_SCOPED_TRACE("bindDmaDirectly");
+ rcEnc->bindDmaDirectly(bufferBits,
+ getMmapedPhysAddr(cb.getMmapedOffset()));
+ }
+ {
AEMU_SCOPED_TRACE("updateColorBuffer");
rcEnc->rcUpdateColorBufferDMA(rcEnc, cb.hostHandle,
0, 0, cb.width, cb.height,