diff options
author | Jesse Barnes <[email protected]> | 2012-02-21 12:53:09 -0800 |
---|---|---|
committer | Jesse Barnes <[email protected]> | 2012-02-22 09:41:40 -0800 |
commit | 8de5c355fa2bf0f30df2c7cf39aee01e793284bf (patch) | |
tree | 4001a8ba5a618e607626610532a67fe080f7d8f4 /src/gallium/state_trackers | |
parent | d35d3d612acef1612aaab9a923b8814d4dbb4d9c (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/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_screen.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drm/dri2.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h index 8c961955ac9..2818e9c2683 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.h +++ b/src/gallium/state_trackers/dri/common/dri_screen.h @@ -85,6 +85,7 @@ struct __DRIimageRec { struct pipe_resource *texture; unsigned level; unsigned layer; + uint32_t dri_format; void *loader_private; }; diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 4c08a025ed2..cc8023d02d5 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -440,6 +440,8 @@ dri2_create_image_from_name(__DRIscreen *_screen, tex_usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; + img->dri_format = format; + switch (format) { case __DRI_IMAGE_FORMAT_RGB565: pf = PIPE_FORMAT_B5G6R5_UNORM; @@ -569,6 +571,7 @@ dri2_create_image(__DRIscreen *_screen, img->level = 0; img->layer = 0; + img->dri_format = format; img->loader_private = loaderPrivate; return img; @@ -598,6 +601,9 @@ dri2_query_image(__DRIimage *image, int attrib, int *value) image->texture, &whandle); *value = whandle.handle; return GL_TRUE; + case __DRI_IMAGE_ATTRIB_FORMAT: + *value = image->dri_format; + return GL_TRUE; default: return GL_FALSE; } |