[Mesa-dev] [PATCH] gbm: Add a flag to enable creation of rotated scanout buffers
Vivek Kasireddy
vivek.kasireddy at intel.com
Fri Sep 11 19:30:38 PDT 2015
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.roper at intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy at 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_SCANOUT 0x0002
#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_ARGB8888:
case GBM_FORMAT_ARGB8888:
- 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_ARGB8888;
- 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_XRGB8888;
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
More information about the mesa-dev
mailing list