|
@@ -27,15 +27,19 @@
|
|
|
|
|
|
static void mga_crtc_load_lut(struct drm_crtc *crtc)
|
|
static void mga_crtc_load_lut(struct drm_crtc *crtc)
|
|
{
|
|
{
|
|
- struct mga_crtc *mga_crtc = to_mga_crtc(crtc);
|
|
|
|
struct drm_device *dev = crtc->dev;
|
|
struct drm_device *dev = crtc->dev;
|
|
struct mga_device *mdev = dev->dev_private;
|
|
struct mga_device *mdev = dev->dev_private;
|
|
struct drm_framebuffer *fb = crtc->primary->fb;
|
|
struct drm_framebuffer *fb = crtc->primary->fb;
|
|
|
|
+ u16 *r_ptr, *g_ptr, *b_ptr;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
if (!crtc->enabled)
|
|
if (!crtc->enabled)
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+ r_ptr = crtc->gamma_store;
|
|
|
|
+ g_ptr = r_ptr + crtc->gamma_size;
|
|
|
|
+ b_ptr = g_ptr + crtc->gamma_size;
|
|
|
|
+
|
|
WREG8(DAC_INDEX + MGA1064_INDEX, 0);
|
|
WREG8(DAC_INDEX + MGA1064_INDEX, 0);
|
|
|
|
|
|
if (fb && fb->format->cpp[0] * 8 == 16) {
|
|
if (fb && fb->format->cpp[0] * 8 == 16) {
|
|
@@ -46,25 +50,27 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc)
|
|
if (i > (MGAG200_LUT_SIZE >> 1)) {
|
|
if (i > (MGAG200_LUT_SIZE >> 1)) {
|
|
r = b = 0;
|
|
r = b = 0;
|
|
} else {
|
|
} else {
|
|
- r = mga_crtc->lut_r[i << 1];
|
|
|
|
- b = mga_crtc->lut_b[i << 1];
|
|
|
|
|
|
+ r = *r_ptr++ >> 8;
|
|
|
|
+ b = *b_ptr++ >> 8;
|
|
|
|
+ r_ptr++;
|
|
|
|
+ b_ptr++;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- r = mga_crtc->lut_r[i];
|
|
|
|
- b = mga_crtc->lut_b[i];
|
|
|
|
|
|
+ r = *r_ptr++ >> 8;
|
|
|
|
+ b = *b_ptr++ >> 8;
|
|
}
|
|
}
|
|
/* VGA registers */
|
|
/* VGA registers */
|
|
WREG8(DAC_INDEX + MGA1064_COL_PAL, r);
|
|
WREG8(DAC_INDEX + MGA1064_COL_PAL, r);
|
|
- WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_g[i]);
|
|
|
|
|
|
+ WREG8(DAC_INDEX + MGA1064_COL_PAL, *g_ptr++ >> 8);
|
|
WREG8(DAC_INDEX + MGA1064_COL_PAL, b);
|
|
WREG8(DAC_INDEX + MGA1064_COL_PAL, b);
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
for (i = 0; i < MGAG200_LUT_SIZE; i++) {
|
|
for (i = 0; i < MGAG200_LUT_SIZE; i++) {
|
|
/* VGA registers */
|
|
/* VGA registers */
|
|
- WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_r[i]);
|
|
|
|
- WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_g[i]);
|
|
|
|
- WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_b[i]);
|
|
|
|
|
|
+ WREG8(DAC_INDEX + MGA1064_COL_PAL, *r_ptr++ >> 8);
|
|
|
|
+ WREG8(DAC_INDEX + MGA1064_COL_PAL, *g_ptr++ >> 8);
|
|
|
|
+ WREG8(DAC_INDEX + MGA1064_COL_PAL, *b_ptr++ >> 8);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1399,14 +1405,6 @@ static int mga_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
|
u16 *blue, uint32_t size,
|
|
u16 *blue, uint32_t size,
|
|
struct drm_modeset_acquire_ctx *ctx)
|
|
struct drm_modeset_acquire_ctx *ctx)
|
|
{
|
|
{
|
|
- struct mga_crtc *mga_crtc = to_mga_crtc(crtc);
|
|
|
|
- int i;
|
|
|
|
-
|
|
|
|
- for (i = 0; i < size; i++) {
|
|
|
|
- mga_crtc->lut_r[i] = red[i] >> 8;
|
|
|
|
- mga_crtc->lut_g[i] = green[i] >> 8;
|
|
|
|
- mga_crtc->lut_b[i] = blue[i] >> 8;
|
|
|
|
- }
|
|
|
|
mga_crtc_load_lut(crtc);
|
|
mga_crtc_load_lut(crtc);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -1455,14 +1453,12 @@ static const struct drm_crtc_helper_funcs mga_helper_funcs = {
|
|
.mode_set_base = mga_crtc_mode_set_base,
|
|
.mode_set_base = mga_crtc_mode_set_base,
|
|
.prepare = mga_crtc_prepare,
|
|
.prepare = mga_crtc_prepare,
|
|
.commit = mga_crtc_commit,
|
|
.commit = mga_crtc_commit,
|
|
- .load_lut = mga_crtc_load_lut,
|
|
|
|
};
|
|
};
|
|
|
|
|
|
/* CRTC setup */
|
|
/* CRTC setup */
|
|
static void mga_crtc_init(struct mga_device *mdev)
|
|
static void mga_crtc_init(struct mga_device *mdev)
|
|
{
|
|
{
|
|
struct mga_crtc *mga_crtc;
|
|
struct mga_crtc *mga_crtc;
|
|
- int i;
|
|
|
|
|
|
|
|
mga_crtc = kzalloc(sizeof(struct mga_crtc) +
|
|
mga_crtc = kzalloc(sizeof(struct mga_crtc) +
|
|
(MGAG200FB_CONN_LIMIT * sizeof(struct drm_connector *)),
|
|
(MGAG200FB_CONN_LIMIT * sizeof(struct drm_connector *)),
|
|
@@ -1476,37 +1472,9 @@ static void mga_crtc_init(struct mga_device *mdev)
|
|
drm_mode_crtc_set_gamma_size(&mga_crtc->base, MGAG200_LUT_SIZE);
|
|
drm_mode_crtc_set_gamma_size(&mga_crtc->base, MGAG200_LUT_SIZE);
|
|
mdev->mode_info.crtc = mga_crtc;
|
|
mdev->mode_info.crtc = mga_crtc;
|
|
|
|
|
|
- for (i = 0; i < MGAG200_LUT_SIZE; i++) {
|
|
|
|
- mga_crtc->lut_r[i] = i;
|
|
|
|
- mga_crtc->lut_g[i] = i;
|
|
|
|
- mga_crtc->lut_b[i] = i;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
drm_crtc_helper_add(&mga_crtc->base, &mga_helper_funcs);
|
|
drm_crtc_helper_add(&mga_crtc->base, &mga_helper_funcs);
|
|
}
|
|
}
|
|
|
|
|
|
-/** Sets the color ramps on behalf of fbcon */
|
|
|
|
-void mga_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
|
|
|
|
- u16 blue, int regno)
|
|
|
|
-{
|
|
|
|
- struct mga_crtc *mga_crtc = to_mga_crtc(crtc);
|
|
|
|
-
|
|
|
|
- mga_crtc->lut_r[regno] = red >> 8;
|
|
|
|
- mga_crtc->lut_g[regno] = green >> 8;
|
|
|
|
- mga_crtc->lut_b[regno] = blue >> 8;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/** Gets the color ramps on behalf of fbcon */
|
|
|
|
-void mga_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
|
|
|
|
- u16 *blue, int regno)
|
|
|
|
-{
|
|
|
|
- struct mga_crtc *mga_crtc = to_mga_crtc(crtc);
|
|
|
|
-
|
|
|
|
- *red = (u16)mga_crtc->lut_r[regno] << 8;
|
|
|
|
- *green = (u16)mga_crtc->lut_g[regno] << 8;
|
|
|
|
- *blue = (u16)mga_crtc->lut_b[regno] << 8;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* The encoder comes after the CRTC in the output pipeline, but before
|
|
* The encoder comes after the CRTC in the output pipeline, but before
|
|
* the connector. It's responsible for ensuring that the digital
|
|
* the connector. It's responsible for ensuring that the digital
|