diff options
author | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2018-09-05 10:38:09 +0300 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2018-10-04 11:57:35 +0300 |
commit | 3e1ca62782043e3d58d21c205a217624e72faf9c (patch) | |
tree | 96602c4106c8ac257acecdb5377af5d5b08d94ca | |
parent | c71f6a18ad113830226dc98f70b1ed4ea11fb3db (diff) | |
download | mutter-3e1ca62782043e3d58d21c205a217624e72faf9c.tar.gz |
renderer/native: check format for drmModeAddFB fallback
If drmModeAddFB2() does not work, the fallback to drmModeAddFB() can
only handle a single specific format. Make sure the requested format is
that one format, and fail the operation otherwise.
This should at least makes the failure mode obvious on such old systems
where the kernel does not support AddFB2, rather than producing wrong
colors.
-rw-r--r-- | src/backends/native/meta-renderer-native.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 08b9befbb..6eaa0b45f 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -3,6 +3,7 @@ /* * Copyright (C) 2011 Intel Corporation. * Copyright (C) 2016 Red Hat + * Copyright (c) 2018 DisplayLink (UK) Ltd. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -2246,6 +2247,15 @@ init_dumb_fb (MetaDumbBuffer *dumb_fb, if (fb_id == 0) { + if (format != DRM_FORMAT_XRGB8888) + { + g_set_error (error, G_IO_ERROR, + G_IO_ERROR_FAILED, + "drmModeAddFB does not support format 0x%x", + format); + goto err_add_fb; + } + if (drmModeAddFB (kms_fd, width, height, 24 /* depth of RGBX8888 */, 32 /* bpp of RGBX8888 */, |