summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorJesse Barnes <[email protected]>2012-02-21 12:53:09 -0800
committerJesse Barnes <[email protected]>2012-02-22 09:41:40 -0800
commit8de5c355fa2bf0f30df2c7cf39aee01e793284bf (patch)
tree4001a8ba5a618e607626610532a67fe080f7d8f4 /src/mesa/drivers/dri
parentd35d3d612acef1612aaab9a923b8814d4dbb4d9c (diff)
gbm: track buffer format through DRI drivers
GBM needs the buffer format in order to communicate with DRM and clients for things like scanout. So track the DRI format requested in the various back ends and use it to return the DRI format back to GBM when requested. GBM will then map this into the GBM surface type (which is in turn based on the DRM fb format list). Signed-off-by: Jesse Barnes <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.h1
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.h1
4 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h
index 8c7e13862e5..4ea970ad6d1 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -132,6 +132,7 @@ void _mesa_copy_rect(GLubyte * dst,
struct __DRIimageRec {
struct intel_region *region;
GLenum internal_format;
+ uint32_t dri_format;
GLuint format;
GLenum data_type;
void *data;
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 4eeeb2f8561..a13e6755a7c 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -245,6 +245,8 @@ intel_create_image(__DRIscreen *screen,
if (image == NULL)
return NULL;
+ image->dri_format = format;
+
switch (format) {
case __DRI_IMAGE_FORMAT_RGB565:
image->format = MESA_FORMAT_RGB565;
@@ -297,6 +299,8 @@ intel_query_image(__DRIimage *image, int attrib, int *value)
return true;
case __DRI_IMAGE_ATTRIB_NAME:
return intel_region_flink(image->region, (uint32_t *) value);
+ case __DRI_IMAGE_ATTRIB_FORMAT:
+ return image->dri_format;
default:
return false;
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 1f60f2ae43f..85cfe17ad76 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -314,6 +314,8 @@ radeon_create_image(__DRIscreen *screen,
if (image == NULL)
return NULL;
+ image->dri_format = format;
+
switch (format) {
case __DRI_IMAGE_FORMAT_RGB565:
image->format = MESA_FORMAT_RGB565;
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h
index 1f0f383c683..dd618f5836f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.h
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.h
@@ -109,6 +109,7 @@ typedef struct radeon_screen {
struct __DRIimageRec {
struct radeon_bo *bo;
GLenum internal_format;
+ uint32_t dri_format;
GLuint format;
GLenum data_type;
int width, height; /* in pixels */