Skip to content

Commit cf37b35

Browse files
committed
modesetting: get unaccelerated modesetting working with gbm buffers only
Signed-off-by: stefan11111 <[email protected]>
1 parent 65c05a4 commit cf37b35

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

hw/xfree86/drivers/video/modesetting/driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,7 @@ modesetCreateScreenResources(ScreenPtr pScreen)
16901690
if (!ms->drmmode.sw_cursor)
16911691
drmmode_map_cursor_bos(pScrn, &ms->drmmode);
16921692

1693-
if (!ms->drmmode.gbm) {
1693+
if (!ms->drmmode.glamor) {
16941694
pixels = drmmode_map_front_bo(&ms->drmmode);
16951695
if (!pixels)
16961696
return FALSE;

hw/xfree86/drivers/video/modesetting/drmmode_display.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,21 +1299,14 @@ drmmode_create_bpp_probe_bo(drmmode_ptr drmmode, drmmode_bo *bo,
12991299
if (gbm_dev) {
13001300
uint32_t format = drmmode_gbm_format_for_depth(depth);
13011301

1302-
/* First try writeable buffer */
1303-
bo->gbm = gbm_bo_create(gbm_dev, width, height, format,
1302+
bo->gbm = gbm_bo_create(gbm_dev, width, height,
1303+
/* libgbm expects this for dumb scanout buffers for some reason */
1304+
(format == GBM_FORMAT_ARGB8888) ? GBM_FORMAT_XRGB8888 : format,
13041305
GBM_BO_USE_SCANOUT | GBM_BO_USE_WRITE);
13051306
if (bo->gbm) {
13061307
bo->used_modifiers = FALSE;
13071308
return TRUE;
13081309
}
1309-
1310-
/* Then try non-writeable buffer */
1311-
bo->gbm = gbm_bo_create(gbm_dev, width, height, format,
1312-
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
1313-
if (bo->gbm) {
1314-
bo->used_modifiers = FALSE;
1315-
return TRUE;
1316-
}
13171310
}
13181311
#endif
13191312

@@ -1358,8 +1351,20 @@ drmmode_create_front_bo(drmmode_ptr drmmode, drmmode_bo *bo,
13581351
return TRUE;
13591352
}
13601353
}
1361-
}
1354+
} else
13621355
#endif
1356+
if (!drmmode->glamor && drmmode->gbm) {
1357+
/* We don't need glamor if modifiers aren't used */
1358+
bo->gbm = gbm_bo_create(drmmode->gbm, width, height,
1359+
/* libgbm expects this for dumb scanout buffers for some reason */
1360+
(format == GBM_FORMAT_ARGB8888) ? GBM_FORMAT_XRGB8888 : format,
1361+
GBM_BO_USE_WRITE | GBM_BO_USE_SCANOUT |
1362+
GBM_BO_USE_FRONT_RENDERING);
1363+
if (bo->gbm) {
1364+
bo->used_modifiers = FALSE;
1365+
return TRUE;
1366+
}
1367+
}
13631368

13641369
if (drmmode->gbm) {
13651370
/* We don't need glamor if modifiers aren't used */

0 commit comments

Comments
 (0)