Skip to content

Commit c4650ec

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

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
@@ -1157,7 +1157,7 @@ drmmode_bo_backing_bo_from_fd(drmmode_ptr drmmode, drmmode_bo *bo, int fd_handle
11571157
.stride = pitch,
11581158
.format = format,
11591159
};
1160-
/* Do we need scanout, even though this is a backing bo? */
1160+
/* XXX Do we need scanout here? Will this backing bo ever be scanned out? XXX */
11611161
struct gbm_bo *ret = gbm_bo_import(drmmode->gbm, GBM_BO_IMPORT_FD, &import_data, GBM_BO_USE_RENDERING);
11621162
if (ret) {
11631163
bo->width = width;
@@ -1296,21 +1296,14 @@ drmmode_create_bpp_probe_bo(drmmode_ptr drmmode, drmmode_bo *bo,
12961296
if (gbm_dev) {
12971297
uint32_t format = drmmode_gbm_format_for_depth(depth);
12981298

1299-
/* First try writeable buffer */
1300-
bo->gbm = gbm_bo_create(gbm_dev, width, height, format,
1299+
bo->gbm = gbm_bo_create(gbm_dev, width, height,
1300+
/* libgbm expects this for dumb scanout buffers for some reason */
1301+
(format == GBM_FORMAT_ARGB8888) ? GBM_FORMAT_XRGB8888 : format,
13011302
GBM_BO_USE_SCANOUT | GBM_BO_USE_WRITE);
13021303
if (bo->gbm) {
13031304
bo->used_modifiers = FALSE;
13041305
return TRUE;
13051306
}
1306-
1307-
/* Then try non-writeable buffer */
1308-
bo->gbm = gbm_bo_create(gbm_dev, width, height, format,
1309-
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
1310-
if (bo->gbm) {
1311-
bo->used_modifiers = FALSE;
1312-
return TRUE;
1313-
}
13141307
}
13151308
#endif
13161309

@@ -1355,6 +1348,17 @@ drmmode_create_front_bo(drmmode_ptr drmmode, drmmode_bo *bo,
13551348
return TRUE;
13561349
}
13571350
}
1351+
} else if (drmmode->shadow_enable && drmmode->gbm) {
1352+
/* We don't need glamor if modifiers aren't used */
1353+
bo->gbm = gbm_bo_create(drmmode->gbm, width, height,
1354+
/* libgbm expects this for dumb scanout buffers for some reason */
1355+
(format == GBM_FORMAT_ARGB8888) ? GBM_FORMAT_XRGB8888 : format,
1356+
GBM_BO_USE_WRITE | GBM_BO_USE_SCANOUT |
1357+
GBM_BO_USE_FRONT_RENDERING);
1358+
if (bo->gbm) {
1359+
bo->used_modifiers = FALSE;
1360+
return TRUE;
1361+
}
13581362
}
13591363
#endif
13601364

0 commit comments

Comments
 (0)