[Mesa-dev] [v2 07/10] dri: propagate extra dma_buf import attributes to the drivers
Pohjolainen, Topi
topi.pohjolainen at intel.com
Wed May 1 23:08:50 PDT 2013
On Tue, Apr 30, 2013 at 11:03:20AM -0700, Ian Romanick wrote:
> On 04/29/2013 04:08 AM, Topi Pohjolainen wrote:
> >Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> >---
> > include/GL/internal/dri_interface.h | 23 +++++++++++++++++++++++
> > src/egl/drivers/dri2/egl_dri2.c | 1 +
> > src/mesa/drivers/dri/intel/intel_regions.h | 7 +++++++
> > src/mesa/drivers/dri/intel/intel_screen.c | 9 +++++++++
> > 4 files changed, 40 insertions(+)
> >
> >diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
> >index 30ce175..2691893 100644
> >--- a/include/GL/internal/dri_interface.h
> >+++ b/include/GL/internal/dri_interface.h
> >@@ -1025,6 +1025,25 @@ struct __DRIdri2ExtensionRec {
> > * 7+. Each query will return a
> > * new fd. */
> >
> >+enum __DRIYUVColorSpace {
> >+ __DRI_YUV_COLOR_SPACE_UNDEFINED = 0,
> >+ __DRI_YUV_COLOR_SPACE_ITU_REC601 = 0x327F,
> >+ __DRI_YUV_COLOR_SPACE_ITU_REC709 = 0x3280,
> >+ __DRI_YUV_COLOR_SPACE_ITU_REC2020 = 0x3281
> >+};
> >+
> >+enum __DRISampleRange {
> >+ __DRI_YUV_RANGE_UNDEFINED = 0,
> >+ __DRI_YUV_FULL_RANGE = 0x3282,
> >+ __DRI_YUV_NARROW_RANGE = 0x3283
> >+};
> >+
> >+enum __DRIChromaSiting {
> >+ __DRI_YUV_CHROMA_SITING_UNDEFINED = 0,
> >+ __DRI_YUV_CHROMA_SITING_0 = 0x3284,
> >+ __DRI_YUV_CHROMA_SITING_0_5 = 0x3285
> >+};
> >+
> > /**
> > * \name Reasons that __DRIimageExtensionRec::createImageFromTexture might fail
> > */
> >@@ -1129,6 +1148,10 @@ struct __DRIimageExtensionRec {
> > int width, int height, int fourcc,
> > int *fds, int num_fds,
> > int *strides, int *offsets,
> >+ enum __DRIYUVColorSpace yuv_color_space,
> >+ enum __DRISampleRange sample_range,
> >+ enum __DRIChromaSiting horizontal_siting,
> >+ enum __DRIChromaSiting vertical_siting,
> > void *loaderPrivate);
>
> Uh... you absolutely cannot change existing functions. This is ABI!
> If you run an updated driver against an old libEGL (or vice versa),
> it will explode.
I was wondering about this, but I misunderstood the purpose of the versioning.
I thought that both the ligEGL and the drivers would always be recompiled
together as they would dependent on this very header file, and that the purpose
of the version was to make decisions on which extensions to enable. I missed the
fact they can be compiled separately and the version is controlling an ABI.
Well one thing at a time...
I'll revise as you said.
>
> You need to add a new function and bump the version of DRI_IMAGE to
> 8. egl_dri.c can use the version of the DRI_IMAGE extension from the
> driver to determine whether to enable EGL_EXT_image_dma_buf_import.
>
> > };
> >
> >diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> >index 1011f27..10fdcef 100644
> >--- a/src/egl/drivers/dri2/egl_dri2.c
> >+++ b/src/egl/drivers/dri2/egl_dri2.c
> >@@ -1523,6 +1523,7 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd,
> > &fd, 1,
> > buffer->stride,
> > buffer->offset,
> >+ 0, 0, 0, 0,
> > NULL);
> >
> > if (img == NULL)
> >diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h
> >index e610f6b..323f834 100644
> >--- a/src/mesa/drivers/dri/intel/intel_regions.h
> >+++ b/src/mesa/drivers/dri/intel/intel_regions.h
> >@@ -40,6 +40,7 @@
> >
> > #include "main/mtypes.h"
> > #include "intel_bufmgr.h"
> >+#include <GL/internal/dri_interface.h>
> >
> > #ifdef __cplusplus
> > extern "C" {
> >@@ -156,6 +157,12 @@ struct __DRIimageRec {
> > GLuint tile_y;
> > bool has_depthstencil;
> >
> >+ /* Provided by dma_buf import extension */
> >+ enum __DRIYUVColorSpace yuv_color_space;
> >+ enum __DRISampleRange sample_range;
> >+ enum __DRIChromaSiting horizontal_siting;
> >+ enum __DRIChromaSiting vertical_siting;
> >+
> > void *data;
> > };
> >
> >diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
> >index e912bc7..75dbb5a 100644
> >--- a/src/mesa/drivers/dri/intel/intel_screen.c
> >+++ b/src/mesa/drivers/dri/intel/intel_screen.c
> >@@ -703,6 +703,10 @@ static __DRIimage *
> > intel_create_image_from_fds(__DRIscreen *screen,
> > int width, int height, int fourcc,
> > int *fds, int num_fds, int *strides, int *offsets,
> >+ enum __DRIYUVColorSpace yuv_color_space,
> >+ enum __DRISampleRange sample_range,
> >+ enum __DRIChromaSiting horizontal_siting,
> >+ enum __DRIChromaSiting vertical_siting,
> > void *loaderPrivate)
> > {
> > struct intel_screen *intelScreen = screen->driverPrivate;
> >@@ -737,6 +741,11 @@ intel_create_image_from_fds(__DRIscreen *screen,
> > }
> > }
> >
> >+ image->yuv_color_space = yuv_color_space;
> >+ image->sample_range = sample_range;
> >+ image->horizontal_siting = horizontal_siting;
> >+ image->vertical_siting = vertical_siting;
> >+
> > return image;
> > }
> >
> >
>
More information about the mesa-dev
mailing list