|
@@ -2182,6 +2182,7 @@ static void dce_v6_0_crtc_load_lut(struct drm_crtc *crtc)
|
|
|
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
|
|
struct drm_device *dev = crtc->dev;
|
|
|
struct amdgpu_device *adev = dev->dev_private;
|
|
|
+ u16 *r, *g, *b;
|
|
|
int i;
|
|
|
|
|
|
DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id);
|
|
@@ -2211,11 +2212,14 @@ static void dce_v6_0_crtc_load_lut(struct drm_crtc *crtc)
|
|
|
WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007);
|
|
|
|
|
|
WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0);
|
|
|
+ r = crtc->gamma_store;
|
|
|
+ g = r + crtc->gamma_size;
|
|
|
+ b = g + crtc->gamma_size;
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset,
|
|
|
- (amdgpu_crtc->lut_r[i] << 20) |
|
|
|
- (amdgpu_crtc->lut_g[i] << 10) |
|
|
|
- (amdgpu_crtc->lut_b[i] << 0));
|
|
|
+ ((*r++ & 0xffc0) << 14) |
|
|
|
+ ((*g++ & 0xffc0) << 4) |
|
|
|
+ (*b++ >> 6));
|
|
|
}
|
|
|
|
|
|
WREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset,
|
|
@@ -2496,15 +2500,6 @@ static int dce_v6_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
|
|
u16 *blue, uint32_t size,
|
|
|
struct drm_modeset_acquire_ctx *ctx)
|
|
|
{
|
|
|
- struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
|
|
- int i;
|
|
|
-
|
|
|
- /* userspace palettes are always correct as is */
|
|
|
- for (i = 0; i < size; i++) {
|
|
|
- amdgpu_crtc->lut_r[i] = red[i] >> 6;
|
|
|
- amdgpu_crtc->lut_g[i] = green[i] >> 6;
|
|
|
- amdgpu_crtc->lut_b[i] = blue[i] >> 6;
|
|
|
- }
|
|
|
dce_v6_0_crtc_load_lut(crtc);
|
|
|
|
|
|
return 0;
|
|
@@ -2712,14 +2707,12 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
|
|
|
.mode_set_base_atomic = dce_v6_0_crtc_set_base_atomic,
|
|
|
.prepare = dce_v6_0_crtc_prepare,
|
|
|
.commit = dce_v6_0_crtc_commit,
|
|
|
- .load_lut = dce_v6_0_crtc_load_lut,
|
|
|
.disable = dce_v6_0_crtc_disable,
|
|
|
};
|
|
|
|
|
|
static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
|
|
|
{
|
|
|
struct amdgpu_crtc *amdgpu_crtc;
|
|
|
- int i;
|
|
|
|
|
|
amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) +
|
|
|
(AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL);
|
|
@@ -2737,12 +2730,6 @@ static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
|
|
|
adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width;
|
|
|
adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height;
|
|
|
|
|
|
- for (i = 0; i < 256; i++) {
|
|
|
- amdgpu_crtc->lut_r[i] = i << 2;
|
|
|
- amdgpu_crtc->lut_g[i] = i << 2;
|
|
|
- amdgpu_crtc->lut_b[i] = i << 2;
|
|
|
- }
|
|
|
-
|
|
|
amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id];
|
|
|
|
|
|
amdgpu_crtc->pll_id = ATOM_PPLL_INVALID;
|