[Mesa-users] How does drmModeAddFB adds framebuffer with gbm_bo object
Xeechem Chou
xeechou at gmail.com
Fri Jul 17 05:39:50 PDT 2015
Hi, everyone.
Trying to understand how drmModeAddFB work with gbm_bo object.
>From google I know that I can use gbm_bo object as framebuffer with kms. The
code is like this.
struct gbm_device *gbm = gbm_create_device(fd);
struct gbm_bo *bo = gbm_bo_create(gbm, width, height,
GBM_BO_FORMAT_XRGB8888,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING
);
and suppose we have set correct drm connector, encoders and EGL stuff.
Now we can create framebuffer with:
uint32_t handle = gbm_bo_get_handle(bo).u32;
uint32_t stride = gbm_bo_get_stride(bo);
drmModeAddFB(fd, width, height, 24, 32, stride, handle, &fb_id);
//and we can setCrtc now
drmModeSetCrtc(fd, crtc, fb_id, 0,0, connector_id, 1, mode);
But HOW did drmModeAddFB use the bo exactly? I have some example code using
GL to
render something into a egl surface which is created from gbm_bo. And after
drmModeSetCrtc, I did get a triangle on my screen.
BTW, The example code is https://gist.github.com/dvdhrm/1364994
-Xeechem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-users/attachments/20150717/b55bd4ea/attachment.html>
More information about the mesa-users
mailing list