renderer/native: assert dumb buffer size on CPU copy
Track the allocated dumb buffer size in MetaDumbBuffer. Assert that the size is as expected in copy_shared_framebuffer_cpu(). This is just to ensure that Cogl and the real size match. The size from Cogl was used in the copy, so getting that wrong might have written beyond the allocation. This is a safety measure and has not been observed to happen yet.
This commit is contained in:
parent
3e1ca62782
commit
72e236106f
@ -124,6 +124,8 @@ typedef struct _MetaDumbBuffer
|
||||
uint32_t handle;
|
||||
void *map;
|
||||
uint64_t map_size;
|
||||
int width;
|
||||
int height;
|
||||
} MetaDumbBuffer;
|
||||
|
||||
typedef struct _MetaOnscreenNativeSecondaryGpuState
|
||||
@ -1798,6 +1800,9 @@ copy_shared_framebuffer_cpu (CoglOnscreen *onscreen,
|
||||
next_dumb_fb = &secondary_gpu_state->cpu.dumb_fbs[0];
|
||||
secondary_gpu_state->cpu.dumb_fb = next_dumb_fb;
|
||||
|
||||
g_assert (width == secondary_gpu_state->cpu.dumb_fb->width);
|
||||
g_assert (height == secondary_gpu_state->cpu.dumb_fb->height);
|
||||
|
||||
target_data = secondary_gpu_state->cpu.dumb_fb->map;
|
||||
target_fb_id = secondary_gpu_state->cpu.dumb_fb->fb_id;
|
||||
|
||||
@ -2299,6 +2304,8 @@ init_dumb_fb (MetaDumbBuffer *dumb_fb,
|
||||
dumb_fb->handle = create_arg.handle;
|
||||
dumb_fb->map = map;
|
||||
dumb_fb->map_size = create_arg.size;
|
||||
dumb_fb->width = width;
|
||||
dumb_fb->height = height;
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user