bugfix for WCG and remove restrictions for buffer request config by 8K

Signed-off-by: zhangyunfei <zhangyunfei15@huawei.com>
Change-Id: I256c7b8a644338e9dca6fedc45b0061ade1f05f0
This commit is contained in:
zhangyunfei 2022-02-26 08:56:23 +08:00
parent b510cd38b4
commit 4506b26c70
5 changed files with 18 additions and 57 deletions

View File

@ -122,13 +122,13 @@ GSError BufferQueue::PopFromDirtyList(sptr<SurfaceBufferImpl> &buffer)
GSError BufferQueue::CheckRequestConfig(const BufferRequestConfig &config)
{
if (config.width <= 0 || config.width > SURFACE_MAX_WIDTH) {
BLOGN_INVALID("config.width (0, %{public}d], now is %{public}d", SURFACE_MAX_WIDTH, config.width);
if (config.width <= 0) {
BLOGN_INVALID("config.width is greater than 0, now is %{public}d", config.width);
return GSERROR_INVALID_ARGUMENTS;
}
if (config.height <= 0 || config.height > SURFACE_MAX_HEIGHT) {
BLOGN_INVALID("config.height (0, %{public}d], now is %{public}d", SURFACE_MAX_HEIGHT, config.height);
if (config.height <= 0) {
BLOGN_INVALID("config.height is greater than 0, now is %{public}d", config.height);
return GSERROR_INVALID_ARGUMENTS;
}
@ -732,13 +732,13 @@ GSError BufferQueue::RegisterReleaseListener(OnReleaseFunc func)
GSError BufferQueue::SetDefaultWidthAndHeight(int32_t width, int32_t height)
{
if (width <= 0 || width > SURFACE_MAX_WIDTH) {
BLOGN_INVALID("defaultWidth (0, %{public}d], now is %{public}d", SURFACE_MAX_WIDTH, width);
if (width <= 0) {
BLOGN_INVALID("defaultWidth is greater than 0, now is %{public}d", width);
return GSERROR_INVALID_ARGUMENTS;
}
if (height <= 0 || height > SURFACE_MAX_HEIGHT) {
BLOGN_INVALID("defaultHeight (0, %{public}d], now is %{public}d", SURFACE_MAX_HEIGHT, height);
if (height <= 0) {
BLOGN_INVALID("defaultHeight is greater than 0, now is %{public}d", height);
return GSERROR_INVALID_ARGUMENTS;
}

View File

@ -55,6 +55,7 @@ void ReadRequestConfig(MessageParcel &parcel, BufferRequestConfig &config)
config.format = parcel.ReadInt32();
config.usage = parcel.ReadInt32();
config.timeout = parcel.ReadInt32();
config.colorGamut = static_cast<SurfaceColorGamut>(parcel.ReadInt32());
}
void WriteRequestConfig(MessageParcel &parcel, BufferRequestConfig const & config)
@ -65,6 +66,7 @@ void WriteRequestConfig(MessageParcel &parcel, BufferRequestConfig const & confi
parcel.WriteInt32(config.format);
parcel.WriteInt32(config.usage);
parcel.WriteInt32(config.timeout);
parcel.WriteInt32(static_cast<int32_t>(config.colorGamut));
}
void ReadFlushConfig(MessageParcel &parcel, BufferFlushConfig &config)

View File

@ -428,12 +428,13 @@ HWTEST_F(BufferQueueTest, RequestBuffer002, Function | MediumTest | Level2)
{
IBufferProducer::RequestBufferReturnValue retval;
BufferRequestConfig config = requestConfig;
config.width = SURFACE_MAX_WIDTH + 1;
config.height = -1;
GSError ret = bq->RequestBuffer(config, bedata, retval);
ASSERT_EQ(ret, OHOS::GSERROR_INVALID_ARGUMENTS);
}
/*
* Function: RequestBuffer
* Type: Function
@ -444,44 +445,6 @@ HWTEST_F(BufferQueueTest, RequestBuffer002, Function | MediumTest | Level2)
* 3. check ret
*/
HWTEST_F(BufferQueueTest, RequestBuffer003, Function | MediumTest | Level2)
{
IBufferProducer::RequestBufferReturnValue retval;
BufferRequestConfig config = requestConfig;
config.height = -1;
GSError ret = bq->RequestBuffer(config, bedata, retval);
ASSERT_EQ(ret, OHOS::GSERROR_INVALID_ARGUMENTS);
}
/*
* Function: RequestBuffer
* Type: Function
* Rank: Important(2)
* EnvConditions: N/A
* CaseDescription: 1. set BufferRequestConfig with abnormal value
* 2. call RequestBuffer
* 3. check ret
*/
HWTEST_F(BufferQueueTest, RequestBuffer004, Function | MediumTest | Level2)
{
IBufferProducer::RequestBufferReturnValue retval;
BufferRequestConfig config = requestConfig;
config.height = SURFACE_MAX_HEIGHT + 1;
GSError ret = bq->RequestBuffer(config, bedata, retval);
ASSERT_EQ(ret, OHOS::GSERROR_INVALID_ARGUMENTS);
}
/*
* Function: RequestBuffer
* Type: Function
* Rank: Important(2)
* EnvConditions: N/A
* CaseDescription: 1. set BufferRequestConfig with abnormal value
* 2. call RequestBuffer
* 3. check ret
*/
HWTEST_F(BufferQueueTest, RequestBuffer005, Function | MediumTest | Level2)
{
IBufferProducer::RequestBufferReturnValue retval;
BufferRequestConfig config = requestConfig;
@ -500,7 +463,7 @@ HWTEST_F(BufferQueueTest, RequestBuffer005, Function | MediumTest | Level2)
* 2. call RequestBuffer
* 3. check ret
*/
HWTEST_F(BufferQueueTest, RequestBuffer006, Function | MediumTest | Level2)
HWTEST_F(BufferQueueTest, RequestBuffer004, Function | MediumTest | Level2)
{
IBufferProducer::RequestBufferReturnValue retval;
BufferRequestConfig config = requestConfig;
@ -519,7 +482,7 @@ HWTEST_F(BufferQueueTest, RequestBuffer006, Function | MediumTest | Level2)
* 2. call RequestBuffer
* 3. check ret
*/
HWTEST_F(BufferQueueTest, RequestBuffer007, Function | MediumTest | Level2)
HWTEST_F(BufferQueueTest, RequestBuffer005, Function | MediumTest | Level2)
{
IBufferProducer::RequestBufferReturnValue retval;
BufferRequestConfig config = requestConfig;
@ -538,7 +501,7 @@ HWTEST_F(BufferQueueTest, RequestBuffer007, Function | MediumTest | Level2)
* 2. call RequestBuffer
* 3. check ret
*/
HWTEST_F(BufferQueueTest, RequestBuffer008, Function | MediumTest | Level2)
HWTEST_F(BufferQueueTest, RequestBuffer006, Function | MediumTest | Level2)
{
IBufferProducer::RequestBufferReturnValue retval;
BufferRequestConfig config = requestConfig;
@ -557,7 +520,7 @@ HWTEST_F(BufferQueueTest, RequestBuffer008, Function | MediumTest | Level2)
* 2. call RequestBuffer
* 3. check ret
*/
HWTEST_F(BufferQueueTest, RequestBuffer009, Function | MediumTest | Level2)
HWTEST_F(BufferQueueTest, RequestBuffer007, Function | MediumTest | Level2)
{
IBufferProducer::RequestBufferReturnValue retval;
BufferRequestConfig config = requestConfig;

View File

@ -23,8 +23,6 @@
namespace OHOS {
#define SURFACE_MAX_USER_DATA_COUNT 1000
#define SURFACE_MAX_WIDTH 7680
#define SURFACE_MAX_HEIGHT 7680
#define SURFACE_MAX_QUEUE_SIZE 10
#define SURFACE_DEFAULT_QUEUE_SIZE 3
#define SURFACE_MAX_STRIDE_ALIGNMENT 32

View File

@ -253,8 +253,7 @@ int32_t HdiDevice::GetScreenReleaseFence(uint32_t screenId, std::vector<uint32_t
int32_t HdiDevice::GetScreenSupportedColorGamuts(uint32_t screenId, std::vector<ColorGamut> &gamuts)
{
uint32_t mockGamutsNum = 1;
gamuts.resize(mockGamutsNum);
gamuts.clear();
gamuts.push_back(ColorGamut::COLOR_GAMUT_SRGB);
return DISPLAY_SUCCESS;
}
@ -298,8 +297,7 @@ int32_t HdiDevice::GetHDRCapabilityInfos(uint32_t screenId, HDRCapability &info)
int32_t HdiDevice::GetSupportedMetaDataKey(uint32_t screenId, std::vector<HDRMetadataKey> &keys)
{
uint32_t keysNum = 14; // keys number is 14
keys.resize(keysNum);
keys.clear();
keys.push_back(HDRMetadataKey::MATAKEY_RED_PRIMARY_X);
keys.push_back(HDRMetadataKey::MATAKEY_RED_PRIMARY_Y);
keys.push_back(HDRMetadataKey::MATAKEY_GREEN_PRIMARY_X);