Skip to content

Commit be92aac

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

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

12511251
#ifdef GLAMOR_HAS_GBM
12521252
if (drmmode->gbm) {
1253+
/**
1254+
* Assume the depth for the cursor is the same as the bpp,
1255+
* even if this is not true for the primary plane (e.g., even if bpp is 32, but drmmode->scrn->depth is 24).
1256+
*/
12531257
uint32_t format = drmmode_gbm_format_for_depth(bpp);
12541258

12551259
bo->gbm = gbm_bo_create(drmmode->gbm, bo->width, bo->height,
@@ -1273,26 +1277,35 @@ drmmode_create_cursor_bo(drmmode_ptr drmmode, drmmode_bo *bo,
12731277
/* XXX Do we really need to do this? XXX */
12741278
static Bool
12751279
drmmode_create_bpp_probe_bo(drmmode_ptr drmmode, drmmode_bo *bo,
1276-
unsigned width, unsigned height, unsigned bpp, void **out_gbm_dev)
1280+
unsigned width, unsigned height, unsigned depth, unsigned bpp, void **out_gbm_dev)
12771281
{
12781282
*out_gbm_dev = NULL;
12791283
#ifdef GLAMOR_HAS_GBM
12801284
struct gbm_device *gbm_dev = drmmode->gbm;
1285+
/* There is no way this is set right now, as glamor isn't yet initialized. */
12811286
if (!gbm_dev) {
1282-
/* There is no way this is set right now, as glamor isn't yet initialized. */
12831287
gbm_dev = gbm_create_device(drmmode->fd);
12841288
*out_gbm_dev = gbm_dev;
12851289
}
12861290

12871291
if (gbm_dev) {
1288-
uint32_t format = drmmode_gbm_format_for_depth(bpp);
1292+
uint32_t format = drmmode_gbm_format_for_depth(depth);
12891293

1294+
/* First try writeable buffer */
12901295
bo->gbm = gbm_bo_create(gbm_dev, width, height, format,
12911296
GBM_BO_USE_SCANOUT | GBM_BO_USE_WRITE);
12921297
if (bo->gbm) {
12931298
bo->used_modifiers = FALSE;
12941299
return TRUE;
12951300
}
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+
}
12961309
}
12971310
#endif
12981311

@@ -5131,7 +5144,7 @@ drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int *depth,
51315144
void* free_gbm_device;
51325145

51335146
/*create a bo */
5134-
ret = drmmode_create_bpp_probe_bo(drmmode, &bo, mode_res->min_width, mode_res->min_height, 32, &free_gbm_device);
5147+
ret = drmmode_create_bpp_probe_bo(drmmode, &bo, mode_res->min_width, mode_res->min_height, *depth, 32, &free_gbm_device);
51355148

51365149
if (!ret) {
51375150
*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)