Skip to content

Commit 65c05a4

Browse files
committed
modesetting: pass depth as an argument in drmmode_create_bpp_probe_bo
Signed-off-by: stefan11111 <[email protected]>
1 parent 9b704a7 commit 65c05a4

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,10 @@ drmmode_create_cursor_bo(drmmode_ptr drmmode, drmmode_bo *bo,
12581258

12591259
#ifdef GLAMOR_HAS_GBM
12601260
if (drmmode->gbm) {
1261+
/**
1262+
* Assume the depth for the cursor is the same as the bpp,
1263+
* even if this is not true for the primary plane (e.g., even if bpp is 32, but drmmode->scrn->depth is 24).
1264+
*/
12611265
uint32_t format = drmmode_gbm_format_for_depth(bpp);
12621266

12631267
bo->gbm = gbm_bo_create(drmmode->gbm, bo->width, bo->height,
@@ -1281,26 +1285,35 @@ drmmode_create_cursor_bo(drmmode_ptr drmmode, drmmode_bo *bo,
12811285
/* XXX Do we really need to do this? XXX */
12821286
static Bool
12831287
drmmode_create_bpp_probe_bo(drmmode_ptr drmmode, drmmode_bo *bo,
1284-
unsigned width, unsigned height, unsigned bpp, void **out_gbm_dev)
1288+
unsigned width, unsigned height, unsigned depth, unsigned bpp, void **out_gbm_dev)
12851289
{
12861290
*out_gbm_dev = NULL;
12871291
#ifdef GLAMOR_HAS_GBM
12881292
struct gbm_device *gbm_dev = drmmode->gbm;
1293+
/* There is no way this is set right now, as glamor isn't yet initialized. */
12891294
if (!gbm_dev) {
1290-
/* There is no way this is set right now, as glamor isn't yet initialized. */
12911295
gbm_dev = gbm_create_device(drmmode->fd);
12921296
*out_gbm_dev = gbm_dev;
12931297
}
12941298

12951299
if (gbm_dev) {
1296-
uint32_t format = drmmode_gbm_format_for_depth(bpp);
1300+
uint32_t format = drmmode_gbm_format_for_depth(depth);
12971301

1302+
/* First try writeable buffer */
12981303
bo->gbm = gbm_bo_create(gbm_dev, width, height, format,
12991304
GBM_BO_USE_SCANOUT | GBM_BO_USE_WRITE);
13001305
if (bo->gbm) {
13011306
bo->used_modifiers = FALSE;
13021307
return TRUE;
13031308
}
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+
}
13041317
}
13051318
#endif
13061319

@@ -5143,7 +5156,7 @@ drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int *depth,
51435156
void* free_gbm_device;
51445157

51455158
/*create a bo */
5146-
ret = drmmode_create_bpp_probe_bo(drmmode, &bo, mode_res->min_width, mode_res->min_height, 32, &free_gbm_device);
5159+
ret = drmmode_create_bpp_probe_bo(drmmode, &bo, mode_res->min_width, mode_res->min_height, *depth, 32, &free_gbm_device);
51475160

51485161
if (!ret) {
51495162
*bpp = 24;

hw/xfree86/drivers/video/modesetting/dumb_bo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include <stdint.h>
3131

32-
#define HAVE_DUMB_BO
32+
//#define HAVE_DUMB_BO
3333

3434
#ifdef HAVE_DUMB_BO
3535
struct dumb_bo {

0 commit comments

Comments
 (0)