summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_resource.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-03-26 00:25:31 -0700
committerKenneth Graunke <[email protected]>2019-03-27 21:27:54 -0700
commitde783a6897e0f67f456793b10c48f24e5ee70a85 (patch)
treee75b8343c31811d22bb0865261a57cf7e23338a3 /src/gallium/drivers/iris/iris_resource.c
parent505854f84bb9f36b2d85ebc243c4c6ec2a87d8ae (diff)
iris: Actually advertise some modifiers
I neglected to fill out this driver function, causing us to advertise 0 modifiers. Now we advertise the various tilings and let the driver pick them. I've verified that X tiling works with Weston (by hacking the list to skip Y tiling). Y+CCS doesn't work yet because it's multiplane and the Gallium dri state tracker isn't really prepared for that. Leave it off for now.
Diffstat (limited to 'src/gallium/drivers/iris/iris_resource.c')
-rw-r--r--src/gallium/drivers/iris/iris_resource.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 164647bc9d0..bf8af133552 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -139,6 +139,44 @@ target_to_isl_surf_dim(enum pipe_texture_target target)
unreachable("invalid texture type");
}
+static void
+iris_query_dmabuf_modifiers(struct pipe_screen *pscreen,
+ enum pipe_format pfmt,
+ int max,
+ uint64_t *modifiers,
+ unsigned int *external_only,
+ int *count)
+{
+ struct iris_screen *screen = (void *) pscreen;
+ const struct gen_device_info *devinfo = &screen->devinfo;
+
+ uint64_t all_modifiers[] = {
+ DRM_FORMAT_MOD_LINEAR,
+ I915_FORMAT_MOD_X_TILED,
+ I915_FORMAT_MOD_Y_TILED,
+ // XXX: (broken) I915_FORMAT_MOD_Y_TILED_CCS,
+ };
+
+ int supported_mods = 0;
+
+ for (int i = 0; i < ARRAY_SIZE(all_modifiers); i++) {
+ if (!modifier_is_supported(devinfo, all_modifiers[i]))
+ continue;
+
+ if (supported_mods < max) {
+ if (modifiers)
+ modifiers[supported_mods] = all_modifiers[i];
+
+ if (external_only)
+ external_only[supported_mods] = util_format_is_yuv(pfmt);
+ }
+
+ supported_mods++;
+ }
+
+ *count = supported_mods;
+}
+
static isl_surf_usage_flags_t
pipe_bind_to_isl_usage(unsigned bindings)
{
@@ -1442,6 +1480,7 @@ static const struct u_transfer_vtbl transfer_vtbl = {
void
iris_init_screen_resource_functions(struct pipe_screen *pscreen)
{
+ pscreen->query_dmabuf_modifiers = iris_query_dmabuf_modifiers;
pscreen->resource_create_with_modifiers =
iris_resource_create_with_modifiers;
pscreen->resource_create = u_transfer_helper_resource_create;