← Back to roadmap

Big Boards, Slow GPUs: Dirty Rectangles, Tiles and RenderNodes

Why changing one stroke on a 4K board can repaint the whole board, what Android actually marks as dirty, and how to keep a change as small as the stroke: tile Views, bitmaps per tile and RenderNodes. With a lab that counts draw calls, pixels and uploads for four ways of holding finished strokes.

  • Android
  • Graphics
  • Performance
  • Panels
  • Internals
On this page
  1. What you’ll study
  2. The basics
  3. Try it: the board lab
  4. The high level
  5. The low level
  6. Checkpoint
  7. Why it helps
  8. The map
  9. Edge cases
  10. Cross questions
  11. Revision: key points
  12. Cheat sheet
  13. Read next
  14. The fine print

What you’ll study

  1. What a change to one stroke costs on a big board, in three separate costs: recording draw calls, repainting pixels and uploading bitmaps.
  2. What Android marks as dirty when something changes, and why invalidate(Rect) no longer narrows it.
  3. How the dirty area becomes one rectangle, when the GPU gets only that rectangle, and why that part is up to the device.
  4. Four ways to hold finished strokes (one View or tiles, display lists or bitmaps) and what each one costs, from a lab.
  5. How to build tiles in an app, and how to keep finished strokes in a RenderNode.
  6. What overdraw and fill rate are, what the numbers on a 4K board come to, and how to measure on the panel itself.

How it connects

Guide 2 said a View draws into a display list and that a changed bitmap is uploaded to the GPU again as a whole. This guide is what that costs when the View is 3840 pixels wide. Guide 8 drew the stroke being written on its own layer and then handed it to the finished strokes, and guide 7 said finished strokes live in a View of your own; this guide is about how that View should be built. Guide 9 found which strokes an eraser touched with bounding boxes, and the same boxes here say which tiles a change touches. Guide 10 put many hands on one board, which is how a board gets to thousands of strokes.

Read it at your level

Level Read You should be able to
Student The basics, the board lab Say why drawing one more line can make the whole screen repaint
Fresher + The high level Name the three costs of a change, and say which a tile cuts
Junior + Damage and the dirty rectangle, tiles Explain why invalidate(Rect) doesn’t help, and why separate Views do
Mid + Bitmaps, RenderNodes, the snippets Choose between tile Views of display lists and of bitmaps, and say what each costs
Senior + Edge cases, cross questions Decide a tile size, say what you would measure on a panel, and say what this guide’s counts can’t tell you

The basics

A classroom board can be a 4K screen: 3840 by 2160 pixels is 8,294,400 of them, and at four bytes a pixel that is 33,177,600 bytes. One full-screen layer drawn 60 times a second touches about 497.7 million pixels a second. That is arithmetic, not a measurement of any chip; the point is only that on a board this size the unit that matters is the pixel, and a drawing app that touches every pixel for every pen stroke is doing 8 million pixels of work to change a few thousand.

Three different costs hide in “the screen updated”, and they land on different threads:

  • Recording. A View draws by writing draw calls into a display list (guide 2). A View that draws 2,000 strokes writes 2,000 draw calls, on the UI thread, every time it is asked to draw again.
  • Repainting. The GPU runs the draw calls and writes pixels. How many pixels it is asked to write is the damage.
  • Uploading. A bitmap the CPU changed has to be copied to the GPU as a texture before it can be drawn.

Everything a board app can do about a big board is a way of making these three cost in proportion to the stroke that changed, not to the board. The usual way is to cut the board into pieces that are recorded, repainted and uploaded on their own: tiles.

One piece of perspective from the Android docs: their overdraw page says that unless you are optimising for a known low-performance GPU, the UI thread’s work is the better place to look first (Reduce overdraw). On a big board the two meet, because a bigger area means more of both. This guide counts them and doesn’t say which one limits your panel; that is for a trace on the panel.

Try it: the board lab

A board of finished strokes, held four ways. The table is the cost of changing one stroke (erasing it or writing it), as a mean over 50 strokes spread through the board, counted for each way side by side. Click the board to pick one stroke and see its own damage as a shaded area; click a row to choose which way the board shows. Partial updates is the switch that decides whether the GPU gets only the dirty rectangle or repaints the whole board.

Interactive board lab: a 1080p or 4K board of 500 to 10,000 strokes held as one View with a display list, one View with a bitmap, tile Views with display lists, or tile Views with bitmaps, with counts of draw calls recorded, strokes painted, bytes uploaded, pixels repainted and draw calls replayed when a stroke is erased or written. Needs JavaScript.

Things to try. Each starts from the lab’s defaults (Board 4K, Strokes 2,000, A stroke is erased, Tile size 512 px, Partial updates On) and names every setting it changes.

  • One View pays for the whole board. In the first row, erasing one stroke records 1,999 draw calls and repaints 8.29 million pixels, all of them. It is the same whichever stroke you pick, and the same with Partial updates Off.
  • Tiles pay for the neighbourhood. In the third row the same erase records 739 draw calls and repaints 0.86 million pixels, about a tenth of the board, in 40 Views. Click different strokes: the shaded tiles move with the stroke, and a stroke that crosses a tile edge shades both tiles.
  • A bitmap trades recording for uploading. The second row records 1 draw call, but it repaints the whole board and uploads 33.2 MB, the whole bitmap, to change one stroke. The fourth row uploads 3.5 MB: only the tiles that changed. It paints 443 strokes into those tiles’ bitmaps, against 205 for the one bitmap, because a stroke that crosses tiles is drawn once in each.
  • Writing is cheaper than erasing for bitmaps. Set A stroke is to written. The second row paints 1 stroke and the fourth paints 4 (one per tile it touches), and uploads are the same as for an erase. A list-based View records 2,000 for a write, one more than for an erase; the tile row 743, against 739.
  • The driver’s switch. Set Partial updates to Off. The tile row still records 739 draw calls, because recording is the UI thread’s, but it now repaints 8.29 million pixels and replays 7,076 draw calls, and the bitmap tiles replay 40 draws instead of 4. The tiles saved nothing on the GPU, and kept the saving on the UI thread.
  • Tile size is a trade. Set Tile size to 256, then 1,024. Views: 135, 40, 12. Pixels repainted: 0.53, 0.86, 1.80 million. Draw calls recorded: 1,028, 739, 845. Bytes uploaded for bitmap tiles: 2.1, 3.5, 7.2 MB. Small tiles repaint less but cut more strokes in pieces, which is why recorded calls are lowest in the middle.
  • More strokes, more reason to tile. With Tile size 512 px, set Strokes to 500, then 10,000. One View records 499, then 9,999. The tile row records 186, then 3,637.
  • A smaller board. Set Board to 1080p with 2,000 strokes: the same erase repaints 0.45 million of 2.07 million pixels in 12 Views, and the one-View row still records 1,999.

The lab counts. It has no timer, no GPU and no frame rate, and the numbers are the model’s, from this guide’s own counting rules, which the next sections give the sources for. Strokes grow with the board, so a 4K board’s handwriting is twice as many pixels across as a 1080p board’s.

The high level

Step What it does Where it goes wrong
Change A stroke is added or removed The app doesn’t say which part of the board changed, and Android can’t ask
Invalidate The View that holds the stroke is marked dirty A View is the smallest piece Android knows about: all of it is dirty
Record The View draws again into its display list All of the View’s strokes are drawn again, on the UI thread
Damage The View’s bounds are added to the frame’s dirty area One big View makes a board-sized dirty area
Rectangle The frame’s damage becomes one rectangle Far-apart changes become one big rectangle
Repaint The GPU draws the display lists that meet the rectangle Only if the device runs with partial updates, and only for Views that clip to their bounds
Upload A bitmap that changed is copied to the GPU The whole bitmap, however small the change

The low level

Source excerpts are from AOSP main (frameworks/base), trimmed with …; lines marked [note] are the author’s. Links are in The map. Whether a frame uses a partial rectangle depends on the device’s graphics driver, so each excerpt says what it does, not what every phone does.

1. invalidate(Rect) no longer narrows anything

The obvious way to say “only this part changed” is the version of invalidate that takes a rectangle. It is deprecated, and the comment says why:

// View.java
/**
 * @deprecated The switch to hardware accelerated rendering in API 14 reduced
 * the importance of the dirty rectangle. In API 21 the given rectangle is
 * ignored entirely in favor of an internally-calculated area instead.
 * Because of this, clients are encouraged to just call {@link #invalidate()}.
 */
@Deprecated
public void invalidate(Rect dirty) { … }

So one View is dirty or it isn’t. A View that draws the whole board, with 2,000 strokes in its onDraw, records all 2,000 whenever any one changes, and Jetpack Ink’s own finished-strokes view is built like that: FinishedShapesView, a private View inside InProgressStrokesView, whose onDraw loops over the finished strokes, with addStrokes and removeStrokes each calling invalidate() (InProgressShapesView.kt, Ink 1.0.0). Ink’s renderer keeps what it builds for a stroke in a weak map, so a redraw reuses it and does not build it again: the platform Mesh on Android 14 and later, and cached path data on older versions. What the redraw still pays is a draw call per stroke, which is what the lab’s first row counts.

2. What a changed RenderNode marks as dirty

A View’s display list lives in a RenderNode. When a node’s list changes, the renderer asks the node to damage itself, and the node says how much:

// RenderNode.cpp
void RenderNode::damageSelf(TreeInfo& info) {
    if (isRenderable()) {
        …
        if (properties().getClipDamageToBounds()) {
            info.damageAccumulator->dirty(0, 0, properties().getWidth(), properties().getHeight());
        } else {
            // Hope this is big enough?
            // TODO: Get this from the display list ops or something
            info.damageAccumulator->dirty(DIRTY_MIN, DIRTY_MIN, DIRTY_MAX, DIRTY_MAX);
        }
        …
    }
}
// RenderProperties.h
bool getClipDamageToBounds() const {
    return getClipToBounds() && (getZ() <= 0 || getOutline().isEmpty());
}

A node that clips to its bounds, and has no elevation with an outline, damages only its own bounds. Any other node adds the largest rectangle there is, and each ancestor that clips then cuts it back to its own bounds as the damage is passed up (applyRenderNodeTransform in DamageAccumulator.cpp), so in practice it damages up to the nearest ancestor that clips. A View inside a ViewGroup clips to its bounds when the group clips its children, which is the default (setDisplayListProperties in View.java). [note] That is why tile Views should be flat: a tile with an elevation and an outline would damage up to its nearest clipping ancestor, the board or the window, instead of only itself.

The same damage is added when a node’s properties change. Moving a node (its translation or scale) damages its old and new area without recording its list again, which is useful for panning and bad for the board’s size: panning a whole board changes every pixel.

3. The dirty area is one rectangle, and the driver decides whether it is used

All the damage in a frame is added into one dirty rectangle, and CanvasContext::computeDirtyRect decides what the GPU is asked to repaint:

