On Thu, 5 Apr 2018 15:05:26 +0300 Tapani Pälli <tapani.pa...@intel.com> wrote:
> Hi; > > On 04/05/2018 02:51 AM, James Xiong wrote: > > From: "Xiong, James" <james.xi...@intel.com> > > > > The importer creates an image out of the imported FOURCC_NV12 > > texture, the image's dri_format is set to R8(same as the first > > plane's format), when it queries the image's fourcc, mesa goes > > through intel_image_format table and returns FOURCC_R8. > > Could you explain the use case a bit, I'm not sure I understand how > this happens. First someone imports dmabufs, creating EGLImage. Then > a texture is associated with that (glEGLImageTargetTexture2DOES?), is > it so that then we create yet another EGLImage from that texture or > am I completely lost here? :) > Sorry for the confusion. What actually happened was the exporter 1) calls eglCreateImageKHR() to create an image from a NV12 texture, 2) calls eglExportDMABUFImageQueryMESA() but the fourcc_r8 is returned instead of fourcc_nv12. Essentially, image->dri_format is the first plane's format, i.e. __DRI_IMAGE_FORMAT_R8 in our case, when querying fourcc, intel_lookup_fourcc() gets the following entry from the table intel_image_formats: { __DRI_IMAGE_FOURCC_R8, __DRI_IMAGE_COMPONENTS_R, 1, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, } }, instead of the corret one: { __DRI_IMAGE_FOURCC_NV12, __DRI_IMAGE_COMPONENTS_Y_UV, 2, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 1, 1, 1, __DRI_IMAGE_FORMAT_GR88, 2 } } }, To fix this, the image should inherit the texture's planar_format which contains the original fourcc; When the user application queries the fourcc, we can return the saved fourcc if planar_format is NULL; otherwise fallback to the original way to look up the fourcc. > > The solution is to 1) set the image's planar_format using the > > texture's in function intel_create_image_from_texture(). 2) when > > queried, return the saved fourcc@planar_format > > > > Xiong, James (2): > > i965: init image's planar_format in > > intel_create_image_from_texture i965: return the fourcc saved in > > __DRIimage > > > > src/mesa/drivers/dri/i965/intel_screen.c | 16 +++++++++++++--- > > 1 file changed, 13 insertions(+), 3 deletions(-) > > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev