Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions hw/xfree86/drivers/video/modesetting/drmmode_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1064,21 +1064,34 @@ drmmode_bo_get_handle(drmmode_bo *bo)
static void *
drmmode_bo_map(drmmode_ptr drmmode, drmmode_bo *bo)
{
int ret;
if (bo->map) {
return bo->map;
}

#ifdef GLAMOR_HAS_GBM
if (bo->gbm)
return NULL;
if (bo->gbm) {
/* We shouldn't read from gpu memory */
uint32_t stride;
void* unused;
void* map = gbm_bo_map(bo->gbm, 0, 0, bo->width, bo->height, GBM_BO_TRANSFER_WRITE, &stride, &unused);
if (map) {
bo->map = map;
return bo->map;
}
}
#endif

if (bo->dumb->ptr)
return bo->dumb->ptr;
if (bo->dumb) {
int ret = dumb_bo_map(drmmode->fd, bo->dumb);
if (ret) {
return NULL;
}

ret = dumb_bo_map(drmmode->fd, bo->dumb);
if (ret)
return NULL;
bo->map = bo->dumb->ptr;
return bo->map;
}

return bo->dumb->ptr;
return NULL;
}

int
Expand Down
1 change: 1 addition & 0 deletions hw/xfree86/drivers/video/modesetting/drmmode_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ typedef struct {
Bool used_modifiers;
struct gbm_bo *gbm;
#endif
void* map;
} drmmode_bo;

typedef struct {
Expand Down