mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-28 02:21:08 +00:00
modesetting: map gbm bo's if possible
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
parent
9db422c1ca
commit
7293fc12fe
2 changed files with 23 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ typedef struct {
|
|||
Bool used_modifiers;
|
||||
struct gbm_bo *gbm;
|
||||
#endif
|
||||
void* map;
|
||||
} drmmode_bo;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
Loading…
Reference in a new issue