mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-06 03:30:30 +01:00
ail: pull in DRM modifier helper
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31532>
This commit is contained in:
parent
b01d53d95a
commit
4ddfc1cfdd
2 changed files with 29 additions and 16 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
#include "util/format/u_format.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/u_math.h"
|
||||
|
|
@ -434,6 +435,33 @@ ail_is_view_compatible(struct ail_layout *layout, enum pipe_format view)
|
|||
ail_formats_compatible(layout->format, view);
|
||||
}
|
||||
|
||||
/* Fake values, pending UAPI upstreaming */
|
||||
#ifndef DRM_FORMAT_MOD_APPLE_TWIDDLED
|
||||
#define DRM_FORMAT_MOD_APPLE_TWIDDLED (2)
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_MOD_APPLE_TWIDDLED_COMPRESSED
|
||||
#define DRM_FORMAT_MOD_APPLE_TWIDDLED_COMPRESSED (3)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We generally use ail enums instead of DRM format modifiers. This helper
|
||||
* bridges the gap.
|
||||
*/
|
||||
static inline enum ail_tiling
|
||||
ail_drm_modifier_to_tiling(uint64_t modifier)
|
||||
{
|
||||
switch (modifier) {
|
||||
case DRM_FORMAT_MOD_LINEAR:
|
||||
return AIL_TILING_LINEAR;
|
||||
case DRM_FORMAT_MOD_APPLE_TWIDDLED:
|
||||
return AIL_TILING_TWIDDLED;
|
||||
case DRM_FORMAT_MOD_APPLE_TWIDDLED_COMPRESSED:
|
||||
return AIL_TILING_TWIDDLED_COMPRESSED;
|
||||
default:
|
||||
unreachable("Unsupported modifier");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -87,21 +87,6 @@ void agx_init_state_functions(struct pipe_context *ctx);
|
|||
* resource
|
||||
*/
|
||||
|
||||
static enum ail_tiling
|
||||
ail_modifier_to_tiling(uint64_t modifier)
|
||||
{
|
||||
switch (modifier) {
|
||||
case DRM_FORMAT_MOD_LINEAR:
|
||||
return AIL_TILING_LINEAR;
|
||||
case DRM_FORMAT_MOD_APPLE_TWIDDLED:
|
||||
return AIL_TILING_TWIDDLED;
|
||||
case DRM_FORMAT_MOD_APPLE_TWIDDLED_COMPRESSED:
|
||||
return AIL_TILING_TWIDDLED_COMPRESSED;
|
||||
default:
|
||||
unreachable("Unsupported modifier");
|
||||
}
|
||||
}
|
||||
|
||||
const static char *s_tiling[] = {
|
||||
[AIL_TILING_LINEAR] = "LINR",
|
||||
[AIL_TILING_TWIDDLED] = "TWID",
|
||||
|
|
@ -159,7 +144,7 @@ agx_resource_setup(struct agx_device *dev, struct agx_resource *nresource)
|
|||
struct pipe_resource *templ = &nresource->base;
|
||||
|
||||
nresource->layout = (struct ail_layout){
|
||||
.tiling = ail_modifier_to_tiling(nresource->modifier),
|
||||
.tiling = ail_drm_modifier_to_tiling(nresource->modifier),
|
||||
.mipmapped_z = templ->target == PIPE_TEXTURE_3D,
|
||||
.format = templ->format,
|
||||
.width_px = templ->width0,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue