aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Stone <[email protected]>2017-05-30 17:23:49 +0530
committerDaniel Stone <[email protected]>2017-06-08 22:27:30 +0100
commit6b18d4aaec11d629347f842909e7dc1c687098ba (patch)
tree65620fbc06a95fa8b01e58517f33a048d2871359 /src
parent11e549ae3f3ce022fb22af933a7d16bbb23e3882 (diff)
i965: Invert image modifier/tiling inference
When allocating images, we record a tiling mode and then work backwards to infer the modifier. Unfortunately this is the wrong way around, since it is a one:many mapping (e.g. TILING_Y can be plain Y-tiling, or Y-tiling with CCS). Invert the mapping, so we record a modifier first and then map this to a tiling mode. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 9354cd53ba9..07af0633d67 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -608,6 +608,7 @@ intel_create_image_common(__DRIscreen *dri_screen,
__DRIimage *image;
struct intel_screen *screen = dri_screen->driverPrivate;
uint32_t tiling;
+ uint64_t modifier = DRM_FORMAT_MOD_INVALID;
int cpp;
/* Callers of this may specify a modifier, or a dri usage, but not both. The
@@ -616,29 +617,29 @@ intel_create_image_common(__DRIscreen *dri_screen,
*/
assert(!(use && count));
- uint64_t modifier = select_best_modifier(&screen->devinfo, modifiers, count);
- if (modifier == DRM_FORMAT_MOD_INVALID) {
- /* User requested specific modifiers, none of which work */
- if (modifiers)
- return NULL;
-
- /* Historically, X-tiled was the default, and so lack of modifier means
- * X-tiled.
- */
- tiling = I915_TILING_X;
- } else {
- /* select_best_modifier has found a modifier we support */
- tiling = modifier_to_tiling(modifier);
- }
-
if (use & __DRI_IMAGE_USE_CURSOR) {
if (width != 64 || height != 64)
return NULL;
- tiling = I915_TILING_NONE;
+ modifier = DRM_FORMAT_MOD_LINEAR;
}
if (use & __DRI_IMAGE_USE_LINEAR)
- tiling = I915_TILING_NONE;
+ modifier = DRM_FORMAT_MOD_LINEAR;
+
+ if (modifier == DRM_FORMAT_MOD_INVALID) {
+ if (modifiers) {
+ /* User requested specific modifiers */
+ modifier = select_best_modifier(&screen->devinfo, modifiers, count);
+ if (modifier == DRM_FORMAT_MOD_INVALID)
+ return NULL;
+ } else {
+ /* Historically, X-tiled was the default, and so lack of modifier means
+ * X-tiled.
+ */
+ modifier = I915_FORMAT_MOD_X_TILED;
+ }
+ }
+ tiling = modifier_to_tiling(modifier);
image = intel_allocate_image(screen, format, loaderPrivate);
if (image == NULL)