2
*----------------------------------------------------------------------------
3
* Filename: ovl_tnc_cache.h
5
*-----------------------------------------------------------------------------
6
* Copyright © 2002-2010, Intel Corporation.
8
* This program is free software; you can redistribute it and/or modify it
9
* under the terms and conditions of the GNU General Public License,
10
* version 2, as published by the Free Software Foundation.
12
* This program is distributed in the hope it will be useful, but WITHOUT
13
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17
* You should have received a copy of the GNU General Public License along with
18
* this program; if not, write to the Free Software Foundation, Inc.,
19
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20
*-----------------------------------------------------------------------------
22
* This is the internal header file for overlay caching. It should be not be
23
* by any other module besides the overlay module itself.
24
*-----------------------------------------------------------------------------
26
#ifndef _OVL_TNC_CACHE_H
27
#define _OVL_TNC_CACHE_H
30
#include "ovl_regs_tnc.h"
31
#include "ovl2_regs_tnc.h"
33
/* Turns the overlay cache on and off. */
34
#define OVL_TNC_CACHE_QUICK_SWAP
38
* In order to cache the overlay registers we need a structure
39
* that defines and wraps them. We already have one for the primary
40
* display, called ovl_reg_image_tnc_t.
41
* Here we define a structure for the secondary display
44
typedef struct _ovl2_reg_tnc_cache{
45
unsigned long control;
47
unsigned long plane_control;
48
unsigned long plane_start;
49
unsigned long linear_offset;
50
unsigned long tiled_offset;
53
unsigned long dest_rect_x1y1;
54
unsigned long dest_rect_w_h;
55
unsigned long cont_bright;
56
unsigned long satn_hue;
57
unsigned long gamma_regs[OVL2_TOTAL_GAMMA_REG];
58
unsigned long colorkey_hw;
59
unsigned long colorkey_mask;
60
unsigned long ckey_high;
61
unsigned long ckey_low;
62
unsigned long ckey_enable;
63
} ovl2_reg_tnc_cache_t;
65
#define MMIO_OFFSET_TNC2_CONTROL 0x72180
66
#define MMIO_OFFSET_TNC2_LINEAR_OFF 0x72184
67
#define MMIO_OFFSET_TNC2_PITCH 0x72188
68
#define MMIO_OFFSET_TNC2_DEST_RECT_X1Y1 0x7218C
69
#define MMIO_OFFSET_TNC2_DEST_RECT_W_H 0x72190
70
#define MMIO_OFFSET_TNC2_CKEY_LOW 0x72194
71
#define MMIO_OFFSET_TNC2_CKEY_ENABLE 0x72198
72
#define MMIO_OFFSET_TNC2_SURF_ADDR 0x7219C
73
#define MMIO_OFFSET_TNC2_CKEY_HIGH 0x721A0
74
#define MMIO_OFFSET_TNC2_DSPC_TILE_OFF 0x721A4
75
#define MMIO_OFFSET_TNC2_CONT_BRIGHT 0x721D0
76
#define MMIO_OFFSET_TNC2_SATN_HUE 0x721D4
77
#define MMIO_OFFSET_TNC2_COLORKEY_HW 0x14
78
#define MMIO_OFFSET_TNC2_COLORKEY_MASK 0x18
81
* This stucture caches the overlay state, so we don't have to
82
* re-program everything for every single frame
84
typedef struct _ovl_tnc_cache {
85
igd_surface_t src_surf;
88
igd_ovl_info_t ovl_info;
90
ovl_reg_image_tnc_t ovl_regs;
91
ovl2_reg_tnc_cache_t ovl2_regs;
92
} ovl_tnc_cache_t, *povl_tnc_cache_t;
95
/* Flags for things that might have changed in the cache */
96
#define IGD_OVL_TNC_UPDATE_DEST (1 << 0)
97
#define IGD_OVL_TNC_UPDATE_SRC (1 << 1)
98
#define IGD_OVL_TNC_UPDATE_SURF (1 << 2)
99
#define IGD_OVL_TNC_UPDATE_INFO (1 << 3)
100
#define IGD_OVL_TNC_UPDATE_FLAGS (1 << 4)
101
#define IGD_OVL_TNC_UPDATE_VQ (1 << 5)
102
#define IGD_OVL_TNC_UPDATE_GAMMA (1 << 6)
103
#define IGD_OVL_TNC_UPDATE_COLORKEY (1 << 7)
107
* Caching helper functions. Implemented in ovl_tnc.c, but used by
108
* the ovl2 and micro_ovl modules as well.
111
/* Tells if a rectangle has changed */
112
int is_changed_rect(igd_rect_t *old_rect, igd_rect_t *new_rect);
114
/* Tells if a surface has changed */
115
int is_changed_surf(igd_surface_t *old_surf, igd_surface_t *new_surf);
117
/* Tells if the color key has changed */
118
int is_changed_color_key(igd_ovl_info_t *old_info, igd_ovl_info_t *new_info);
120
/* Tells if the video quality has changed */
121
int is_changed_vq(igd_ovl_info_t *old_info, igd_ovl_info_t *new_info);
123
/* Tells if the gamma has changed */
124
int is_changed_gamma(igd_ovl_info_t *old_info, igd_ovl_info_t *new_info);
126
/* Copies a source rectangle to the cache */
127
void copy_src_rect_tnc(igd_rect_t *src_rect, povl_tnc_cache_t ovl_cache);
129
/* Copies a dest rectangle to the cache */
130
void copy_dest_rect_tnc( igd_rect_t *dest_rect, povl_tnc_cache_t ovl_cache);
132
/* Copies a surface to the cache */
133
void copy_surf_tnc(igd_surface_t *src_surf, povl_tnc_cache_t ovl_cache);
135
/* Copies the color key to the cache */
136
void copy_color_key_tnc( igd_ovl_info_t *ovl_info, povl_tnc_cache_t ovl_cache);
138
/* Copies the video quality info to the cache */
139
void copy_vq_tnc(igd_ovl_info_t *ovl_info, povl_tnc_cache_t ovl_cache);
141
/* Copies the gamma to the cache */
142
void copy_gamma_tnc(igd_ovl_info_t *ovl_info, povl_tnc_cache_t ovl_cache);
144
/* Checks to see what, if anything has changed.
145
* Clears bits in the command and config register that are invalid.
146
* Returns a set of flags telling what changed */
147
unsigned int get_cache_changes_tnc(
148
igd_surface_t *src_surf,
149
igd_rect_t *src_rect,
150
igd_rect_t *dest_rect,
151
igd_ovl_info_t *ovl_info,
153
povl_tnc_cache_t ovl_cache);
157
#endif /* _OVL_TNC_CACHE_H */