gallium: add PIPE_CAP_PREFER_BACK_BUFFER_REUSE
This will be used in the next commit. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Michel Dänzer <mdaenzer@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12788>
This commit is contained in:

committed by
Marge Bot

parent
d89ba3f2a9
commit
e67083caf4
@@ -621,6 +621,7 @@ The integer capabilities:
|
||||
* ``PIPE_CAP_EMULATE_NONFIXED_PRIMITIVE_RESTART``: Driver requests all draws using a non-fixed restart index to be rewritten to use a fixed restart index.
|
||||
* ``PIPE_CAP_SUPPORTED_PRIM_MODES``: A bitmask of the ``pipe_prim_type`` enum values that the driver can natively support.
|
||||
* ``PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART``: A bitmask of the ``pipe_prim_type`` enum values that the driver can natively support for primitive restart. Only useful if ``PIPE_CAP_PRIMITIVE_RESTART`` is also exported.
|
||||
* ``PIPE_CAP_PREFER_BACK_BUFFER_REUSE``: Only applies to DRI_PRIME. If 1, the driver prefers that DRI3 tries to use the same back buffer each frame. If 0, this means DRI3 will at least use 2 back buffers and ping-pong between them to allow the tiled->linear copy to run in parallel.
|
||||
|
||||
.. _pipe_capf:
|
||||
|
||||
|
@@ -1991,6 +1991,7 @@ typedef struct __DRIDriverVtableExtensionRec {
|
||||
#define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_HIGH (1 << 2)
|
||||
|
||||
#define __DRI2_RENDERER_HAS_PROTECTED_CONTENT 0x000e
|
||||
#define __DRI2_RENDERER_PREFER_BACK_BUFFER_REUSE 0x000f
|
||||
|
||||
typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension;
|
||||
struct __DRI2rendererQueryExtensionRec {
|
||||
|
@@ -175,6 +175,7 @@ dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
|
||||
dri2_dpy->dri_screen,
|
||||
dri2_dpy->is_different_gpu,
|
||||
dri2_dpy->multibuffers_available,
|
||||
true,
|
||||
dri_config,
|
||||
&dri2_dpy->loader_dri3_ext,
|
||||
&egl_dri3_vtable,
|
||||
|
@@ -291,6 +291,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
||||
return 4; /* GLES 2.0 minimum value */
|
||||
|
||||
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
|
||||
case PIPE_CAP_PREFER_BACK_BUFFER_REUSE:
|
||||
return 1;
|
||||
|
||||
case PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS:
|
||||
|
@@ -74,6 +74,11 @@ dri2_query_renderer_integer(__DRIscreen *_screen, int param,
|
||||
if (!value[0])
|
||||
return -1;
|
||||
return 0;
|
||||
case __DRI2_RENDERER_PREFER_BACK_BUFFER_REUSE:
|
||||
value[0] =
|
||||
screen->base.screen->get_param(screen->base.screen,
|
||||
PIPE_CAP_PREFER_BACK_BUFFER_REUSE);
|
||||
return 0;
|
||||
default:
|
||||
return driQueryRendererIntegerCommon(_screen, param, value);
|
||||
}
|
||||
|
@@ -993,6 +993,7 @@ enum pipe_cap
|
||||
PIPE_CAP_EMULATE_NONFIXED_PRIMITIVE_RESTART,
|
||||
PIPE_CAP_SUPPORTED_PRIM_MODES,
|
||||
PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART,
|
||||
PIPE_CAP_PREFER_BACK_BUFFER_REUSE,
|
||||
|
||||
PIPE_CAP_LAST,
|
||||
/* XXX do not add caps after PIPE_CAP_LAST! */
|
||||
|
@@ -375,6 +375,7 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
|
||||
if (loader_dri3_drawable_init(XGetXCBConnection(base->dpy),
|
||||
xDrawable, psc->driScreen,
|
||||
psc->is_different_gpu, has_multibuffer,
|
||||
psc->prefer_back_buffer_reuse,
|
||||
config->driConfig,
|
||||
&psc->loader_dri3_ext, &glx_dri3_vtable,
|
||||
&pdraw->loader_drawable)) {
|
||||
@@ -1022,6 +1023,15 @@ dri3_create_screen(int screen, struct glx_display * priv)
|
||||
|
||||
InfoMessageF("Using DRI3 for screen %d\n", screen);
|
||||
|
||||
psc->prefer_back_buffer_reuse = 1;
|
||||
if (psc->is_different_gpu && psc->rendererQuery) {
|
||||
unsigned value;
|
||||
if (psc->rendererQuery->queryInteger(psc->driScreen,
|
||||
__DRI2_RENDERER_PREFER_BACK_BUFFER_REUSE,
|
||||
&value) == 0)
|
||||
psc->prefer_back_buffer_reuse = value;
|
||||
}
|
||||
|
||||
return &psc->base;
|
||||
|
||||
handle_error:
|
||||
|
@@ -108,6 +108,7 @@ struct dri3_screen {
|
||||
void *driver;
|
||||
int fd;
|
||||
bool is_different_gpu;
|
||||
bool prefer_back_buffer_reuse;
|
||||
|
||||
/* fd for display GPU in case of prime */
|
||||
int fd_display_gpu;
|
||||
|
@@ -373,6 +373,7 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
|
||||
__DRIscreen *dri_screen,
|
||||
bool is_different_gpu,
|
||||
bool multiplanes_available,
|
||||
bool prefer_back_buffer_reuse,
|
||||
const __DRIconfig *dri_config,
|
||||
struct loader_dri3_extensions *ext,
|
||||
const struct loader_dri3_vtable *vtable,
|
||||
@@ -392,6 +393,7 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
|
||||
draw->dri_screen = dri_screen;
|
||||
draw->is_different_gpu = is_different_gpu;
|
||||
draw->multiplanes_available = multiplanes_available;
|
||||
draw->prefer_back_buffer_reuse = prefer_back_buffer_reuse;
|
||||
|
||||
draw->have_back = 0;
|
||||
draw->have_fake_front = 0;
|
||||
|
@@ -134,6 +134,7 @@ struct loader_dri3_drawable {
|
||||
__DRIscreen *dri_screen;
|
||||
bool is_different_gpu;
|
||||
bool multiplanes_available;
|
||||
bool prefer_back_buffer_reuse;
|
||||
|
||||
/* DRI screen created for display GPU in case of prime */
|
||||
__DRIscreen *dri_screen_display_gpu;
|
||||
@@ -204,6 +205,7 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
|
||||
__DRIscreen *dri_screen,
|
||||
bool is_different_gpu,
|
||||
bool is_multiplanes_available,
|
||||
bool prefer_back_buffer_reuse,
|
||||
const __DRIconfig *dri_config,
|
||||
struct loader_dri3_extensions *ext,
|
||||
const struct loader_dri3_vtable *vtable,
|
||||
|
Reference in New Issue
Block a user