mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 13:10:10 +01:00
freedreno: support UBWC scanout
On sway+xwayland, both explicit and implicit modifiers are advertised. While dri3proto says nothing about it, zwp_linux_dmabuf_v1 says A compositor that sends valid modifiers and DRM_FORMAT_MOD_INVALID for a given format supports both explicit modifiers and implicit modifiers. "glmark2 -b build:model=bunny --fullscreen" goes from 468 to 598fps on a618 @ 2160x1440. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20892>
This commit is contained in:
parent
1cf28bd049
commit
dc7f6c5324
1 changed files with 14 additions and 3 deletions
|
|
@ -1196,12 +1196,23 @@ has_implicit_modifier(const uint64_t *modifiers, int count)
|
|||
drm_find_modifier(DRM_FORMAT_MOD_INVALID, modifiers, count);
|
||||
}
|
||||
|
||||
static bool
|
||||
has_explicit_modifier(const uint64_t *modifiers, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (modifiers[i] != DRM_FORMAT_MOD_INVALID)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static enum fd_layout_type
|
||||
get_best_layout(struct fd_screen *screen, struct pipe_resource *prsc,
|
||||
const struct pipe_resource *tmpl, const uint64_t *modifiers,
|
||||
int count)
|
||||
{
|
||||
const bool can_implicit = has_implicit_modifier(modifiers, count);
|
||||
const bool can_explicit = has_explicit_modifier(modifiers, count);
|
||||
|
||||
/* First, find all the conditions which would force us to linear */
|
||||
if (!screen->tile_mode)
|
||||
|
|
@ -1223,8 +1234,8 @@ get_best_layout(struct fd_screen *screen, struct pipe_resource *prsc,
|
|||
if (FD_DBG(NOTILE))
|
||||
return LINEAR;
|
||||
|
||||
/* Shared resources with implicit modifiers must always be linear */
|
||||
if (can_implicit && (tmpl->bind & PIPE_BIND_SHARED)) {
|
||||
/* Shared resources without explicit modifiers must always be linear */
|
||||
if (!can_explicit && (tmpl->bind & PIPE_BIND_SHARED)) {
|
||||
perf_debug("%" PRSC_FMT
|
||||
": forcing linear: shared resource + implicit modifiers",
|
||||
PRSC_ARGS(prsc));
|
||||
|
|
@ -1378,7 +1389,7 @@ fd_resource_create_with_modifiers(struct pipe_screen *pscreen,
|
|||
*/
|
||||
if (screen->ro &&
|
||||
((tmpl->bind & PIPE_BIND_SCANOUT) ||
|
||||
!(count == 1 && modifiers[0] == DRM_FORMAT_MOD_INVALID))) {
|
||||
has_explicit_modifier(modifiers, count))) {
|
||||
struct pipe_resource scanout_templat = *tmpl;
|
||||
struct renderonly_scanout *scanout;
|
||||
struct winsys_handle handle;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue