summaryrefslogtreecommitdiff
path: root/lib/media_fill.h
blob: 5edd7b3c570748cb5bd93c74ea684c65e7b1b4f5 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef RENDE_MEDIA_FILL_H
#define RENDE_MEDIA_FILL_H

#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <getopt.h>
#include "drm.h"
#include "i915_drm.h"
#include "drmtest.h"
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
#include "intel_gpu_tools.h"

struct scratch_buf {
    drm_intel_bo *bo;
    uint32_t stride;
    uint32_t tiling;
    uint32_t *data;
    uint32_t *cpu_mapping;
    uint32_t size;
    unsigned num_tiles;
};

static inline unsigned buf_width(struct scratch_buf *buf)
{
	return buf->stride/sizeof(uint8_t);
}

static inline unsigned buf_height(struct scratch_buf *buf)
{
	return buf->size/buf->stride;
}

typedef void (*media_fillfunc_t)(struct intel_batchbuffer *batch,
				struct scratch_buf *dst,
				unsigned x, unsigned y,
				unsigned width, unsigned height,
				uint8_t color);

media_fillfunc_t get_media_fillfunc(int devid);

void
gen8_media_fillfunc(struct intel_batchbuffer *batch,
		struct scratch_buf *dst,
		unsigned x, unsigned y,
		unsigned width, unsigned height,
		uint8_t color);

#endif /* RENDE_MEDIA_FILL_H */