diff options
author | Nanley Chery <nanley.g.chery@intel.com> | 2020-04-15 16:30:24 -0700 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-09-09 20:02:03 +0000 |
commit | d686835171c44cf325306f6c87408bef999f5496 (patch) | |
tree | 4181224a2434ce1e0c80ad8758476e67554c9884 | |
parent | a42bf9a29707cf503c56201e90aff2bbc5f685ca (diff) |
gallium/dri2: Support I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS import
Add support for up to four planes being imported via the
I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS modifier. In the four plane
scenario, two planes are used for the compressed surface and two planes
are used for the compression metadata.
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>
-rw-r--r-- | src/gallium/frontends/dri/dri2.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 8c62e8bd3da..b02d9f26049 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -739,6 +739,7 @@ dri2_create_image_from_winsys(__DRIscreen *_screen, unsigned tex_usage = 0; int i; bool use_lowered = false; + const unsigned format_planes = util_format_get_num_planes(map->pipe_format); if (pscreen->is_format_supported(pscreen, map->pipe_format, screen->target, 0, 0, PIPE_BIND_RENDER_TARGET)) @@ -773,7 +774,23 @@ dri2_create_image_from_winsys(__DRIscreen *_screen, templ.depth0 = 1; templ.array_size = 1; - for (i = (use_lowered ? map->nplanes : num_handles) - 1; i >= 0; i--) { + for (i = num_handles - 1; i >= format_planes; i--) { + struct pipe_resource *tex; + + templ.next = img->texture; + + tex = pscreen->resource_from_handle(pscreen, &templ, &whandle[i], + PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE); + if (!tex) { + pipe_resource_reference(&img->texture, NULL); + FREE(img); + return NULL; + } + + img->texture = tex; + } + + for (i = (use_lowered ? map->nplanes : format_planes) - 1; i >= 0; i--) { struct pipe_resource *tex; templ.next = img->texture; @@ -891,7 +908,7 @@ dri2_create_image_from_fd(__DRIscreen *_screen, int *strides, int *offsets, unsigned *error, void *loaderPrivate) { - struct winsys_handle whandles[3]; + struct winsys_handle whandles[4]; const struct dri2_format_mapping *map = dri2_get_mapping_by_fourcc(fourcc); __DRIimage *img = NULL; unsigned err = __DRI_IMAGE_ERROR_SUCCESS; |