summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2019-11-15 14:10:38 -0800
committerNanley Chery <[email protected]>2019-12-06 20:31:48 +0000
commit51ee8fff9b5e803592a2fd34730fdcfdfba469cb (patch)
treef14272cddcf778cac14136cb6c03c381d9880ec9
parentd5c857837aae205c0e1fddee30300b4419e2bb3f (diff)
gallium: Store the image format in winsys_handle
This format will be used to properly handle planar images with modifiers in iris. Fixes: 246eebba4a8 ("iris: Export and import surfaces with modifiers that have aux data") Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/gallium/include/state_tracker/winsys_handle.h6
-rw-r--r--src/gallium/state_trackers/dri/dri2.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/include/state_tracker/winsys_handle.h b/src/gallium/include/state_tracker/winsys_handle.h
index 53d2fd2b70d..78f5f4b36f2 100644
--- a/src/gallium/include/state_tracker/winsys_handle.h
+++ b/src/gallium/include/state_tracker/winsys_handle.h
@@ -53,6 +53,12 @@ struct winsys_handle
* Input to resource_from_handle.
* Output from resource_get_handle.
*/
+ uint64_t format;
+
+ /**
+ * Input to resource_from_handle.
+ * Output from resource_get_handle.
+ */
uint64_t modifier;
};
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 986f770738d..1f72c9d11c5 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -547,6 +547,7 @@ dri2_allocate_textures(struct dri_context *ctx,
whandle.handle = buf->name;
whandle.stride = buf->pitch;
whandle.offset = 0;
+ whandle.format = format;
whandle.modifier = DRM_FORMAT_MOD_INVALID;
if (screen->can_share_buffer)
whandle.type = WINSYS_HANDLE_TYPE_SHARED;
@@ -820,6 +821,7 @@ dri2_create_image_from_name(__DRIscreen *_screen,
memset(&whandle, 0, sizeof(whandle));
whandle.type = WINSYS_HANDLE_TYPE_SHARED;
whandle.handle = name;
+ whandle.format = map->pipe_format;
whandle.modifier = DRM_FORMAT_MOD_INVALID;
whandle.stride = pitch * util_format_get_blocksize(map->pipe_format);
@@ -921,6 +923,7 @@ dri2_create_image_from_fd(__DRIscreen *_screen,
whandles[i].handle = (unsigned)fds[fdnum];
whandles[i].stride = (unsigned)strides[index];
whandles[i].offset = (unsigned)offsets[index];
+ whandles[i].format = map->pipe_format;
whandles[i].modifier = modifier;
whandles[i].plane = index;
}
@@ -1311,6 +1314,7 @@ dri2_from_names(__DRIscreen *screen, int width, int height, int format,
whandle.handle = names[0];
whandle.stride = strides[0];
whandle.offset = offsets[0];
+ whandle.format = map->pipe_format;
whandle.modifier = DRM_FORMAT_MOD_INVALID;
img = dri2_create_image_from_winsys(screen, width, height, map,