summaryrefslogtreecommitdiff
path: root/src/gen6_vme.h
blob: 70dee053a51c6ea41a841a65c8c740902599750a (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * Copyright © 2009 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, sub license, 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 NON-INFRINGEMENT.
 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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
 * SOFTWAR
 *
 * Authors:
 *    Zhou Chang <chang.zhou@intel.com>
 *
 */

#ifndef _GEN6_VME_H_
#define _GEN6_VME_H_

#include <xf86drm.h>
#include <drm.h>
#include <i915_drm.h>
#include <intel_bufmgr.h>

#include "i965_gpe_utils.h"

#define INTRA_VME_OUTPUT_IN_BYTES       16      /* in bytes */
#define INTRA_VME_OUTPUT_IN_DWS         (INTRA_VME_OUTPUT_IN_BYTES / 4)
#define INTER_VME_OUTPUT_IN_BYTES       160     /* the first 128 bytes for MVs and the last 32 bytes for other info */
#define INTER_VME_OUTPUT_IN_DWS         (INTER_VME_OUTPUT_IN_BYTES / 4)

#define MAX_INTERFACE_DESC_GEN6      MAX_GPE_KERNELS
#define MAX_MEDIA_SURFACES_GEN6      34

#define GEN6_VME_KERNEL_NUMBER          3

struct encode_state;
struct intel_encoder_context;

struct gen6_vme_context
{
    struct i965_gpe_context gpe_context;

    struct {
        dri_bo *bo;
    } vme_state;

    struct i965_buffer_surface vme_output;
    struct i965_buffer_surface vme_batchbuffer;


    void (*vme_surface2_setup)(VADriverContextP ctx,
                                struct i965_gpe_context *gpe_context,
                                struct object_surface *obj_surface,
                                unsigned long binding_table_offset,
                                unsigned long surface_state_offset);
    void (*vme_media_rw_surface_setup)(VADriverContextP ctx,
                                            struct i965_gpe_context *gpe_context,
                                            struct object_surface *obj_surface,
                                            unsigned long binding_table_offset,
                                            unsigned long surface_state_offset);
    void (*vme_buffer_suface_setup)(VADriverContextP ctx,
                                    struct i965_gpe_context *gpe_context,
                                    struct i965_buffer_surface *buffer_surface,
                                    unsigned long binding_table_offset,
                                    unsigned long surface_state_offset);
    void (*vme_media_chroma_surface_setup)(VADriverContextP ctx,
                                            struct i965_gpe_context *gpe_context,
                                            struct object_surface *obj_surface,
                                            unsigned long binding_table_offset,
                                            unsigned long surface_state_offset);
    void *vme_state_message;
    unsigned int h264_level;
    unsigned int video_coding_type;
    unsigned int vme_kernel_sum;
};

Bool gen75_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context);

extern void intel_vme_update_mbmv_cost(VADriverContextP ctx,
                                       struct encode_state *encode_state,
                                       struct intel_encoder_context *encoder_context);

Bool gen7_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context);

#define		MODE_INTRA_NONPRED	0
#define		MODE_INTRA_16X16	1
#define		MODE_INTRA_8X8		2
#define		MODE_INTRA_4X4		3
#define		MODE_INTER_16X8		4
#define		MODE_INTER_8X16		4
#define		MODE_INTER_8X8		5
#define		MODE_INTER_8X4		6
#define		MODE_INTER_4X8		6
#define		MODE_INTER_4X4		7
#define		MODE_INTER_16X16	8
#define		MODE_INTER_BWD		9
#define		MODE_REFID_COST		10
#define		MODE_CHROMA_INTRA	11

#define		MODE_INTER_MV0		12
#define		MODE_INTER_MV1		13
#define		MODE_INTER_MV2		14

#define		MODE_INTER_MV3		15
#define		MODE_INTER_MV4		16
#define		MODE_INTER_MV5		17
#define		MODE_INTER_MV6		18
#define		MODE_INTER_MV7		19

#endif /* _GEN6_VME_H_ */