// CanvasContext.cpp
SkRect CanvasContext::computeDirtyRect(const Frame& frame, SkRect* dirty) {
    if (frame.width() != mLastFrameWidth || frame.height() != mLastFrameHeight) {
        // can't rely on prior content of window if viewport size changes
        dirty->setEmpty();
        …
    } else if (mHaveNewSurface || frame.bufferAge() == 0) {
        // New surface needs a full draw
        dirty->setEmpty();
    } else { … }

    if (dirty->isEmpty()) {
        dirty->setIWH(frame.width(), frame.height());   // [note] empty means the whole window
        return *dirty;
    }
    …
    // If the buffer age is 1 the buffer contents are the same as they were
    // last frame so there's nothing to union() against
    // Therefore we only care about the > 1 case.
    if (frame.bufferAge() > 1) { … dirty->join(mSwapHistory[i].damage); … }

Three things follow. A change in window size, a new surface, or a buffer of unknown age repaints the whole window. A buffer that is more than one frame old also repaints what the frames since then changed, so a stroke’s rectangle is repainted again over the next frames. And the rectangle is one rectangle: two changes at opposite corners of the board give a rectangle that covers the board, which is why a stroke that crosses a tile edge is a block of tiles and not a scatter.

Whether any of this is used depends on how the surface was set up. On the OpenGL pipeline (EglManager):

// EglManager.cpp
if (Properties::enablePartialUpdates) {
    …
    if (Properties::useBufferAge && EglExtensions.bufferAge) {
        mSwapBehavior = SwapBehavior::BufferAge;
    } else {
        mSwapBehavior = SwapBehavior::Preserved;
    }
}
…
if (mEglConfig == EGL_NO_CONFIG_KHR) {
    if (mSwapBehavior == SwapBehavior::Preserved) {
        // Try again without dirty regions enabled
        … mSwapBehavior = SwapBehavior::Discard;

The defaults are both on, and each can be switched off by a debug system property, but this excerpt shows a device that has neither the buffer-age extension nor a configuration with preserved swap falling back to repainting everything (Discard). The Vulkan pipeline is different: a comment in SkiaVulkanPipeline.cpp says it ignores the swap behavior because it “will always operate in a mode equivalent to” buffer age. I read that comment and not the rest of the Vulkan path. So the lab’s Partial updates switch is the OpenGL fallback: I can’t tell you which pipeline or which side of the fork a given panel is on, and nothing in the guide ran on one. That is the first thing to find out, with a trace (below).

4. A node that misses the rectangle is skipped

With a partial rectangle, the renderer clips drawing to it (SkiaPipeline, androidFramework_setDeviceClipRestriction), and then, as each node is drawn:

// RenderNodeDrawable.cpp, in drawContent
const SkRect bounds = SkRect::MakeWH(properties.getWidth(), properties.getHeight());
bool quickRejected = properties.getClipToBounds() && canvas->quickReject(bounds);
if (!quickRejected) { … }

A node that clips to its bounds, and whose bounds fall outside the clip, is rejected without replaying its list. That is what makes tiles pay off on the GPU thread: the tiles that did not change (about 36 of the 40, on average, in the lab’s start board) are not replayed, and in the lab’s Partial updates Off case every tile is. A single View has no such saving, because its one node is always inside the rectangle.

5. Tiles in an app

A tile is a View that holds the finished strokes touching it. A stroke is held by every tile its bounding box touches (the same box guide 9 used for the eraser), and the tile draws its own strokes, shifted to its own corner:

class TileView(
    context: Context,
    private val renderer: CanvasStrokeRenderer,
    private val originX: Int,
    private val originY: Int,
) : View(context) {
    private val strokes = LinkedHashSet<Stroke>()
    private val identity = Matrix()

    fun add(stroke: Stroke) {
        if (strokes.add(stroke)) invalidate()
    }

    fun remove(stroke: Stroke) {
        if (strokes.remove(stroke)) invalidate()
    }

    override fun onDraw(canvas: Canvas) {
        canvas.translate(-originX.toFloat(), -originY.toFloat()) // strokes are in board coordinates
        for (stroke in strokes) renderer.draw(canvas, stroke, identity)
    }
}

The board is a FrameLayout of tiles, with the grid arithmetic of guide 9’s StrokeGrid:

class TiledBoard(
    context: Context,
    private val boardWidth: Int,
    private val boardHeight: Int,
    private val tileSize: Int = 512,
) : FrameLayout(context) {
    private val renderer = CanvasStrokeRenderer.create()
    private val columns = (boardWidth + tileSize - 1) / tileSize
    private val rows = (boardHeight + tileSize - 1) / tileSize
    private val tiles = List(columns * rows) { i ->
        val x = (i % columns) * tileSize
        val y = (i / columns) * tileSize
        TileView(context, renderer, x, y).also {
            val params = LayoutParams(min(tileSize, boardWidth - x), min(tileSize, boardHeight - y))
            params.leftMargin = x
            params.topMargin = y
            addView(it, params)
        }
    }

    private fun tilesUnder(stroke: Stroke): List<TileView> {
        val box = stroke.shape.computeBoundingBox() ?: return emptyList()
        val c0 = floor(box.xMin / tileSize).toInt().coerceAtLeast(0)
        val c1 = floor(box.xMax / tileSize).toInt().coerceAtMost(columns - 1)
        val r0 = floor(box.yMin / tileSize).toInt().coerceAtLeast(0)
        val r1 = floor(box.yMax / tileSize).toInt().coerceAtMost(rows - 1)
        val out = ArrayList<TileView>()
        for (r in r0..r1) for (c in c0..c1) out.add(tiles[r * columns + c])
        return out
    }

    fun add(stroke: Stroke) = tilesUnder(stroke).forEach { it.add(stroke) }

    fun remove(stroke: Stroke) = tilesUnder(stroke).forEach { it.remove(stroke) }
}

Imports are kotlin.math.floor and kotlin.math.min plus the usual Android and Ink ones. Strokes are added in the order they were written, and each tile keeps that order, so overlapping strokes stack the same way in every tile. When the eraser of guide 9 removes a stroke, call remove with the same stroke, and only the tiles it touched record again. [note] The lab’s counts are for this layout, with the stroke’s box standing in for what the tile really needs to redraw.

6. Bitmaps: fewer draw calls, a whole upload

A tile can hold a bitmap instead of a list: paint the tile’s strokes into a Bitmap on the CPU, and the View draws that one bitmap. The hardware-acceleration guide says what that costs: a bitmap whose content changed is “uploaded again as a GPU texture” the next time you draw it (quoted in guide 2). A tile’s bitmap is the tile’s size, so a change uploads one tile’s worth: in the lab, 3.5 MB at 512 px against 33.2 MB for one bitmap the size of the board. Memory is the same either way, one bitmap’s worth, because every tile of this board holds a stroke; a tile with no strokes needs no bitmap, which is the one place tiles save memory.

Two costs the lab shows and one it doesn’t. Bitmaps paint strokes on the CPU: the lab’s Strokes painted into a bitmap column counts them, and it goes up when tiles shrink, because a stroke across an edge is painted into both. And Ink’s renderer draws meshes only on a hardware canvas (canDrawMesh in CanvasMeshSupport), so painting into a Bitmap canvas falls back to another rendering route in the library; I haven’t compared the two on speed.

7. RenderNodes: record once, move for free

A tile View of display lists asks each tile to record its strokes again on a change. If the strokes don’t change but the board moves, record them once into a RenderNode and move the node:

@RequiresApi(Build.VERSION_CODES.Q)
class RecordedStrokes(private val renderer: CanvasStrokeRenderer) {
    private val node = RenderNode("finished-strokes")
    private val identity = Matrix()

    fun record(strokes: List<Stroke>, width: Int, height: Int) {
        node.setPosition(0, 0, width, height)
        val canvas = node.beginRecording(width, height)
        try {
            for (stroke in strokes) renderer.draw(canvas, stroke, identity)
        } finally {
            node.endRecording()
        }
    }

    fun panTo(dx: Float, dy: Float) {
        node.setTranslationX(dx)
        node.setTranslationY(dy)
    }

    /** Call from a View's onDraw. A RenderNode can only be drawn on a hardware canvas. */
    fun drawInto(canvas: Canvas) {
        if (canvas.isHardwareAccelerated) canvas.drawRenderNode(node)
    }
}

RenderNode is a public API from Android 10 (API 29), so a minSdk below that needs the @RequiresApi guard shown, and drawRenderNode throws on a software canvas, hence the check. Moving the node damages its old and new area (section 2): nothing is recorded again, and a pan still repaints the board. The saving is on the UI thread. Changing the node does not ask for a frame by itself; the RenderNode docs say to call invalidate() on the View that draws it, and that View records one drawRenderNode call.

8. Overdraw and fill rate

Overdraw is painting the same pixel more than once in one frame; fill rate is how fast the GPU can write pixels. The Android docs name the tools: Debug GPU Overdraw shows how many times each pixel is drawn, and Profile GPU Rendering shows the time of each stage as bars, where a high Process bar with heavy overdraw points to the GPU being overwhelmed (Reduce overdraw, Inspect rendering speed). Two things a drawing board adds: strokes overlap each other, so a dense board paints some pixels many times; and a translucent View is rendered in an off-screen buffer, which the docs say doubles the fill rate it needs (quoted in guide 2). Keep tiles at full alpha where you can. This guide does not say how many millions of pixels a given panel’s GPU can fill; that number is the panel’s, and the way to get it is the profiler on the panel.

Checkpoint

You should be able to say:

  • A change costs three things: draw calls recorded (UI thread), pixels repainted (GPU) and bytes uploaded (bitmaps), and tiles cut all three.
  • invalidate(Rect) has been ignored since API 21; one View is all dirty or not at all.
  • A node that clips to its bounds, with no elevation outline, damages only its bounds, and a node outside the dirty rectangle is skipped.
  • The frame’s damage is one rectangle, and whether the GPU repaints only that is the device’s: a switch the lab shows, not one the guide knows for your panel.
  • A changed bitmap is uploaded whole, so tile it; strokes across a tile edge are drawn in both tiles.
  • A RenderNode records once and moves without recording again, but a pan still repaints.
  • Overdraw and fill rate are measured with the profiler on the panel, not read off a table.

Why it helps

Symptom What is happening What to do
Erasing one stroke on a full board stutters, and gets worse as the board fills One View re-records every stroke, and its whole area is damaged Tile the board, so only the tiles the stroke touches record again
A bitmap board is fast to draw but stutters on every change The whole bitmap is uploaded again Tile the bitmap, so a change uploads a tile
Tiles didn’t help the GPU On the OpenGL pipeline, partial updates may be off or unsupported, so every frame repaints the board Check with a trace on the panel; keep the tiles for the UI thread’s sake
Panning the board is slow, though nothing is recorded The moved node damages its whole area Pan a RenderNode or View, accept the repaint, and keep the board’s layers opaque
Tiles made things slower Tiles too small: many Views, and strokes drawn in every tile they cross Make tiles bigger, then measure again
A tile repaints far more than itself The tile has an elevation and an outline, so its damage isn’t cut to its own bounds Remove the elevation from tiles
Everything is a little slow on a 4K panel and nothing stands out A lot of translucent layers, or heavy overdraw Look at Debug GPU Overdraw and the Process bar on the panel

The map

Topic Code Where
invalidate(Rect) ignored View.invalidate(Rect) View.java
A View’s node clips to its bounds View.setDisplayListProperties View.java
A node damages itself RenderNode::damageSelf RenderNode.cpp
What counts as damage to bounds getClipDamageToBounds RenderProperties.h
The dirty rectangle and buffer age CanvasContext::computeDirtyRect CanvasContext.cpp
Preserved, buffer-age or discard swap EglManager EglManager.cpp
Partial updates and buffer age on by default Properties::enablePartialUpdates, useBufferAge Properties.cpp
The clip to the dirty region androidFramework_setDeviceClipRestriction SkiaPipeline.cpp
A clipping ancestor trims child damage DamageAccumulator::applyRenderNodeTransform DamageAccumulator.cpp
The Vulkan pipeline and buffer age SkiaVulkanPipeline::setSurface SkiaVulkanPipeline.cpp
The finished-strokes view FinishedShapesView InProgressShapesView.kt
A node outside the clip is skipped RenderNodeDrawable::drawContent RenderNodeDrawable.cpp
RenderNode, drawRenderNode RenderNode, Canvas.drawRenderNode RenderNode reference
Mesh and path caches, hardware canvas check CanvasMeshRenderer, CanvasPathRenderer, CanvasMeshSupport Ink releases
Bitmap uploads, paths as masks The hardware acceleration guide Hardware acceleration
Overdraw, fill rate, the tools The overdraw and profiling pages Reduce overdraw

Edge cases

  • Buffer age. A buffer more than one frame old repaints the damage of the frames since too, so the cost of one stroke is spread over the next few frames. The lab counts one frame.
  • Strokes drawn while the pen is down. The stroke being written is not a tile’s: guide 8’s front layer draws it, and it joins a tile on finished. If the in-progress stroke and the tile it is handed to are both drawn for a frame, that is guide 8’s handoff, not this one.
  • Zoom. A zoomed board changes every pixel, so no tiling saves a repaint while it moves. A tile of bitmaps was painted at one scale and goes soft when scaled up, so it has to be painted again at the new one. A tile of display lists was recorded with the transform it was given: Ink’s CanvasStrokeRenderer.draw says an inaccurate strokeToScreenTransform can make strokes blurry or aliased, so record the tiles again with the new scale once the zoom settles.
  • A very long stroke. A stroke across the board touches every tile on its way and is recorded in each. The lab’s strokes are short; a ruler line or a shape is not.
  • Tiles with bitmaps on a low-memory panel. One bitmap’s worth of memory is held either way, and a lot of it: 33.2 MB at 4K for one layer. Whether the panel has room is a measurement on the panel.
  • Lint. TileView and TiledBoard take their arguments in the constructor, so Android Studio’s lint warns they lack the constructors layout inflation needs; they are made in code.
  • Version differences. This is AOSP main as read on 17 November 2026 and Ink 1.0.0. Release builds differ.

Cross questions

Why can't I just tell Android which part of my View changed?

invalidate(Rect) takes a rectangle, but since API 21 it is ignored: the platform works out the area itself. What it works out is per View, so the way to say "only this part" is to make the part a View, or a layer. That is what a tile is.

If the GPU only repaints the dirty rectangle, why does one big View hurt?

Two reasons. The dirty rectangle of one big View is the whole View, because that is its bounds. And repainting is only part of the cost: the View records every stroke into its display list on the UI thread again, which a partial rectangle doesn't reduce.

Do tiles always make the GPU do less?

No. Only if the device repaints just the dirty rectangle, which on the OpenGL pipeline depends on its driver (the buffer-age and preserved-swap paths above) and which the Vulkan pipeline's comment says it always does. Without it every frame repaints the whole window whatever the tiles do, and the tiles' saving is on the UI thread alone. The way to find out is a trace on the panel.

Is 512 the right tile size?

It was the lowest point on the lab's board for draw calls recorded, but that is this board's strokes: boxes about 242 pixels across at 1080p and 484 at 4K, on average. Smaller tiles repaint and upload less and cut more strokes in pieces; bigger ones the opposite. Try 256, 512 and 1,024 on your own strokes and your own panel.

Bitmaps or display lists?

Display lists can be recorded again at a new zoom (with the new strokeToScreenTransform) and cost draw calls on every change to a tile; bitmaps draw as one call and cost an upload on every change, and fix their resolution at the time they are painted. A board that is mostly written and rarely erased suits bitmaps; one that is erased and zoomed a lot suits lists. The lab only counts; it can't say which is faster.

Does Ink already do this?

Not for the finished strokes view. Its renderer reuses what it built for a stroke, but its own view for finished strokes is one View whose onDraw draws all of them, and removeFinishedStrokes exists so an app can hold finished strokes in a view of its own, which is where a tiled board goes.

Does a RenderNode make my board faster?

For moving it, on the UI thread: the list is recorded once and the node moves without recording again. The moved area is still repainted, so a pan costs a repaint of what moved, and a RenderNode of the whole board moves all of it.

What would I measure on the panel?

First whether the frame's dirty area is partial: the system's Profile GPU Rendering bars and a Perfetto trace of a stroke being erased, with and without tiles. Then the recorded draw calls and the time on the UI thread, then the GPU stage. The lab says what to expect to change; it can't say by how much.

Revision: key points

  1. A change costs recording (UI thread), repainting (GPU) and uploading (bitmaps); on a 4K board a full layer is 8,294,400 pixels and 33,177,600 bytes.
  2. invalidate(Rect) is ignored since API 21; one View is all dirty, so one View of all the strokes re-records them all.
  3. A node that clips to its bounds, without an elevation outline, damages only its bounds; tiles should be flat Views.
  4. The frame’s damage is one rectangle; with partial updates a node outside it is skipped, without them everything repaints, and the driver decides which.
  5. A changed bitmap is uploaded whole: tile it so a change uploads a tile.
  6. Tile size trades repaint and upload against Views and strokes drawn twice; on the lab’s board, calls recorded were lowest at 512 px.
  7. A RenderNode records once and moves without recording; moving still damages its area.
  8. Overdraw and fill rate are measured with the profiler on the panel.

Cheat sheet

Each concept in a few words.

Concept In a few words
Damage The part of the screen that changed and must be repainted.
Dirty rectangle One rectangle covering all the damage in a frame.
Recording Writing a View’s draw calls into its display list, on the UI thread.
Replay The GPU thread running recorded draw calls.
RenderNode A View’s recorded draw calls and properties; damage is tracked per node.
Clip to bounds A node only damages and draws inside its own box.
Tile A fixed-size piece of the board with a View of its own.
Partial updates Repainting only the dirty rectangle; the device decides if it’s on.
Buffer age How many frames old the buffer being drawn into is.
Texture upload Copying a changed bitmap to the GPU, always whole.
Fill rate How many pixels the GPU can write each second.
Overdraw Painting the same pixel more than once in a frame.
  • The docs: Reduce overdraw, Inspect rendering speed and Hardware acceleration
  • The source: the files in The map, especially damageSelf, computeDirtyRect and drawContent
  • References: RenderNode, and guide 2 and guide 8 for the pieces this builds on
  • Where real software uses this: the interactive whiteboards and drawing apps that keep a large page of finished strokes; the lab is a model of the cost, not of any one product

Search terms that find more: Android dirty region partial update HWUI, RenderNode damage, EGL buffer age Android, invalidate(Rect) deprecated, Debug GPU Overdraw, tile based canvas Android, Perfetto frame timeline, bitmap texture upload Android.

The fine print

The source was read from AOSP main (frameworks/base, including libs/hwui; the Vulkan pipeline only for one comment) on 17 November 2026, and the Kotlin sources of androidx.ink 1.0.0. The Kotlin snippets compile against androidx.ink 1.0.0 and were linted at minSdk 26; lint’s only warnings are that the two Views have no inflation constructor, and they were not run on a device. The lab is a TypeScript model whose tests check the counting rules, with no library or device vectors to check against. Its counting rules follow the source excerpts above, but nothing was measured: no time, no frame rate, no GPU, and no panel. A stroke is one draw call and its samples’ box grown by half its width; a change is one stroke appearing or disappearing, and the numbers are the mean of 50 strokes spread through the board, from a fixed seed, for the lists and bitmaps after the change. The lab damages the touched tiles’ union as one rectangle and counts one frame, so buffer age is not modelled; whether Partial updates is on is a switch because that is the device’s. Bitmaps are counted at four bytes a pixel. The page was checked in the built-in browser pane in dark theme, with a synthetic click on the board, and every “Things to try” number was read back from the page. The light theme, narrow widths and a phone were not checked.

Part of the ink series: 1. Why naive drawing feels bad, 2. Canvas, Paint and Path, 3. Looper, epoll and vsync, 4. From glass to your app, 5. Reading a MotionEvent, 6. Smoothing and predicting the pen, 7. From points to a stroke mesh, 8. Drawing with low latency, 9. The eraser, 10. Many hands on one board.

How useful was this guide?

Only the author sees ratings.

Friday's 5 best, plus one guide

The Friday email is on its way. Until then, follow by RSS.