[drm] bail if not in 24bpp color mode

Some server hardware gets initialized into 8bpp mode to
conserve memory.  We can't work in that mode, so we now
check for it and back early.
This commit is contained in:
Ray Strode 2010-08-18 16:16:35 -04:00
parent 4469b8719e
commit 625b82f2c3

View file

@ -766,6 +766,29 @@ get_index_of_active_mode (ply_renderer_backend_t *backend,
return find_index_of_mode (backend, connector, &controller->mode);
}
static bool
buffer_has_reasonable_color_depth (ply_renderer_backend_t *backend,
uint32_t buffer_id)
{
unsigned int color_depth;
bool has_reasonable_color_depth;
if (!backend->driver_interface->fetch_buffer (backend->driver,
buffer_id,
NULL, NULL, NULL, &color_depth))
return false;
if (color_depth == 24 || color_depth == 32)
has_reasonable_color_depth = true;
else
has_reasonable_color_depth = false;
backend->driver_interface->destroy_buffer (backend->driver, buffer_id);
return has_reasonable_color_depth;
}
static bool
create_heads_for_active_connectors (ply_renderer_backend_t *backend)
{
@ -833,6 +856,13 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend)
console_buffer_id = controller->buffer_id;
drmModeFreeCrtc (controller);
if (!buffer_has_reasonable_color_depth (backend, console_buffer_id))
{
ply_trace ("frame buffer console doesn't have usable color depth");
free_heads (backend);
return false;
}
head = ply_renderer_head_new (backend, connector, connector_mode_index,
encoder_id, controller_id,
console_buffer_id);