mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
drm/nouveau/kms/gf119-: allow both 256- and 1024-sized LUTs to be used
The hardware supports either size. Also add checks to ensure that only these two sizes may be used for supplying a LUT. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
11a8630917
commit
131992709d
14 changed files with 93 additions and 40 deletions
|
@ -75,12 +75,16 @@ base907c_xlut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size)
|
||||||
{
|
{
|
||||||
asyw->xlut.i.mode = 7;
|
if (size != 256 && size != 1024)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
asyw->xlut.i.mode = size == 1024 ? 4 : 7;
|
||||||
asyw->xlut.i.enable = 2;
|
asyw->xlut.i.enable = 2;
|
||||||
asyw->xlut.i.load = head907d_olut_load;
|
asyw->xlut.i.load = head907d_olut_load;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u32
|
static inline u32
|
||||||
|
@ -160,6 +164,7 @@ base907c = {
|
||||||
.csc_set = base907c_csc_set,
|
.csc_set = base907c_csc_set,
|
||||||
.csc_clr = base907c_csc_clr,
|
.csc_clr = base907c_csc_clr,
|
||||||
.olut_core = true,
|
.olut_core = true,
|
||||||
|
.ilut_size = 1024,
|
||||||
.xlut_set = base907c_xlut_set,
|
.xlut_set = base907c_xlut_set,
|
||||||
.xlut_clr = base907c_xlut_clr,
|
.xlut_clr = base907c_xlut_clr,
|
||||||
.image_set = base907c_image_set,
|
.image_set = base907c_image_set,
|
||||||
|
|
|
@ -213,6 +213,7 @@ nv50_head_atomic_check_lut(struct nv50_head *head,
|
||||||
{
|
{
|
||||||
struct nv50_disp *disp = nv50_disp(head->base.base.dev);
|
struct nv50_disp *disp = nv50_disp(head->base.base.dev);
|
||||||
struct drm_property_blob *olut = asyh->state.gamma_lut;
|
struct drm_property_blob *olut = asyh->state.gamma_lut;
|
||||||
|
int size;
|
||||||
|
|
||||||
/* Determine whether core output LUT should be enabled. */
|
/* Determine whether core output LUT should be enabled. */
|
||||||
if (olut) {
|
if (olut) {
|
||||||
|
@ -229,14 +230,23 @@ nv50_head_atomic_check_lut(struct nv50_head *head,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!olut && !head->func->olut_identity) {
|
if (!olut) {
|
||||||
asyh->olut.handle = 0;
|
if (!head->func->olut_identity) {
|
||||||
return 0;
|
asyh->olut.handle = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
size = 0;
|
||||||
|
} else {
|
||||||
|
size = drm_color_lut_size(olut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!head->func->olut(head, asyh, size)) {
|
||||||
|
DRM_DEBUG_KMS("Invalid olut\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
asyh->olut.handle = disp->core->chan.vram.handle;
|
asyh->olut.handle = disp->core->chan.vram.handle;
|
||||||
asyh->olut.buffer = !asyh->olut.buffer;
|
asyh->olut.buffer = !asyh->olut.buffer;
|
||||||
head->func->olut(head, asyh);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,11 +520,11 @@ nv50_head_create(struct drm_device *dev, int index)
|
||||||
drm_crtc_init_with_planes(dev, crtc, &base->plane, &curs->plane,
|
drm_crtc_init_with_planes(dev, crtc, &base->plane, &curs->plane,
|
||||||
&nv50_head_func, "head-%d", head->base.index);
|
&nv50_head_func, "head-%d", head->base.index);
|
||||||
drm_crtc_helper_add(crtc, &nv50_head_help);
|
drm_crtc_helper_add(crtc, &nv50_head_help);
|
||||||
|
/* Keep the legacy gamma size at 256 to avoid compatibility issues */
|
||||||
drm_mode_crtc_set_gamma_size(crtc, 256);
|
drm_mode_crtc_set_gamma_size(crtc, 256);
|
||||||
if (disp->disp->object.oclass >= GF110_DISP)
|
drm_crtc_enable_color_mgmt(crtc, base->func->ilut_size,
|
||||||
drm_crtc_enable_color_mgmt(crtc, 256, true, 256);
|
disp->disp->object.oclass >= GF110_DISP,
|
||||||
else
|
head->func->olut_size);
|
||||||
drm_crtc_enable_color_mgmt(crtc, 0, false, 256);
|
|
||||||
|
|
||||||
if (head->func->olut_set) {
|
if (head->func->olut_set) {
|
||||||
ret = nv50_lut_init(disp, &drm->client.mmu, &head->olut);
|
ret = nv50_lut_init(disp, &drm->client.mmu, &head->olut);
|
||||||
|
|
|
@ -20,8 +20,9 @@ void nv50_head_flush_clr(struct nv50_head *, struct nv50_head_atom *, bool y);
|
||||||
struct nv50_head_func {
|
struct nv50_head_func {
|
||||||
void (*view)(struct nv50_head *, struct nv50_head_atom *);
|
void (*view)(struct nv50_head *, struct nv50_head_atom *);
|
||||||
void (*mode)(struct nv50_head *, struct nv50_head_atom *);
|
void (*mode)(struct nv50_head *, struct nv50_head_atom *);
|
||||||
void (*olut)(struct nv50_head *, struct nv50_head_atom *);
|
bool (*olut)(struct nv50_head *, struct nv50_head_atom *, int);
|
||||||
bool olut_identity;
|
bool olut_identity;
|
||||||
|
int olut_size;
|
||||||
void (*olut_set)(struct nv50_head *, struct nv50_head_atom *);
|
void (*olut_set)(struct nv50_head *, struct nv50_head_atom *);
|
||||||
void (*olut_clr)(struct nv50_head *);
|
void (*olut_clr)(struct nv50_head *);
|
||||||
void (*core_calc)(struct nv50_head *, struct nv50_head_atom *);
|
void (*core_calc)(struct nv50_head *, struct nv50_head_atom *);
|
||||||
|
@ -43,7 +44,7 @@ struct nv50_head_func {
|
||||||
extern const struct nv50_head_func head507d;
|
extern const struct nv50_head_func head507d;
|
||||||
void head507d_view(struct nv50_head *, struct nv50_head_atom *);
|
void head507d_view(struct nv50_head *, struct nv50_head_atom *);
|
||||||
void head507d_mode(struct nv50_head *, struct nv50_head_atom *);
|
void head507d_mode(struct nv50_head *, struct nv50_head_atom *);
|
||||||
void head507d_olut(struct nv50_head *, struct nv50_head_atom *);
|
bool head507d_olut(struct nv50_head *, struct nv50_head_atom *, int);
|
||||||
void head507d_core_calc(struct nv50_head *, struct nv50_head_atom *);
|
void head507d_core_calc(struct nv50_head *, struct nv50_head_atom *);
|
||||||
void head507d_core_clr(struct nv50_head *);
|
void head507d_core_clr(struct nv50_head *);
|
||||||
int head507d_curs_layout(struct nv50_head *, struct nv50_wndw_atom *,
|
int head507d_curs_layout(struct nv50_head *, struct nv50_wndw_atom *,
|
||||||
|
@ -60,7 +61,7 @@ extern const struct nv50_head_func head827d;
|
||||||
extern const struct nv50_head_func head907d;
|
extern const struct nv50_head_func head907d;
|
||||||
void head907d_view(struct nv50_head *, struct nv50_head_atom *);
|
void head907d_view(struct nv50_head *, struct nv50_head_atom *);
|
||||||
void head907d_mode(struct nv50_head *, struct nv50_head_atom *);
|
void head907d_mode(struct nv50_head *, struct nv50_head_atom *);
|
||||||
void head907d_olut(struct nv50_head *, struct nv50_head_atom *);
|
bool head907d_olut(struct nv50_head *, struct nv50_head_atom *, int);
|
||||||
void head907d_olut_set(struct nv50_head *, struct nv50_head_atom *);
|
void head907d_olut_set(struct nv50_head *, struct nv50_head_atom *);
|
||||||
void head907d_olut_clr(struct nv50_head *);
|
void head907d_olut_clr(struct nv50_head *);
|
||||||
void head907d_core_set(struct nv50_head *, struct nv50_head_atom *);
|
void head907d_core_set(struct nv50_head *, struct nv50_head_atom *);
|
||||||
|
|
|
@ -271,15 +271,19 @@ head507d_olut_load(struct drm_color_lut *in, int size, void __iomem *mem)
|
||||||
writew(readw(mem - 4), mem + 4);
|
writew(readw(mem - 4), mem + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
head507d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
|
head507d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size)
|
||||||
{
|
{
|
||||||
|
if (size != 256)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (asyh->base.cpp == 1)
|
if (asyh->base.cpp == 1)
|
||||||
asyh->olut.mode = 0;
|
asyh->olut.mode = 0;
|
||||||
else
|
else
|
||||||
asyh->olut.mode = 1;
|
asyh->olut.mode = 1;
|
||||||
|
|
||||||
asyh->olut.load = head507d_olut_load;
|
asyh->olut.load = head507d_olut_load;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -328,6 +332,7 @@ head507d = {
|
||||||
.view = head507d_view,
|
.view = head507d_view,
|
||||||
.mode = head507d_mode,
|
.mode = head507d_mode,
|
||||||
.olut = head507d_olut,
|
.olut = head507d_olut,
|
||||||
|
.olut_size = 256,
|
||||||
.olut_set = head507d_olut_set,
|
.olut_set = head507d_olut_set,
|
||||||
.olut_clr = head507d_olut_clr,
|
.olut_clr = head507d_olut_clr,
|
||||||
.core_calc = head507d_core_calc,
|
.core_calc = head507d_core_calc,
|
||||||
|
|
|
@ -108,6 +108,7 @@ head827d = {
|
||||||
.view = head507d_view,
|
.view = head507d_view,
|
||||||
.mode = head507d_mode,
|
.mode = head507d_mode,
|
||||||
.olut = head507d_olut,
|
.olut = head507d_olut,
|
||||||
|
.olut_size = 256,
|
||||||
.olut_set = head827d_olut_set,
|
.olut_set = head827d_olut_set,
|
||||||
.olut_clr = head827d_olut_clr,
|
.olut_clr = head827d_olut_clr,
|
||||||
.core_calc = head507d_core_calc,
|
.core_calc = head507d_core_calc,
|
||||||
|
|
|
@ -230,11 +230,15 @@ head907d_olut_load(struct drm_color_lut *in, int size, void __iomem *mem)
|
||||||
writew(readw(mem - 4), mem + 4);
|
writew(readw(mem - 4), mem + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
head907d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
|
head907d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size)
|
||||||
{
|
{
|
||||||
asyh->olut.mode = 7;
|
if (size != 256 && size != 1024)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
asyh->olut.mode = size == 1024 ? 4 : 7;
|
||||||
asyh->olut.load = head907d_olut_load;
|
asyh->olut.load = head907d_olut_load;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -285,6 +289,7 @@ head907d = {
|
||||||
.view = head907d_view,
|
.view = head907d_view,
|
||||||
.mode = head907d_mode,
|
.mode = head907d_mode,
|
||||||
.olut = head907d_olut,
|
.olut = head907d_olut,
|
||||||
|
.olut_size = 1024,
|
||||||
.olut_set = head907d_olut_set,
|
.olut_set = head907d_olut_set,
|
||||||
.olut_clr = head907d_olut_clr,
|
.olut_clr = head907d_olut_clr,
|
||||||
.core_calc = head507d_core_calc,
|
.core_calc = head507d_core_calc,
|
||||||
|
|
|
@ -83,6 +83,7 @@ head917d = {
|
||||||
.view = head907d_view,
|
.view = head907d_view,
|
||||||
.mode = head907d_mode,
|
.mode = head907d_mode,
|
||||||
.olut = head907d_olut,
|
.olut = head907d_olut,
|
||||||
|
.olut_size = 1024,
|
||||||
.olut_set = head907d_olut_set,
|
.olut_set = head907d_olut_set,
|
||||||
.olut_clr = head907d_olut_clr,
|
.olut_clr = head907d_olut_clr,
|
||||||
.core_calc = head507d_core_calc,
|
.core_calc = head507d_core_calc,
|
||||||
|
|
|
@ -148,14 +148,18 @@ headc37d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
headc37d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
|
headc37d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size)
|
||||||
{
|
{
|
||||||
|
if (size != 256 && size != 1024)
|
||||||
|
return false;
|
||||||
|
|
||||||
asyh->olut.mode = 2;
|
asyh->olut.mode = 2;
|
||||||
asyh->olut.size = 0;
|
asyh->olut.size = size == 1024 ? 2 : 0;
|
||||||
asyh->olut.range = 0;
|
asyh->olut.range = 0;
|
||||||
asyh->olut.output_mode = 1;
|
asyh->olut.output_mode = 1;
|
||||||
asyh->olut.load = head907d_olut_load;
|
asyh->olut.load = head907d_olut_load;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -201,6 +205,7 @@ headc37d = {
|
||||||
.view = headc37d_view,
|
.view = headc37d_view,
|
||||||
.mode = headc37d_mode,
|
.mode = headc37d_mode,
|
||||||
.olut = headc37d_olut,
|
.olut = headc37d_olut,
|
||||||
|
.olut_size = 1024,
|
||||||
.olut_set = headc37d_olut_set,
|
.olut_set = headc37d_olut_set,
|
||||||
.olut_clr = headc37d_olut_clr,
|
.olut_clr = headc37d_olut_clr,
|
||||||
.curs_layout = head917d_curs_layout,
|
.curs_layout = head917d_curs_layout,
|
||||||
|
|
|
@ -151,17 +151,20 @@ headc57d_olut_load(struct drm_color_lut *in, int size, void __iomem *mem)
|
||||||
writew(readw(mem - 4), mem + 4);
|
writew(readw(mem - 4), mem + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
headc57d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
|
headc57d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size)
|
||||||
{
|
{
|
||||||
|
if (size != 0 && size != 256 && size != 1024)
|
||||||
|
return false;
|
||||||
|
|
||||||
asyh->olut.mode = 2; /* DIRECT10 */
|
asyh->olut.mode = 2; /* DIRECT10 */
|
||||||
asyh->olut.size = 4 /* VSS header. */ + 1024 + 1 /* Entries. */;
|
asyh->olut.size = 4 /* VSS header. */ + 1024 + 1 /* Entries. */;
|
||||||
asyh->olut.output_mode = 1; /* INTERPOLATE_ENABLE. */
|
asyh->olut.output_mode = 1; /* INTERPOLATE_ENABLE. */
|
||||||
if (asyh->state.gamma_lut &&
|
if (size == 256)
|
||||||
asyh->state.gamma_lut->length / sizeof(struct drm_color_lut) == 256)
|
|
||||||
asyh->olut.load = headc57d_olut_load_8;
|
asyh->olut.load = headc57d_olut_load_8;
|
||||||
else
|
else
|
||||||
asyh->olut.load = headc57d_olut_load;
|
asyh->olut.load = headc57d_olut_load;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -194,6 +197,7 @@ headc57d = {
|
||||||
.mode = headc57d_mode,
|
.mode = headc57d_mode,
|
||||||
.olut = headc57d_olut,
|
.olut = headc57d_olut,
|
||||||
.olut_identity = true,
|
.olut_identity = true,
|
||||||
|
.olut_size = 1024,
|
||||||
.olut_set = headc57d_olut_set,
|
.olut_set = headc57d_olut_set,
|
||||||
.olut_clr = headc57d_olut_clr,
|
.olut_clr = headc57d_olut_clr,
|
||||||
.curs_layout = head917d_curs_layout,
|
.curs_layout = head917d_curs_layout,
|
||||||
|
|
|
@ -49,7 +49,7 @@ nv50_lut_load(struct nv50_lut *lut, int buffer, struct drm_property_blob *blob,
|
||||||
kvfree(in);
|
kvfree(in);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
load(in, blob->length / sizeof(*in), mem);
|
load(in, drm_color_lut_size(blob), mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
return addr;
|
return addr;
|
||||||
|
|
|
@ -318,7 +318,7 @@ nv50_wndw_atomic_check_acquire(struct nv50_wndw *wndw, bool modeset,
|
||||||
return wndw->func->acquire(wndw, asyw, asyh);
|
return wndw->func->acquire(wndw, asyw, asyh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
nv50_wndw_atomic_check_lut(struct nv50_wndw *wndw,
|
nv50_wndw_atomic_check_lut(struct nv50_wndw *wndw,
|
||||||
struct nv50_wndw_atom *armw,
|
struct nv50_wndw_atom *armw,
|
||||||
struct nv50_wndw_atom *asyw,
|
struct nv50_wndw_atom *asyw,
|
||||||
|
@ -340,7 +340,7 @@ nv50_wndw_atomic_check_lut(struct nv50_wndw *wndw,
|
||||||
*/
|
*/
|
||||||
if (!(ilut = asyh->state.gamma_lut)) {
|
if (!(ilut = asyh->state.gamma_lut)) {
|
||||||
asyw->visible = false;
|
asyw->visible = false;
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wndw->func->ilut)
|
if (wndw->func->ilut)
|
||||||
|
@ -359,7 +359,10 @@ nv50_wndw_atomic_check_lut(struct nv50_wndw *wndw,
|
||||||
/* Recalculate LUT state. */
|
/* Recalculate LUT state. */
|
||||||
memset(&asyw->xlut, 0x00, sizeof(asyw->xlut));
|
memset(&asyw->xlut, 0x00, sizeof(asyw->xlut));
|
||||||
if ((asyw->ilut = wndw->func->ilut ? ilut : NULL)) {
|
if ((asyw->ilut = wndw->func->ilut ? ilut : NULL)) {
|
||||||
wndw->func->ilut(wndw, asyw);
|
if (!wndw->func->ilut(wndw, asyw, drm_color_lut_size(ilut))) {
|
||||||
|
DRM_DEBUG_KMS("Invalid ilut\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
asyw->xlut.handle = wndw->wndw.vram.handle;
|
asyw->xlut.handle = wndw->wndw.vram.handle;
|
||||||
asyw->xlut.i.buffer = !asyw->xlut.i.buffer;
|
asyw->xlut.i.buffer = !asyw->xlut.i.buffer;
|
||||||
asyw->set.xlut = true;
|
asyw->set.xlut = true;
|
||||||
|
@ -384,6 +387,7 @@ nv50_wndw_atomic_check_lut(struct nv50_wndw *wndw,
|
||||||
|
|
||||||
/* Can't do an immediate flip while changing the LUT. */
|
/* Can't do an immediate flip while changing the LUT. */
|
||||||
asyh->state.async_flip = false;
|
asyh->state.async_flip = false;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -424,8 +428,11 @@ nv50_wndw_atomic_check(struct drm_plane *plane, struct drm_plane_state *state)
|
||||||
(!armw->visible ||
|
(!armw->visible ||
|
||||||
asyh->state.color_mgmt_changed ||
|
asyh->state.color_mgmt_changed ||
|
||||||
asyw->state.fb->format->format !=
|
asyw->state.fb->format->format !=
|
||||||
armw->state.fb->format->format))
|
armw->state.fb->format->format)) {
|
||||||
nv50_wndw_atomic_check_lut(wndw, armw, asyw, asyh);
|
ret = nv50_wndw_atomic_check_lut(wndw, armw, asyw, asyh);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Calculate new window state. */
|
/* Calculate new window state. */
|
||||||
if (asyw->visible) {
|
if (asyw->visible) {
|
||||||
|
|
|
@ -64,12 +64,13 @@ struct nv50_wndw_func {
|
||||||
void (*ntfy_clr)(struct nv50_wndw *);
|
void (*ntfy_clr)(struct nv50_wndw *);
|
||||||
int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset,
|
int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset,
|
||||||
struct nvif_device *);
|
struct nvif_device *);
|
||||||
void (*ilut)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
bool (*ilut)(struct nv50_wndw *, struct nv50_wndw_atom *, int);
|
||||||
void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *,
|
void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *,
|
||||||
const struct drm_color_ctm *);
|
const struct drm_color_ctm *);
|
||||||
void (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
void (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||||
void (*csc_clr)(struct nv50_wndw *);
|
void (*csc_clr)(struct nv50_wndw *);
|
||||||
bool ilut_identity;
|
bool ilut_identity;
|
||||||
|
int ilut_size;
|
||||||
bool olut_core;
|
bool olut_core;
|
||||||
void (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
void (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||||
void (*xlut_clr)(struct nv50_wndw *);
|
void (*xlut_clr)(struct nv50_wndw *);
|
||||||
|
|
|
@ -71,14 +71,18 @@ wndwc37e_ilut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
wndwc37e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
wndwc37e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size)
|
||||||
{
|
{
|
||||||
|
if (size != 256 && size != 1024)
|
||||||
|
return false;
|
||||||
|
|
||||||
asyw->xlut.i.mode = 2;
|
asyw->xlut.i.mode = 2;
|
||||||
asyw->xlut.i.size = 0;
|
asyw->xlut.i.size = size == 1024 ? 2 : 0;
|
||||||
asyw->xlut.i.range = 0;
|
asyw->xlut.i.range = 0;
|
||||||
asyw->xlut.i.output_mode = 1;
|
asyw->xlut.i.output_mode = 1;
|
||||||
asyw->xlut.i.load = head907d_olut_load;
|
asyw->xlut.i.load = head907d_olut_load;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -261,6 +265,7 @@ wndwc37e = {
|
||||||
.ntfy_reset = corec37d_ntfy_init,
|
.ntfy_reset = corec37d_ntfy_init,
|
||||||
.ntfy_wait_begun = base507c_ntfy_wait_begun,
|
.ntfy_wait_begun = base507c_ntfy_wait_begun,
|
||||||
.ilut = wndwc37e_ilut,
|
.ilut = wndwc37e_ilut,
|
||||||
|
.ilut_size = 1024,
|
||||||
.xlut_set = wndwc37e_ilut_set,
|
.xlut_set = wndwc37e_ilut_set,
|
||||||
.xlut_clr = wndwc37e_ilut_clr,
|
.xlut_clr = wndwc37e_ilut_clr,
|
||||||
.csc = base907c_csc,
|
.csc = base907c_csc,
|
||||||
|
|
|
@ -156,19 +156,21 @@ wndwc57e_ilut_load(struct drm_color_lut *in, int size, void __iomem *mem)
|
||||||
writew(readw(mem - 4), mem + 4);
|
writew(readw(mem - 4), mem + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
wndwc57e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
wndwc57e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size)
|
||||||
{
|
{
|
||||||
u16 size = asyw->ilut->length / sizeof(struct drm_color_lut);
|
if (size = size ? size : 1024, size != 256 && size != 1024)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (size == 256) {
|
if (size == 256) {
|
||||||
asyw->xlut.i.mode = 1; /* DIRECT8. */
|
asyw->xlut.i.mode = 1; /* DIRECT8. */
|
||||||
} else {
|
} else {
|
||||||
asyw->xlut.i.mode = 2; /* DIRECT10. */
|
asyw->xlut.i.mode = 2; /* DIRECT10. */
|
||||||
size = 1024;
|
|
||||||
}
|
}
|
||||||
asyw->xlut.i.size = 4 /* VSS header. */ + size + 1 /* Entries. */;
|
asyw->xlut.i.size = 4 /* VSS header. */ + size + 1 /* Entries. */;
|
||||||
asyw->xlut.i.output_mode = 0; /* INTERPOLATE_DISABLE. */
|
asyw->xlut.i.output_mode = 0; /* INTERPOLATE_DISABLE. */
|
||||||
asyw->xlut.i.load = wndwc57e_ilut_load;
|
asyw->xlut.i.load = wndwc57e_ilut_load;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct nv50_wndw_func
|
static const struct nv50_wndw_func
|
||||||
|
@ -183,6 +185,7 @@ wndwc57e = {
|
||||||
.ntfy_wait_begun = base507c_ntfy_wait_begun,
|
.ntfy_wait_begun = base507c_ntfy_wait_begun,
|
||||||
.ilut = wndwc57e_ilut,
|
.ilut = wndwc57e_ilut,
|
||||||
.ilut_identity = true,
|
.ilut_identity = true,
|
||||||
|
.ilut_size = 1024,
|
||||||
.xlut_set = wndwc57e_ilut_set,
|
.xlut_set = wndwc57e_ilut_set,
|
||||||
.xlut_clr = wndwc57e_ilut_clr,
|
.xlut_clr = wndwc57e_ilut_clr,
|
||||||
.csc = base907c_csc,
|
.csc = base907c_csc,
|
||||||
|
|
Loading…
Add table
Reference in a new issue