diff options
author | Kenneth Graunke <[email protected]> | 2019-07-31 11:05:49 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-07-31 11:06:32 -0700 |
commit | 3f9012839e2af6685cc2aeb8dc7c2757bba37326 (patch) | |
tree | 18a5a5fed5d6089ce977e33d52932e8fcb28c803 /src | |
parent | 91c4acedafa024d3b2e9267e9c8625efb09d35cc (diff) |
Revert "st/dri: simplify dri_get_egl_image by reusing dri2_format_table"
This reverts commit c47af8b95f26bd83efe322ff0baa52263fb8625e. It causes
dEQP-EGL regressions. (I think there is an easy fix, but we'll have it
go through review again.)
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 17 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_helpers.h | 19 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_screen.c | 31 |
3 files changed, 42 insertions, 25 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 1a7c6d0a0ae..7b6fc37c0f6 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -65,6 +65,21 @@ dri2_buffer(__DRIbuffer * driBufferPriv) return (struct dri2_buffer *) driBufferPriv; } +struct dri2_format_mapping { + int dri_fourcc; + int dri_format; /* image format */ + int dri_components; + enum pipe_format pipe_format; + int nplanes; + struct { + int buffer_index; + int width_shift; + int height_shift; + uint32_t dri_format; /* plane format */ + int cpp; + } planes[3]; +}; + static const struct dri2_format_mapping dri2_format_table[] = { { __DRI_IMAGE_FOURCC_ARGB2101010, __DRI_IMAGE_FORMAT_ARGB2101010, __DRI_IMAGE_COMPONENTS_RGBA, PIPE_FORMAT_B10G10R10A2_UNORM, 1, @@ -212,7 +227,7 @@ static const struct dri2_format_mapping dri2_format_table[] = { { 0, 1, 0, __DRI_IMAGE_FORMAT_ABGR8888, 4 } } } }; -const struct dri2_format_mapping * +static const struct dri2_format_mapping * dri2_get_mapping_by_fourcc(int fourcc) { for (unsigned i = 0; i < ARRAY_SIZE(dri2_format_table); i++) { diff --git a/src/gallium/state_trackers/dri/dri_helpers.h b/src/gallium/state_trackers/dri/dri_helpers.h index e8425bf5616..76f024fd67c 100644 --- a/src/gallium/state_trackers/dri/dri_helpers.h +++ b/src/gallium/state_trackers/dri/dri_helpers.h @@ -26,27 +26,8 @@ #include "dri_context.h" #include "dri_screen.h" - -struct dri2_format_mapping { - int dri_fourcc; - int dri_format; /* image format */ - int dri_components; - enum pipe_format pipe_format; - int nplanes; - struct { - int buffer_index; - int width_shift; - int height_shift; - uint32_t dri_format; /* plane format */ - int cpp; - } planes[3]; -}; - extern const __DRI2fenceExtension dri2FenceExtension; -const struct dri2_format_mapping * -dri2_get_mapping_by_fourcc(int fourcc); - __DRIimage * dri2_lookup_egl_image(struct dri_screen *screen, void *handle); diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 11bee3306c8..188d50dc6e3 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -33,7 +33,6 @@ #include "dri_screen.h" #include "dri_context.h" -#include "dri_helpers.h" #include "util/u_inlines.h" #include "pipe/p_screen.h" @@ -424,7 +423,6 @@ dri_get_egl_image(struct st_manager *smapi, { struct dri_screen *screen = (struct dri_screen *)smapi; __DRIimage *img = NULL; - const struct dri2_format_mapping *map; if (screen->lookup_egl_image) { img = screen->lookup_egl_image(screen, egl_image); @@ -435,9 +433,32 @@ dri_get_egl_image(struct st_manager *smapi, stimg->texture = NULL; pipe_resource_reference(&stimg->texture, img->texture); - map = dri2_get_mapping_by_fourcc(img->dri_fourcc); - assert(map); - stimg->format = map->pipe_format; + switch (img->dri_components) { + case __DRI_IMAGE_COMPONENTS_Y_U_V: + stimg->format = PIPE_FORMAT_IYUV; + break; + case __DRI_IMAGE_COMPONENTS_Y_UV: + if (img->texture->format == PIPE_FORMAT_R8_UNORM) + stimg->format = PIPE_FORMAT_NV12; + else /* P0XX uses R16 for first texture */ + stimg->format = PIPE_FORMAT_P016; + break; + case __DRI_IMAGE_COMPONENTS_AYUV: + stimg->format = PIPE_FORMAT_RGBA8888_UNORM; + break; + case __DRI_IMAGE_COMPONENTS_XYUV: + stimg->format = PIPE_FORMAT_RGBX8888_UNORM; + break; + case __DRI_IMAGE_COMPONENTS_Y_XUXV: + stimg->format = PIPE_FORMAT_YUYV; + break; + case __DRI_IMAGE_COMPONENTS_Y_UXVX: + stimg->format = PIPE_FORMAT_UYVY; + break; + default: + stimg->format = img->texture->format; + break; + } stimg->level = img->level; stimg->layer = img->layer; |