aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri
diff options
context:
space:
mode:
authorStanimir Varbanov <[email protected]>2016-05-27 01:10:35 +0300
committerEmil Velikov <[email protected]>2016-05-30 10:26:35 +0100
commit9d852a1f7501dbca8c0d40ebd7b9055b068bf2f3 (patch)
tree7a85f9f6bc104eab510786b13b7193adbad1f3bd /src/gallium/state_trackers/dri
parente9d3246a7a74282fbbf95ed077e3c3b7750c8ddd (diff)
st/dri: add handling of R8 and GR88 DRI fourcc formats
This helps to import dmabuf buffers from DRM_FORMAT_R8 and DRM_FORMAT_GR88 used for example by GStreamer for YUV to RGB conversion using shaders. Signed-off-by: Stanimir Varbanov <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r--src/gallium/state_trackers/dri/dri2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 0c84bafe14e..3f2d622f45c 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -75,6 +75,14 @@ static int convert_fourcc(int format, int *dri_components_p)
format = __DRI_IMAGE_FORMAT_XBGR8888;
dri_components = __DRI_IMAGE_COMPONENTS_RGB;
break;
+ case __DRI_IMAGE_FOURCC_R8:
+ format = __DRI_IMAGE_FORMAT_R8;
+ dri_components = __DRI_IMAGE_COMPONENTS_R;
+ break;
+ case __DRI_IMAGE_FOURCC_GR88:
+ format = __DRI_IMAGE_FORMAT_GR88;
+ dri_components = __DRI_IMAGE_COMPONENTS_RG;
+ break;
default:
return -1;
}
@@ -100,6 +108,12 @@ static int convert_to_fourcc(int format)
case __DRI_IMAGE_FORMAT_XBGR8888:
format = __DRI_IMAGE_FOURCC_XBGR8888;
break;
+ case __DRI_IMAGE_FORMAT_R8:
+ format = __DRI_IMAGE_FOURCC_R8;
+ break;
+ case __DRI_IMAGE_FORMAT_GR88:
+ format = __DRI_IMAGE_FOURCC_GR88;
+ break;
default:
return -1;
}
@@ -123,6 +137,12 @@ static enum pipe_format dri2_format_to_pipe_format (int format)
case __DRI_IMAGE_FORMAT_ABGR8888:
pf = PIPE_FORMAT_RGBA8888_UNORM;
break;
+ case __DRI_IMAGE_FORMAT_R8:
+ pf = PIPE_FORMAT_R8_UNORM;
+ break;
+ case __DRI_IMAGE_FORMAT_GR88:
+ pf = PIPE_FORMAT_RG88_UNORM;
+ break;
default:
pf = PIPE_FORMAT_NONE;
break;