mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-22 01:20:26 +00:00
glamor/glamor_egl: Add support for passing gbm devices to glamor
Instead of having glamor_egl create the gbm device, let the ddx create it and pass it to glamor. This allows for saving some resources and for fixing a bug on amd (if it still happens) Signed-off-by: stefan11111 <stefan11111github@gmail.com>
This commit is contained in:
parent
d13cf6f431
commit
fbde8700f8
3 changed files with 12 additions and 3 deletions
|
|
@ -1734,7 +1734,8 @@ glamor_egl_post_close_screen(CallbackListPtr *pcbl, ScreenPtr screen, void *unus
|
|||
#ifdef GLAMOR_HAS_GBM
|
||||
glamor_egl_priv_t *glamor_egl = glamor_egl_get_screen_private(screen);
|
||||
|
||||
if (glamor_egl->gbm)
|
||||
if (!glamor_egl->gbm_borrowed &&
|
||||
glamor_egl->gbm)
|
||||
gbm_device_destroy(glamor_egl->gbm);
|
||||
#endif
|
||||
|
||||
|
|
@ -2279,8 +2280,10 @@ void glamor_egl_cleanup(glamor_egl_priv_t *glamor_egl)
|
|||
glamor_egl_pre_close_screen_cleanup(glamor_egl);
|
||||
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
if (glamor_egl->gbm)
|
||||
if (!glamor_egl->gbm_borrowed &&
|
||||
glamor_egl->gbm) {
|
||||
gbm_device_destroy(glamor_egl->gbm);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -2764,7 +2767,10 @@ glamor_egl_prepare_and_init_display(glamor_egl_priv_t* glamor_egl, int *platform
|
|||
glamor_egl->fd = glamor_egl_conf->fd;
|
||||
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
if (glamor_egl->fd >= 0 && !glamor_egl_conf->gbm_forbidden) {
|
||||
if (glamor_egl_conf->gbm && !glamor_egl_conf->gbm_forbidden) {
|
||||
glamor_egl->gbm = glamor_egl_conf->gbm;
|
||||
glamor_egl->gbm_borrowed = TRUE;
|
||||
} else if (glamor_egl->fd >= 0 && !glamor_egl_conf->gbm_forbidden) {
|
||||
glamor_egl->gbm = gbm_create_device(glamor_egl->fd);
|
||||
if (!glamor_egl->gbm) {
|
||||
glamor_egl->gbm = gbm_create_device_by_name(glamor_egl->fd, "dumb");
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ typedef struct {
|
|||
int fd; /* /dev/dri/cardxx */
|
||||
int gbm_forbidden; /* If glamor should not use libgbm, even if available */
|
||||
|
||||
void* gbm; /* An optional gbm device for glamor to use instead of opening it */
|
||||
|
||||
int direct_dri3_only; /* If glamor should only use the direct DRI3 implementation */
|
||||
|
||||
int auto_dri; /* If glamor should try to automatically enable DRI3 support */
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ typedef struct glamor_egl_screen_private {
|
|||
struct gbm_device *gbm;
|
||||
int fast_gbm_import;
|
||||
int can_texture_gbm_bo;
|
||||
int gbm_borrowed; /* If glamor borrowed the gbm device, and should not destroy it */
|
||||
#endif
|
||||
|
||||
int has_image_dma_buf_export;
|
||||
|
|
|
|||
Loading…
Reference in a new issue