summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/lima/lima_object.h
blob: 6738724afb7b06b0b82c71735f1f9ae6a58df5d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
/* Copyright 2018-2019 Qiang Yu <yuq825@gmail.com> */

#ifndef __LIMA_OBJECT_H__
#define __LIMA_OBJECT_H__

#include <drm/drm_gem.h>

#include "lima_device.h"

struct lima_bo {
	struct drm_gem_object gem;

	struct page **pages;
	dma_addr_t *pages_dma_addr;
	struct sg_table *sgt;
	void *vaddr;

	struct mutex lock;
	struct list_head va;
};

static inline struct lima_bo *
to_lima_bo(struct drm_gem_object *obj)
{
	return container_of(obj, struct lima_bo, gem);
}

struct lima_bo *lima_bo_create(struct lima_device *dev, u32 size,
			       u32 flags, struct sg_table *sgt,
			       struct reservation_object *resv);
void lima_bo_destroy(struct lima_bo *bo);
void *lima_bo_vmap(struct lima_bo *bo);
void lima_bo_vunmap(struct lima_bo *bo);

#endif
OpenPOWER on IntegriCloud