diff --git a/frameworks/surface/src/buffer_queue.cpp b/frameworks/surface/src/buffer_queue.cpp index 022cc7b2ad..c2d83a4c62 100644 --- a/frameworks/surface/src/buffer_queue.cpp +++ b/frameworks/surface/src/buffer_queue.cpp @@ -122,13 +122,13 @@ GSError BufferQueue::PopFromDirtyList(sptr &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; } diff --git a/frameworks/surface/src/buffer_utils.cpp b/frameworks/surface/src/buffer_utils.cpp index 8fda12d8f9..74947a6647 100644 --- a/frameworks/surface/src/buffer_utils.cpp +++ b/frameworks/surface/src/buffer_utils.cpp @@ -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(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(config.colorGamut)); } void ReadFlushConfig(MessageParcel &parcel, BufferFlushConfig &config) diff --git a/frameworks/surface/test/unittest/buffer_queue_test.cpp b/frameworks/surface/test/unittest/buffer_queue_test.cpp index 2450d862a2..48c622d7c2 100644 --- a/frameworks/surface/test/unittest/buffer_queue_test.cpp +++ b/frameworks/surface/test/unittest/buffer_queue_test.cpp @@ -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; diff --git a/interfaces/innerkits/surface/surface_type.h b/interfaces/innerkits/surface/surface_type.h index cce70d9521..f7a4a05c6f 100644 --- a/interfaces/innerkits/surface/surface_type.h +++ b/interfaces/innerkits/surface/surface_type.h @@ -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 diff --git a/rosen/modules/composer/hdi_backend/src/hdi_device.cpp b/rosen/modules/composer/hdi_backend/src/hdi_device.cpp index 0800d25d03..cdf3aa53ea 100644 --- a/rosen/modules/composer/hdi_backend/src/hdi_device.cpp +++ b/rosen/modules/composer/hdi_backend/src/hdi_device.cpp @@ -253,8 +253,7 @@ int32_t HdiDevice::GetScreenReleaseFence(uint32_t screenId, std::vector &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 &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);