Skip to content

Commit 4b24306

Browse files
committed
ui/cocoa: Add format check for shared surfaces
Only share surfaces for specific pixman formats supported by equivalent formats in CGImage. Probably more could be supported, but these are the ones implemented right now and should match the common cases. Signed-off-by: Rainer Müller <[email protected]>
1 parent 6de7737 commit 4b24306

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ui/cocoa.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,16 @@ static void cocoa_refresh(DisplayChangeListener *dcl)
11031103
[pool release];
11041104
}
11051105

1106+
static bool cocoa_check_format(DisplayChangeListener *dcl,
1107+
pixman_format_code_t format)
1108+
{
1109+
/* The only supported format is kCGImageAlphaNoneSkipFirst,
1110+
* for 32 and 16 bit
1111+
*/
1112+
return format == PIXMAN_x8r8g8b8 ||
1113+
format == PIXMAN_x1r5g5b5;
1114+
}
1115+
11061116
static void cocoa_cleanup(void)
11071117
{
11081118
COCOA_DEBUG("qemu_cocoa: cocoa_cleanup\n");
@@ -1113,6 +1123,7 @@ static void cocoa_cleanup(void)
11131123
.dpy_name = "cocoa",
11141124
.dpy_gfx_update = cocoa_update,
11151125
.dpy_gfx_switch = cocoa_switch,
1126+
.dpy_gfx_check_format = cocoa_check_format,
11161127
.dpy_refresh = cocoa_refresh,
11171128
};
11181129

0 commit comments

Comments
 (0)