10bit output via KMS
I have implemented a display manager application that takes DMB-BUF FDs from another process and presents them to a connected output display using the KMS infrastructure (drmModeAddFB, etc.). So far this works without problems for XRGB8888. Now I wanted to have 10bit color depth per channel. I created a FBO with 10bit (by patching the mesa and ex- ported it's texture as a file descriptor via eglExportDMABUFImageMESA, see attached patch).
When I try to import that file descriptor via gbm_bo_import it fails because in gbm_bo_import, createImageFromFds is called which compares the format passed to gbm_bo_import with intel_image_formats. But this array does not seem to support 10bit formats. Now I wonder how one could output 10bit per color channel to an output connector?
--- include/EGL/eglext.h | 4 ++++ src/egl/drivers/dri2/egl_dri2.c | 26 +++++++++++++++++++++++++- src/gbm/backends/dri/gbm_dri.c | 3 +++ src/mesa/drivers/dri/i965/intel_screen.c | 2 ++ 4 files changed, 34 insertions(+), 1 deletion(-)
include/EGL/eglext.h +4 -0
@@ -862,10 +862,14 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfi#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0#define EGL_DRM_BUFFER_USE_MESA 0x31D1#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 +#define EGL_DRM_BUFFER_FORMAT_RGB10A2_MESA 0x31D9 +#define EGL_DRM_BUFFER_FORMAT_R8_MESA 0x31E0 +#define EGL_DRM_BUFFER_FORMAT_GR88_MESA 0x31E1#define EGL_DRM_BUFFER_MESA 0x31D3#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 +#define EGL_DRM_BUFFER_USE_LINEAR 0x00000008 typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC)
(EGLDisplay dpy, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC)
(EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
#ifdef EGL_EGLEXT_PROTOTYPES
src/egl/drivers/dri2/egl_dri2.c +25 -1
@@ -1921,6 +1921,18 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, format = __DRI_IMAGE_FORMAT_ARGB8888; pitch = attrs.DRMBufferStrideMESA;break ; +case EGL_DRM_BUFFER_FORMAT_RGB10A2_MESA : + format = __DRI_IMAGE_FORMAT_ARGB2101010; + pitch = attrs.DRMBufferStrideMESA; +break ; +case EGL_DRM_BUFFER_FORMAT_R8_MESA : + format = __DRI_IMAGE_FORMAT_R8; + pitch = attrs.DRMBufferStrideMESA; +break ; +case EGL_DRM_BUFFER_FORMAT_GR88_MESA : + format = __DRI_IMAGE_FORMAT_GR88; + pitch = attrs.DRMBufferStrideMESA; +break ;default :_eglError (EGL_BAD_PARAMETER ,"dri2_create_image_khr: unsupported pixmap depth" );
@@ -2216,6 +2228,15 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp,case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA : format = __DRI_IMAGE_FORMAT_ARGB8888;break ; +case EGL_DRM_BUFFER_FORMAT_RGB10A2_MESA : + format = __DRI_IMAGE_FORMAT_ARGB2101010; +break ; +case EGL_DRM_BUFFER_FORMAT_R8_MESA : + format = __DRI_IMAGE_FORMAT_R8; +break ; +case EGL_DRM_BUFFER_FORMAT_GR88_MESA : + format = __DRI_IMAGE_FORMAT_GR88; +break ;default :_eglLog (_EGL_WARNING,"bad image format value 0x%04x" , attrs.DRMBufferFormatMESA);
@@ -2225,7 +2246,8 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, valid_mask =EGL_DRM_BUFFER_USE_SCANOUT_MESA |EGL_DRM_BUFFER_USE_SHARE_MESA | -EGL_DRM_BUFFER_USE_CURSOR_MESA ; +EGL_DRM_BUFFER_USE_CURSOR_MESA | +EGL_DRM_BUFFER_USE_LINEAR ;if (attrs.DRMBufferUseMESA & ~valid_mask) {_eglLog (_EGL_WARNING,"bad image use bit 0x%04x" , attrs.DRMBufferUseMESA & ~valid_mask);
@@ -2239,6 +2261,8 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, dri_use |= __DRI_IMAGE_USE_SCANOUT;if (attrs.DRMBufferUseMESA &EGL_DRM_BUFFER_USE_CURSOR_MESA ) dri_use |= __DRI_IMAGE_USE_CURSOR; +if (attrs.DRMBufferUseMESA &EGL_DRM_BUFFER_USE_LINEAR ) + dri_use |= __DRI_IMAGE_USE_LINEAR; dri2_img->dri_image = dri2_dpy->image->createImage(dri2_dpy->dri_screen,
src/gbm/backends/dri/gbm_dri.c +3 -0
@@ -817,6 +817,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)case __DRI_IMAGE_FORMAT_ABGR8888: ret =GBM_FORMAT_ABGR8888 ;break ; +case __DRI_IMAGE_FORMAT_ARGB2101010: + ret =GBM_FORMAT_ARGB2101010 ; +break ;default : ret =0 ;break ;
src/mesa/drivers/dri/i965/intel_screen.c +2 -0
@@ -385,6 +385,8 @@ intel_allocate_image(struct intel_screen *screen, int dri_format, } image->internal_format =_mesa_get_format_base_format (image->format); +if (image->internal_format ==GL_RGBA && image->format ==MESA_FORMAT_B10G10R10A2_UNORM ) + image->internal_format =GL_RGB10_A2 ; image->data = loaderPrivate;return image;
Signature · 7 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Volker Vogelhuber
I have implemented a display manager application that takes DMB-BUF FDs from another process and presents them to a connected output display using the KMS infrastructure (drmModeAddFB, etc.). So far this works without problems for XRGB8888. Now I wanted to have 10bit color depth
Quoted 9 lines
per channel. I created a FBO with 10bit (by patching the mesa and ex- ported it's texture as a file descriptor via eglExportDMABUFImageMESA, see attached patch).
When I try to import that file descriptor viagbm_bo_importit fails because ingbm_bo_import, createImageFromFds is called which compares the format passed togbm_bo_importwithintel_image_formats. But this array does not seem to support 10bit formats. Now I wonder how one could output 10bit per color channel to an output connector?
Adding Nicolai. I think he sent out similar patches for mesa and glamor earlier this year to enable this as well.
Alex
Quoted 123 lines
--- include/EGL/eglext.h | 4 ++++ src/egl/drivers/dri2/egl_dri2.c | 26 +++++++++++++++++++++++++- src/gbm/backends/dri/gbm_dri.c | 3 +++ src/mesa/drivers/dri/i965/intel_screen.c | 2 ++ 4 files changed, 34 insertions(+), 1 deletion(-)include/EGL/eglext.h +0
-0@@ -862,10 +862,14 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfi
#defineEGL_DRM_BUFFER_FORMAT_MESA0x31D0
#defineEGL_DRM_BUFFER_USE_MESA0x31D1
#defineEGL_DRM_BUFFER_FORMAT_ARGB32_MESA0x31D2include/EGL/eglext.h +4
-0+#define EGL_DRM_BUFFER_FORMAT_RGB10A2_MESA 0x31D9 +#define EGL_DRM_BUFFER_FORMAT_R8_MESA 0x31E0 +#define EGL_DRM_BUFFER_FORMAT_GR88_MESA 0x31E1#define EGL_DRM_BUFFER_MESA 0x31D3#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 +#define EGL_DRM_BUFFER_USE_LINEAR 0x00000008 typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplaydpy, const EGLint
*attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay
dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
#ifdefEGL_EGLEXT_PROTOTYPESsrc/egl/drivers/dri2/egl_dri2.c +12
-0@@ -1921,6 +1921,18 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp,_EGLContext *ctx, format = __DRI_IMAGE_FORMAT_ARGB8888; pitch = attrs.DRMBufferStrideMESA;break ; +case EGL_DRM_BUFFER_FORMAT_RGB10A2_MESA : + format = __DRI_IMAGE_FORMAT_ARGB2101010; + pitch = attrs.DRMBufferStrideMESA; +break ; +case EGL_DRM_BUFFER_FORMAT_R8_MESA : + format = __DRI_IMAGE_FORMAT_R8; + pitch = attrs.DRMBufferStrideMESA; +break ; +case EGL_DRM_BUFFER_FORMAT_GR88_MESA : + format = __DRI_IMAGE_FORMAT_GR88; + pitch = attrs.DRMBufferStrideMESA; +break ;default : _eglError(EGL_BAD_PARAMETER,"dri2_create_image_khr: unsupported pixmap depth");src/egl/drivers/dri2/egl_dri2.c +9
-0@@ -2216,6 +2228,15 @@ dri2_create_drm_image_mesa(_EGLDriver *drv,_EGLDisplay *disp, case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: format = __DRI_IMAGE_FORMAT_ARGB8888;break ; +case EGL_DRM_BUFFER_FORMAT_RGB10A2_MESA : + format = __DRI_IMAGE_FORMAT_ARGB2101010; +break ; +case EGL_DRM_BUFFER_FORMAT_R8_MESA : + format = __DRI_IMAGE_FORMAT_R8; +break ; +case EGL_DRM_BUFFER_FORMAT_GR88_MESA : + format = __DRI_IMAGE_FORMAT_GR88; +break ;default : _eglLog(_EGL_WARNING, "bad image format value 0x%04x",attrs.DRMBufferFormatMESA);src/egl/drivers/dri2/egl_dri2.c +2
-1@@ -2225,7 +2246,8 @@ dri2_create_drm_image_mesa(_EGLDriver *drv,_EGLDisplay *disp, valid_mask =EGL_DRM_BUFFER_USE_SCANOUT_MESA |EGL_DRM_BUFFER_USE_SHARE_MESA | -EGL_DRM_BUFFER_USE_CURSOR_MESA ; +EGL_DRM_BUFFER_USE_CURSOR_MESA | +EGL_DRM_BUFFER_USE_LINEAR ;if (attrs.DRMBufferUseMESA & ~valid_mask) { _eglLog(_EGL_WARNING, "bad image use bit 0x%04x",attrs.DRMBufferUseMESA & ~valid_mask);src/egl/drivers/dri2/egl_dri2.c +2
-0@@ -2239,6 +2261,8 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, dri_use |= __DRI_IMAGE_USE_SCANOUT;if (attrs.DRMBufferUseMESA &EGL_DRM_BUFFER_USE_CURSOR_MESA ) dri_use |= __DRI_IMAGE_USE_CURSOR; +if (attrs.DRMBufferUseMESA &EGL_DRM_BUFFER_USE_LINEAR ) + dri_use |= __DRI_IMAGE_USE_LINEAR; dri2_img->dri_image =dri2_dpy->image->createImage(dri2_dpy->dri_screen,src/gbm/backends/dri/gbm_dri.c +3
-0@@ -817,6 +817,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)case __DRI_IMAGE_FORMAT_ABGR8888: ret =GBM_FORMAT_ABGR8888 ;break ; +case __DRI_IMAGE_FORMAT_ARGB2101010: + ret =GBM_FORMAT_ARGB2101010 ; +break ;default : ret =0 ;break ;src/mesa/drivers/dri/i965/intel_screen.c +2
-0@@ -385,6 +385,8 @@ intel_allocate_image(struct intel_screen *screen, int dri_format, } image->internal_format =_mesa_get_format_base_format (image->format); +if (image->internal_format ==GL_RGBA && image->format ==MESA_FORMAT_B10G10R10A2_UNORM ) + image->internal_format =GL_RGB10_A2 ; image->data = loaderPrivate;return image;
Quoted 8 lines
--
2.11.0_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): CACvgo53m0qSADivgxzK+4zrXfwtvxTYLuac4aZFw2vap5+bDrg@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CAPj87rNnoNYK8jE+Q=jPPzATrWzEp2nW5hB084-aByrw9ZjUgA@mail.gmail.com
Hi,
Quoted 9 lines
Quoted 2 lines · Volker Vogelhuber
I wonder if it is possible to have drmModeAddFB2 to handle 'X', 'R', '3', '0' at all. So is this supported in any way?
Secondly, you're correct that you would need (theoretically) to extend drmModeAddFB2, however it already has
DRM_FORMAT_XRGB2101010andDRM_FORMAT_XBGR2101010for i965 and above, which covers everything in the last 10 years. This is the 'XR30' FourCC you mention, so it should already be there and working in the kernel.
This question probably better fits to the drm mailing list, although the discussion started on the mesa list.
I got it working now that my 10bit buffers are correctly displayed on a Samsung QM49F via drmModeAddFB2 and the 'X', 'R', '3', '0' fourcc code. Based on the Samsung's datasheet it should support 10bit signals, although the EDID does not seem to contain a vendor specific data block that would confirm that assumption.
I have connected an Apollo Lake module with a display port cable
to that display but I'm unsure if it's really 10bit or if there is some
conversion logic somewhere in between that may downsample my
10 bit buffer to 8bit before sending it via displayport to the display.
So far I stumbled over some patches regarding color management
in the drm part of the kernel, but couldn't figure out how one could
configure what is really send to the display. It seem to mostly be used to manipulate gamma values and so on. As the only indicator
what is provided to the display is the buffer format handled by
drmModeAddFB2 I doubt this is enough to configure the signal.
Otherwise one could argue that the link speed of the display signal
would have to toggle every time I send a different buffer format, which is certainly not the case. So what portion of the kms/drm chain do I
miss currently? The drmModeModeInfo pointer has a clock field, but I guess this is meant to be for the pixel clock not the clock of the serialized signal. Probably that's why I couldn't find modelines for 4k@60 especially for 10bit compared to 8bit.
Thanks
Volker
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 28.07.2017 um 11:55 schrieb Volker Vogelhuber:
Quoted 20 lines
Hi,
Quoted 9 lines
Quoted 2 lines · Volker Vogelhuber
I wonder if it is possible to have drmModeAddFB2 to handle 'X', 'R', '3', '0' at all. So is this supported in any way?
Secondly, you're correct that you would need (theoretically) to extend drmModeAddFB2, however it already has
DRM_FORMAT_XRGB2101010andDRM_FORMAT_XBGR2101010for i965 and above, which covers everything in the last 10 years. This is the 'XR30' FourCC you mention, so it should already be there and working in the kernel.This question probably better fits to the drm mailing list, although the discussion started on the mesa list.
I got it working now that my 10bit buffers are correctly displayed on a Samsung QM49F via drmModeAddFB2 and the 'X', 'R', '3', '0' fourcc code. Based on the Samsung's datasheet it should support 10bit signals, although the EDID does not seem to contain a vendor specific data block that would confirm that assumption.
Quoted 4 lines
I have connected an Apollo Lake module with a display port cable to that display but I'm unsure if it's really 10bit or if there is some conversion logic somewhere in between that may downsample my 10 bit buffer to 8bit before sending it via displayport to the display.
Well you could just try to display a 10bit image with a gradient going from black to white.
The difference between 8bit and 10bit should be obvious even to the naked eye.
Christian.
Quoted 14 lines
So far I stumbled over some patches regarding color management
in the drm part of the kernel, but couldn't figure out how one could
configure what is really send to the display. It seem to mostly be used to manipulate gamma values and so on. As the only indicator
what is provided to the display is the buffer format handled by
drmModeAddFB2 I doubt this is enough to configure the signal.
Otherwise one could argue that the link speed of the display signal
would have to toggle every time I send a different buffer format, which is certainly not the case. So what portion of the kms/drm chain do I
miss currently? The drmModeModeInfo pointer has a clock field, but I guess this is meant to be for the pixel clock not the clock of the serialized signal. Probably that's why I couldn't find modelines for 4k@60 especially for 10bit compared to 8bit.Thanks
Volker
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 24 July 2017 at 14:56, Volker Vogelhuber >>>
<[email protected]> wrote: >>>> I wonder if it is possible to have drmModeAddFB2 to handle >>>> 'X', 'R', '3', '0' at all. So is this supported in any way? >>> Secondly, you're correct that you would need (theoretically) to extend >>> drmModeAddFB2, however it already has DRM_FORMAT_XRGB2101010 and >>> DRM_FORMAT_XBGR2101010 for i965 and above, which covers everything in >>> the last 10 years. This is the 'XR30' FourCC you mention, so it should >>> already be there and working in the kernel. >> This question probably better fits to the drm mailing list, although the >> discussion started on the mesa list. >> >> I got it working now that my 10bit buffers are correctly displayed >> on a Samsung QM49F via drmModeAddFB2 and the 'X', 'R', '3', '0' >> fourcc code. Based on the Samsung's datasheet it should support 10bit >> signals, although the EDID does not seem to contain a vendor >> specific data block that would confirm that assumption. >> >> I have connected an Apollo Lake module with a display port cable >> to that display but I'm unsure if it's really 10bit or if there is some >> conversion logic somewhere in between that may downsample my >> 10 bit buffer to 8bit before sending it via displayport to the display. > > Well you could just try to display a 10bit image with a gradient going from black to white. > The difference between 8bit and 10bit should be obvious even to the naked eye. Thanks Christian. I tried your proposal but as I already assumed there seem to be no difference. I switched the display to an LG 27UD58-B
which supports the vendor specific data block and also states that
it supports 36bpp as well as 30bpp input signals. It even has a deep
color option to be enabled in it's menu. But apparently the apollo
lake GPU does not care about that, or at least it makes no
difference regarding my test buffer. What I verified is that the
buffer generated by OpenGL is really 10bit. When I pass the 10bit
buffer to drmModeAddFB2 as an 8bit buffer it is shown with various
color artifacts because of the wrong bit mapping.
I just stumbled upon a slide from Andy Ritger where he mentions that there are some components still missing for HDR10.
(https://www.x.org/wiki/Events/XDC2016/Program/xdc-2016-hdr.pdf)
As far as I understand it, he proposes that the driver should accept an scRGB FP16 buffer and that this part is still missing in the Linux kernel. My question is: is that only true for HDR10 with regards to SMPTE 2086, or is it even not possible to output a "deep color" DRM_FORMAT_XBGR2101010 buffer as a 10bit BPP signal via displayport.
Quoted 1 line
Quoted 1 line
So far I stumbled over some patches regarding color management >> in the drm part of the kernel, but couldn't figure out how one
could >> configure what is really send to the display. It seem to mostly be used to manipulate gamma values and so on. As the only indicator >> what is provided to the display is the buffer format handled by >> drmModeAddFB2 I doubt this is enough to configure the signal. >> Otherwise one could argue that the link speed of the display signal >> would have to toggle every time I send a different buffer format, which is certainly not the case. So what portion of the kms/drm chain do I >> miss currently? The drmModeModeInfo pointer has a clock field, but I guess this is meant to be for the pixel clock not the clock of the serialized signal. Probably that's why I couldn't find modelines for 4k@60 especially for 10bit compared to 8bit. >> >> Thanks >> Volker >> >> >> >> _______________________________________________ >> dri-devel mailing list >> [email protected] >> https://lists.freedesktop.org/mailman/listinfo/dri-devel > >
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel