Re: [Mesa-dev] [PATCH] nir/lower_tex: Fix the channel ordering during conversion of AYUV images
On Tue, 15 Jan 2019 09:45:52 +0200 Tapani Pälli wrote: > On 1/15/19 4:34 AM, Lionel Landwerlin wrote: > > When writing this I used this page to figure the bytes' ordering : > > https://docs.microsoft.com/en-us/windows/desktop/medfound/recommended-8-bit-yuv-formats-for-video-rendering#ayuv > > > > > > Of course endianess confuses everything :( > > > > sunxi seems to support AYUV & VUYA : > > https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/include/video/sunxi_display2.h#L40 > > > > > > > > Finally this patch (and its gstreamer comments) confuses me even > > more : https://patchwork.freedesktop.org/patch/255529/ > > > > I really don't know what's right or wrong here... > > IMO order 1230 seems wrong to me. Vivek, was the order chosen just > because vivid driver outputs that or is it based on anything else, > like some specification or other information? Hi Tapani, I chose the order just by looking at the Vivid driver output. YUYV and VYUY buffers generated by the Vivid driver were displayed correctly on Weston and I believed that YUV4 buffers (which I assumed were AYUV) should have displayed correctly as well. -Vivek > > > > - > > Lionel > > > > On 15/01/2019 00:49, Vivek Kasireddy wrote: > >> From: "Kasireddy, Vivek" > >> > >> The channel ordering should be 1230 instead of 2103. > >> > >> While displaying the packed YUV buffers generated by the Vivid > >> (Virtual Video) driver on Weston, it was observed that AYUV images > >> were not displayed correctly. Changing the ordering to 1230 makes > >> AYUV buffers display as expected. > >> > >> CC: Lionel Landwerlin > >> CC: Tapani Palli > >> Signed-off-by: Vivek Kasireddy > >> --- > >> src/compiler/nir/nir_lower_tex.c | 6 +++--- > >> 1 file changed, 3 insertions(+), 3 deletions(-) > >> > >> diff --git a/src/compiler/nir/nir_lower_tex.c > >> b/src/compiler/nir/nir_lower_tex.c > >> index a618b86b34c..7058c54f17c 100644 > >> --- a/src/compiler/nir/nir_lower_tex.c > >> +++ b/src/compiler/nir/nir_lower_tex.c > >> @@ -434,10 +434,10 @@ lower_ayuv_external(nir_builder *b, > >> nir_tex_instr *tex) > >> nir_ssa_def *ayuv = sample_plane(b, tex, 0); > >> convert_yuv_to_rgb(b, tex, > >> - nir_channel(b, ayuv, 2), > >> nir_channel(b, ayuv, 1), > >> - nir_channel(b, ayuv, 0), > >> - nir_channel(b, ayuv, 3)); > >> + nir_channel(b, ayuv, 2), > >> + nir_channel(b, ayuv, 3), > >> + nir_channel(b, ayuv, 0)); > >> } > >> /* > > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nir/lower_tex: Fix the channel ordering during conversion of AYUV images
On Tue, 15 Jan 2019 02:34:08 + Lionel Landwerlin wrote: > When writing this I used this page to figure the bytes' ordering : > https://docs.microsoft.com/en-us/windows/desktop/medfound/recommended-8-bit-yuv-formats-for-video-rendering#ayuv > Of course endianess confuses everything :( > > sunxi seems to support AYUV & VUYA : > https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/include/video/sunxi_display2.h#L40 > > Finally this patch (and its gstreamer comments) confuses me even > more : https://patchwork.freedesktop.org/patch/255529/ > > I really don't know what's right or wrong here... > > - > Lionel Hi Lionel, I am in the same boat as you; however, I think you may be right. I was looking at this page: https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/pixfmt-packed-yuv.html and assumed that the format it refers to as V4L2_PIX_FMT_YUV32 with code YUV4 is the same as AYUV. I am guessing the best way to fix this is to add a new AYUV format to V4L that reverses the channel ordering? -Vivek > > On 15/01/2019 00:49, Vivek Kasireddy wrote: > > From: "Kasireddy, Vivek" > > > > The channel ordering should be 1230 instead of 2103. > > > > While displaying the packed YUV buffers generated by the Vivid > > (Virtual Video) driver on Weston, it was observed that AYUV images > > were not displayed correctly. Changing the ordering to 1230 makes > > AYUV buffers display as expected. > > > > CC: Lionel Landwerlin > > CC: Tapani Palli > > Signed-off-by: Vivek Kasireddy > > --- > > src/compiler/nir/nir_lower_tex.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/src/compiler/nir/nir_lower_tex.c > > b/src/compiler/nir/nir_lower_tex.c index a618b86b34c..7058c54f17c > > 100644 --- a/src/compiler/nir/nir_lower_tex.c > > +++ b/src/compiler/nir/nir_lower_tex.c > > @@ -434,10 +434,10 @@ lower_ayuv_external(nir_builder *b, > > nir_tex_instr *tex) nir_ssa_def *ayuv = sample_plane(b, tex, 0); > > > > convert_yuv_to_rgb(b, tex, > > - nir_channel(b, ayuv, 2), > >nir_channel(b, ayuv, 1), > > - nir_channel(b, ayuv, 0), > > - nir_channel(b, ayuv, 3)); > > + nir_channel(b, ayuv, 2), > > + nir_channel(b, ayuv, 3), > > + nir_channel(b, ayuv, 0)); > > } > > > > /* > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] nir/lower_tex: Fix the channel ordering during conversion of AYUV images
From: "Kasireddy, Vivek" The channel ordering should be 1230 instead of 2103. While displaying the packed YUV buffers generated by the Vivid (Virtual Video) driver on Weston, it was observed that AYUV images were not displayed correctly. Changing the ordering to 1230 makes AYUV buffers display as expected. CC: Lionel Landwerlin CC: Tapani Palli Signed-off-by: Vivek Kasireddy --- src/compiler/nir/nir_lower_tex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index a618b86b34c..7058c54f17c 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -434,10 +434,10 @@ lower_ayuv_external(nir_builder *b, nir_tex_instr *tex) nir_ssa_def *ayuv = sample_plane(b, tex, 0); convert_yuv_to_rgb(b, tex, - nir_channel(b, ayuv, 2), nir_channel(b, ayuv, 1), - nir_channel(b, ayuv, 0), - nir_channel(b, ayuv, 3)); + nir_channel(b, ayuv, 2), + nir_channel(b, ayuv, 3), + nir_channel(b, ayuv, 0)); } /* -- 2.14.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] dri_interface: Introduce __DRI_IMAGE_USE_SCANOUT_ROTATION_* flags (v3)
On Thu, 26 Nov 2015 16:44:20 +0900 Michel Dänzer <mic...@daenzer.net> wrote: > On 26.11.2015 11:01, Vivek Kasireddy wrote: > > On Wed, 25 Nov 2015 18:38:50 +0900 > > Michel Dänzer <mic...@daenzer.net> wrote: > > > >> On 21.11.2015 12:38, Vivek Kasireddy wrote: > >>> These flags can be used by the DRI driver to set additional > >>> requirements such as tiling while creating buffers. > >>> > >>> v2: Added a brief comment to explain the rotation orientation. > >>> > >>> v3: Corrected a typo in the comment added in v2 and removed an > >>> empty line. > >>> > >>> Cc: Michel Danzer <mic...@daenzer.net> > >>> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> > >> > >> The series is > >> > >> Reviewed-by: Michel Dänzer <michel.daen...@amd.com> > >> > >> > >> Do you need somebody to push the patches for you? > > > > Yes please! > > I was getting ready to push these, but it occurred to me that we > normally don't add new APIs without any code implementing/using them. > Do you have a (i965?) driver patch implementing these flags? Hi Michel, I did have a patch (http://lists.freedesktop.org/archives/mesa-dev/2015-October/098161.html) for the i965 driver but couldn't get it merged due to lack of adequate testing. I could only test it with a Weston based compositor. Thanks and Regards, Vivek > > Also, I wonder if we need to add code to other drivers returning NULL > if any of these new flags are specified, until they are actually > handled correctly. > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] dri_interface: Introduce __DRI_IMAGE_USE_SCANOUT_ROTATION_* flags (v3)
On Wed, 25 Nov 2015 18:38:50 +0900 Michel Dänzer <mic...@daenzer.net> wrote: > On 21.11.2015 12:38, Vivek Kasireddy wrote: > > These flags can be used by the DRI driver to set additional > > requirements such as tiling while creating buffers. > > > > v2: Added a brief comment to explain the rotation orientation. > > > > v3: Corrected a typo in the comment added in v2 and removed an empty > > line. > > > > Cc: Michel Danzer <mic...@daenzer.net> > > Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> > > The series is > > Reviewed-by: Michel Dänzer <michel.daen...@amd.com> > > > Do you need somebody to push the patches for you? Yes please! > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] gbm: Add new flags to enable creation of rotated scanout buffers (v5)
For certain platforms that support rotated scanout buffers, currently, there is no way to create them with the GBM DRI interface. These flags will instruct the DRI driver to create the buffer by setting additional requirements such as tiling mode. v2: Reserve a bit per angle. (Ville and Michel) v3: Combine all GBM_BO_USE_SCANOUT_ROTATION_* flags into GBM_BO_USE_SCANOUT_ANY macro (Michel) v4: Added a brief comment to explain the rotation orientation. v5: Corrected a typo in the comment added in v4. Cc: Michel Danzer <mic...@daenzer.net> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- src/gbm/backends/dri/gbm_dri.c | 10 -- src/gbm/main/gbm.h | 15 +++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 88e5c5e..6616d37 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -129,6 +129,12 @@ gbm_to_dri_flag(uint32_t usage, { if (usage & GBM_BO_USE_SCANOUT) *dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ROTATION_90) + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_90; + if (usage & GBM_BO_USE_SCANOUT_ROTATION_180) + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_180; + if (usage & GBM_BO_USE_SCANOUT_ROTATION_270) + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_270; if (usage & GBM_BO_USE_CURSOR) *dri_use |= __DRI_IMAGE_USE_CURSOR; if (usage & GBM_BO_USE_LINEAR) @@ -551,7 +557,7 @@ gbm_dri_is_format_supported(struct gbm_device *gbm, break; case GBM_BO_FORMAT_ARGB: case GBM_FORMAT_ARGB: - if (usage & GBM_BO_USE_SCANOUT) + if (usage & GBM_BO_USE_SCANOUT_ANY) return 0; break; default: @@ -796,7 +802,7 @@ create_dumb(struct gbm_device *gbm, is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && format == GBM_FORMAT_ARGB; - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && + is_scanout = (usage & GBM_BO_USE_SCANOUT_ANY) != 0 && format == GBM_FORMAT_XRGB; if (!is_cursor && !is_scanout) { errno = EINVAL; diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 8db2153..e99d96d 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -214,8 +214,23 @@ enum gbm_bo_flags { * Buffer is linear, i.e. not tiled. */ GBM_BO_USE_LINEAR = (1 << 4), + /** +* Buffer would be rotated and some platforms have additional tiling +* requirements for rotated scanout buffers. +* And, setting a rotation angle of 90 or 270 would result in the +* scanout buffer being rotated in a counter clockwise manner. This +* is the expected behavior for ensuring XRandR compliance. +*/ + GBM_BO_USE_SCANOUT_ROTATION_90 = (1 << 5), + GBM_BO_USE_SCANOUT_ROTATION_180 = (1 << 6), + GBM_BO_USE_SCANOUT_ROTATION_270 = (1 << 7), }; +#define GBM_BO_USE_SCANOUT_ANY (GBM_BO_USE_SCANOUT | \ +GBM_BO_USE_SCANOUT_ROTATION_90 | \ +GBM_BO_USE_SCANOUT_ROTATION_180 | \ +GBM_BO_USE_SCANOUT_ROTATION_270) + int gbm_device_get_fd(struct gbm_device *gbm); -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] dri_interface: Introduce __DRI_IMAGE_USE_SCANOUT_ROTATION_* flags (v3)
These flags can be used by the DRI driver to set additional requirements such as tiling while creating buffers. v2: Added a brief comment to explain the rotation orientation. v3: Corrected a typo in the comment added in v2 and removed an empty line. Cc: Michel Danzer <mic...@daenzer.net> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- include/GL/internal/dri_interface.h | 8 1 file changed, 8 insertions(+) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 6bbd3fa..2fba46f 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1100,6 +1100,14 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_SCANOUT0x0002 #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 +/** + * Setting a rotation angle of 90 or 270 would result in the scanout + * buffer being rotated in a counter clockwise manner. This is the + * expected behavior for ensuring XRandR compliance. + */ +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_90 0x0010 +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_1800x0020 +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_2700x0040 /** -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] gbm: Introduce a helper function gbm_to_dri_flag()
Pull the code that updates the variable dri_use based on the GBM flags into this helper function. Cc: Michel Danzer <mic...@daenzer.net> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- src/gbm/backends/dri/gbm_dri.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..88e5c5e 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -124,6 +124,18 @@ image_get_buffers(__DRIdrawable *driDrawable, } static void +gbm_to_dri_flag(uint32_t usage, +unsigned *dri_use) +{ + if (usage & GBM_BO_USE_SCANOUT) + *dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_CURSOR) + *dri_use |= __DRI_IMAGE_USE_CURSOR; + if (usage & GBM_BO_USE_LINEAR) + *dri_use |= __DRI_IMAGE_USE_LINEAR; +} + +static void swrast_get_drawable_info(__DRIdrawable *driDrawable, int *x, int *y, @@ -746,10 +758,8 @@ gbm_dri_bo_import(struct gbm_device *gbm, bo->image = image; - if (usage & GBM_BO_USE_SCANOUT) - dri_use |= __DRI_IMAGE_USE_SCANOUT; - if (usage & GBM_BO_USE_CURSOR) - dri_use |= __DRI_IMAGE_USE_CURSOR; + gbm_to_dri_flag(usage, _use); + if (dri->image->base.version >= 2 && !dri->image->validateUsage(bo->image, dri_use)) { errno = EINVAL; @@ -878,12 +888,7 @@ gbm_dri_bo_create(struct gbm_device *gbm, goto failed; } - if (usage & GBM_BO_USE_SCANOUT) - dri_use |= __DRI_IMAGE_USE_SCANOUT; - if (usage & GBM_BO_USE_CURSOR) - dri_use |= __DRI_IMAGE_USE_CURSOR; - if (usage & GBM_BO_USE_LINEAR) - dri_use |= __DRI_IMAGE_USE_LINEAR; + gbm_to_dri_flag(usage, _use); /* Gallium drivers requires shared in order to get the handle/stride */ dri_use |= __DRI_IMAGE_USE_SHARE; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] dri_interface: Introduce __DRI_IMAGE_USE_SCANOUT_ROTATION_* flags (v3)
These flags can be used by the DRI driver to set additional requirements such as tiling while creating buffers. v2: Added a brief comment to explain the rotation orientation. v3: Corrected a typo in the comment added in v2 and removed an empty line. Cc: Michel Danzer <mic...@daenzer.net> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- include/GL/internal/dri_interface.h | 8 1 file changed, 8 insertions(+) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 6bbd3fa..2fba46f 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1100,6 +1100,14 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_SCANOUT0x0002 #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 +/** + * Setting a rotation angle of 90 or 270 would result in the scanout + * buffer being rotated in a counter clockwise manner. This is the + * expected behavior for ensuring XRandR compliance. + */ +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_90 0x0010 +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_1800x0020 +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_2700x0040 /** -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] gbm: Add flags to enable creation of rotated scanout buffers (v3)
Hi Michel, Do you have any further comments/suggestions on this patch? Thanks and Regards, Vivek On Fri, 6 Nov 2015 18:56:13 +0900 Michel Dänzer <mic...@daenzer.net> wrote: > On 06.11.2015 12:08, Vivek Kasireddy wrote: > > For certain platforms that support rotated scanout buffers, > > currently, there is no way to create them with the GBM DRI > > interface. These flags will instruct the DRI driver to create the > > buffer by setting additional requirements such as tiling mode. > > > > v2: Reserve a bit per angle. (Ville and Michel) > > > > v3: > > - Combine all GBM_BO_USE_SCANOUT_ROTATION_* flags into > > GBM_BO_USE_SCANOUT_ANY macro (Michel) > > - Pull the code that updates dri_use based on the rotation flag > > into a separate function. > > [...] > > > diff --git a/src/gbm/backends/dri/gbm_dri.c > > b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..741e509 100644 > > --- a/src/gbm/backends/dri/gbm_dri.c > > +++ b/src/gbm/backends/dri/gbm_dri.c > > @@ -124,6 +124,20 @@ image_get_buffers(__DRIdrawable *driDrawable, > > } > > > > static void > > +gbm_to_dri_flag(uint32_t usage, > > +unsigned *dri_use) > > +{ > > + if (usage & GBM_BO_USE_SCANOUT) > > + *dri_use |= __DRI_IMAGE_USE_SCANOUT; > > + if (usage & GBM_BO_USE_SCANOUT_ROTATION_90) > > + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_90; > > + if (usage & GBM_BO_USE_SCANOUT_ROTATION_180) > > + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_180; > > + if (usage & GBM_BO_USE_SCANOUT_ROTATION_270) > > + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_270; > > +} > > I like the idea of this helper function, but it could handle > GBM_BO_USE_CURSOR and GBM_BO_USE_LINEAR as well. Ideally, there would > be a separate preparatory change which creates the helper function and > makes gbm_dri_bo_import and gbm_dri_bo_create use it; then this change > can just add the new flags in the helper function. If that's too much > trouble, the handling of the other flags can be moved into the helper > function in a followup change. > > > > diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h > > index 8db2153..4bda089 100644 > > --- a/src/gbm/main/gbm.h > > +++ b/src/gbm/main/gbm.h > > @@ -214,6 +214,13 @@ enum gbm_bo_flags { > > * Buffer is linear, i.e. not tiled. > > */ > > GBM_BO_USE_LINEAR = (1 << 4), > > + /** > > +* Buffer would be rotated and some platforms have additional > > tiling > > +* requirements for rotated scanout buffers. > > +*/ > > + GBM_BO_USE_SCANOUT_ROTATION_90 = (1 << 5), > > + GBM_BO_USE_SCANOUT_ROTATION_180 = (1 << 6), > > + GBM_BO_USE_SCANOUT_ROTATION_270 = (1 << 7), > > }; > > Hmm, we should probably explicitly specify the orientation of the 90 > and 270 degree rotations. Clockwise? (Same in patch 1) > > > > @@ -240,6 +247,10 @@ gbm_bo_create(struct gbm_device *gbm, > > #define GBM_BO_IMPORT_WL_BUFFER 0x5501 > > #define GBM_BO_IMPORT_EGL_IMAGE 0x5502 > > #define GBM_BO_IMPORT_FD0x5503 > > +#define GBM_BO_USE_SCANOUT_ANY (GBM_BO_USE_SCANOUT > > | \ > > + GBM_BO_USE_SCANOUT_ROTATION_90 | \ > > + GBM_BO_USE_SCANOUT_ROTATION_180 | \ > > + GBM_BO_USE_SCANOUT_ROTATION_170) > > > > struct gbm_import_fd_data { > > int fd; > > > > Please add the define after the definition of enum gbm_bo_flags > instead of here. > > > Other than that, these are starting to look pretty good to me. > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] dri_interface: Introduce __DRI_IMAGE_USE_SCANOUT_ROTATION_* flags (v2)
These flags can be used by the DRI driver to set additional requirements such as tiling while creating buffers. v2: Added a brief comment to explain the rotation orientation. Cc: Michel Danzer <mic...@daenzer.net> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- include/GL/internal/dri_interface.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 6bbd3fa..c72c365 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1101,6 +1101,15 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 +/** + * Setting a rotation angle of 90 or 270 would result in the scanout + * buffer being rotated in a clounter clockwise manner. This is the + * expected behavior for ensuring XRandR compliance. + */ +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_900x0010 +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_180 0x0020 +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_270 0x0040 + /** * Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h, -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] gbm: Add flags to enable creation of rotated scanout buffers (v4)
For certain platforms that support rotated scanout buffers, currently, there is no way to create them with the GBM DRI interface. These flags will instruct the DRI driver to create the buffer by setting additional requirements such as tiling mode. v2: Reserve a bit per angle. (Ville and Michel) v3: - Combine all GBM_BO_USE_SCANOUT_ROTATION_* flags into GBM_BO_USE_SCANOUT_ANY macro (Michel) - Pull the code that updates dri_use based on the rotation flag into a separate function. v4: - Added a brief comment to explain the rotation orientation. - Augmented the helper function gbm_to_dri_flag() introduced in v3 to handle GBM_BO_USE_CURSOR and GBM_BO_USE_LINEAR as well. (Michel) Cc: Michel Danzer <mic...@daenzer.net> Cc: Ville Syrjala <ville.syrj...@linux.intel.com> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- src/gbm/backends/dri/gbm_dri.c | 35 +++ src/gbm/main/gbm.h | 15 +++ 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..6616d37 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -124,6 +124,24 @@ image_get_buffers(__DRIdrawable *driDrawable, } static void +gbm_to_dri_flag(uint32_t usage, +unsigned *dri_use) +{ + if (usage & GBM_BO_USE_SCANOUT) + *dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ROTATION_90) + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_90; + if (usage & GBM_BO_USE_SCANOUT_ROTATION_180) + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_180; + if (usage & GBM_BO_USE_SCANOUT_ROTATION_270) + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_270; + if (usage & GBM_BO_USE_CURSOR) + *dri_use |= __DRI_IMAGE_USE_CURSOR; + if (usage & GBM_BO_USE_LINEAR) + *dri_use |= __DRI_IMAGE_USE_LINEAR; +} + +static void swrast_get_drawable_info(__DRIdrawable *driDrawable, int *x, int *y, @@ -539,7 +557,7 @@ gbm_dri_is_format_supported(struct gbm_device *gbm, break; case GBM_BO_FORMAT_ARGB: case GBM_FORMAT_ARGB: - if (usage & GBM_BO_USE_SCANOUT) + if (usage & GBM_BO_USE_SCANOUT_ANY) return 0; break; default: @@ -746,10 +764,8 @@ gbm_dri_bo_import(struct gbm_device *gbm, bo->image = image; - if (usage & GBM_BO_USE_SCANOUT) - dri_use |= __DRI_IMAGE_USE_SCANOUT; - if (usage & GBM_BO_USE_CURSOR) - dri_use |= __DRI_IMAGE_USE_CURSOR; + gbm_to_dri_flag(usage, _use); + if (dri->image->base.version >= 2 && !dri->image->validateUsage(bo->image, dri_use)) { errno = EINVAL; @@ -786,7 +802,7 @@ create_dumb(struct gbm_device *gbm, is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && format == GBM_FORMAT_ARGB; - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && + is_scanout = (usage & GBM_BO_USE_SCANOUT_ANY) != 0 && format == GBM_FORMAT_XRGB; if (!is_cursor && !is_scanout) { errno = EINVAL; @@ -878,12 +894,7 @@ gbm_dri_bo_create(struct gbm_device *gbm, goto failed; } - if (usage & GBM_BO_USE_SCANOUT) - dri_use |= __DRI_IMAGE_USE_SCANOUT; - if (usage & GBM_BO_USE_CURSOR) - dri_use |= __DRI_IMAGE_USE_CURSOR; - if (usage & GBM_BO_USE_LINEAR) - dri_use |= __DRI_IMAGE_USE_LINEAR; + gbm_to_dri_flag(usage, _use); /* Gallium drivers requires shared in order to get the handle/stride */ dri_use |= __DRI_IMAGE_USE_SHARE; diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 8db2153..667fcf7 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -214,8 +214,23 @@ enum gbm_bo_flags { * Buffer is linear, i.e. not tiled. */ GBM_BO_USE_LINEAR = (1 << 4), + /** +* Buffer would be rotated and some platforms have additional tiling +* requirements for rotated scanout buffers. +* And, setting a rotation angle of 90 or 270 would result in the +* scanout buffer being rotated in a clounter clockwise manner. This +* is the expected behavior for ensuring XRandR compliance. +*/ + GBM_BO_USE_SCANOUT_ROTATION_90 = (1 << 5), + GBM_BO_USE_SCANOUT_ROTATION_180 = (1 << 6), + GBM_BO_USE_SCANOUT_ROTATION_270 = (1 << 7), }; +#define GBM_BO_USE_SCANOUT_ANY (GBM_BO_USE_SCANOUT | \ +GBM_BO_USE_SCANOUT_ROTATION_90 | \ +GBM_BO_USE_SCANOUT_ROTATION_180 | \ +GBM_BO_USE_SCANOUT_ROTATION_270) + int gbm_device_get_fd(struct gbm_device *gbm); -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gbm: Add a flag to enable creation of rotated scanout buffers (v2)
On Thu, 5 Nov 2015 15:34:27 +0900 Michel Dänzer <mic...@daenzer.net> wrote: > On 05.11.2015 11:32, Vivek Kasireddy wrote: > > For certain platforms that support rotated scanout buffers, > > currently, there is no way to create them with the GBM DRI > > interface. This flag will instruct the DRI driver to create the > > buffer by setting additional requirements such as tiling mode. > > > > v2: Reserve a bit per angle. (Ville and Michel) > > > > Cc: Michel Danzer <mic...@daenzer.net> > > Cc: Ville Syrjala <ville.syrj...@linux.intel.com> > > Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> > > --- > > include/GL/internal/dri_interface.h | 3 +++ > > src/gbm/backends/dri/gbm_dri.c | 19 +-- > > src/gbm/main/gbm.h | 7 +++ > > 3 files changed, 27 insertions(+), 2 deletions(-) > > > > diff --git a/include/GL/internal/dri_interface.h > > b/include/GL/internal/dri_interface.h index 6bbd3fa..cd1bf62 100644 > > --- a/include/GL/internal/dri_interface.h > > +++ b/include/GL/internal/dri_interface.h > > @@ -1100,6 +1100,9 @@ struct __DRIdri2ExtensionRec { > > #define __DRI_IMAGE_USE_SCANOUT0x0002 > > #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated > > */ #define __DRI_IMAGE_USE_LINEAR 0x0008 > > +#define __DRI_IMAGE_USE_ROTATION_900x0010 > > +#define __DRI_IMAGE_USE_ROTATION_180 0x0020 > > +#define __DRI_IMAGE_USE_ROTATION_270 0x0040 > > > > > > /** > > I still think the dri_interface.h change should be a separate patch. > > > > diff --git a/src/gbm/backends/dri/gbm_dri.c > > b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..a997946 100644 > > --- a/src/gbm/backends/dri/gbm_dri.c > > +++ b/src/gbm/backends/dri/gbm_dri.c > > @@ -539,7 +539,8 @@ gbm_dri_is_format_supported(struct gbm_device > > *gbm, break; > > case GBM_BO_FORMAT_ARGB: > > case GBM_FORMAT_ARGB: > > - if (usage & GBM_BO_USE_SCANOUT) > > + if (usage & (GBM_BO_USE_SCANOUT | GBM_BO_USE_ROTATION_90 | > > + GBM_BO_USE_ROTATION_180 | GBM_BO_USE_ROTATION_270)) > > return 0; > >break; > > default: > > If you stick to this approach (see below), I suggest adding a > GBM_BO_USE_SCANOUT_ANY define which combines all > GBM_BO_USE_SCANOUT(_ROTATION_*) values, to make these checks less > cumbersome. > > > > diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h > > index 8db2153..b200ca6 100644 > > --- a/src/gbm/main/gbm.h > > +++ b/src/gbm/main/gbm.h > > @@ -214,6 +214,13 @@ enum gbm_bo_flags { > > * Buffer is linear, i.e. not tiled. > > */ > > GBM_BO_USE_LINEAR = (1 << 4), > > + /** > > +* Buffer would be rotated and some platforms have additional > > tiling > > +* requirements for rotated scanout buffers. > > +*/ > > + GBM_BO_USE_ROTATION_90 = (1 << 5), > > + GBM_BO_USE_ROTATION_180 = (1 << 6), > > + GBM_BO_USE_ROTATION_270 = (1 << 7), > > }; > > > > int > > > > With this approach, these should be named > GBM_BO_USE_SCANOUT_ROTATION_* to make it clearer that they are > alternatives to GBM_BO_USE_SCANOUT. > > One issue with this approach is: What happens if several > GBM_BO_USE_SCANOUT_ROTATION_* flags are set, and the hardware has > conflicting requirements for different rotation angles? Hi Michel, If multiple GBM_BO_USE_SCANOUT_ROTATION_* flags are set and if the hardware has conflicting requirements for different rotation angles, I think it should be flagged as an error not in GBM but perhaps in the DRI driver as it is expected to figure out the requirements for rotation. Thanks and Regards, Vivek > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] gbm: Add flags to enable creation of rotated scanout buffers (v3)
For certain platforms that support rotated scanout buffers, currently, there is no way to create them with the GBM DRI interface. These flags will instruct the DRI driver to create the buffer by setting additional requirements such as tiling mode. v2: Reserve a bit per angle. (Ville and Michel) v3: - Combine all GBM_BO_USE_SCANOUT_ROTATION_* flags into GBM_BO_USE_SCANOUT_ANY macro (Michel) - Pull the code that updates dri_use based on the rotation flag into a separate function. Cc: Michel Danzer <mic...@daenzer.net> Cc: Ville Syrjala <ville.syrj...@linux.intel.com> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- src/gbm/backends/dri/gbm_dri.c | 26 -- src/gbm/main/gbm.h | 11 +++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..741e509 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -124,6 +124,20 @@ image_get_buffers(__DRIdrawable *driDrawable, } static void +gbm_to_dri_flag(uint32_t usage, +unsigned *dri_use) +{ + if (usage & GBM_BO_USE_SCANOUT) + *dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ROTATION_90) + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_90; + if (usage & GBM_BO_USE_SCANOUT_ROTATION_180) + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_180; + if (usage & GBM_BO_USE_SCANOUT_ROTATION_270) + *dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATION_270; +} + +static void swrast_get_drawable_info(__DRIdrawable *driDrawable, int *x, int *y, @@ -539,7 +553,7 @@ gbm_dri_is_format_supported(struct gbm_device *gbm, break; case GBM_BO_FORMAT_ARGB: case GBM_FORMAT_ARGB: - if (usage & GBM_BO_USE_SCANOUT) + if (usage & GBM_BO_USE_SCANOUT_ANY) return 0; break; default: @@ -746,8 +760,8 @@ gbm_dri_bo_import(struct gbm_device *gbm, bo->image = image; - if (usage & GBM_BO_USE_SCANOUT) - dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ANY) + gbm_to_dri_flag(usage, _use); if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (dri->image->base.version >= 2 && @@ -786,7 +800,7 @@ create_dumb(struct gbm_device *gbm, is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && format == GBM_FORMAT_ARGB; - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && + is_scanout = (usage & GBM_BO_USE_SCANOUT_ANY) != 0 && format == GBM_FORMAT_XRGB; if (!is_cursor && !is_scanout) { errno = EINVAL; @@ -878,8 +892,8 @@ gbm_dri_bo_create(struct gbm_device *gbm, goto failed; } - if (usage & GBM_BO_USE_SCANOUT) - dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ANY) + gbm_to_dri_flag(usage, _use); if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (usage & GBM_BO_USE_LINEAR) diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 8db2153..4bda089 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -214,6 +214,13 @@ enum gbm_bo_flags { * Buffer is linear, i.e. not tiled. */ GBM_BO_USE_LINEAR = (1 << 4), + /** +* Buffer would be rotated and some platforms have additional tiling +* requirements for rotated scanout buffers. +*/ + GBM_BO_USE_SCANOUT_ROTATION_90 = (1 << 5), + GBM_BO_USE_SCANOUT_ROTATION_180 = (1 << 6), + GBM_BO_USE_SCANOUT_ROTATION_270 = (1 << 7), }; int @@ -240,6 +247,10 @@ gbm_bo_create(struct gbm_device *gbm, #define GBM_BO_IMPORT_WL_BUFFER 0x5501 #define GBM_BO_IMPORT_EGL_IMAGE 0x5502 #define GBM_BO_IMPORT_FD0x5503 +#define GBM_BO_USE_SCANOUT_ANY (GBM_BO_USE_SCANOUT | \ + GBM_BO_USE_SCANOUT_ROTATION_90 | \ + GBM_BO_USE_SCANOUT_ROTATION_180 | \ + GBM_BO_USE_SCANOUT_ROTATION_170) struct gbm_import_fd_data { int fd; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] dri_interface: Introduce __DRI_IMAGE_USE_SCANOUT_ROTATION_* flags
These flags can be used by the DRI driver to set additional requirements such as tiling while creating buffers. Cc: Michel Danzer <mic...@daenzer.net> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- include/GL/internal/dri_interface.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 6bbd3fa..871143ae 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1100,6 +1100,9 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_SCANOUT0x0002 #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_900x0010 +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_180 0x0020 +#define __DRI_IMAGE_USE_SCANOUT_ROTATION_270 0x0040 /** -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gbm: Add a flag to enable creation of rotated scanout buffers (v2)
For certain platforms that support rotated scanout buffers, currently, there is no way to create them with the GBM DRI interface. This flag will instruct the DRI driver to create the buffer by setting additional requirements such as tiling mode. v2: Reserve a bit per angle. (Ville and Michel) Cc: Michel Danzer <mic...@daenzer.net> Cc: Ville Syrjala <ville.syrj...@linux.intel.com> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- include/GL/internal/dri_interface.h | 3 +++ src/gbm/backends/dri/gbm_dri.c | 19 +-- src/gbm/main/gbm.h | 7 +++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 6bbd3fa..cd1bf62 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1100,6 +1100,9 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_SCANOUT0x0002 #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 +#define __DRI_IMAGE_USE_ROTATION_900x0010 +#define __DRI_IMAGE_USE_ROTATION_180 0x0020 +#define __DRI_IMAGE_USE_ROTATION_270 0x0040 /** diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..a997946 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -539,7 +539,8 @@ gbm_dri_is_format_supported(struct gbm_device *gbm, break; case GBM_BO_FORMAT_ARGB: case GBM_FORMAT_ARGB: - if (usage & GBM_BO_USE_SCANOUT) + if (usage & (GBM_BO_USE_SCANOUT | GBM_BO_USE_ROTATION_90 | + GBM_BO_USE_ROTATION_180 | GBM_BO_USE_ROTATION_270)) return 0; break; default: @@ -748,6 +749,12 @@ gbm_dri_bo_import(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_ROTATION_90) + dri_use |= __DRI_IMAGE_USE_ROTATION_90; + if (usage & GBM_BO_USE_ROTATION_180) + dri_use |= __DRI_IMAGE_USE_ROTATION_180; + if (usage & GBM_BO_USE_ROTATION_270) + dri_use |= __DRI_IMAGE_USE_ROTATION_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (dri->image->base.version >= 2 && @@ -786,7 +793,9 @@ create_dumb(struct gbm_device *gbm, is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && format == GBM_FORMAT_ARGB; - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && + is_scanout = (usage & (GBM_BO_USE_SCANOUT | + GBM_BO_USE_ROTATION_90 | GBM_BO_USE_ROTATION_180 | + GBM_BO_USE_ROTATION_270)) != 0 && format == GBM_FORMAT_XRGB; if (!is_cursor && !is_scanout) { errno = EINVAL; @@ -880,6 +889,12 @@ gbm_dri_bo_create(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_ROTATION_90) + dri_use |= __DRI_IMAGE_USE_ROTATION_90; + if (usage & GBM_BO_USE_ROTATION_180) + dri_use |= __DRI_IMAGE_USE_ROTATION_180; + if (usage & GBM_BO_USE_ROTATION_270) + dri_use |= __DRI_IMAGE_USE_ROTATION_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (usage & GBM_BO_USE_LINEAR) diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 8db2153..b200ca6 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -214,6 +214,13 @@ enum gbm_bo_flags { * Buffer is linear, i.e. not tiled. */ GBM_BO_USE_LINEAR = (1 << 4), + /** +* Buffer would be rotated and some platforms have additional tiling +* requirements for rotated scanout buffers. +*/ + GBM_BO_USE_ROTATION_90 = (1 << 5), + GBM_BO_USE_ROTATION_180 = (1 << 6), + GBM_BO_USE_ROTATION_270 = (1 << 7), }; int -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] gbm: Add a flag to enable creation of rotated scanout buffers
On Fri, 23 Oct 2015 12:18:39 +0900 Michel Dänzer <mic...@daenzer.net> wrote: > On 23.10.2015 10:44, Vivek Kasireddy wrote: > > For certain platforms that support rotated scanout buffers, > > currently, there is no way to create them with the GBM DRI > > interface. This flag will instruct the DRI driver to create the > > buffer by setting additional requirements. > > > > Cc: Kristian Hogsberg <k...@bitplanet.net> > > Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> > > --- > > include/GL/internal/dri_interface.h | 1 + > > src/gbm/backends/dri/gbm_dri.c | 9 +++-- > > src/gbm/main/gbm.h | 5 + > > 3 files changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/include/GL/internal/dri_interface.h > > b/include/GL/internal/dri_interface.h index a0f155a..2271217 100644 > > --- a/include/GL/internal/dri_interface.h > > +++ b/include/GL/internal/dri_interface.h > > @@ -1091,6 +1091,7 @@ struct __DRIdri2ExtensionRec { > > #define __DRI_IMAGE_USE_SCANOUT0x0002 > > #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated > > */ #define __DRI_IMAGE_USE_LINEAR 0x0008 > > +#define __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270 > > 0x0010 > > > > /** > > Thank you for splitting out the driver change. Sorry I didn't think of > this before, but it might be worth splitting out the dri_interface.h > change as well. I'm fine either way, though. > > > > diff --git a/src/gbm/backends/dri/gbm_dri.c > > b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..cde63de 100644 > > --- a/src/gbm/backends/dri/gbm_dri.c > > +++ b/src/gbm/backends/dri/gbm_dri.c > > @@ -539,7 +539,7 @@ gbm_dri_is_format_supported(struct gbm_device > > *gbm, break; > > case GBM_BO_FORMAT_ARGB: > > case GBM_FORMAT_ARGB: > > - if (usage & GBM_BO_USE_SCANOUT) > > + if (usage & (GBM_BO_USE_SCANOUT | > > GBM_BO_USE_SCANOUT_ROTATED_90_270)) return 0; > >break; > > default: > > @@ -748,6 +748,8 @@ gbm_dri_bo_import(struct gbm_device *gbm, > > > > if (usage & GBM_BO_USE_SCANOUT) > >dri_use |= __DRI_IMAGE_USE_SCANOUT; > > + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) > > + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; > > if (usage & GBM_BO_USE_CURSOR) > >dri_use |= __DRI_IMAGE_USE_CURSOR; > > if (dri->image->base.version >= 2 && > > @@ -786,7 +788,8 @@ create_dumb(struct gbm_device *gbm, > > > > is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && > >format == GBM_FORMAT_ARGB; > > - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && > > + is_scanout = (usage & (GBM_BO_USE_SCANOUT | > > + GBM_BO_USE_SCANOUT_ROTATED_90_270)) != 0 && > >format == GBM_FORMAT_XRGB; > > if (!is_cursor && !is_scanout) { > >errno = EINVAL; > > @@ -880,6 +883,8 @@ gbm_dri_bo_create(struct gbm_device *gbm, > > > > if (usage & GBM_BO_USE_SCANOUT) > >dri_use |= __DRI_IMAGE_USE_SCANOUT; > > + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) > > + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; > > if (usage & GBM_BO_USE_CURSOR) > >dri_use |= __DRI_IMAGE_USE_CURSOR; > > if (usage & GBM_BO_USE_LINEAR) > > diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h > > index 2708e50..2ef7bd8 100644 > > --- a/src/gbm/main/gbm.h > > +++ b/src/gbm/main/gbm.h > > @@ -213,6 +213,11 @@ enum gbm_bo_flags { > > * Buffer is linear, i.e. not tiled. > > */ > > GBM_BO_USE_LINEAR = (1 << 4), > > + /** > > +* Buffer would be rotated and some platforms have additional > > tiling > > +* requirements for 90/270 rotated buffers. > > +*/ > > + GBM_BO_USE_SCANOUT_ROTATED_90_270 = (1 << 5), > > }; > > > > int > > > > I asked internally, and apparently our display hardware requires a > rotation specific tiling mode for 180 degree rotation as well. In > order to avoid having to add *_SCANOUT_ROTATED_180 later, would > *_SCANOUT_ROTATED work for you as well? Or would using Y-tiling for > 180 degree rotation be an issue? Hi Michel, Using Y-tiling for 180 degree rotation may not be an issue but our hardware does not require setting Y-tiling on the object to do 180 degree rotation. This is the reason why the flag is named *_ROTATED_90_270 to make it clear. Thanks and Regards, Vivek > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] i965: Set Y-tiling for qualified rotated scanout buffers
On Thu, 22 Oct 2015 21:12:02 -0700 Ben Widawsky <b...@bwidawsk.net> wrote: > On Thu, Oct 22, 2015 at 06:44:53PM -0700, Vivek Kasireddy wrote: > > On newer hardware platforms that support rotation, if the gbm > > interface requests to create a rotated scanout buffer via the > > flag __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270, set Y-tiling > > while creating the buffer. > > > > Cc: Kristian Hogsberg <k...@bitplanet.net> > > Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> > > FYI, I'd been hoping to land a superset of this for quite a while. My > understanding was the DDX doesn't support it. > > http://patchwork.freedesktop.org/patch/46984/ Hi Ben, I am sorry I wasn't aware of your patch. I am testing this feature with a Wayland/Weston based compositor. Thanks and Regards, Vivek > > > --- > > src/mesa/drivers/dri/i965/intel_screen.c | 6 ++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/src/mesa/drivers/dri/i965/intel_screen.c > > b/src/mesa/drivers/dri/i965/intel_screen.c index 590c45d..1079676 > > 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c > > +++ b/src/mesa/drivers/dri/i965/intel_screen.c > > @@ -525,6 +525,12 @@ intel_create_image(__DRIscreen *screen, > > > > if (use & __DRI_IMAGE_USE_LINEAR) > >tiling = I915_TILING_NONE; > > + else if (use & __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270) { > > + if (intelScreen->devinfo->gen >= 9) > > + tiling = I915_TILING_Y; > > + else > > + return NULL; > > + } > > > > image = intel_allocate_image(format, loaderPrivate); > > if (image == NULL) > > -- > > 2.4.3 > > > > ___ > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] gbm: Add a flag to enable creation of rotated scanout buffers
On Fri, 23 Oct 2015 15:29:08 +0300 Ville Syrjälä <ville.syrj...@linux.intel.com> wrote: > On Fri, Oct 23, 2015 at 12:18:39PM +0900, Michel Dänzer wrote: > > On 23.10.2015 10:44, Vivek Kasireddy wrote: > > > For certain platforms that support rotated scanout buffers, > > > currently, there is no way to create them with the GBM DRI > > > interface. This flag will instruct the DRI driver to create the > > > buffer by setting additional requirements. > > > > > > Cc: Kristian Hogsberg <k...@bitplanet.net> > > > Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> > > > --- > > > include/GL/internal/dri_interface.h | 1 + > > > src/gbm/backends/dri/gbm_dri.c | 9 +++-- > > > src/gbm/main/gbm.h | 5 + > > > 3 files changed, 13 insertions(+), 2 deletions(-) > > > > > > diff --git a/include/GL/internal/dri_interface.h > > > b/include/GL/internal/dri_interface.h index a0f155a..2271217 > > > 100644 --- a/include/GL/internal/dri_interface.h > > > +++ b/include/GL/internal/dri_interface.h > > > @@ -1091,6 +1091,7 @@ struct __DRIdri2ExtensionRec { > > > #define __DRI_IMAGE_USE_SCANOUT 0x0002 > > > #define __DRI_IMAGE_USE_CURSOR 0x0004 /* > > > Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 > > > +#define __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270 > > > 0x0010 > > > > > > /** > > > > Thank you for splitting out the driver change. Sorry I didn't think > > of this before, but it might be worth splitting out the > > dri_interface.h change as well. I'm fine either way, though. > > > > > > > diff --git a/src/gbm/backends/dri/gbm_dri.c > > > b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..cde63de 100644 > > > --- a/src/gbm/backends/dri/gbm_dri.c > > > +++ b/src/gbm/backends/dri/gbm_dri.c > > > @@ -539,7 +539,7 @@ gbm_dri_is_format_supported(struct gbm_device > > > *gbm, break; > > > case GBM_BO_FORMAT_ARGB: > > > case GBM_FORMAT_ARGB: > > > - if (usage & GBM_BO_USE_SCANOUT) > > > + if (usage & (GBM_BO_USE_SCANOUT | > > > GBM_BO_USE_SCANOUT_ROTATED_90_270)) return 0; > > >break; > > > default: > > > @@ -748,6 +748,8 @@ gbm_dri_bo_import(struct gbm_device *gbm, > > > > > > if (usage & GBM_BO_USE_SCANOUT) > > >dri_use |= __DRI_IMAGE_USE_SCANOUT; > > > + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) > > > + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; > > > if (usage & GBM_BO_USE_CURSOR) > > >dri_use |= __DRI_IMAGE_USE_CURSOR; > > > if (dri->image->base.version >= 2 && > > > @@ -786,7 +788,8 @@ create_dumb(struct gbm_device *gbm, > > > > > > is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && > > >format == GBM_FORMAT_ARGB; > > > - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && > > > + is_scanout = (usage & (GBM_BO_USE_SCANOUT | > > > + GBM_BO_USE_SCANOUT_ROTATED_90_270)) != 0 && > > >format == GBM_FORMAT_XRGB; > > > if (!is_cursor && !is_scanout) { > > >errno = EINVAL; > > > @@ -880,6 +883,8 @@ gbm_dri_bo_create(struct gbm_device *gbm, > > > > > > if (usage & GBM_BO_USE_SCANOUT) > > >dri_use |= __DRI_IMAGE_USE_SCANOUT; > > > + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) > > > + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; > > > if (usage & GBM_BO_USE_CURSOR) > > >dri_use |= __DRI_IMAGE_USE_CURSOR; > > > if (usage & GBM_BO_USE_LINEAR) > > > diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h > > > index 2708e50..2ef7bd8 100644 > > > --- a/src/gbm/main/gbm.h > > > +++ b/src/gbm/main/gbm.h > > > @@ -213,6 +213,11 @@ enum gbm_bo_flags { > > > * Buffer is linear, i.e. not tiled. > > > */ > > > GBM_BO_USE_LINEAR = (1 << 4), > > > + /** > > > +* Buffer would be rotated and some platforms have additional > > > tiling > > > +* requirements for 90/270 rotated buffers. > > > +*/ > > > + GBM_BO_USE_SCANOUT_ROTATED_90_270 = (1 << 5), > > > }; > > > > > > int > > > > > > > I asked internally, and apparently our display hardware requires a > > rotation specific tiling mode for 180 degree rotation as well. In > > order to avoid having to add *_SCANOUT_ROTATED_180 later, would > > *_SCANOUT_ROTATED work for you as well? Or would using Y-tiling for > > 180 degree rotation be an issue? > > What about a bit per angle? To avoid hardware specifics. Hi Ville, I am not sure what's the best way to move forward as you know our (Intel) new hardware needs Y-tiling only for 90/270. Thanks and Regards, Vivek > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] i965: Set Y-tiling for qualified rotated scanout buffers
On newer hardware platforms that support rotation, if the gbm interface requests to create a rotated scanout buffer via the flag __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270, set Y-tiling while creating the buffer. Cc: Kristian Hogsberg <k...@bitplanet.net> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- src/mesa/drivers/dri/i965/intel_screen.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 590c45d..1079676 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -525,6 +525,12 @@ intel_create_image(__DRIscreen *screen, if (use & __DRI_IMAGE_USE_LINEAR) tiling = I915_TILING_NONE; + else if (use & __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270) { + if (intelScreen->devinfo->gen >= 9) + tiling = I915_TILING_Y; + else + return NULL; + } image = intel_allocate_image(format, loaderPrivate); if (image == NULL) -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] gbm: Add a flag to enable creation of rotated scanout buffers
For certain platforms that support rotated scanout buffers, currently, there is no way to create them with the GBM DRI interface. This flag will instruct the DRI driver to create the buffer by setting additional requirements. Cc: Kristian Hogsberg <k...@bitplanet.net> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- include/GL/internal/dri_interface.h | 1 + src/gbm/backends/dri/gbm_dri.c | 9 +++-- src/gbm/main/gbm.h | 5 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index a0f155a..2271217 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1091,6 +1091,7 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_SCANOUT0x0002 #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 +#define __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270 0x0010 /** diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..cde63de 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -539,7 +539,7 @@ gbm_dri_is_format_supported(struct gbm_device *gbm, break; case GBM_BO_FORMAT_ARGB: case GBM_FORMAT_ARGB: - if (usage & GBM_BO_USE_SCANOUT) + if (usage & (GBM_BO_USE_SCANOUT | GBM_BO_USE_SCANOUT_ROTATED_90_270)) return 0; break; default: @@ -748,6 +748,8 @@ gbm_dri_bo_import(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (dri->image->base.version >= 2 && @@ -786,7 +788,8 @@ create_dumb(struct gbm_device *gbm, is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && format == GBM_FORMAT_ARGB; - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && + is_scanout = (usage & (GBM_BO_USE_SCANOUT | + GBM_BO_USE_SCANOUT_ROTATED_90_270)) != 0 && format == GBM_FORMAT_XRGB; if (!is_cursor && !is_scanout) { errno = EINVAL; @@ -880,6 +883,8 @@ gbm_dri_bo_create(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (usage & GBM_BO_USE_LINEAR) diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 2708e50..2ef7bd8 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -213,6 +213,11 @@ enum gbm_bo_flags { * Buffer is linear, i.e. not tiled. */ GBM_BO_USE_LINEAR = (1 << 4), + /** +* Buffer would be rotated and some platforms have additional tiling +* requirements for 90/270 rotated buffers. +*/ + GBM_BO_USE_SCANOUT_ROTATED_90_270 = (1 << 5), }; int -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gbm: Add a flag to enable creation of rotated scanout buffers
For certain platforms that support rotated scanout buffers, currently, there is no way to create them with the GBM DRI interface. This flag will tell the DRI driver to set Y-tiling while creating the rotated scanout buffer. Cc: Kristian Hogsberg <k...@bitplanet.net> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- include/GL/internal/dri_interface.h | 1 + src/gbm/backends/dri/gbm_dri.c | 9 +++-- src/gbm/main/gbm.h | 5 + src/mesa/drivers/dri/i965/intel_screen.c | 6 ++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index c827bb6..1a721d0 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1098,6 +1098,7 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_SCANOUT0x0002 #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 +#define __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270 0x0010 /** diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index ccc3cc6..92b6573 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -539,7 +539,7 @@ gbm_dri_is_format_supported(struct gbm_device *gbm, break; case GBM_BO_FORMAT_ARGB: case GBM_FORMAT_ARGB: - if (usage & GBM_BO_USE_SCANOUT) + if (usage & (GBM_BO_USE_SCANOUT | GBM_BO_USE_SCANOUT_ROTATED_90_270)) return 0; break; default: @@ -732,6 +732,8 @@ gbm_dri_bo_import(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (dri->image->base.version >= 2 && @@ -770,7 +772,8 @@ create_dumb(struct gbm_device *gbm, is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && format == GBM_FORMAT_ARGB; - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && + is_scanout = (usage & (GBM_BO_USE_SCANOUT | + GBM_BO_USE_SCANOUT_ROTATED_90_270)) != 0 && format == GBM_FORMAT_XRGB; if (!is_cursor && !is_scanout) { errno = EINVAL; @@ -864,6 +867,8 @@ gbm_dri_bo_create(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (usage & GBM_BO_USE_LINEAR) diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 2708e50..2ef7bd8 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -213,6 +213,11 @@ enum gbm_bo_flags { * Buffer is linear, i.e. not tiled. */ GBM_BO_USE_LINEAR = (1 << 4), + /** +* Buffer would be rotated and some platforms have additional tiling +* requirements for 90/270 rotated buffers. +*/ + GBM_BO_USE_SCANOUT_ROTATED_90_270 = (1 << 5), }; int diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 896a125..3c1dc9f 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -520,6 +520,12 @@ intel_create_image(__DRIscreen *screen, if (use & __DRI_IMAGE_USE_LINEAR) tiling = I915_TILING_NONE; + else if (use & __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270) { + if (intelScreen->devinfo->gen >= 9) + tiling = I915_TILING_Y; + else + return NULL; + } image = intel_allocate_image(format, loaderPrivate); if (image == NULL) -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gbm: Add a flag to enable creation of rotated scanout buffers
For certain platforms that support rotated scanout buffers, currently, there is no way to create them with the GBM DRI interface. This flag will tell the DRI driver to set Y-tiling while creating the rotated scanout buffer. Cc: Matthew D Roper <matthew.d.ro...@intel.com> Signed-off-by: Vivek Kasireddy <vivek.kasire...@intel.com> --- include/GL/internal/dri_interface.h | 1 + src/gbm/backends/dri/gbm_dri.c | 9 +++-- src/gbm/main/gbm.h | 5 + src/mesa/drivers/dri/i965/intel_screen.c | 6 ++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index c827bb6..1a721d0 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1098,6 +1098,7 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_SCANOUT0x0002 #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 +#define __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270 0x0010 /** diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index ccc3cc6..92b6573 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -539,7 +539,7 @@ gbm_dri_is_format_supported(struct gbm_device *gbm, break; case GBM_BO_FORMAT_ARGB: case GBM_FORMAT_ARGB: - if (usage & GBM_BO_USE_SCANOUT) + if (usage & (GBM_BO_USE_SCANOUT | GBM_BO_USE_SCANOUT_ROTATED_90_270)) return 0; break; default: @@ -732,6 +732,8 @@ gbm_dri_bo_import(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (dri->image->base.version >= 2 && @@ -770,7 +772,8 @@ create_dumb(struct gbm_device *gbm, is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && format == GBM_FORMAT_ARGB; - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && + is_scanout = (usage & (GBM_BO_USE_SCANOUT | + GBM_BO_USE_SCANOUT_ROTATED_90_270)) != 0 && format == GBM_FORMAT_XRGB; if (!is_cursor && !is_scanout) { errno = EINVAL; @@ -864,6 +867,8 @@ gbm_dri_bo_create(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (usage & GBM_BO_USE_LINEAR) diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 2708e50..2ef7bd8 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -213,6 +213,11 @@ enum gbm_bo_flags { * Buffer is linear, i.e. not tiled. */ GBM_BO_USE_LINEAR = (1 << 4), + /** +* Buffer would be rotated and some platforms have additional tiling +* requirements for 90/270 rotated buffers. +*/ + GBM_BO_USE_SCANOUT_ROTATED_90_270 = (1 << 5), }; int diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 896a125..3c1dc9f 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -520,6 +520,12 @@ intel_create_image(__DRIscreen *screen, if (use & __DRI_IMAGE_USE_LINEAR) tiling = I915_TILING_NONE; + else if (use & __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270) { + if (intelScreen->devinfo->gen >= 9) + tiling = I915_TILING_Y; + else + return NULL; + } image = intel_allocate_image(format, loaderPrivate); if (image == NULL) -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Move need_throttle and first_post_swapbuffers_batch into the renderbuffer
If there are multiple EGL surfaces associated with one EGL context, for any given surface, we unnecessarily have to wait for swapbuffers to complete on other EGL surfaces because we throttle to the context. By moving first_post_swapbuffers_batch from the brw context into intel_renderuffer, we would no longer be throttled by other surface's swapbuffers thereby leading to better performance. Signed-off-by: Vivek Kasireddy vivek.kasire...@intel.com --- src/mesa/drivers/dri/i965/brw_context.c | 48 +++-- src/mesa/drivers/dri/i965/brw_context.h |5 --- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 15 ++-- src/mesa/drivers/dri/i965/intel_fbo.h |5 +++ src/mesa/drivers/dri/i965/intel_screen.c | 11 +- 5 files changed, 65 insertions(+), 19 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 786e6f5..1d08c65 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -229,11 +229,19 @@ static void intel_glFlush(struct gl_context *ctx) { struct brw_context *brw = brw_context(ctx); + struct intel_renderbuffer *rb = NULL; + + if (ctx-DrawBuffer) { + if (brw_is_front_buffer_drawing(ctx-DrawBuffer)) + rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_FRONT_LEFT); + else + rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_BACK_LEFT); + } intel_batchbuffer_flush(brw); intel_flush_front(ctx); if (brw_is_front_buffer_drawing(ctx-DrawBuffer)) - brw-need_throttle = true; + rb-need_throttle = true; } static void @@ -882,6 +890,7 @@ intelDestroyContext(__DRIcontext * driContextPriv) struct brw_context *brw = (struct brw_context *) driContextPriv-driverPrivate; struct gl_context *ctx = brw-ctx; + struct intel_renderbuffer *front_rb = NULL, *back_rb = NULL; assert(brw); /* should never be null */ if (!brw) @@ -922,8 +931,20 @@ intelDestroyContext(__DRIcontext * driContextPriv) intel_batchbuffer_free(brw); - drm_intel_bo_unreference(brw-first_post_swapbuffers_batch); - brw-first_post_swapbuffers_batch = NULL; + if (ctx-DrawBuffer) { + front_rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_FRONT_LEFT); + back_rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_BACK_LEFT); + } + + if (front_rb) { + drm_intel_bo_unreference(front_rb-first_post_swapbuffers_batch); + front_rb-first_post_swapbuffers_batch = NULL; + } + + if (back_rb) { + drm_intel_bo_unreference(back_rb-first_post_swapbuffers_batch); + back_rb-first_post_swapbuffers_batch = NULL; + } driDestroyOptionCache(brw-optionCache); @@ -1195,6 +1216,7 @@ intel_prepare_render(struct brw_context *brw) struct gl_context *ctx = brw-ctx; __DRIcontext *driContext = brw-driContext; __DRIdrawable *drawable; + struct intel_renderbuffer *rb = NULL; drawable = driContext-driDrawablePriv; if (drawable drawable-dri2.stamp != driContext-dri2.draw_stamp) { @@ -1214,8 +1236,14 @@ intel_prepare_render(struct brw_context *brw) * that will happen next will probably dirty the front buffer. So * mark it as dirty here. */ - if (brw_is_front_buffer_drawing(ctx-DrawBuffer)) - brw-front_buffer_dirty = true; + if (ctx-DrawBuffer) { + if (brw_is_front_buffer_drawing(ctx-DrawBuffer)) { + brw-front_buffer_dirty = true; + rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_FRONT_LEFT); + } else { + rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_BACK_LEFT); + } + } /* Wait for the swapbuffers before the one we just emitted, so we * don't get too many swaps outstanding for apps that are GPU-heavy @@ -1232,12 +1260,12 @@ intel_prepare_render(struct brw_context *brw) * the swap, and getting our hands on that doesn't seem worth it, * so we just us the first batch we emitted after the last swap. */ - if (brw-need_throttle brw-first_post_swapbuffers_batch) { + if (rb rb-need_throttle rb-first_post_swapbuffers_batch) { if (!brw-disable_throttling) - drm_intel_bo_wait_rendering(brw-first_post_swapbuffers_batch); - drm_intel_bo_unreference(brw-first_post_swapbuffers_batch); - brw-first_post_swapbuffers_batch = NULL; - brw-need_throttle = false; + drm_intel_bo_wait_rendering(rb-first_post_swapbuffers_batch); + drm_intel_bo_unreference(rb-first_post_swapbuffers_batch); + rb-first_post_swapbuffers_batch = NULL; + rb-need_throttle = false; } } diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 682fbe9..da89f08 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1029,11 +1029,6 @@ struct brw_context */ bool front_buffer_dirty; - /** Framerate throttling: @{ */ - drm_intel_bo
[Mesa-dev] [PATCH] i965: Move first_post_swapbuffers_batch from the context into the renderbuffer (v2)
If there are multiple EGL surfaces associated with one EGL context, for any given surface, we unnecessarily have to wait for swapbuffers to complete on other EGL surfaces because we throttle to the context. By moving first_post_swapbuffers_batch from the brw context into intel_renderuffer, we would no longer be throttled by other surface's swapbuffers thereby leading to better performance. v2: Unref both the front and back renderbuffers inside intelDestroyContext to address situations where applications switch rendering to back and front buffers back and forth. Signed-off-by: Vivek Kasireddy vivek.kasire...@intel.com --- src/mesa/drivers/dri/i965/brw_context.c | 36 +++-- src/mesa/drivers/dri/i965/brw_context.h |1 - src/mesa/drivers/dri/i965/intel_batchbuffer.c | 15 --- src/mesa/drivers/dri/i965/intel_fbo.h |1 + 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 860ee22d..04ecca3 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -870,6 +870,7 @@ intelDestroyContext(__DRIcontext * driContextPriv) struct brw_context *brw = (struct brw_context *) driContextPriv-driverPrivate; struct gl_context *ctx = brw-ctx; + struct intel_renderbuffer *front_rb = NULL, *back_rb = NULL; assert(brw); /* should never be null */ if (!brw) @@ -910,8 +911,20 @@ intelDestroyContext(__DRIcontext * driContextPriv) intel_batchbuffer_free(brw); - drm_intel_bo_unreference(brw-first_post_swapbuffers_batch); - brw-first_post_swapbuffers_batch = NULL; + if (ctx-DrawBuffer) { + front_rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_FRONT_LEFT); + back_rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_BACK_LEFT); + } + + if (front_rb) { + drm_intel_bo_unreference(front_rb-first_post_swapbuffers_batch); + front_rb-first_post_swapbuffers_batch = NULL; + } + + if (back_rb) { + drm_intel_bo_unreference(back_rb-first_post_swapbuffers_batch); + back_rb-first_post_swapbuffers_batch = NULL; + } driDestroyOptionCache(brw-optionCache); @@ -1183,6 +1196,7 @@ intel_prepare_render(struct brw_context *brw) struct gl_context *ctx = brw-ctx; __DRIcontext *driContext = brw-driContext; __DRIdrawable *drawable; + struct intel_renderbuffer *rb = NULL; drawable = driContext-driDrawablePriv; if (drawable drawable-dri2.stamp != driContext-dri2.draw_stamp) { @@ -1202,8 +1216,14 @@ intel_prepare_render(struct brw_context *brw) * that will happen next will probably dirty the front buffer. So * mark it as dirty here. */ - if (brw_is_front_buffer_drawing(ctx-DrawBuffer)) - brw-front_buffer_dirty = true; + if (ctx-DrawBuffer) { + if (brw_is_front_buffer_drawing(ctx-DrawBuffer)) { + brw-front_buffer_dirty = true; + rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_FRONT_LEFT); + } else { + rb = intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_BACK_LEFT); + } + } /* Wait for the swapbuffers before the one we just emitted, so we * don't get too many swaps outstanding for apps that are GPU-heavy @@ -1220,11 +1240,11 @@ intel_prepare_render(struct brw_context *brw) * the swap, and getting our hands on that doesn't seem worth it, * so we just us the first batch we emitted after the last swap. */ - if (brw-need_throttle brw-first_post_swapbuffers_batch) { + if (brw-need_throttle rb rb-first_post_swapbuffers_batch) { if (!brw-disable_throttling) - drm_intel_bo_wait_rendering(brw-first_post_swapbuffers_batch); - drm_intel_bo_unreference(brw-first_post_swapbuffers_batch); - brw-first_post_swapbuffers_batch = NULL; + drm_intel_bo_wait_rendering(rb-first_post_swapbuffers_batch); + drm_intel_bo_unreference(rb-first_post_swapbuffers_batch); + rb-first_post_swapbuffers_batch = NULL; brw-need_throttle = false; } } diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index a63c483..3a84cb4 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1028,7 +1028,6 @@ struct brw_context bool front_buffer_dirty; /** Framerate throttling: @{ */ - drm_intel_bo *first_post_swapbuffers_batch; bool need_throttle; /** @} */ diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index 2bd11d7..c3ac5c2 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -291,13 +291,22 @@ _intel_batchbuffer_flush(struct brw_context *brw, const char *file, int line) { int ret; + struct gl_context *ctx = brw-ctx; + struct intel_renderbuffer *rb = NULL; if (brw-batch.used == 0