Commit 7203425a authored by James Simmons's avatar James Simmons Committed by Dave Airlie

drm: expand gamma_set

Expand the crtc_gamma_set function to accept a starting offset. The
reason for this is to eventually use this function for setcolreg from
drm_fb_helper.c. The fbdev colormap function can start at any offset in
the color map.
Signed-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 38fcbb67
...@@ -2541,7 +2541,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, ...@@ -2541,7 +2541,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
goto out; goto out;
} }
crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, crtc->gamma_size);
out: out:
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
......
...@@ -4330,15 +4330,12 @@ void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, ...@@ -4330,15 +4330,12 @@ void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
} }
static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
u16 *blue, uint32_t size) u16 *blue, uint32_t start, uint32_t size)
{ {
int end = (start + size > 256) ? 256 : start + size, i;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int i;
if (size != 256)
return;
for (i = 0; i < 256; i++) { for (i = start; i < end; i++) {
intel_crtc->lut_r[i] = red[i] >> 8; intel_crtc->lut_r[i] = red[i] >> 8;
intel_crtc->lut_g[i] = green[i] >> 8; intel_crtc->lut_g[i] = green[i] >> 8;
intel_crtc->lut_b[i] = blue[i] >> 8; intel_crtc->lut_b[i] = blue[i] >> 8;
......
...@@ -742,15 +742,13 @@ nv_crtc_gamma_load(struct drm_crtc *crtc) ...@@ -742,15 +742,13 @@ nv_crtc_gamma_load(struct drm_crtc *crtc)
} }
static void static void
nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size) nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t start,
uint32_t size)
{ {
int end = (start + size > 256) ? 256 : start + size, i;
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
int i;
if (size != 256)
return;
for (i = 0; i < 256; i++) { for (i = start; i < end; i++) {
nv_crtc->lut.r[i] = r[i]; nv_crtc->lut.r[i] = r[i];
nv_crtc->lut.g[i] = g[i]; nv_crtc->lut.g[i] = g[i];
nv_crtc->lut.b[i] = b[i]; nv_crtc->lut.b[i] = b[i];
......
...@@ -398,15 +398,12 @@ nv50_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) ...@@ -398,15 +398,12 @@ nv50_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
static void static void
nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
uint32_t size) uint32_t start, uint32_t size)
{ {
int end = (start + size > 256) ? 256 : start + size, i;
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
int i;
if (size != 256)
return;
for (i = 0; i < 256; i++) { for (i = start; i < end; i++) {
nv_crtc->lut.r[i] = r[i]; nv_crtc->lut.r[i] = r[i];
nv_crtc->lut.g[i] = g[i]; nv_crtc->lut.g[i] = g[i];
nv_crtc->lut.b[i] = b[i]; nv_crtc->lut.b[i] = b[i];
......
...@@ -161,17 +161,13 @@ void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, ...@@ -161,17 +161,13 @@ void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
} }
static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
u16 *blue, uint32_t size) u16 *blue, uint32_t start, uint32_t size)
{ {
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
int i; int end = (start + size > 256) ? 256 : start + size, i;
if (size != 256) {
return;
}
/* userspace palettes are always correct as is */ /* userspace palettes are always correct as is */
for (i = 0; i < 256; i++) { for (i = start; i < end; i++) {
radeon_crtc->lut_r[i] = red[i] >> 6; radeon_crtc->lut_r[i] = red[i] >> 6;
radeon_crtc->lut_g[i] = green[i] >> 6; radeon_crtc->lut_g[i] = green[i] >> 6;
radeon_crtc->lut_b[i] = blue[i] >> 6; radeon_crtc->lut_b[i] = blue[i] >> 6;
......
...@@ -79,7 +79,7 @@ static void vmw_ldu_crtc_restore(struct drm_crtc *crtc) ...@@ -79,7 +79,7 @@ static void vmw_ldu_crtc_restore(struct drm_crtc *crtc)
static void vmw_ldu_crtc_gamma_set(struct drm_crtc *crtc, static void vmw_ldu_crtc_gamma_set(struct drm_crtc *crtc,
u16 *r, u16 *g, u16 *b, u16 *r, u16 *g, u16 *b,
uint32_t size) uint32_t start, uint32_t size)
{ {
} }
......
...@@ -310,7 +310,7 @@ struct drm_crtc_funcs { ...@@ -310,7 +310,7 @@ struct drm_crtc_funcs {
/* Set gamma on the CRTC */ /* Set gamma on the CRTC */
void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
uint32_t size); uint32_t start, uint32_t size);
/* Object destroy routine */ /* Object destroy routine */
void (*destroy)(struct drm_crtc *crtc); void (*destroy)(struct drm_crtc *crtc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment