Skip to content

Commit 8bb2fc9

Browse files
stefan11111metux
authored andcommitted
modesetting: Create the front buffer with GBM_BO_USE_FRONT_RENDERING
Also renamed `drmmode_create_bo` to `drmmode_create_front_bo`, better reflecting how it is used. According to the mesa docs: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/gbm/main/gbm.h : ``` /** * The buffer will be used for front buffer rendering. On some * platforms this may (for example) disable framebuffer compression * to avoid problems with compression flags data being out of sync * with pixel data. */ GBM_BO_USE_FRONT_RENDERING = (1 << 6), ``` Signed-off-by: stefan11111 <[email protected]>
1 parent 7a8f123 commit 8bb2fc9

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,8 @@ drmmode_bo_import(drmmode_ptr drmmode, drmmode_bo *bo,
11261126
}
11271127

11281128
static Bool
1129-
drmmode_create_bo(drmmode_ptr drmmode, drmmode_bo *bo,
1130-
unsigned width, unsigned height, unsigned bpp)
1129+
drmmode_create_front_bo(drmmode_ptr drmmode, drmmode_bo *bo,
1130+
unsigned width, unsigned height, unsigned bpp)
11311131
{
11321132
bo->width = width;
11331133
bo->height = height;
@@ -1151,6 +1151,10 @@ drmmode_create_bo(drmmode_ptr drmmode, drmmode_bo *bo,
11511151
break;
11521152
}
11531153

1154+
#ifndef GBM_BO_USE_FRONT_RENDERING
1155+
#define GBM_BO_USE_FRONT_RENDERING 0
1156+
#endif
1157+
11541158
#ifdef GBM_BO_WITH_MODIFIERS
11551159
uint32_t num_modifiers;
11561160
uint64_t *modifiers = NULL;
@@ -1160,7 +1164,8 @@ drmmode_create_bo(drmmode_ptr drmmode, drmmode_bo *bo,
11601164
#ifdef GBM_BO_WITH_MODIFIERS2
11611165
bo->gbm = gbm_bo_create_with_modifiers2(drmmode->gbm, width, height,
11621166
format, modifiers, num_modifiers,
1163-
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
1167+
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT |
1168+
GBM_BO_USE_FRONT_RENDERING);
11641169
#else
11651170
bo->gbm = gbm_bo_create_with_modifiers(drmmode->gbm, width, height,
11661171
format, modifiers,
@@ -1175,7 +1180,8 @@ drmmode_create_bo(drmmode_ptr drmmode, drmmode_bo *bo,
11751180
#endif
11761181

11771182
bo->gbm = gbm_bo_create(drmmode->gbm, width, height, format,
1178-
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
1183+
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT |
1184+
GBM_BO_USE_FRONT_RENDERING);
11791185
bo->used_modifiers = FALSE;
11801186
return bo->gbm != NULL;
11811187
}
@@ -2238,7 +2244,8 @@ drmmode_shadow_fb_allocate(xf86CrtcPtr crtc, int width, int height,
22382244
drmmode_ptr drmmode = drmmode_crtc->drmmode;
22392245
int ret;
22402246

2241-
if (!drmmode_create_bo(drmmode, bo, width, height, drmmode->kbpp)) {
2247+
/* If we're using shadow fb, we're not using glamor, so no gbm bo's */
2248+
if (!drmmode_create_front_bo(drmmode, bo, width, height, drmmode->kbpp)) {
22422249
xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
22432250
"Couldn't allocate shadow memory for rotated CRTC\n");
22442251
return NULL;
@@ -3942,8 +3949,8 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
39423949
old_fb_id = drmmode->fb_id;
39433950
drmmode->fb_id = 0;
39443951

3945-
if (!drmmode_create_bo(drmmode, &drmmode->front_bo,
3946-
width, height, drmmode->kbpp))
3952+
if (!drmmode_create_front_bo(drmmode, &drmmode->front_bo,
3953+
width, height, drmmode->kbpp))
39473954
goto fail;
39483955

39493956
pitch = drmmode_bo_get_pitch(&drmmode->front_bo);
@@ -4827,7 +4834,7 @@ drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
48274834
width = pScrn->virtualX;
48284835
height = pScrn->virtualY;
48294836

4830-
if (!drmmode_create_bo(drmmode, &drmmode->front_bo, width, height, bpp))
4837+
if (!drmmode_create_front_bo(drmmode, &drmmode->front_bo, width, height, bpp))
48314838
return FALSE;
48324839
pScrn->displayWidth = drmmode_bo_get_pitch(&drmmode->front_bo) / cpp;
48334840

0 commit comments

Comments
 (0)