loader/dri3: add drawable type set by GLX and EGL
Drawable type include more information which can be used to distinguish pixmap and pbuffer which both treated as pixmap before. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13750>
This commit is contained in:
parent
887f5a6320
commit
13bf30583c
|
@ -133,6 +133,21 @@ dri3_set_swap_interval(_EGLDisplay *disp, _EGLSurface *surf, EGLint interval)
|
|||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static enum loader_dri3_drawable_type
|
||||
egl_to_loader_dri3_drawable_type(EGLint type)
|
||||
{
|
||||
switch (type) {
|
||||
case EGL_WINDOW_BIT:
|
||||
return LOADER_DRI3_DRAWABLE_WINDOW;
|
||||
case EGL_PIXMAP_BIT:
|
||||
return LOADER_DRI3_DRAWABLE_PIXMAP;
|
||||
case EGL_PBUFFER_BIT:
|
||||
return LOADER_DRI3_DRAWABLE_PBUFFER;
|
||||
default:
|
||||
return LOADER_DRI3_DRAWABLE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
static _EGLSurface *
|
||||
dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
|
||||
void *native_surface, const EGLint *attrib_list)
|
||||
|
@ -172,6 +187,7 @@ dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
|
|||
}
|
||||
|
||||
if (loader_dri3_drawable_init(dri2_dpy->conn, drawable,
|
||||
egl_to_loader_dri3_drawable_type(type),
|
||||
dri2_dpy->dri_screen,
|
||||
dri2_dpy->is_different_gpu,
|
||||
dri2_dpy->multibuffers_available,
|
||||
|
|
|
@ -342,6 +342,21 @@ dri3_destroy_drawable(__GLXDRIdrawable *base)
|
|||
free(pdraw);
|
||||
}
|
||||
|
||||
static enum loader_dri3_drawable_type
|
||||
glx_to_loader_dri3_drawable_type(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case GLX_WINDOW_BIT:
|
||||
return LOADER_DRI3_DRAWABLE_WINDOW;
|
||||
case GLX_PIXMAP_BIT:
|
||||
return LOADER_DRI3_DRAWABLE_PIXMAP;
|
||||
case GLX_PBUFFER_BIT:
|
||||
return LOADER_DRI3_DRAWABLE_PBUFFER;
|
||||
default:
|
||||
return LOADER_DRI3_DRAWABLE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
static __GLXDRIdrawable *
|
||||
dri3_create_drawable(struct glx_screen *base, XID xDrawable,
|
||||
GLXDrawable drawable, int type,
|
||||
|
@ -376,7 +391,9 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
|
|||
(void) __glXInitialize(psc->base.dpy);
|
||||
|
||||
if (loader_dri3_drawable_init(XGetXCBConnection(base->dpy),
|
||||
xDrawable, psc->driScreen,
|
||||
xDrawable,
|
||||
glx_to_loader_dri3_drawable_type(type),
|
||||
psc->driScreen,
|
||||
psc->is_different_gpu, has_multibuffer,
|
||||
psc->prefer_back_buffer_reuse,
|
||||
config->driConfig,
|
||||
|
|
|
@ -384,6 +384,7 @@ loader_dri3_drawable_fini(struct loader_dri3_drawable *draw)
|
|||
int
|
||||
loader_dri3_drawable_init(xcb_connection_t *conn,
|
||||
xcb_drawable_t drawable,
|
||||
enum loader_dri3_drawable_type type,
|
||||
__DRIscreen *dri_screen,
|
||||
bool is_different_gpu,
|
||||
bool multiplanes_available,
|
||||
|
@ -403,6 +404,7 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
|
|||
draw->ext = ext;
|
||||
draw->vtable = vtable;
|
||||
draw->drawable = drawable;
|
||||
draw->type = type;
|
||||
draw->region = 0;
|
||||
draw->dri_screen = dri_screen;
|
||||
draw->is_different_gpu = is_different_gpu;
|
||||
|
|
|
@ -116,6 +116,13 @@ struct loader_dri3_vtable {
|
|||
|
||||
#define LOADER_DRI3_NUM_BUFFERS (1 + LOADER_DRI3_MAX_BACK)
|
||||
|
||||
enum loader_dri3_drawable_type {
|
||||
LOADER_DRI3_DRAWABLE_UNKNOWN,
|
||||
LOADER_DRI3_DRAWABLE_WINDOW,
|
||||
LOADER_DRI3_DRAWABLE_PIXMAP,
|
||||
LOADER_DRI3_DRAWABLE_PBUFFER,
|
||||
};
|
||||
|
||||
struct loader_dri3_drawable {
|
||||
xcb_connection_t *conn;
|
||||
xcb_screen_t *screen;
|
||||
|
@ -129,6 +136,7 @@ struct loader_dri3_drawable {
|
|||
uint8_t have_back;
|
||||
uint8_t have_fake_front;
|
||||
uint8_t is_pixmap;
|
||||
enum loader_dri3_drawable_type type;
|
||||
|
||||
/* Information about the GPU owning the buffer */
|
||||
__DRIscreen *dri_screen;
|
||||
|
@ -202,6 +210,7 @@ loader_dri3_drawable_fini(struct loader_dri3_drawable *draw);
|
|||
int
|
||||
loader_dri3_drawable_init(xcb_connection_t *conn,
|
||||
xcb_drawable_t drawable,
|
||||
enum loader_dri3_drawable_type type,
|
||||
__DRIscreen *dri_screen,
|
||||
bool is_different_gpu,
|
||||
bool is_multiplanes_available,
|
||||
|
|
Loading…
Reference in New Issue