Skip to content

Commit c8cda95

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

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
@@ -1255,6 +1255,10 @@ drmmode_create_cursor_bo(drmmode_ptr drmmode, drmmode_bo *bo,
12551255

12561256
#ifdef GLAMOR_HAS_GBM
12571257
if (drmmode->gbm) {
1258+
/**
1259+
* Assume the depth for the cursor is the same as the bpp,
1260+
* even if this is not true for the primary plane (e.g., even if bpp is 32, but drmmode->scrn->depth is 24).
1261+
*/
12581262
uint32_t format = drmmode_gbm_format_for_depth(bpp);
12591263

12601264
bo->gbm = gbm_bo_create(drmmode->gbm, bo->width, bo->height,
@@ -1278,26 +1282,35 @@ drmmode_create_cursor_bo(drmmode_ptr drmmode, drmmode_bo *bo,
12781282
/* XXX Do we really need to do this? XXX */
12791283
static Bool
12801284
drmmode_create_bpp_probe_bo(drmmode_ptr drmmode, drmmode_bo *bo,
1281-
unsigned width, unsigned height, unsigned bpp, void **out_gbm_dev)
1285+
unsigned width, unsigned height, unsigned depth, unsigned bpp, void **out_gbm_dev)
12821286
{
12831287
*out_gbm_dev = NULL;
12841288
#ifdef GLAMOR_HAS_GBM
12851289
struct gbm_device *gbm_dev = drmmode->gbm;
1290+
/* There is no way this is set right now, as glamor isn't yet initialized. */
12861291
if (!gbm_dev) {
1287-
/* There is no way this is set right now, as glamor isn't yet initialized. */
12881292
gbm_dev = gbm_create_device(drmmode->fd);
12891293
*out_gbm_dev = gbm_dev;
12901294
}
12911295

12921296
if (gbm_dev) {
1293-
uint32_t format = drmmode_gbm_format_for_depth(bpp);
1297+
uint32_t format = drmmode_gbm_format_for_depth(depth);
12941298

1299+
/* First try writeable buffer */
12951300
bo->gbm = gbm_bo_create(gbm_dev, width, height, format,
12961301
GBM_BO_USE_SCANOUT | GBM_BO_USE_WRITE);
12971302
if (bo->gbm) {
12981303
bo->used_modifiers = FALSE;
12991304
return TRUE;
13001305
}
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+
}
13011314
}
13021315
#endif
13031316

@@ -5136,7 +5149,7 @@ drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int *depth,
51365149
void* free_gbm_device;
51375150

51385151
/*create a bo */
5139-
ret = drmmode_create_bpp_probe_bo(drmmode, &bo, mode_res->min_width, mode_res->min_height, 32, &free_gbm_device);
5152+
ret = drmmode_create_bpp_probe_bo(drmmode, &bo, mode_res->min_width, mode_res->min_height, *depth, 32, &free_gbm_device);
51405153

51415154
if (!ret) {
51425155
*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)