2016-11-11 12:43:54 +02:00
/*
* Copyright © 2016 Intel Corporation
*
* Permission is hereby granted , free of charge , to any person obtaining a
* copy of this software and associated documentation files ( the " Software " ) ,
* to deal in the Software without restriction , including without limitation
* the rights to use , copy , modify , merge , publish , distribute , sublicense ,
* and / or sell copies of the Software , and to permit persons to whom the
* Software is furnished to do so , subject to the following conditions :
*
* The above copyright notice and this permission notice ( including the next
* paragraph ) shall be included in all copies or substantial portions of the
* Software .
*
* THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR
* IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY ,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER
* LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING
* FROM , OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE .
*
*/
2020-03-16 11:38:43 +00:00
# ifndef __INTEL_GGTT_FENCING_H__
# define __INTEL_GGTT_FENCING_H__
2016-11-11 12:43:54 +02:00
# include <linux/list.h>
2019-06-13 08:32:54 +01:00
# include <linux/types.h>
2016-11-11 12:43:54 +02:00
2020-04-01 22:01:02 +01:00
# include "i915_active.h"
2019-06-13 08:32:54 +01:00
struct drm_i915_gem_object ;
struct i915_ggtt ;
2016-11-11 12:43:54 +02:00
struct i915_vma ;
2019-06-21 08:07:45 +01:00
struct intel_gt ;
2019-06-13 08:32:54 +01:00
struct sg_table ;
2016-11-11 12:43:54 +02:00
2017-01-10 14:47:34 +00:00
# define I965_FENCE_PAGE 4096UL
2019-06-13 08:32:54 +01:00
struct i915_fence_reg {
2016-11-11 12:43:54 +02:00
struct list_head link ;
2019-10-16 15:32:33 +01:00
struct i915_ggtt * ggtt ;
2016-11-11 12:43:54 +02:00
struct i915_vma * vma ;
2019-08-22 07:09:12 +01:00
atomic_t pin_count ;
2020-04-01 22:01:02 +01:00
struct i915_active active ;
2016-11-11 12:43:54 +02:00
int id ;
/**
* Whether the tiling parameters for the currently
* associated fence register have changed . Note that
* for the purposes of tracking tiling changes we also
* treat the unfenced register , the register slot that
* the object occupies whilst it executes a fenced
* command ( such as BLT on gen2 / 3 ) , as a " fence " .
*/
bool dirty ;
} ;
2019-10-16 15:32:33 +01:00
struct i915_fence_reg * i915_reserve_fence ( struct i915_ggtt * ggtt ) ;
2019-06-13 08:32:54 +01:00
void i915_unreserve_fence ( struct i915_fence_reg * fence ) ;
2020-03-16 11:38:43 +00:00
void intel_ggtt_restore_fences ( struct i915_ggtt * ggtt ) ;
2019-06-13 08:32:54 +01:00
void i915_gem_object_do_bit_17_swizzle ( struct drm_i915_gem_object * obj ,
struct sg_table * pages ) ;
void i915_gem_object_save_bit_17_swizzle ( struct drm_i915_gem_object * obj ,
struct sg_table * pages ) ;
2020-03-16 11:38:43 +00:00
void intel_ggtt_init_fences ( struct i915_ggtt * ggtt ) ;
2020-03-16 11:38:46 +00:00
void intel_ggtt_fini_fences ( struct i915_ggtt * ggtt ) ;
2019-06-13 08:32:54 +01:00
2019-06-21 08:07:45 +01:00
void intel_gt_init_swizzling ( struct intel_gt * gt ) ;
2016-11-11 12:43:54 +02:00
# endif