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.
This commit is contained in:
parent
c71f6a18ad
commit
3e1ca62782
@ -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 */,
|
||||
|
Loading…
Reference in New Issue
Block a user