gfxstream: guest: introduce Gralloc::getGrallocType()
This API tells the user whether the chosen implementation is goldfish gralloc, cros_gralloc (minigbm), or emulated gralloc. Use with caution. 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:

committed by
Marge Bot

parent
999a9a3fb9
commit
2d967209ad
@@ -414,6 +414,8 @@ EmulatedGralloc::~EmulatedGralloc() {
|
|||||||
delete mDevice;
|
delete mDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GrallocType EmulatedGralloc::getGrallocType() { return GRALLOC_TYPE_EMULATED; }
|
||||||
|
|
||||||
uint32_t EmulatedGralloc::createColorBuffer(void*, int width, int height, uint32_t glFormat) {
|
uint32_t EmulatedGralloc::createColorBuffer(void*, int width, int height, uint32_t glFormat) {
|
||||||
auto drmFormat = GlFormatToDrmFormat(glFormat);
|
auto drmFormat = GlFormatToDrmFormat(glFormat);
|
||||||
if (!drmFormat) {
|
if (!drmFormat) {
|
||||||
|
@@ -67,6 +67,8 @@ class EmulatedGralloc : public Gralloc {
|
|||||||
public:
|
public:
|
||||||
EmulatedGralloc(VirtGpuDevice* device);
|
EmulatedGralloc(VirtGpuDevice* device);
|
||||||
~EmulatedGralloc();
|
~EmulatedGralloc();
|
||||||
|
|
||||||
|
GrallocType getGrallocType() override;
|
||||||
uint32_t createColorBuffer(void*, int width, int height, uint32_t glFormat) override;
|
uint32_t createColorBuffer(void*, int width, int height, uint32_t glFormat) override;
|
||||||
|
|
||||||
int allocate(uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
|
int allocate(uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
|
||||||
|
@@ -26,6 +26,8 @@ uint32_t GoldfishGralloc::createColorBuffer(void* rcEnc, int width, int height,
|
|||||||
return rc->rcCreateColorBuffer(rc, width, height, glformat);
|
return rc->rcCreateColorBuffer(rc, width, height, glformat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GrallocType GoldfishGralloc::getGrallocType() { return GRALLOC_TYPE_GOLDFISH; }
|
||||||
|
|
||||||
int GoldfishGralloc::allocate(uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
|
int GoldfishGralloc::allocate(uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
|
||||||
AHardwareBuffer** outputAhb) {
|
AHardwareBuffer** outputAhb) {
|
||||||
struct AHardwareBuffer_Desc desc = {
|
struct AHardwareBuffer_Desc desc = {
|
||||||
|
@@ -20,6 +20,7 @@ namespace gfxstream {
|
|||||||
|
|
||||||
class GoldfishGralloc : public Gralloc {
|
class GoldfishGralloc : public Gralloc {
|
||||||
public:
|
public:
|
||||||
|
GrallocType getGrallocType() override;
|
||||||
uint32_t createColorBuffer(void* rcEnc, int width, int height, uint32_t glformat) override;
|
uint32_t createColorBuffer(void* rcEnc, int width, int height, uint32_t glformat) override;
|
||||||
|
|
||||||
int allocate(uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
|
int allocate(uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
|
||||||
|
@@ -112,6 +112,8 @@ bool getVirtioGpuResourceInfo(int fd, native_handle_t const* handle,
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
GrallocType MinigbmGralloc::getGrallocType() { return GRALLOC_TYPE_MINIGBM; }
|
||||||
|
|
||||||
uint32_t MinigbmGralloc::createColorBuffer(void*, int width, int height, uint32_t glformat) {
|
uint32_t MinigbmGralloc::createColorBuffer(void*, int width, int height, uint32_t glformat) {
|
||||||
// Only supported format for pbuffers in gfxstream should be RGBA8
|
// Only supported format for pbuffers in gfxstream should be RGBA8
|
||||||
const uint32_t kVirglFormatRGBA = 67; // VIRGL_FORMAT_R8G8B8A8_UNORM;
|
const uint32_t kVirglFormatRGBA = 67; // VIRGL_FORMAT_R8G8B8A8_UNORM;
|
||||||
|
@@ -20,6 +20,8 @@ namespace gfxstream {
|
|||||||
|
|
||||||
class MinigbmGralloc : public Gralloc {
|
class MinigbmGralloc : public Gralloc {
|
||||||
public:
|
public:
|
||||||
|
GrallocType getGrallocType() override;
|
||||||
|
|
||||||
uint32_t createColorBuffer(void* rcEnc, int width, int height, uint32_t glformat) override;
|
uint32_t createColorBuffer(void* rcEnc, int width, int height, uint32_t glformat) override;
|
||||||
|
|
||||||
int allocate(uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
|
int allocate(uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
|
||||||
|
Reference in New Issue
Block a user