gfxstream: mesa-ify libgfxstream_android

ALOGE --> mesa_loge(..) essentially

Also, nuke the unused stubs.

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:
Gurchetan Singh
2024-08-26 16:47:02 -07:00
committed by Marge Bot
parent fcf73c0ed4
commit 105923cd63
4 changed files with 22 additions and 23 deletions
@@ -14,7 +14,7 @@
#include "ANativeWindowEmulated.h"
#include <log/log.h>
#include "util/log.h"
namespace gfxstream {
@@ -147,7 +147,7 @@ int EmulatedANativeWindowHelper::getFormat(EGLClientBuffer buffer, Gralloc* help
}
void EmulatedANativeWindowHelper::setSwapInterval(EGLNativeWindowType window, int interval) {
ALOGE("Unimplemented");
mesa_loge("Unimplemented");
(void)window;
(void)interval;
}
@@ -181,7 +181,7 @@ EGLNativeWindowType EmulatedANativeWindowHelper::createNativeWindowForTesting(Gr
for (int i = 0; i < 3; i++) {
AHardwareBuffer* ahb = nullptr;
if (gralloc->allocate(width, height, GFXSTREAM_AHB_FORMAT_R8G8B8A8_UNORM, -1, &ahb) != 0) {
ALOGE("Failed to allocate gralloc buffer.");
mesa_loge("Failed to allocate gralloc buffer.");
return nullptr;
}
buffers.emplace_back(reinterpret_cast<EmulatedAHardwareBuffer*>(ahb));
+12 -13
View File
@@ -14,12 +14,11 @@
#include "GrallocEmulated.h"
#include <cutils/log.h>
#include <optional>
#include <unordered_map>
#include "drm_fourcc.h"
#include "util/log.h"
namespace gfxstream {
namespace {
@@ -302,7 +301,7 @@ int EmulatedAHardwareBuffer::getAndroidFormat() const {
const auto& formatInfosMap = GetDrmFormatInfoMap();
auto formatInfoIt = formatInfosMap.find(mDrmFormat);
if (formatInfoIt == formatInfosMap.end()) {
ALOGE("Unhandled DRM format:%u", mDrmFormat);
mesa_loge("Unhandled DRM format:%u", mDrmFormat);
return -1;
}
const auto& formatInfo = formatInfoIt->second;
@@ -336,7 +335,7 @@ int EmulatedAHardwareBuffer::lock(uint8_t** ptr) {
if (!mMapped) {
mMapped = mResource->createMapping();
if (!mMapped) {
ALOGE("Failed to lock EmulatedAHardwareBuffer: failed to create mapping.");
mesa_loge("Failed to lock EmulatedAHardwareBuffer: failed to create mapping.");
return -1;
}
@@ -358,7 +357,7 @@ int EmulatedAHardwareBuffer::lockPlanes(std::vector<Gralloc::LockedPlane>* ahbPl
const auto& formatInfosMap = GetDrmFormatInfoMap();
auto formatInfoIt = formatInfosMap.find(mDrmFormat);
if (formatInfoIt == formatInfosMap.end()) {
ALOGE("Failed to lock: failed to find format info for drm format:%u", mDrmFormat);
mesa_loge("Failed to lock: failed to find format info for drm format:%u", mDrmFormat);
return -1;
}
const auto& formatInfo = formatInfoIt->second;
@@ -398,7 +397,7 @@ int EmulatedAHardwareBuffer::lockPlanes(std::vector<Gralloc::LockedPlane>* ahbPl
int EmulatedAHardwareBuffer::unlock() {
if (!mMapped) {
ALOGE("Failed to unlock EmulatedAHardwareBuffer: never locked?");
mesa_loge("Failed to unlock EmulatedAHardwareBuffer: never locked?");
return -1;
}
mResource->transferToHost(0, 0, mWidth, mHeight);
@@ -418,7 +417,7 @@ GrallocType EmulatedGralloc::getGrallocType() { return GRALLOC_TYPE_EMULATED; }
uint32_t EmulatedGralloc::createColorBuffer(int width, int height, uint32_t glFormat) {
auto drmFormat = GlFormatToDrmFormat(glFormat);
if (!drmFormat) {
ALOGE("Unhandled format");
mesa_loge("Unhandled format");
return -1;
}
@@ -440,7 +439,7 @@ int EmulatedGralloc::allocate(uint32_t width, uint32_t height, uint32_t ahbForma
auto drmFormat = AhbToDrmFormat(ahbFormat);
if (!drmFormat) {
ALOGE("Unhandled AHB format:%u", ahbFormat);
mesa_loge("Unhandled AHB format:%u", ahbFormat);
return -1;
}
@@ -453,12 +452,12 @@ int EmulatedGralloc::allocate(uint32_t width, uint32_t height, uint32_t ahbForma
}
AHardwareBuffer* EmulatedGralloc::allocate(uint32_t width, uint32_t height, uint32_t drmFormat) {
ALOGE("Allocating AHB w:%u, h:%u, format %u", width, height, drmFormat);
mesa_loge("Allocating AHB w:%u, h:%u, format %u", width, height, drmFormat);
const auto& formatInfosMap = GetDrmFormatInfoMap();
auto formatInfoIt = formatInfosMap.find(drmFormat);
if (formatInfoIt == formatInfosMap.end()) {
ALOGE("Failed to allocate: failed to find format info for drm format:%u", drmFormat);
mesa_loge("Failed to allocate: failed to find format info for drm format:%u", drmFormat);
return nullptr;
}
const auto& formatInfo = formatInfoIt->second;
@@ -486,7 +485,7 @@ AHardwareBuffer* EmulatedGralloc::allocate(uint32_t width, uint32_t height, uint
auto resource = mDevice->createResource(width, height, stride, size, formatInfo.virglFormat,
PIPE_TEXTURE_2D, bind);
if (!resource) {
ALOGE("Failed to allocate: failed to create virtio resource.");
mesa_loge("Failed to allocate: failed to create virtio resource.");
return nullptr;
}
@@ -561,12 +560,12 @@ uint32_t EmulatedGralloc::getHeight(const AHardwareBuffer* handle) {
}
size_t EmulatedGralloc::getAllocatedSize(const native_handle_t*) {
ALOGE("Unimplemented.");
mesa_loge("Unimplemented.");
return 0;
}
size_t EmulatedGralloc::getAllocatedSize(const AHardwareBuffer*) {
ALOGE("Unimplemented.");
mesa_loge("Unimplemented.");
return 0;
}
@@ -15,7 +15,6 @@
#include "GrallocMinigbm.h"
#include <cros_gralloc/cros_gralloc_handle.h>
#include <log/log.h>
#include <stdlib.h>
#include <sys/user.h>
#include <unistd.h>
@@ -25,6 +24,7 @@
#include <cstring>
#include "VirtGpu.h"
#include "util/log.h"
namespace gfxstream {
@@ -41,7 +41,7 @@ uint32_t MinigbmGralloc::createColorBuffer(int width, int height, uint32_t glfor
uint32_t bpp = 0;
switch (glformat) {
case kGlRGB:
ALOGV("Note: egl wanted GL_RGB, still using RGBA");
mesa_logi("Note: egl wanted GL_RGB, still using RGBA");
virtgpu_format = kVirglFormatRGBA;
bpp = 4;
break;
@@ -50,7 +50,7 @@ uint32_t MinigbmGralloc::createColorBuffer(int width, int height, uint32_t glfor
bpp = 4;
break;
default:
ALOGV("Note: egl wanted 0x%x, still using RGBA", glformat);
mesa_logi("Note: egl wanted 0x%x, still using RGBA", glformat);
virtgpu_format = kVirglFormatRGBA;
bpp = 4;
break;
@@ -88,7 +88,7 @@ int MinigbmGralloc::lock(AHardwareBuffer* ahb, uint8_t** ptr) {
}
int MinigbmGralloc::lockPlanes(AHardwareBuffer* ahb, std::vector<LockedPlane>* ahbPlanes) {
ALOGE("%s: unimplemented", __func__);
mesa_loge("%s: unimplemented", __func__);
return -1;
}
@@ -54,7 +54,7 @@ FuchsiaVirtGpuDevice::FuchsiaVirtGpuDevice(enum VirtGpuCapset capset, magma_devi
zx::vmo capset_info(buffer);
zx_status_t status =
capset_info.read(&mCaps.vulkanCapset, /*offset=*/0, sizeof(struct vulkanCapset));
ALOGD("Got capset result, read status %d", status);
mesa_logi("Got capset result, read status %d", status);
} else {
mesa_loge("Query(%lu) failed: status %d, expected buffer result", query_id, status);
}
@@ -112,12 +112,12 @@ VirtGpuDevice* osCreateVirtGpuDevice(enum VirtGpuCapset capset, int32_t descript
return nullptr;
}
ALOGD("Opened dir %s", kDevGpu);
mesa_logi("Opened dir %s", kDevGpu);
VirtGpuDevice* gpu_device = nullptr;
while ((de = os_readdir(dir)) != NULL) {
ALOGD("Got name %s", de->d_name);
mesa_logi("Got name %s", de->d_name);
if (strcmp(de->d_name, ".") == 0) {
continue;