10bit output via KMS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
index bc8f0ba..c0d55e9 100644
--- a/include/EGL/eglext.h
+++ b/include/EGL/eglext.h
@@ -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
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 2cab7d0..39394b0 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -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,
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 71590d7..fdad65a 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -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;
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 0aba1be..18cbd0b 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -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;
--
2.11.0


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux