Merge "[Graphics] Update CommandWriter APIs to common::V1_1::* enum." into pi-dev
This commit is contained in:
commit
584ee3b94a
14 changed files with 257 additions and 37 deletions
|
@ -325,7 +325,7 @@ a830336ac8627d6432cfafb1b884343ad9f885dee0a5323e380e6d3c519156b8 android.hardwar
|
|||
83e7a10ff3702147bd7ffa04567b20d407a3b16bbb7705644af44d919afe9103 android.hardware.gnss@1.1::IGnssMeasurementCallback
|
||||
0b96e0254e2168cfecb30c1ed5fb42681652cc00faa68c6e07568fafe64d1d50 android.hardware.graphics.common@1.1::types
|
||||
d9b40a5b09962a5a0780b10fe33a4e607e69e2e088fc83de88a584115b7cb1c0 android.hardware.graphics.composer@2.2::IComposer
|
||||
da3979dd97093cdc4ffc2e2427e848f4ba07ddcd181f31f2cb494ad0d2fa58ad android.hardware.graphics.composer@2.2::IComposerClient
|
||||
c3cd2a3e245ffefae859c9a3d31382a9421be95cfa6bc1231571eb3533049b54 android.hardware.graphics.composer@2.2::IComposerClient
|
||||
dd83be076b6b3f10ed62ab34d8c8b95f2415961fb785200eb842e7bfb2b0ee92 android.hardware.graphics.mapper@2.1::IMapper
|
||||
675682dd3007805c985eaaec91612abc88f4c25b3431fb84070b7584a1a741fb android.hardware.health@2.0::IHealth
|
||||
434c4c32c00b0e54bb05e40c79503208b40f786a318029a2a4f66e34f10f2a76 android.hardware.health@2.0::IHealthInfoCallback
|
||||
|
|
|
@ -247,21 +247,8 @@ class CommandWriterBase {
|
|||
|
||||
void setClientTarget(uint32_t slot, const native_handle_t* target, int acquireFence,
|
||||
Dataspace dataspace, const std::vector<IComposerClient::Rect>& damage) {
|
||||
bool doWrite = (damage.size() <= (kMaxLength - 4) / 4);
|
||||
size_t length = 4 + ((doWrite) ? damage.size() * 4 : 0);
|
||||
|
||||
beginCommand(IComposerClient::Command::SET_CLIENT_TARGET, length);
|
||||
write(slot);
|
||||
writeHandle(target, true);
|
||||
writeFence(acquireFence);
|
||||
writeSigned(static_cast<int32_t>(dataspace));
|
||||
// When there are too many rectangles in the damage region and doWrite
|
||||
// is false, we write no rectangle at all which means the entire
|
||||
// client target is damaged.
|
||||
if (doWrite) {
|
||||
writeRegion(damage);
|
||||
}
|
||||
endCommand();
|
||||
setClientTargetInternal(slot, target, acquireFence, static_cast<int32_t>(dataspace),
|
||||
damage);
|
||||
}
|
||||
|
||||
static constexpr uint16_t kSetOutputBufferLength = 3;
|
||||
|
@ -354,9 +341,7 @@ class CommandWriterBase {
|
|||
|
||||
static constexpr uint16_t kSetLayerDataspaceLength = 1;
|
||||
void setLayerDataspace(Dataspace dataspace) {
|
||||
beginCommand(IComposerClient::Command::SET_LAYER_DATASPACE, kSetLayerDataspaceLength);
|
||||
writeSigned(static_cast<int32_t>(dataspace));
|
||||
endCommand();
|
||||
setLayerDataspaceInternal(static_cast<int32_t>(dataspace));
|
||||
}
|
||||
|
||||
static constexpr uint16_t kSetLayerDisplayFrameLength = 4;
|
||||
|
@ -418,6 +403,32 @@ class CommandWriterBase {
|
|||
}
|
||||
|
||||
protected:
|
||||
void setClientTargetInternal(uint32_t slot, const native_handle_t* target, int acquireFence,
|
||||
int32_t dataspace,
|
||||
const std::vector<IComposerClient::Rect>& damage) {
|
||||
bool doWrite = (damage.size() <= (kMaxLength - 4) / 4);
|
||||
size_t length = 4 + ((doWrite) ? damage.size() * 4 : 0);
|
||||
|
||||
beginCommand(IComposerClient::Command::SET_CLIENT_TARGET, length);
|
||||
write(slot);
|
||||
writeHandle(target, true);
|
||||
writeFence(acquireFence);
|
||||
writeSigned(dataspace);
|
||||
// When there are too many rectangles in the damage region and doWrite
|
||||
// is false, we write no rectangle at all which means the entire
|
||||
// client target is damaged.
|
||||
if (doWrite) {
|
||||
writeRegion(damage);
|
||||
}
|
||||
endCommand();
|
||||
}
|
||||
|
||||
void setLayerDataspaceInternal(int32_t dataspace) {
|
||||
beginCommand(IComposerClient::Command::SET_LAYER_DATASPACE, kSetLayerDataspaceLength);
|
||||
writeSigned(dataspace);
|
||||
endCommand();
|
||||
}
|
||||
|
||||
void beginCommand(IComposerClient::Command command, uint16_t length) {
|
||||
if (mCommandEnd) {
|
||||
LOG_FATAL("endCommand was not called before command 0x%x", command);
|
||||
|
|
|
@ -104,9 +104,7 @@ class ComposerClient {
|
|||
|
||||
void execute(TestCommandReader* reader, CommandWriterBase* writer);
|
||||
|
||||
private:
|
||||
sp<IComposerClient> mClient;
|
||||
|
||||
protected:
|
||||
// Keep track of all virtual displays and layers. When a test fails with
|
||||
// ASSERT_*, the destructor will clean up the resources for the test.
|
||||
struct DisplayResource {
|
||||
|
@ -116,6 +114,9 @@ class ComposerClient {
|
|||
std::unordered_set<Layer> layers;
|
||||
};
|
||||
std::unordered_map<Display, DisplayResource> mDisplayResources;
|
||||
|
||||
private:
|
||||
sp<IComposerClient> mClient;
|
||||
};
|
||||
|
||||
} // namespace vts
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
|
||||
package android.hardware.graphics.composer@2.2;
|
||||
|
||||
import android.hardware.graphics.common@1.0::Dataspace;
|
||||
import android.hardware.graphics.common@1.0::PixelFormat;
|
||||
import android.hardware.graphics.common@1.1::ColorMode;
|
||||
import android.hardware.graphics.common@1.1::Dataspace;
|
||||
import android.hardware.graphics.common@1.1::PixelFormat;
|
||||
import android.hardware.graphics.common@1.1::RenderIntent;
|
||||
import @2.1::IComposerClient;
|
||||
import @2.1::Display;
|
||||
import @2.1::Error;
|
||||
import @2.1::IComposerClient;
|
||||
|
||||
interface IComposerClient extends @2.1::IComposerClient {
|
||||
|
||||
|
@ -247,6 +248,65 @@ interface IComposerClient extends @2.1::IComposerClient {
|
|||
*/
|
||||
setReadbackBuffer(Display display, handle buffer, handle releaseFence) generates (Error error);
|
||||
|
||||
/**
|
||||
* createVirtualDisplay_2_2
|
||||
* Creates a new virtual display with the given width and height. The
|
||||
* format passed into this function is the default format requested by the
|
||||
* consumer of the virtual display output buffers.
|
||||
*
|
||||
* The display must be assumed to be on from the time the first frame is
|
||||
* presented until the display is destroyed.
|
||||
*
|
||||
* @param width is the width in pixels.
|
||||
* @param height is the height in pixels.
|
||||
* @param formatHint is the default output buffer format selected by
|
||||
* the consumer.
|
||||
* @param outputBufferSlotCount is the number of output buffer slots to be
|
||||
* reserved.
|
||||
* @return error is NONE upon success. Otherwise,
|
||||
* UNSUPPORTED when the width or height is too large for the
|
||||
* device to be able to create a virtual display.
|
||||
* NO_RESOURCES when the device is unable to create a new virtual
|
||||
* display at this time.
|
||||
* @return display is the newly-created virtual display.
|
||||
* @return format is the format of the buffer the device will produce.
|
||||
*/
|
||||
@callflow(next="*")
|
||||
createVirtualDisplay_2_2(uint32_t width,
|
||||
uint32_t height,
|
||||
PixelFormat formatHint,
|
||||
uint32_t outputBufferSlotCount)
|
||||
generates (Error error,
|
||||
Display display,
|
||||
PixelFormat format);
|
||||
|
||||
/**
|
||||
* getClientTargetSupport_2_2
|
||||
* Returns whether a client target with the given properties can be
|
||||
* handled by the device.
|
||||
*
|
||||
* This function must return true for a client target with width and
|
||||
* height equal to the active display configuration dimensions,
|
||||
* PixelFormat::RGBA_8888, and Dataspace::UNKNOWN. It is not required to
|
||||
* return true for any other configuration.
|
||||
*
|
||||
* @param display is the display to query.
|
||||
* @param width is the client target width in pixels.
|
||||
* @param height is the client target height in pixels.
|
||||
* @param format is the client target format.
|
||||
* @param dataspace is the client target dataspace, as described in
|
||||
* setLayerDataspace.
|
||||
* @return error is NONE upon success. Otherwise,
|
||||
* BAD_DISPLAY when an invalid display handle was passed in.
|
||||
* UNSUPPORTED when the given configuration is not supported.
|
||||
*/
|
||||
@callflow(next="*")
|
||||
getClientTargetSupport_2_2(Display display,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
PixelFormat format,
|
||||
Dataspace dataspace)
|
||||
generates (Error error);
|
||||
/**
|
||||
* setPowerMode_2_2
|
||||
* Sets the power mode of the given display. The transition must be
|
||||
|
|
|
@ -47,8 +47,8 @@ namespace V2_2 {
|
|||
|
||||
using android::hardware::MessageQueue;
|
||||
using android::hardware::graphics::common::V1_0::ColorTransform;
|
||||
using android::hardware::graphics::common::V1_0::Dataspace;
|
||||
using android::hardware::graphics::common::V1_0::Transform;
|
||||
using android::hardware::graphics::common::V1_1::Dataspace;
|
||||
using android::hardware::graphics::composer::V2_1::Config;
|
||||
using android::hardware::graphics::composer::V2_1::Display;
|
||||
using android::hardware::graphics::composer::V2_1::Error;
|
||||
|
@ -64,6 +64,16 @@ class CommandWriterBase : public V2_1::CommandWriterBase {
|
|||
public:
|
||||
CommandWriterBase(uint32_t initialMaxSize) : V2_1::CommandWriterBase(initialMaxSize) {}
|
||||
|
||||
void setClientTarget(uint32_t slot, const native_handle_t* target, int acquireFence,
|
||||
Dataspace dataspace, const std::vector<IComposerClient::Rect>& damage) {
|
||||
setClientTargetInternal(slot, target, acquireFence, static_cast<int32_t>(dataspace),
|
||||
damage);
|
||||
}
|
||||
|
||||
void setLayerDataspace(Dataspace dataspace) {
|
||||
setLayerDataspaceInternal(static_cast<int32_t>(dataspace));
|
||||
}
|
||||
|
||||
static constexpr uint16_t kSetLayerFloatColorLength = 4;
|
||||
void setLayerFloatColor(IComposerClient::FloatColor color) {
|
||||
beginCommand_2_2(IComposerClient::Command::SET_LAYER_FLOAT_COLOR,
|
||||
|
|
|
@ -99,6 +99,25 @@ class ComposerClientImpl : public V2_1::hal::detail::ComposerClientImpl<Interfac
|
|||
return mHal->setReadbackBuffer(display, readbackBuffer, std::move(fenceFd));
|
||||
}
|
||||
|
||||
Return<void> createVirtualDisplay_2_2(
|
||||
uint32_t width, uint32_t height, PixelFormat formatHint, uint32_t outputBufferSlotCount,
|
||||
IComposerClient::createVirtualDisplay_2_2_cb hidl_cb) override {
|
||||
Display display = 0;
|
||||
Error err = mHal->createVirtualDisplay_2_2(width, height, &formatHint, &display);
|
||||
if (err == Error::NONE) {
|
||||
mResources->addVirtualDisplay(display, outputBufferSlotCount);
|
||||
}
|
||||
|
||||
hidl_cb(err, display, formatHint);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Error> getClientTargetSupport_2_2(Display display, uint32_t width, uint32_t height,
|
||||
PixelFormat format, Dataspace dataspace) override {
|
||||
Error err = mHal->getClientTargetSupport_2_2(display, width, height, format, dataspace);
|
||||
return err;
|
||||
}
|
||||
|
||||
Return<Error> setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) override {
|
||||
return mHal->setPowerMode_2_2(display, mode);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ namespace composer {
|
|||
namespace V2_2 {
|
||||
namespace hal {
|
||||
|
||||
using common::V1_0::Dataspace;
|
||||
using common::V1_0::PixelFormat;
|
||||
using common::V1_1::ColorMode;
|
||||
using common::V1_1::Dataspace;
|
||||
using common::V1_1::PixelFormat;
|
||||
using common::V1_1::RenderIntent;
|
||||
using V2_1::Display;
|
||||
using V2_1::Error;
|
||||
|
@ -38,6 +38,17 @@ using V2_1::Layer;
|
|||
|
||||
class ComposerHal : public V2_1::hal::ComposerHal {
|
||||
public:
|
||||
Error createVirtualDisplay(uint32_t width, uint32_t height, common::V1_0::PixelFormat* format,
|
||||
Display* outDisplay) override {
|
||||
return createVirtualDisplay_2_2(width, height, reinterpret_cast<PixelFormat*>(format),
|
||||
outDisplay);
|
||||
}
|
||||
Error getClientTargetSupport(Display display, uint32_t width, uint32_t height,
|
||||
common::V1_0::PixelFormat format,
|
||||
common::V1_0::Dataspace dataspace) override {
|
||||
return getClientTargetSupport_2_2(display, width, height, static_cast<PixelFormat>(format),
|
||||
static_cast<Dataspace>(dataspace));
|
||||
}
|
||||
// superceded by setPowerMode_2_2
|
||||
Error setPowerMode(Display display, V2_1::IComposerClient::PowerMode mode) override {
|
||||
return setPowerMode_2_2(display, static_cast<IComposerClient::PowerMode>(mode));
|
||||
|
@ -64,7 +75,10 @@ class ComposerHal : public V2_1::hal::ComposerHal {
|
|||
virtual Error setReadbackBuffer(Display display, const native_handle_t* bufferHandle,
|
||||
base::unique_fd fenceFd) = 0;
|
||||
virtual Error getReadbackBufferFence(Display display, base::unique_fd* outFenceFd) = 0;
|
||||
|
||||
virtual Error createVirtualDisplay_2_2(uint32_t width, uint32_t height, PixelFormat* format,
|
||||
Display* outDisplay) = 0;
|
||||
virtual Error getClientTargetSupport_2_2(Display display, uint32_t width, uint32_t height,
|
||||
PixelFormat format, Dataspace dataspace) = 0;
|
||||
virtual Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) = 0;
|
||||
|
||||
virtual Error setLayerFloatColor(Display display, Layer layer,
|
||||
|
|
|
@ -34,9 +34,9 @@ namespace passthrough {
|
|||
|
||||
namespace detail {
|
||||
|
||||
using common::V1_0::Dataspace;
|
||||
using common::V1_0::PixelFormat;
|
||||
using common::V1_1::ColorMode;
|
||||
using common::V1_1::Dataspace;
|
||||
using common::V1_1::PixelFormat;
|
||||
using common::V1_1::RenderIntent;
|
||||
using V2_1::Display;
|
||||
using V2_1::Error;
|
||||
|
@ -134,6 +134,19 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> {
|
|||
return static_cast<Error>(error);
|
||||
}
|
||||
|
||||
Error createVirtualDisplay_2_2(uint32_t width, uint32_t height, PixelFormat* format,
|
||||
Display* outDisplay) override {
|
||||
return createVirtualDisplay(
|
||||
width, height, reinterpret_cast<common::V1_0::PixelFormat*>(format), outDisplay);
|
||||
}
|
||||
|
||||
Error getClientTargetSupport_2_2(Display display, uint32_t width, uint32_t height,
|
||||
PixelFormat format, Dataspace dataspace) override {
|
||||
return getClientTargetSupport(display, width, height,
|
||||
static_cast<common::V1_0::PixelFormat>(format),
|
||||
static_cast<common::V1_0::Dataspace>(dataspace));
|
||||
}
|
||||
|
||||
Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) override {
|
||||
if (mode == IComposerClient::PowerMode::ON_SUSPEND) {
|
||||
return Error::UNSUPPORTED;
|
||||
|
@ -271,6 +284,8 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> {
|
|||
using BaseType2_1::getColorModes;
|
||||
using BaseType2_1::mDevice;
|
||||
using BaseType2_1::setColorMode;
|
||||
using BaseType2_1::createVirtualDisplay;
|
||||
using BaseType2_1::getClientTargetSupport;
|
||||
using BaseType2_1::setPowerMode;
|
||||
};
|
||||
|
||||
|
|
|
@ -87,6 +87,33 @@ void ComposerClient_v2_2::execute_v2_2(V2_1::vts::TestCommandReader* reader,
|
|||
});
|
||||
}
|
||||
|
||||
Display ComposerClient_v2_2::createVirtualDisplay_2_2(uint32_t width, uint32_t height,
|
||||
PixelFormat formatHint,
|
||||
uint32_t outputBufferSlotCount,
|
||||
PixelFormat* outFormat) {
|
||||
Display display = 0;
|
||||
mClient_v2_2->createVirtualDisplay_2_2(
|
||||
width, height, formatHint, outputBufferSlotCount,
|
||||
[&](const auto& tmpError, const auto& tmpDisplay, const auto& tmpFormat) {
|
||||
ASSERT_EQ(Error::NONE, tmpError) << "failed to create virtual display";
|
||||
display = tmpDisplay;
|
||||
*outFormat = tmpFormat;
|
||||
|
||||
ASSERT_TRUE(mDisplayResources.insert({display, DisplayResource(true)}).second)
|
||||
<< "duplicated virtual display id " << display;
|
||||
});
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
bool ComposerClient_v2_2::getClientTargetSupport_2_2(Display display, uint32_t width,
|
||||
uint32_t height, PixelFormat format,
|
||||
Dataspace dataspace) {
|
||||
Error error =
|
||||
mClient_v2_2->getClientTargetSupport_2_2(display, width, height, format, dataspace);
|
||||
return error == Error::NONE;
|
||||
}
|
||||
|
||||
void ComposerClient_v2_2::setPowerMode_2_2(Display display, V2_2::IComposerClient::PowerMode mode) {
|
||||
Error error = mClient_v2_2->setPowerMode_2_2(display, mode);
|
||||
ASSERT_TRUE(error == Error::NONE || error == Error::UNSUPPORTED) << "failed to set power mode";
|
||||
|
|
|
@ -36,10 +36,10 @@ namespace composer {
|
|||
namespace V2_2 {
|
||||
namespace vts {
|
||||
|
||||
using android::hardware::graphics::common::V1_0::Dataspace;
|
||||
using android::hardware::graphics::common::V1_0::Hdr;
|
||||
using android::hardware::graphics::common::V1_0::PixelFormat;
|
||||
using android::hardware::graphics::common::V1_1::ColorMode;
|
||||
using android::hardware::graphics::common::V1_1::Dataspace;
|
||||
using android::hardware::graphics::common::V1_1::PixelFormat;
|
||||
using android::hardware::graphics::common::V1_1::RenderIntent;
|
||||
using android::hardware::graphics::composer::V2_2::IComposer;
|
||||
using android::hardware::graphics::composer::V2_2::IComposerClient;
|
||||
|
@ -67,6 +67,10 @@ class ComposerClient_v2_2
|
|||
|
||||
std::vector<IComposerClient::PerFrameMetadataKey> getPerFrameMetadataKeys(Display display);
|
||||
|
||||
Display createVirtualDisplay_2_2(uint32_t width, uint32_t height, PixelFormat formatHint,
|
||||
uint32_t outputBufferSlotCount, PixelFormat* outFormat);
|
||||
bool getClientTargetSupport_2_2(Display display, uint32_t width, uint32_t height,
|
||||
PixelFormat format, Dataspace dataspace);
|
||||
void setPowerMode_2_2(Display display, V2_2::IComposerClient::PowerMode mode);
|
||||
void setReadbackBuffer(Display display, const native_handle_t* buffer, int32_t releaseFence);
|
||||
void getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat,
|
||||
|
|
|
@ -27,6 +27,7 @@ cc_test {
|
|||
],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.allocator@2.0",
|
||||
"android.hardware.graphics.common@1.1",
|
||||
"android.hardware.graphics.composer@2.1",
|
||||
"android.hardware.graphics.composer@2.1-vts",
|
||||
"android.hardware.graphics.composer@2.2",
|
||||
|
@ -34,6 +35,7 @@ cc_test {
|
|||
"android.hardware.graphics.mapper@2.0",
|
||||
"android.hardware.graphics.mapper@2.0-vts",
|
||||
"android.hardware.graphics.mapper@2.1",
|
||||
"android.hardware.graphics.mapper@2.1-vts",
|
||||
],
|
||||
header_libs: [
|
||||
"android.hardware.graphics.composer@2.1-command-buffer",
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <composer-vts/2.1/GraphicsComposerCallback.h>
|
||||
#include <composer-vts/2.1/TestCommandReader.h>
|
||||
#include <composer-vts/2.2/ComposerVts.h>
|
||||
#include <mapper-vts/2.0/MapperVts.h>
|
||||
#include <mapper-vts/2.1/MapperVts.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
|
@ -34,14 +34,14 @@ namespace {
|
|||
|
||||
using android::hardware::graphics::common::V1_0::BufferUsage;
|
||||
using android::hardware::graphics::common::V1_0::ColorTransform;
|
||||
using android::hardware::graphics::common::V1_0::Dataspace;
|
||||
using android::hardware::graphics::common::V1_0::PixelFormat;
|
||||
using android::hardware::graphics::common::V1_0::Transform;
|
||||
using android::hardware::graphics::common::V1_1::ColorMode;
|
||||
using android::hardware::graphics::common::V1_1::Dataspace;
|
||||
using android::hardware::graphics::common::V1_1::PixelFormat;
|
||||
using android::hardware::graphics::common::V1_1::RenderIntent;
|
||||
using android::hardware::graphics::composer::V2_2::IComposerClient;
|
||||
using android::hardware::graphics::mapper::V2_0::IMapper;
|
||||
using android::hardware::graphics::mapper::V2_0::vts::Gralloc;
|
||||
using android::hardware::graphics::mapper::V2_1::IMapper;
|
||||
using android::hardware::graphics::mapper::V2_1::vts::Gralloc;
|
||||
using GrallocError = android::hardware::graphics::mapper::V2_0::Error;
|
||||
|
||||
// Test environment for graphics.composer
|
||||
|
@ -193,6 +193,55 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_PER_FRAME_METADATA) {
|
|||
TEST_F(GraphicsComposerHidlTest, GetPerFrameMetadataKeys) {
|
||||
mComposerClient->getPerFrameMetadataKeys(mPrimaryDisplay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IComposerClient::createVirtualDisplay_2_2 and
|
||||
* IComposerClient::destroyVirtualDisplay.
|
||||
*
|
||||
* Test that virtual displays can be created and has the correct display type.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, CreateVirtualDisplay_2_2) {
|
||||
if (mComposerClient->getMaxVirtualDisplayCount() == 0) {
|
||||
GTEST_SUCCEED() << "no virtual display support";
|
||||
return;
|
||||
}
|
||||
|
||||
Display display;
|
||||
PixelFormat format;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
display = mComposerClient->createVirtualDisplay_2_2(
|
||||
64, 64, PixelFormat::IMPLEMENTATION_DEFINED, kBufferSlotCount, &format));
|
||||
|
||||
// test display type
|
||||
IComposerClient::DisplayType type = mComposerClient->getDisplayType(display);
|
||||
EXPECT_EQ(IComposerClient::DisplayType::VIRTUAL, type);
|
||||
|
||||
mComposerClient->destroyVirtualDisplay(display);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IComposerClient::getClientTargetSupport_2_2.
|
||||
*
|
||||
* Test that IComposerClient::getClientTargetSupport returns true for the
|
||||
* required client targets.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetClientTargetSupport_2_2) {
|
||||
std::vector<Config> configs = mComposerClient->getDisplayConfigs(mPrimaryDisplay);
|
||||
for (auto config : configs) {
|
||||
int32_t width = mComposerClient->getDisplayAttribute(mPrimaryDisplay, config,
|
||||
IComposerClient::Attribute::WIDTH);
|
||||
int32_t height = mComposerClient->getDisplayAttribute(mPrimaryDisplay, config,
|
||||
IComposerClient::Attribute::HEIGHT);
|
||||
ASSERT_LT(0, width);
|
||||
ASSERT_LT(0, height);
|
||||
|
||||
mComposerClient->setActiveConfig(mPrimaryDisplay, config);
|
||||
|
||||
ASSERT_TRUE(mComposerClient->getClientTargetSupport_2_2(
|
||||
mPrimaryDisplay, width, height, PixelFormat::RGBA_8888, Dataspace::UNKNOWN));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IComposerClient::setPowerMode_2_2.
|
||||
*/
|
||||
|
|
|
@ -43,6 +43,13 @@ static_assert(sizeof(OldBufferDescriptorInfo) == sizeof(IMapper::BufferDescripto
|
|||
offsetof(IMapper::BufferDescriptorInfo, usage),
|
||||
"");
|
||||
|
||||
Gralloc::Gralloc() : V2_0::vts::Gralloc() {
|
||||
if (::testing::Test::HasFatalFailure()) {
|
||||
return;
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName)
|
||||
: V2_0::vts::Gralloc(allocatorServiceName, mapperServiceName) {
|
||||
if (::testing::Test::HasFatalFailure()) {
|
||||
|
|
|
@ -32,6 +32,7 @@ using V2_0::BufferDescriptor;
|
|||
// A wrapper to IAllocator and IMapper.
|
||||
class Gralloc : public V2_0::vts::Gralloc {
|
||||
public:
|
||||
Gralloc();
|
||||
Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName);
|
||||
|
||||
sp<IMapper> getMapper() const;
|
||||
|
|
Loading…
Reference in a new issue