[Mesa-dev] [PATCH 2/3] gbm/dri: Add more color formats support.
Zhigang Gong
zhigang.gong at gmail.com
Sat Dec 17 18:32:25 PST 2011
Added two color formats RGB565 and A8 to gbm layer.
Add A8 to dri layer.
Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
include/GL/internal/dri_interface.h | 1 +
src/gbm/backends/dri/gbm_dri.c | 6 ++++++
src/gbm/main/gbm.h | 2 ++
src/mesa/drivers/dri/intel/intel_screen.c | 5 +++++
4 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 4f768f0..da3f11e 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -840,6 +840,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
#define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
#define __DRI_IMAGE_FORMAT_ABGR8888 0x1004
+#define __DRI_IMAGE_FORMAT_A8 0x1005
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index e44e5c6..7673953 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -224,6 +224,12 @@ gbm_dri_match_format(enum gbm_bo_format format, int *dri_format)
case GBM_BO_FORMAT_ARGB8888:
*dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
break;
+ case GBM_BO_FORMAT_RGB565:
+ *dri_format = __DRI_IMAGE_FORMAT_RGB565;
+ break;
+ case GBM_BO_FORMAT_A8:
+ *dri_format = __DRI_IMAGE_FORMAT_A8;
+ break;
default:
return -1;
}
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index a994451..e3cecb4 100644
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -51,6 +51,8 @@ union gbm_bo_handle {
enum gbm_bo_format {
GBM_BO_FORMAT_XRGB8888,
GBM_BO_FORMAT_ARGB8888,
+ GBM_BO_FORMAT_RGB565,
+ GBM_BO_FORMAT_A8
};
enum gbm_bo_flags {
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index e4cc5b0..6284071 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -143,6 +143,11 @@ intel_create_image_from_name(__DRIscreen *screen,
return NULL;
switch (format) {
+ case __DRI_IMAGE_FORMAT_A8:
+ image->format = MESA_FORMAT_A8;
+ image->internal_format = GL_ALPHA;
+ image->data_type = GL_UNSIGNED_BYTE;
+ break;
case __DRI_IMAGE_FORMAT_RGB565:
image->format = MESA_FORMAT_RGB565;
image->internal_format = GL_RGB;
--
1.7.3.1
More information about the mesa-dev
mailing list