Skip to content

Commit d242c58

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

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-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.shadow_enable) {
16941694
pixels = drmmode_map_front_bo(&ms->drmmode);
16951695
if (!pixels)
16961696
return FALSE;

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ drmmode_bo_backing_bo_from_fd(drmmode_ptr drmmode, drmmode_bo *bo, int fd_handle
11551155
.stride = pitch,
11561156
.format = format,
11571157
};
1158-
/* Do we need scanout, even though this is a backing bo? */
1158+
/* XXX Do we need scanout here? Will this backing bo ever be scanned out? XXX */
11591159
struct gbm_bo *ret = gbm_bo_import(drmmode->gbm, GBM_BO_IMPORT_FD, &import_data, GBM_BO_USE_RENDERING);
11601160
if (ret) {
11611161
bo->width = width;
@@ -1291,21 +1291,14 @@ drmmode_create_bpp_probe_bo(drmmode_ptr drmmode, drmmode_bo *bo,
12911291
if (gbm_dev) {
12921292
uint32_t format = drmmode_gbm_format_for_depth(depth);
12931293

1294-
/* First try writeable buffer */
1295-
bo->gbm = gbm_bo_create(gbm_dev, width, height, format,
1294+
bo->gbm = gbm_bo_create(gbm_dev, width, height,
1295+
/* libgbm expects this for dumb scanout buffers for some reason */
1296+
(format == GBM_FORMAT_ARGB8888) ? GBM_FORMAT_XRGB8888 : format,
12961297
GBM_BO_USE_SCANOUT | GBM_BO_USE_WRITE);
12971298
if (bo->gbm) {
12981299
bo->used_modifiers = FALSE;
12991300
return TRUE;
13001301
}
1301-
1302-
/* Then try non-writeable buffer */
1303-
bo->gbm = gbm_bo_create(gbm_dev, width, height, format,
1304-
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
1305-
if (bo->gbm) {
1306-
bo->used_modifiers = FALSE;
1307-
return TRUE;
1308-
}
13091302
}
13101303
#endif
13111304

@@ -1350,6 +1343,17 @@ drmmode_create_front_bo(drmmode_ptr drmmode, drmmode_bo *bo,
13501343
return TRUE;
13511344
}
13521345
}
1346+
} else if (drmmode->shadow_enable && drmmode->gbm) {
1347+
/* We don't need glamor if modifiers aren't used */
1348+
bo->gbm = gbm_bo_create(drmmode->gbm, width, height,
1349+
/* libgbm expects this for dumb scanout buffers for some reason */
1350+
(format == GBM_FORMAT_ARGB8888) ? GBM_FORMAT_XRGB8888 : format,
1351+
GBM_BO_USE_WRITE | GBM_BO_USE_SCANOUT |
1352+
GBM_BO_USE_FRONT_RENDERING);
1353+
if (bo->gbm) {
1354+
bo->used_modifiers = FALSE;
1355+
return TRUE;
1356+
}
13531357
}
13541358
#endif
13551359

0 commit comments

Comments
 (0)