Skip to content

Commit

Permalink
drm/ttm: move populated state into page flags
Browse files Browse the repository at this point in the history
Just use the top bit of page flags to store the populated state.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-8-airlied@gmail.com
  • Loading branch information
Dave Airlie committed Sep 15, 2020
1 parent 3a4ab16 commit 3312be8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions include/drm/ttm/ttm_tt.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ struct ttm_operation_ctx;
#define TTM_PAGE_FLAG_SG (1 << 8)
#define TTM_PAGE_FLAG_NO_RETRY (1 << 9)

#define TTM_PAGE_FLAG_PRIV_POPULATED (1 << 31)

enum ttm_caching_state {
tt_uncached,
tt_wc,
Expand Down Expand Up @@ -70,22 +72,21 @@ struct ttm_tt {
struct sg_table *sg; /* for SG objects via dma-buf */
struct file *swap_storage;
enum ttm_caching_state caching_state;
bool populated;
};

static inline bool ttm_tt_is_populated(struct ttm_tt *tt)
{
return tt->populated;
return tt->page_flags & TTM_PAGE_FLAG_PRIV_POPULATED;
}

static inline void ttm_tt_set_unpopulated(struct ttm_tt *tt)
{
tt->populated = false;
tt->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED;
}

static inline void ttm_tt_set_populated(struct ttm_tt *tt)
{
tt->populated = true;
tt->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
}

/**
Expand Down

0 comments on commit 3312be8

Please sign in to comment.