Subversion Repositories Kolibri OS

Rev

Rev 1182 | Rev 1268 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1182 Rev 1221
Line 104... Line 104...
104
		avivo_crtc_load_lut(crtc);
104
		avivo_crtc_load_lut(crtc);
105
	else
105
	else
106
		legacy_crtc_load_lut(crtc);
106
		legacy_crtc_load_lut(crtc);
107
}
107
}
Line 108... Line 108...
108
 
108
 
109
/** Sets the color ramps on behalf of RandR */
109
/** Sets the color ramps on behalf of fbcon */
110
void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
110
void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
111
			      u16 blue, int regno)
111
			      u16 blue, int regno)
112
{
112
{
Line 113... Line -...
113
	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
-
 
114
 
-
 
115
	if (regno == 0)
113
	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
116
		DRM_DEBUG("gamma set %d\n", radeon_crtc->crtc_id);
114
 
117
	radeon_crtc->lut_r[regno] = red >> 6;
115
	radeon_crtc->lut_r[regno] = red >> 6;
118
	radeon_crtc->lut_g[regno] = green >> 6;
116
	radeon_crtc->lut_g[regno] = green >> 6;
Line -... Line 117...
-
 
117
	radeon_crtc->lut_b[regno] = blue >> 6;
-
 
118
}
-
 
119
 
-
 
120
/** Gets the color ramps on behalf of fbcon */
-
 
121
void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
-
 
122
			      u16 *blue, int regno)
-
 
123
{
-
 
124
	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
-
 
125
 
-
 
126
	*red = radeon_crtc->lut_r[regno] << 6;
-
 
127
	*green = radeon_crtc->lut_g[regno] << 6;
119
	radeon_crtc->lut_b[regno] = blue >> 6;
128
	*blue = radeon_crtc->lut_b[regno] << 6;
120
}
129
}
121
 
130
 
122
static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
131
static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
123
				  u16 *blue, uint32_t size)
132
				  u16 *blue, uint32_t size)
Line 124... Line 133...
124
{
133
{
125
	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
134
	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
126
	int i, j;
135
	int i;
127
 
136
 
128
	if (size != 256) {
137
	if (size != 256) {
129
		return;
138
		return;
Line 130... Line -...
130
	}
-
 
131
	if (crtc->fb == NULL) {
-
 
132
		return;
-
 
133
	}
-
 
134
 
-
 
135
	if (crtc->fb->depth == 16) {
-
 
136
		for (i = 0; i < 64; i++) {
-
 
137
			if (i <= 31) {
-
 
138
				for (j = 0; j < 8; j++) {
-
 
139
					radeon_crtc->lut_r[i * 8 + j] = red[i] >> 6;
139
	}
140
					radeon_crtc->lut_b[i * 8 + j] = blue[i] >> 6;
-
 
141
				}
-
 
142
			}
140
	if (crtc->fb == NULL) {
143
			for (j = 0; j < 4; j++)
141
		return;
144
				radeon_crtc->lut_g[i * 4 + j] = green[i] >> 6;
142
	}
145
		}
143
 
146
	} else {
144
	/* userspace palettes are always correct as is */
147
		for (i = 0; i < 256; i++) {
-
 
Line 148... Line 145...
148
			radeon_crtc->lut_r[i] = red[i] >> 6;
145
		for (i = 0; i < 256; i++) {
149
			radeon_crtc->lut_g[i] = green[i] >> 6;
146
			radeon_crtc->lut_r[i] = red[i] >> 6;
Line 150... Line 147...
150
			radeon_crtc->lut_b[i] = blue[i] >> 6;
147
			radeon_crtc->lut_g[i] = green[i] >> 6;
Line 161... Line 158...
161
	drm_crtc_cleanup(crtc);
158
	drm_crtc_cleanup(crtc);
162
	kfree(radeon_crtc);
159
	kfree(radeon_crtc);
163
}
160
}
Line 164... Line 161...
164
 
161
 
165
static const struct drm_crtc_funcs radeon_crtc_funcs = {
162
static const struct drm_crtc_funcs radeon_crtc_funcs = {
166
//   .cursor_set = radeon_crtc_cursor_set,
163
    .cursor_set = NULL,
167
	.cursor_move = radeon_crtc_cursor_move,
164
    .cursor_move = NULL,
168
	.gamma_set = radeon_crtc_gamma_set,
165
	.gamma_set = radeon_crtc_gamma_set,
169
	.set_config = drm_crtc_helper_set_config,
166
	.set_config = drm_crtc_helper_set_config,
170
	.destroy = radeon_crtc_destroy,
167
	.destroy = radeon_crtc_destroy,
Line 725... Line 722...
725
 
722
 
726
	ret = radeon_modeset_create_props(rdev);
723
	ret = radeon_modeset_create_props(rdev);
727
	if (ret) {
724
	if (ret) {
728
		return ret;
725
		return ret;
-
 
726
	}
-
 
727
 
-
 
728
	if (rdev->flags & RADEON_SINGLE_CRTC)
-
 
729
		num_crtc = 1;
729
	}
730
 
730
	/* allocate crtcs - TODO single crtc */
731
	/* allocate crtcs */
731
	for (i = 0; i < num_crtc; i++) {
732
	for (i = 0; i < num_crtc; i++) {
732
		radeon_crtc_init(rdev->ddev, i);
733
		radeon_crtc_init(rdev->ddev, i);
Line 733... Line 734...
733
	}
734
	}