Skip to contentSkip to conversation

gbm: Add a flag to enable creation of rotated scanout buffers (v2)

PATCH New Vivek Kasireddy 1 participant 1 message Nov 5, 2015 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 gbm: Add a flag to enable creation of rotated scanout buffers (v2)

In reply to a message not in the archive

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 <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 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(-)
include/GL/internal/dri_interface.h +3 -0
index 6bbd3fa..cd1bf62 100644
@@ -1100,6 +1100,9 @@ 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_ROTATION_90	0x0010
+#define __DRI_IMAGE_USE_ROTATION_180	0x0020
+#define __DRI_IMAGE_USE_ROTATION_270	0x0040
 
 
 /**
src/gbm/backends/dri/gbm_dri.c +17 -2
index 57cdeac..a997946 100644
@@ -539,7 +539,8 @@ gbm_dri_is_format_supported(struct gbm_device *gbm,
       break;
    case GBM_BO_FORMAT_ARGB8888:
    case GBM_FORMAT_ARGB8888:
-      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_ARGB8888;
-   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_XRGB8888;
    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)
src/gbm/main/gbm.h +7 -0
index 8db2153..b200ca6 100644
@@ -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
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx