mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
renderer-native: Remove no_add_fb2
drmModeAddFB2 allows userspace to specify a real format enum on non-ancient kernels, as an improvement over the legacy drmModeAddFB which derives format from a fixed depth/bpp mapping. As an optimisation, Weston used to decide at the first failure of drmModeAddFB2 that the ioctl was unavailable: as non-existent DRM ioctls return -EINVAL rather than -ENOSYS or similar, bad parameters are not distinguishable from the ioctl not being present. Mutter has also implemented the same optimisation for dumb framebuffers, which potentially papers over errors for the gain of avoiding one ioctl which will rapidly fail on ancient kernels. Remove the optimisation and always use AddFB2 where possible. Closes: #14
This commit is contained in:
parent
3649795108
commit
f2dea5d139
@ -103,8 +103,6 @@ typedef struct _MetaRendererNativeGpuData
|
|||||||
|
|
||||||
MetaRendererNativeMode mode;
|
MetaRendererNativeMode mode;
|
||||||
|
|
||||||
gboolean no_add_fb2;
|
|
||||||
|
|
||||||
EGLDisplay egl_display;
|
EGLDisplay egl_display;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2181,14 +2179,15 @@ init_dumb_fb (MetaDumbBuffer *dumb_fb,
|
|||||||
uint32_t format,
|
uint32_t format,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
MetaRendererNative *renderer_native = meta_renderer_native_from_gpu (gpu_kms);
|
|
||||||
MetaRendererNativeGpuData *renderer_gpu_data;
|
|
||||||
struct drm_mode_create_dumb create_arg;
|
struct drm_mode_create_dumb create_arg;
|
||||||
struct drm_mode_destroy_dumb destroy_arg;
|
struct drm_mode_destroy_dumb destroy_arg;
|
||||||
struct drm_mode_map_dumb map_arg;
|
struct drm_mode_map_dumb map_arg;
|
||||||
uint32_t fb_id = 0;
|
uint32_t fb_id = 0;
|
||||||
void *map;
|
void *map;
|
||||||
int kms_fd;
|
int kms_fd;
|
||||||
|
uint32_t handles[4] = { 0, };
|
||||||
|
uint32_t pitches[4] = { 0, };
|
||||||
|
uint32_t offsets[4] = { 0, };
|
||||||
|
|
||||||
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
|
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
|
||||||
|
|
||||||
@ -2206,25 +2205,18 @@ init_dumb_fb (MetaDumbBuffer *dumb_fb,
|
|||||||
goto err_ioctl;
|
goto err_ioctl;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
|
handles[0] = create_arg.handle;
|
||||||
gpu_kms);
|
pitches[0] = create_arg.pitch;
|
||||||
if (!renderer_gpu_data->no_add_fb2)
|
|
||||||
{
|
|
||||||
uint32_t handles[4] = { create_arg.handle, };
|
|
||||||
uint32_t pitches[4] = { create_arg.pitch, };
|
|
||||||
uint32_t offsets[4] = { 0 };
|
|
||||||
|
|
||||||
if (drmModeAddFB2 (kms_fd, width, height, format,
|
if (drmModeAddFB2 (kms_fd, width, height, format,
|
||||||
handles, pitches, offsets,
|
handles, pitches, offsets,
|
||||||
&fb_id, 0) != 0)
|
&fb_id, 0) != 0)
|
||||||
{
|
{
|
||||||
g_warning ("drmModeAddFB2 failed (%s), falling back to drmModeAddFB",
|
g_debug ("drmModeAddFB2 failed (%s), falling back to drmModeAddFB",
|
||||||
g_strerror (errno));
|
g_strerror (errno));
|
||||||
renderer_gpu_data->no_add_fb2 = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderer_gpu_data->no_add_fb2)
|
if (fb_id == 0)
|
||||||
{
|
{
|
||||||
if (drmModeAddFB (kms_fd, width, height,
|
if (drmModeAddFB (kms_fd, width, height,
|
||||||
24 /* depth of RGBX8888 */,
|
24 /* depth of RGBX8888 */,
|
||||||
|
Loading…
Reference in New Issue
Block a user