Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
a5ee8e62
Commit
a5ee8e62
authored
1 year ago
by
Kalesh Singh
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "libhwui: Move MAX_PAGE_SIZE into uirenderer namespace" into main
parents
99fa55cb
c662b393
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/hwui/utils/LinearAllocator.cpp
+9
-9
9 additions, 9 deletions
libs/hwui/utils/LinearAllocator.cpp
with
9 additions
and
9 deletions
libs/hwui/utils/LinearAllocator.cpp
+
9
−
9
View file @
a5ee8e62
...
...
@@ -31,15 +31,11 @@
#include
<utils/Log.h>
#include
<utils/Macros.h>
// The ideal size of a page allocation (these need to be multiples of 8)
#define INITIAL_PAGE_SIZE ((size_t)512) // 512b
#define MAX_PAGE_SIZE ((size_t)131072) // 128kb
// The maximum amount of wasted space we can have per page
// Allocations exceeding this will have their own dedicated page
// If this is too low, we will malloc too much
// Too high, and we may waste too much space
// Must be smaller than
INITIAL_PAGE_SIZE
// Must be smaller than
kInitialPageSize
#define MAX_WASTE_RATIO (0.5f)
#if LOG_NDEBUG
...
...
@@ -75,6 +71,10 @@ static void _addAllocation(int count) {
namespace
android
{
namespace
uirenderer
{
// The ideal size of a page allocation (these need to be multiples of 8)
static
constexpr
size_t
kInitialPageSize
=
512
;
// 512b
static
constexpr
size_t
kMaxPageSize
=
131072
;
// 128kb
class
LinearAllocator
::
Page
{
public:
Page
*
next
()
{
return
mNextPage
;
}
...
...
@@ -94,8 +94,8 @@ private:
};
LinearAllocator
::
LinearAllocator
()
:
mPageSize
(
INITIAL_PAGE_SIZE
)
,
mMaxAllocSize
(
INITIAL_PAGE_SIZE
*
MAX_WASTE_RATIO
)
:
mPageSize
(
kInitialPageSize
)
,
mMaxAllocSize
(
kInitialPageSize
*
MAX_WASTE_RATIO
)
,
mNext
(
0
)
,
mCurrentPage
(
0
)
,
mPages
(
0
)
...
...
@@ -135,8 +135,8 @@ bool LinearAllocator::fitsInCurrentPage(size_t size) {
void
LinearAllocator
::
ensureNext
(
size_t
size
)
{
if
(
fitsInCurrentPage
(
size
))
return
;
if
(
mCurrentPage
&&
mPageSize
<
MAX_PAGE_SIZE
)
{
mPageSize
=
min
(
MAX_PAGE_SIZE
,
mPageSize
*
2
);
if
(
mCurrentPage
&&
mPageSize
<
kMaxPageSize
)
{
mPageSize
=
min
(
kMaxPageSize
,
mPageSize
*
2
);
mMaxAllocSize
=
mPageSize
*
MAX_WASTE_RATIO
;
mPageSize
=
ALIGN
(
mPageSize
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment