summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2016-10-13 16:03:36 -0700
committerBen Widawsky <ben@bwidawsk.net>2017-03-09 16:10:20 -0800
commit26315784359aaa1e0970d40995073edc85a9b5ab (patch)
tree49fc1832d1478e023883b729b2d97f9010ce20a3
parent4fb8a477982dd40d556fb3a381d42983e282804a (diff)
i965/miptree: Add a helper function for image creation
This provides a common function or creating miptrees when there is an existing DRIimage to use. That provides an easy way to add CCS allocation. v2: Make the new function assume there are always no layout flags. This will be adjusted later. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Acked-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--src/mesa/drivers/dri/i965/intel_fbo.c17
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c25
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.h10
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_image.c17
4 files changed, 50 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index de0cd6aca2..f6e17599b8 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -362,15 +362,14 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx,
* buffer's content to the main buffer nor for invalidating the aux buffer's
* content.
*/
- irb->mt = intel_miptree_create_for_bo(brw,
- image->bo,
- image->format,
- image->offset,
- image->width,
- image->height,
- 1,
- image->pitch,
- MIPTREE_LAYOUT_DISABLE_AUX);
+ irb->mt = intel_miptree_create_for_image(brw,
+ image,
+ image->format,
+ image->offset,
+ image->width,
+ image->height,
+ image->pitch,
+ 0);
if (!irb->mt)
return;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 3295175d0b..11f017b874 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -24,7 +24,6 @@
*/
#include <GL/gl.h>
-#include <GL/internal/dri_interface.h>
#include "intel_batchbuffer.h"
#include "intel_mipmap_tree.h"
@@ -32,6 +31,7 @@
#include "intel_tex.h"
#include "intel_blit.h"
#include "intel_fbo.h"
+#include "intel_image.h"
#include "brw_blorp.h"
#include "brw_context.h"
@@ -807,6 +807,29 @@ intel_miptree_create_for_bo(struct brw_context *brw,
return mt;
}
+struct intel_mipmap_tree *
+intel_miptree_create_for_image(struct brw_context *intel,
+ __DRIimage *image,
+ mesa_format format,
+ uint32_t offset,
+ uint32_t width,
+ uint32_t height,
+ uint32_t pitch,
+ uint32_t layout_flags)
+{
+ assert(layout_flags == 0);
+ layout_flags = MIPTREE_LAYOUT_DISABLE_AUX;
+ return intel_miptree_create_for_bo(intel,
+ image->bo,
+ format,
+ offset,
+ width,
+ height,
+ 1,
+ pitch,
+ layout_flags);
+}
+
/**
* For a singlesample renderbuffer, this simply wraps the given BO with a
* miptree.
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 27bcdfbe33..e433da56b0 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -720,6 +720,16 @@ intel_miptree_create_for_bo(struct brw_context *brw,
int pitch,
uint32_t layout_flags);
+struct intel_mipmap_tree *
+intel_miptree_create_for_image(struct brw_context *intel,
+ __DRIimage *image,
+ mesa_format format,
+ uint32_t offset,
+ uint32_t width,
+ uint32_t height,
+ uint32_t pitch,
+ uint32_t layout_flags);
+
void
intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
struct intel_renderbuffer *irb,
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index 141996f707..2d79183b16 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -221,11 +221,11 @@ create_mt_for_planar_dri_image(struct brw_context *brw,
* invalidating the aux buffer's content.
*/
struct intel_mipmap_tree *mt =
- intel_miptree_create_for_bo(brw, image->bo, format,
- image->offsets[index],
- width, height, 1,
- image->strides[index],
- MIPTREE_LAYOUT_DISABLE_AUX);
+ intel_miptree_create_for_image(brw, image, format,
+ image->offsets[index],
+ width, height,
+ image->strides[index],
+ 0);
if (mt == NULL)
return NULL;
@@ -259,10 +259,9 @@ create_mt_for_dri_image(struct brw_context *brw,
* buffer's content to the main buffer nor for invalidating the aux buffer's
* content.
*/
- mt = intel_miptree_create_for_bo(brw, image->bo, image->format,
- 0, image->width, image->height, 1,
- image->pitch,
- MIPTREE_LAYOUT_DISABLE_AUX);
+ mt = intel_miptree_create_for_image(brw, image, image->format,
+ 0, image->width, image->height,
+ image->pitch, 0);
if (mt == NULL)
return NULL;