summaryrefslogtreecommitdiff
authorKevin Murphy <kemurphy@andrew.cmu.edu>2012-05-08 09:02:08 (GMT)
committer Ray Strode <rstrode@redhat.com>2012-05-11 15:54:05 (GMT)
commitcdbfba5364d5bbb6fa16f84aff90b2ebb3a17315 (patch) (side-by-side diff)
tree26b631fc608f2bd2a0fa50845319723ad04b2bdf
parente274cda1eee35730faa47a10198c0740e635c724 (diff)
downloadplymouth-master.zip
plymouth-master.tar.gz
drm: for minimum buffer size to be greater than 0HEADmaster
The drm driver tells us the minimum dimensions it supports for buffer objects. We use this minimum for creating a small temporary 32-bit buffer to test if 32-bit buffers are supported. Unfortunately, some drivers neglect to fill in min_width/min_height and then we try to allocate a buffer with 0 sized dimensions. This commit checks for min_width/min_height being 0, and then bumps them to 1. Minor changes to initial patch by Ray Strode.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/plugins/renderers/drm/plugin.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
index 90d40e7..c19d671 100644
--- a/src/plugins/renderers/drm/plugin.c
+++ b/src/plugins/renderers/drm/plugin.c
@@ -885,10 +885,24 @@ has_32bpp_support (ply_renderer_backend_t *backend)
{
uint32_t buffer_id;
unsigned long row_stride;
+ uint32_t min_width;
+ uint32_t min_height;
+
+ min_width = backend->resources->min_width;
+ min_height = backend->resources->min_height;
+
+ /* Some drivers set min_width/min_height to 0,
+ * but 0x0 sized buffers don't work.
+ */
+ if (min_width == 0)
+ min_width = 1;
+
+ if (min_height == 0)
+ min_height = 1;
buffer_id = backend->driver_interface->create_buffer (backend->driver,
- backend->resources->min_width,
- backend->resources->min_height,
+ min_width,
+ min_height,
&row_stride);
if (buffer_id == 0)