Merge branch 'linux-4.18' of git://github.com/skeggsb/linux into drm-next
The main thing here is the addition of support for Volta GV100 GPUs, everything else basically restructuring display / graphics init code to make it possible to fit Volta support in more nicely. There's a bunch of improvements/fixes scattered in there for earlier GPUs too, particularly graphics engine init on all GPUs from Fermi onwards. Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/CACAvsv7sjDKyR43n+6=iLC+ExGhBTLRLdKqwrhcfJWjEAndK0g@mail.gmail.com
This commit is contained in:
commit
3b064e6f7b
322 changed files with 15437 additions and 8006 deletions
|
|
@ -38,14 +38,16 @@ nouveau-y += nouveau_vmm.o
|
|||
|
||||
# DRM - modesetting
|
||||
nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o
|
||||
nouveau-y += nouveau_bios.o
|
||||
nouveau-y += nouveau_connector.o
|
||||
nouveau-y += nouveau_display.o
|
||||
nouveau-y += nv50_display.o
|
||||
nouveau-y += nouveau_dp.o
|
||||
nouveau-y += nouveau_fbcon.o
|
||||
nouveau-y += nv04_fbcon.o
|
||||
nouveau-y += nv50_fbcon.o
|
||||
nouveau-y += nvc0_fbcon.o
|
||||
include $(src)/dispnv04/Kbuild
|
||||
include $(src)/dispnv50/Kbuild
|
||||
|
||||
# DRM - command submission
|
||||
nouveau-y += nouveau_abi16.o
|
||||
|
|
@ -59,8 +61,4 @@ nouveau-y += nv50_fence.o
|
|||
nouveau-y += nv84_fence.o
|
||||
nouveau-y += nvc0_fence.o
|
||||
|
||||
# DRM - prehistoric modesetting (NV04-G7x)
|
||||
nouveau-y += nouveau_bios.o
|
||||
include $(src)/dispnv04/Kbuild
|
||||
|
||||
obj-$(CONFIG_DRM_NOUVEAU) += nouveau.o
|
||||
|
|
|
|||
51
drivers/gpu/drm/nouveau/dispnv50/Kbuild
Normal file
51
drivers/gpu/drm/nouveau/dispnv50/Kbuild
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
nouveau-y += dispnv50/disp.o
|
||||
nouveau-y += dispnv50/lut.o
|
||||
|
||||
nouveau-y += dispnv50/core.o
|
||||
nouveau-y += dispnv50/core507d.o
|
||||
nouveau-y += dispnv50/core827d.o
|
||||
nouveau-y += dispnv50/core907d.o
|
||||
nouveau-y += dispnv50/core917d.o
|
||||
nouveau-y += dispnv50/corec37d.o
|
||||
|
||||
nouveau-y += dispnv50/dac507d.o
|
||||
nouveau-y += dispnv50/dac907d.o
|
||||
|
||||
nouveau-y += dispnv50/pior507d.o
|
||||
|
||||
nouveau-y += dispnv50/sor507d.o
|
||||
nouveau-y += dispnv50/sor907d.o
|
||||
nouveau-y += dispnv50/sorc37d.o
|
||||
|
||||
nouveau-y += dispnv50/head.o
|
||||
nouveau-y += dispnv50/head507d.o
|
||||
nouveau-y += dispnv50/head827d.o
|
||||
nouveau-y += dispnv50/head907d.o
|
||||
nouveau-y += dispnv50/head917d.o
|
||||
nouveau-y += dispnv50/headc37d.o
|
||||
|
||||
nouveau-y += dispnv50/wimm.o
|
||||
nouveau-y += dispnv50/wimmc37b.o
|
||||
|
||||
nouveau-y += dispnv50/wndw.o
|
||||
nouveau-y += dispnv50/wndwc37e.o
|
||||
|
||||
nouveau-y += dispnv50/base.o
|
||||
nouveau-y += dispnv50/base507c.o
|
||||
nouveau-y += dispnv50/base827c.o
|
||||
nouveau-y += dispnv50/base907c.o
|
||||
nouveau-y += dispnv50/base917c.o
|
||||
|
||||
nouveau-y += dispnv50/curs.o
|
||||
nouveau-y += dispnv50/curs507a.o
|
||||
nouveau-y += dispnv50/curs907a.o
|
||||
nouveau-y += dispnv50/cursc37a.o
|
||||
|
||||
nouveau-y += dispnv50/oimm.o
|
||||
nouveau-y += dispnv50/oimm507b.o
|
||||
|
||||
nouveau-y += dispnv50/ovly.o
|
||||
nouveau-y += dispnv50/ovly507e.o
|
||||
nouveau-y += dispnv50/ovly827e.o
|
||||
nouveau-y += dispnv50/ovly907e.o
|
||||
nouveau-y += dispnv50/ovly917e.o
|
||||
222
drivers/gpu/drm/nouveau/dispnv50/atom.h
Normal file
222
drivers/gpu/drm/nouveau/dispnv50/atom.h
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
#ifndef __NV50_KMS_ATOM_H__
|
||||
#define __NV50_KMS_ATOM_H__
|
||||
#define nv50_atom(p) container_of((p), struct nv50_atom, state)
|
||||
#include <drm/drm_atomic.h>
|
||||
|
||||
struct nv50_atom {
|
||||
struct drm_atomic_state state;
|
||||
|
||||
struct list_head outp;
|
||||
bool lock_core;
|
||||
bool flush_disable;
|
||||
};
|
||||
|
||||
#define nv50_head_atom(p) container_of((p), struct nv50_head_atom, state)
|
||||
|
||||
struct nv50_head_atom {
|
||||
struct drm_crtc_state state;
|
||||
|
||||
struct {
|
||||
u32 mask;
|
||||
u32 olut;
|
||||
} wndw;
|
||||
|
||||
struct {
|
||||
u16 iW;
|
||||
u16 iH;
|
||||
u16 oW;
|
||||
u16 oH;
|
||||
} view;
|
||||
|
||||
struct nv50_head_mode {
|
||||
bool interlace;
|
||||
u32 clock;
|
||||
struct {
|
||||
u16 active;
|
||||
u16 synce;
|
||||
u16 blanke;
|
||||
u16 blanks;
|
||||
} h;
|
||||
struct {
|
||||
u32 active;
|
||||
u16 synce;
|
||||
u16 blanke;
|
||||
u16 blanks;
|
||||
u16 blank2s;
|
||||
u16 blank2e;
|
||||
u16 blankus;
|
||||
} v;
|
||||
} mode;
|
||||
|
||||
struct {
|
||||
bool visible;
|
||||
u32 handle;
|
||||
u64 offset:40;
|
||||
u8 buffer:1;
|
||||
u8 mode:4;
|
||||
u8 size:2;
|
||||
u8 range:2;
|
||||
u8 output_mode:2;
|
||||
} olut;
|
||||
|
||||
struct {
|
||||
bool visible;
|
||||
u32 handle;
|
||||
u64 offset:40;
|
||||
u8 format;
|
||||
u8 kind:7;
|
||||
u8 layout:1;
|
||||
u8 blockh:4;
|
||||
u16 blocks:12;
|
||||
u32 pitch:20;
|
||||
u16 x;
|
||||
u16 y;
|
||||
u16 w;
|
||||
u16 h;
|
||||
} core;
|
||||
|
||||
struct {
|
||||
bool visible;
|
||||
u32 handle;
|
||||
u64 offset:40;
|
||||
u8 layout:2;
|
||||
u8 format:8;
|
||||
} curs;
|
||||
|
||||
struct {
|
||||
u8 depth;
|
||||
u8 cpp;
|
||||
u16 x;
|
||||
u16 y;
|
||||
u16 w;
|
||||
u16 h;
|
||||
} base;
|
||||
|
||||
struct {
|
||||
u8 cpp;
|
||||
} ovly;
|
||||
|
||||
struct {
|
||||
bool enable:1;
|
||||
u8 bits:2;
|
||||
u8 mode:4;
|
||||
} dither;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
u16 cos:12;
|
||||
u16 sin:12;
|
||||
} sat;
|
||||
} procamp;
|
||||
|
||||
struct {
|
||||
u8 nhsync:1;
|
||||
u8 nvsync:1;
|
||||
u8 depth:4;
|
||||
} or;
|
||||
|
||||
union nv50_head_atom_mask {
|
||||
struct {
|
||||
bool olut:1;
|
||||
bool core:1;
|
||||
bool curs:1;
|
||||
bool view:1;
|
||||
bool mode:1;
|
||||
bool base:1;
|
||||
bool ovly:1;
|
||||
bool dither:1;
|
||||
bool procamp:1;
|
||||
bool or:1;
|
||||
};
|
||||
u16 mask;
|
||||
} set, clr;
|
||||
};
|
||||
|
||||
static inline struct nv50_head_atom *
|
||||
nv50_head_atom_get(struct drm_atomic_state *state, struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_crtc_state *statec = drm_atomic_get_crtc_state(state, crtc);
|
||||
if (IS_ERR(statec))
|
||||
return (void *)statec;
|
||||
return nv50_head_atom(statec);
|
||||
}
|
||||
|
||||
#define nv50_wndw_atom(p) container_of((p), struct nv50_wndw_atom, state)
|
||||
|
||||
struct nv50_wndw_atom {
|
||||
struct drm_plane_state state;
|
||||
|
||||
struct drm_property_blob *ilut;
|
||||
bool visible;
|
||||
|
||||
struct {
|
||||
u32 handle;
|
||||
u16 offset:12;
|
||||
bool awaken:1;
|
||||
} ntfy;
|
||||
|
||||
struct {
|
||||
u32 handle;
|
||||
u16 offset:12;
|
||||
u32 acquire;
|
||||
u32 release;
|
||||
} sema;
|
||||
|
||||
struct {
|
||||
u32 handle;
|
||||
struct {
|
||||
u64 offset:40;
|
||||
u8 buffer:1;
|
||||
u8 enable:2;
|
||||
u8 mode:4;
|
||||
u8 size:2;
|
||||
u8 range:2;
|
||||
u8 output_mode:2;
|
||||
} i;
|
||||
} xlut;
|
||||
|
||||
struct {
|
||||
u8 mode:2;
|
||||
u8 interval:4;
|
||||
|
||||
u8 colorspace:2;
|
||||
u8 format;
|
||||
u8 kind:7;
|
||||
u8 layout:1;
|
||||
u8 blockh:4;
|
||||
u16 blocks[3];
|
||||
u32 pitch[3];
|
||||
u16 w;
|
||||
u16 h;
|
||||
|
||||
u32 handle[6];
|
||||
u64 offset[6];
|
||||
} image;
|
||||
|
||||
struct {
|
||||
u16 sx;
|
||||
u16 sy;
|
||||
u16 sw;
|
||||
u16 sh;
|
||||
u16 dw;
|
||||
u16 dh;
|
||||
} scale;
|
||||
|
||||
struct {
|
||||
u16 x;
|
||||
u16 y;
|
||||
} point;
|
||||
|
||||
union nv50_wndw_atom_mask {
|
||||
struct {
|
||||
bool ntfy:1;
|
||||
bool sema:1;
|
||||
bool xlut:1;
|
||||
bool image:1;
|
||||
bool scale:1;
|
||||
bool point:1;
|
||||
};
|
||||
u8 mask;
|
||||
} set, clr;
|
||||
};
|
||||
#endif
|
||||
53
drivers/gpu/drm/nouveau/dispnv50/base.c
Normal file
53
drivers/gpu/drm/nouveau/dispnv50/base.c
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "base.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
int
|
||||
nv50_base_new(struct nouveau_drm *drm, int head, struct nv50_wndw **pwndw)
|
||||
{
|
||||
struct {
|
||||
s32 oclass;
|
||||
int version;
|
||||
int (*new)(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
} bases[] = {
|
||||
{ GK110_DISP_BASE_CHANNEL_DMA, 0, base917c_new },
|
||||
{ GK104_DISP_BASE_CHANNEL_DMA, 0, base917c_new },
|
||||
{ GF110_DISP_BASE_CHANNEL_DMA, 0, base907c_new },
|
||||
{ GT214_DISP_BASE_CHANNEL_DMA, 0, base827c_new },
|
||||
{ GT200_DISP_BASE_CHANNEL_DMA, 0, base827c_new },
|
||||
{ G82_DISP_BASE_CHANNEL_DMA, 0, base827c_new },
|
||||
{ NV50_DISP_BASE_CHANNEL_DMA, 0, base507c_new },
|
||||
{}
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
int cid;
|
||||
|
||||
cid = nvif_mclass(&disp->disp->object, bases);
|
||||
if (cid < 0) {
|
||||
NV_ERROR(drm, "No supported base class\n");
|
||||
return cid;
|
||||
}
|
||||
|
||||
return bases[cid].new(drm, head, bases[cid].oclass, pwndw);
|
||||
}
|
||||
31
drivers/gpu/drm/nouveau/dispnv50/base.h
Normal file
31
drivers/gpu/drm/nouveau/dispnv50/base.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef __NV50_KMS_BASE_H__
|
||||
#define __NV50_KMS_BASE_H__
|
||||
#include "wndw.h"
|
||||
|
||||
int base507c_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
int base507c_new_(const struct nv50_wndw_func *, const u32 *format,
|
||||
struct nouveau_drm *, int head, s32 oclass,
|
||||
u32 interlock_data, struct nv50_wndw **);
|
||||
extern const u32 base507c_format[];
|
||||
int base507c_acquire(struct nv50_wndw *, struct nv50_wndw_atom *,
|
||||
struct nv50_head_atom *);
|
||||
void base507c_release(struct nv50_wndw *, struct nv50_wndw_atom *,
|
||||
struct nv50_head_atom *);
|
||||
void base507c_sema_set(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
void base507c_sema_clr(struct nv50_wndw *);
|
||||
void base507c_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
void base507c_ntfy_clr(struct nv50_wndw *);
|
||||
void base507c_xlut_set(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
void base507c_xlut_clr(struct nv50_wndw *);
|
||||
void base507c_image_clr(struct nv50_wndw *);
|
||||
void base507c_update(struct nv50_wndw *, u32 *);
|
||||
|
||||
int base827c_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
|
||||
int base907c_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
extern const struct nv50_wndw_func base907c;
|
||||
|
||||
int base917c_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
|
||||
int nv50_base_new(struct nouveau_drm *, int head, struct nv50_wndw **);
|
||||
#endif
|
||||
286
drivers/gpu/drm/nouveau/dispnv50/base507c.c
Normal file
286
drivers/gpu/drm/nouveau/dispnv50/base507c.c
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "base.h"
|
||||
|
||||
#include <nvif/cl507c.h>
|
||||
#include <nvif/event.h>
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_plane_helper.h>
|
||||
#include "nouveau_bo.h"
|
||||
|
||||
void
|
||||
base507c_update(struct nv50_wndw *wndw, u32 *interlock)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x0080, 1);
|
||||
evo_data(push, interlock[NV50_DISP_INTERLOCK_CORE]);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
base507c_image_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 4))) {
|
||||
evo_mthd(push, 0x0084, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x00c0, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
base507c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 10))) {
|
||||
evo_mthd(push, 0x0084, 1);
|
||||
evo_data(push, asyw->image.mode << 8 |
|
||||
asyw->image.interval << 4);
|
||||
evo_mthd(push, 0x00c0, 1);
|
||||
evo_data(push, asyw->image.handle[0]);
|
||||
evo_mthd(push, 0x0800, 5);
|
||||
evo_data(push, asyw->image.offset[0] >> 8);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_data(push, asyw->image.h << 16 | asyw->image.w);
|
||||
evo_data(push, asyw->image.layout << 20 |
|
||||
(asyw->image.pitch[0] >> 8) << 8 |
|
||||
asyw->image.blocks[0] << 8 |
|
||||
asyw->image.blockh);
|
||||
evo_data(push, asyw->image.kind << 16 |
|
||||
asyw->image.format << 8);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
base507c_xlut_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x00e0, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
base507c_xlut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x00e0, 1);
|
||||
evo_data(push, 0x40000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
base507c_ntfy_wait_begun(struct nouveau_bo *bo, u32 offset,
|
||||
struct nvif_device *device)
|
||||
{
|
||||
s64 time = nvif_msec(device, 2000ULL,
|
||||
u32 data = nouveau_bo_rd32(bo, offset / 4);
|
||||
if ((data & 0xc0000000) == 0x40000000)
|
||||
break;
|
||||
usleep_range(1, 2);
|
||||
);
|
||||
return time < 0 ? time : 0;
|
||||
}
|
||||
|
||||
void
|
||||
base507c_ntfy_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x00a4, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
base507c_ntfy_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 3))) {
|
||||
evo_mthd(push, 0x00a0, 2);
|
||||
evo_data(push, asyw->ntfy.awaken << 30 | asyw->ntfy.offset);
|
||||
evo_data(push, asyw->ntfy.handle);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
base507c_ntfy_reset(struct nouveau_bo *bo, u32 offset)
|
||||
{
|
||||
nouveau_bo_wr32(bo, offset / 4, 0x00000000);
|
||||
}
|
||||
|
||||
void
|
||||
base507c_sema_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x0094, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
base507c_sema_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 5))) {
|
||||
evo_mthd(push, 0x0088, 4);
|
||||
evo_data(push, asyw->sema.offset);
|
||||
evo_data(push, asyw->sema.acquire);
|
||||
evo_data(push, asyw->sema.release);
|
||||
evo_data(push, asyw->sema.handle);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
base507c_release(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
asyh->base.cpp = 0;
|
||||
}
|
||||
|
||||
int
|
||||
base507c_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
const struct drm_framebuffer *fb = asyw->state.fb;
|
||||
int ret;
|
||||
|
||||
if (!fb->format->depth)
|
||||
return -EINVAL;
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
false, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!wndw->func->ilut) {
|
||||
if ((asyh->base.cpp != 1) ^ (fb->format->cpp[0] != 1))
|
||||
asyh->state.color_mgmt_changed = true;
|
||||
}
|
||||
|
||||
asyh->base.depth = fb->format->depth;
|
||||
asyh->base.cpp = fb->format->cpp[0];
|
||||
asyh->base.x = asyw->state.src.x1 >> 16;
|
||||
asyh->base.y = asyw->state.src.y1 >> 16;
|
||||
asyh->base.w = asyw->state.fb->width;
|
||||
asyh->base.h = asyw->state.fb->height;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const u32
|
||||
base507c_format[] = {
|
||||
DRM_FORMAT_C8,
|
||||
DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XRGB1555,
|
||||
DRM_FORMAT_ARGB1555,
|
||||
DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_XBGR2101010,
|
||||
DRM_FORMAT_ABGR2101010,
|
||||
DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_ABGR8888,
|
||||
0
|
||||
};
|
||||
|
||||
static const struct nv50_wndw_func
|
||||
base507c = {
|
||||
.acquire = base507c_acquire,
|
||||
.release = base507c_release,
|
||||
.sema_set = base507c_sema_set,
|
||||
.sema_clr = base507c_sema_clr,
|
||||
.ntfy_reset = base507c_ntfy_reset,
|
||||
.ntfy_set = base507c_ntfy_set,
|
||||
.ntfy_clr = base507c_ntfy_clr,
|
||||
.ntfy_wait_begun = base507c_ntfy_wait_begun,
|
||||
.olut_core = 1,
|
||||
.xlut_set = base507c_xlut_set,
|
||||
.xlut_clr = base507c_xlut_clr,
|
||||
.image_set = base507c_image_set,
|
||||
.image_clr = base507c_image_clr,
|
||||
.update = base507c_update,
|
||||
};
|
||||
|
||||
int
|
||||
base507c_new_(const struct nv50_wndw_func *func, const u32 *format,
|
||||
struct nouveau_drm *drm, int head, s32 oclass, u32 interlock_data,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
struct nv50_disp_base_channel_dma_v0 args = {
|
||||
.head = head,
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
struct nv50_wndw *wndw;
|
||||
int ret;
|
||||
|
||||
ret = nv50_wndw_new_(func, drm->dev, DRM_PLANE_TYPE_PRIMARY,
|
||||
"base", head, format, BIT(head),
|
||||
NV50_DISP_INTERLOCK_BASE, interlock_data, &wndw);
|
||||
if (*pwndw = wndw, ret)
|
||||
return ret;
|
||||
|
||||
ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
|
||||
&oclass, head, &args, sizeof(args),
|
||||
disp->sync->bo.offset, &wndw->wndw);
|
||||
if (ret) {
|
||||
NV_ERROR(drm, "base%04x allocation failed: %d\n", oclass, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = nvif_notify_init(&wndw->wndw.base.user, wndw->notify.func,
|
||||
false, NV50_DISP_BASE_CHANNEL_DMA_V0_NTFY_UEVENT,
|
||||
&(struct nvif_notify_uevent_req) {},
|
||||
sizeof(struct nvif_notify_uevent_req),
|
||||
sizeof(struct nvif_notify_uevent_rep),
|
||||
&wndw->notify);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
wndw->ntfy = NV50_DISP_BASE_NTFY(wndw->id);
|
||||
wndw->sema = NV50_DISP_BASE_SEM0(wndw->id);
|
||||
wndw->data = 0x00000000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
base507c_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return base507c_new_(&base507c, base507c_format, drm, head, oclass,
|
||||
0x00000002 << (head * 8), pwndw);
|
||||
}
|
||||
71
drivers/gpu/drm/nouveau/dispnv50/base827c.c
Normal file
71
drivers/gpu/drm/nouveau/dispnv50/base827c.c
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "base.h"
|
||||
|
||||
static void
|
||||
base827c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 10))) {
|
||||
evo_mthd(push, 0x0084, 1);
|
||||
evo_data(push, asyw->image.mode << 8 |
|
||||
asyw->image.interval << 4);
|
||||
evo_mthd(push, 0x00c0, 1);
|
||||
evo_data(push, asyw->image.handle[0]);
|
||||
evo_mthd(push, 0x0800, 5);
|
||||
evo_data(push, asyw->image.offset[0] >> 8);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_data(push, asyw->image.h << 16 | asyw->image.w);
|
||||
evo_data(push, asyw->image.layout << 20 |
|
||||
(asyw->image.pitch[0] >> 8) << 8 |
|
||||
asyw->image.blocks[0] << 8 |
|
||||
asyw->image.blockh);
|
||||
evo_data(push, asyw->image.format << 8);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct nv50_wndw_func
|
||||
base827c = {
|
||||
.acquire = base507c_acquire,
|
||||
.release = base507c_release,
|
||||
.sema_set = base507c_sema_set,
|
||||
.sema_clr = base507c_sema_clr,
|
||||
.ntfy_reset = base507c_ntfy_reset,
|
||||
.ntfy_set = base507c_ntfy_set,
|
||||
.ntfy_clr = base507c_ntfy_clr,
|
||||
.ntfy_wait_begun = base507c_ntfy_wait_begun,
|
||||
.olut_core = 1,
|
||||
.xlut_set = base507c_xlut_set,
|
||||
.xlut_clr = base507c_xlut_clr,
|
||||
.image_set = base827c_image_set,
|
||||
.image_clr = base507c_image_clr,
|
||||
.update = base507c_update,
|
||||
};
|
||||
|
||||
int
|
||||
base827c_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return base507c_new_(&base827c, base507c_format, drm, head, oclass,
|
||||
0x00000002 << (head * 8), pwndw);
|
||||
}
|
||||
110
drivers/gpu/drm/nouveau/dispnv50/base907c.c
Normal file
110
drivers/gpu/drm/nouveau/dispnv50/base907c.c
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "base.h"
|
||||
|
||||
static void
|
||||
base907c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 10))) {
|
||||
evo_mthd(push, 0x0084, 1);
|
||||
evo_data(push, asyw->image.mode << 8 |
|
||||
asyw->image.interval << 4);
|
||||
evo_mthd(push, 0x00c0, 1);
|
||||
evo_data(push, asyw->image.handle[0]);
|
||||
evo_mthd(push, 0x0400, 5);
|
||||
evo_data(push, asyw->image.offset[0] >> 8);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_data(push, asyw->image.h << 16 | asyw->image.w);
|
||||
evo_data(push, asyw->image.layout << 24 |
|
||||
(asyw->image.pitch[0] >> 8) << 8 |
|
||||
asyw->image.blocks[0] << 8 |
|
||||
asyw->image.blockh);
|
||||
evo_data(push, asyw->image.format << 8);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
base907c_xlut_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 6))) {
|
||||
evo_mthd(push, 0x00e0, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x00e8, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x00fc, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
base907c_xlut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 6))) {
|
||||
evo_mthd(push, 0x00e0, 3);
|
||||
evo_data(push, asyw->xlut.i.enable << 30 |
|
||||
asyw->xlut.i.mode << 24);
|
||||
evo_data(push, asyw->xlut.i.offset >> 8);
|
||||
evo_data(push, 0x40000000);
|
||||
evo_mthd(push, 0x00fc, 1);
|
||||
evo_data(push, asyw->xlut.handle);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
asyw->xlut.i.mode = 7;
|
||||
asyw->xlut.i.enable = 2;
|
||||
}
|
||||
|
||||
const struct nv50_wndw_func
|
||||
base907c = {
|
||||
.acquire = base507c_acquire,
|
||||
.release = base507c_release,
|
||||
.sema_set = base507c_sema_set,
|
||||
.sema_clr = base507c_sema_clr,
|
||||
.ntfy_reset = base507c_ntfy_reset,
|
||||
.ntfy_set = base507c_ntfy_set,
|
||||
.ntfy_clr = base507c_ntfy_clr,
|
||||
.ntfy_wait_begun = base507c_ntfy_wait_begun,
|
||||
.ilut = base907c_ilut,
|
||||
.olut_core = true,
|
||||
.xlut_set = base907c_xlut_set,
|
||||
.xlut_clr = base907c_xlut_clr,
|
||||
.image_set = base907c_image_set,
|
||||
.image_clr = base507c_image_clr,
|
||||
.update = base507c_update,
|
||||
};
|
||||
|
||||
int
|
||||
base907c_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return base507c_new_(&base907c, base507c_format, drm, head, oclass,
|
||||
0x00000002 << (head * 4), pwndw);
|
||||
}
|
||||
48
drivers/gpu/drm/nouveau/dispnv50/base917c.c
Normal file
48
drivers/gpu/drm/nouveau/dispnv50/base917c.c
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "base.h"
|
||||
#include "atom.h"
|
||||
|
||||
const u32
|
||||
base917c_format[] = {
|
||||
DRM_FORMAT_C8,
|
||||
DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XRGB1555,
|
||||
DRM_FORMAT_ARGB1555,
|
||||
DRM_FORMAT_XBGR2101010,
|
||||
DRM_FORMAT_ABGR2101010,
|
||||
DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_ABGR8888,
|
||||
DRM_FORMAT_XRGB2101010,
|
||||
DRM_FORMAT_ARGB2101010,
|
||||
0
|
||||
};
|
||||
|
||||
int
|
||||
base917c_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return base507c_new_(&base907c, base917c_format, drm, head, oclass,
|
||||
0x00000002 << (head * 4), pwndw);
|
||||
}
|
||||
70
drivers/gpu/drm/nouveau/dispnv50/core.c
Normal file
70
drivers/gpu/drm/nouveau/dispnv50/core.c
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "core.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
void
|
||||
nv50_core_del(struct nv50_core **pcore)
|
||||
{
|
||||
struct nv50_core *core = *pcore;
|
||||
if (core) {
|
||||
nv50_dmac_destroy(&core->chan);
|
||||
kfree(*pcore);
|
||||
*pcore = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
nv50_core_new(struct nouveau_drm *drm, struct nv50_core **pcore)
|
||||
{
|
||||
struct {
|
||||
s32 oclass;
|
||||
int version;
|
||||
int (*new)(struct nouveau_drm *, s32, struct nv50_core **);
|
||||
} cores[] = {
|
||||
{ GV100_DISP_CORE_CHANNEL_DMA, 0, corec37d_new },
|
||||
{ GP102_DISP_CORE_CHANNEL_DMA, 0, core917d_new },
|
||||
{ GP100_DISP_CORE_CHANNEL_DMA, 0, core917d_new },
|
||||
{ GM200_DISP_CORE_CHANNEL_DMA, 0, core917d_new },
|
||||
{ GM107_DISP_CORE_CHANNEL_DMA, 0, core917d_new },
|
||||
{ GK110_DISP_CORE_CHANNEL_DMA, 0, core917d_new },
|
||||
{ GK104_DISP_CORE_CHANNEL_DMA, 0, core917d_new },
|
||||
{ GF110_DISP_CORE_CHANNEL_DMA, 0, core907d_new },
|
||||
{ GT214_DISP_CORE_CHANNEL_DMA, 0, core827d_new },
|
||||
{ GT206_DISP_CORE_CHANNEL_DMA, 0, core827d_new },
|
||||
{ GT200_DISP_CORE_CHANNEL_DMA, 0, core827d_new },
|
||||
{ G82_DISP_CORE_CHANNEL_DMA, 0, core827d_new },
|
||||
{ NV50_DISP_CORE_CHANNEL_DMA, 0, core507d_new },
|
||||
{}
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
int cid;
|
||||
|
||||
cid = nvif_mclass(&disp->disp->object, cores);
|
||||
if (cid < 0) {
|
||||
NV_ERROR(drm, "No supported core channel class\n");
|
||||
return cid;
|
||||
}
|
||||
|
||||
return cores[cid].new(drm, cores[cid].oclass, pcore);
|
||||
}
|
||||
50
drivers/gpu/drm/nouveau/dispnv50/core.h
Normal file
50
drivers/gpu/drm/nouveau/dispnv50/core.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#ifndef __NV50_KMS_CORE_H__
|
||||
#define __NV50_KMS_CORE_H__
|
||||
#include "disp.h"
|
||||
#include "atom.h"
|
||||
|
||||
struct nv50_core {
|
||||
const struct nv50_core_func *func;
|
||||
struct nv50_dmac chan;
|
||||
};
|
||||
|
||||
int nv50_core_new(struct nouveau_drm *, struct nv50_core **);
|
||||
void nv50_core_del(struct nv50_core **);
|
||||
|
||||
struct nv50_core_func {
|
||||
void (*init)(struct nv50_core *);
|
||||
void (*ntfy_init)(struct nouveau_bo *, u32 offset);
|
||||
int (*ntfy_wait_done)(struct nouveau_bo *, u32 offset,
|
||||
struct nvif_device *);
|
||||
void (*update)(struct nv50_core *, u32 *interlock, bool ntfy);
|
||||
|
||||
const struct nv50_head_func *head;
|
||||
const struct nv50_outp_func {
|
||||
void (*ctrl)(struct nv50_core *, int or, u32 ctrl,
|
||||
struct nv50_head_atom *);
|
||||
} *dac, *pior, *sor;
|
||||
};
|
||||
|
||||
int core507d_new(struct nouveau_drm *, s32, struct nv50_core **);
|
||||
int core507d_new_(const struct nv50_core_func *, struct nouveau_drm *, s32,
|
||||
struct nv50_core **);
|
||||
void core507d_init(struct nv50_core *);
|
||||
void core507d_ntfy_init(struct nouveau_bo *, u32);
|
||||
int core507d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
|
||||
void core507d_update(struct nv50_core *, u32 *, bool);
|
||||
|
||||
extern const struct nv50_outp_func dac507d;
|
||||
extern const struct nv50_outp_func sor507d;
|
||||
extern const struct nv50_outp_func pior507d;
|
||||
|
||||
int core827d_new(struct nouveau_drm *, s32, struct nv50_core **);
|
||||
|
||||
int core907d_new(struct nouveau_drm *, s32, struct nv50_core **);
|
||||
extern const struct nv50_outp_func dac907d;
|
||||
extern const struct nv50_outp_func sor907d;
|
||||
|
||||
int core917d_new(struct nouveau_drm *, s32, struct nv50_core **);
|
||||
|
||||
int corec37d_new(struct nouveau_drm *, s32, struct nv50_core **);
|
||||
extern const struct nv50_outp_func sorc37d;
|
||||
#endif
|
||||
115
drivers/gpu/drm/nouveau/dispnv50/core507d.c
Normal file
115
drivers/gpu/drm/nouveau/dispnv50/core507d.c
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "core.h"
|
||||
#include "head.h"
|
||||
|
||||
#include <nvif/cl507d.h>
|
||||
|
||||
#include "nouveau_bo.h"
|
||||
|
||||
void
|
||||
core507d_update(struct nv50_core *core, u32 *interlock, bool ntfy)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&core->chan, 5))) {
|
||||
if (ntfy) {
|
||||
evo_mthd(push, 0x0084, 1);
|
||||
evo_data(push, 0x80000000 | NV50_DISP_CORE_NTFY);
|
||||
}
|
||||
evo_mthd(push, 0x0080, 2);
|
||||
evo_data(push, interlock[NV50_DISP_INTERLOCK_BASE] |
|
||||
interlock[NV50_DISP_INTERLOCK_OVLY]);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
core507d_ntfy_wait_done(struct nouveau_bo *bo, u32 offset,
|
||||
struct nvif_device *device)
|
||||
{
|
||||
s64 time = nvif_msec(device, 2000ULL,
|
||||
if (nouveau_bo_rd32(bo, offset / 4))
|
||||
break;
|
||||
usleep_range(1, 2);
|
||||
);
|
||||
return time < 0 ? time : 0;
|
||||
}
|
||||
|
||||
void
|
||||
core507d_ntfy_init(struct nouveau_bo *bo, u32 offset)
|
||||
{
|
||||
nouveau_bo_wr32(bo, offset / 4, 0x00000000);
|
||||
}
|
||||
|
||||
void
|
||||
core507d_init(struct nv50_core *core)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&core->chan, 2))) {
|
||||
evo_mthd(push, 0x0088, 1);
|
||||
evo_data(push, core->chan.sync.handle);
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct nv50_core_func
|
||||
core507d = {
|
||||
.init = core507d_init,
|
||||
.ntfy_init = core507d_ntfy_init,
|
||||
.ntfy_wait_done = core507d_ntfy_wait_done,
|
||||
.update = core507d_update,
|
||||
.head = &head507d,
|
||||
.dac = &dac507d,
|
||||
.sor = &sor507d,
|
||||
.pior = &pior507d,
|
||||
};
|
||||
|
||||
int
|
||||
core507d_new_(const struct nv50_core_func *func, struct nouveau_drm *drm,
|
||||
s32 oclass, struct nv50_core **pcore)
|
||||
{
|
||||
struct nv50_disp_core_channel_dma_v0 args = {};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
struct nv50_core *core;
|
||||
int ret;
|
||||
|
||||
if (!(core = *pcore = kzalloc(sizeof(*core), GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
core->func = func;
|
||||
|
||||
ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
|
||||
&oclass, 0, &args, sizeof(args),
|
||||
disp->sync->bo.offset, &core->chan);
|
||||
if (ret) {
|
||||
NV_ERROR(drm, "core%04x allocation failed: %d\n", oclass, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
core507d_new(struct nouveau_drm *drm, s32 oclass, struct nv50_core **pcore)
|
||||
{
|
||||
return core507d_new_(&core507d, drm, oclass, pcore);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat Inc.
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -18,21 +18,24 @@
|
|||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Ben Skeggs <bskeggs@redhat.com>
|
||||
*/
|
||||
#include "dmacnv50.h"
|
||||
#include "rootnv50.h"
|
||||
#include "core.h"
|
||||
#include "head.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
const struct nv50_disp_dmac_oclass
|
||||
gt200_disp_base_oclass = {
|
||||
.base.oclass = GT200_DISP_BASE_CHANNEL_DMA,
|
||||
.base.minver = 0,
|
||||
.base.maxver = 0,
|
||||
.ctor = nv50_disp_base_new,
|
||||
.func = &nv50_disp_dmac_func,
|
||||
.mthd = &g84_disp_base_chan_mthd,
|
||||
.chid = 1,
|
||||
static const struct nv50_core_func
|
||||
core827d = {
|
||||
.init = core507d_init,
|
||||
.ntfy_init = core507d_ntfy_init,
|
||||
.ntfy_wait_done = core507d_ntfy_wait_done,
|
||||
.update = core507d_update,
|
||||
.head = &head827d,
|
||||
.dac = &dac507d,
|
||||
.sor = &sor507d,
|
||||
.pior = &pior507d,
|
||||
};
|
||||
|
||||
int
|
||||
core827d_new(struct nouveau_drm *drm, s32 oclass, struct nv50_core **pcore)
|
||||
{
|
||||
return core507d_new_(&core827d, drm, oclass, pcore);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat Inc.
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -18,21 +18,23 @@
|
|||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Ben Skeggs <bskeggs@redhat.com>
|
||||
*/
|
||||
#include "dmacnv50.h"
|
||||
#include "rootnv50.h"
|
||||
#include "core.h"
|
||||
#include "head.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
const struct nv50_disp_dmac_oclass
|
||||
gk104_disp_base_oclass = {
|
||||
.base.oclass = GK104_DISP_BASE_CHANNEL_DMA,
|
||||
.base.minver = 0,
|
||||
.base.maxver = 0,
|
||||
.ctor = nv50_disp_base_new,
|
||||
.func = &gf119_disp_dmac_func,
|
||||
.mthd = &gf119_disp_base_chan_mthd,
|
||||
.chid = 1,
|
||||
static const struct nv50_core_func
|
||||
core907d = {
|
||||
.init = core507d_init,
|
||||
.ntfy_init = core507d_ntfy_init,
|
||||
.ntfy_wait_done = core507d_ntfy_wait_done,
|
||||
.update = core507d_update,
|
||||
.head = &head907d,
|
||||
.dac = &dac907d,
|
||||
.sor = &sor907d,
|
||||
};
|
||||
|
||||
int
|
||||
core907d_new(struct nouveau_drm *drm, s32 oclass, struct nv50_core **pcore)
|
||||
{
|
||||
return core507d_new_(&core907d, drm, oclass, pcore);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat Inc.
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -18,21 +18,23 @@
|
|||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Ben Skeggs <bskeggs@redhat.com>
|
||||
*/
|
||||
#include "dmacnv50.h"
|
||||
#include "rootnv50.h"
|
||||
#include "core.h"
|
||||
#include "head.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
const struct nv50_disp_dmac_oclass
|
||||
gk110_disp_base_oclass = {
|
||||
.base.oclass = GK110_DISP_BASE_CHANNEL_DMA,
|
||||
.base.minver = 0,
|
||||
.base.maxver = 0,
|
||||
.ctor = nv50_disp_base_new,
|
||||
.func = &gf119_disp_dmac_func,
|
||||
.mthd = &gf119_disp_base_chan_mthd,
|
||||
.chid = 1,
|
||||
static const struct nv50_core_func
|
||||
core917d = {
|
||||
.init = core507d_init,
|
||||
.ntfy_init = core507d_ntfy_init,
|
||||
.ntfy_wait_done = core507d_ntfy_wait_done,
|
||||
.update = core507d_update,
|
||||
.head = &head917d,
|
||||
.dac = &dac907d,
|
||||
.sor = &sor907d,
|
||||
};
|
||||
|
||||
int
|
||||
core917d_new(struct nouveau_drm *drm, s32 oclass, struct nv50_core **pcore)
|
||||
{
|
||||
return core507d_new_(&core917d, drm, oclass, pcore);
|
||||
}
|
||||
110
drivers/gpu/drm/nouveau/dispnv50/corec37d.c
Normal file
110
drivers/gpu/drm/nouveau/dispnv50/corec37d.c
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "core.h"
|
||||
#include "head.h"
|
||||
|
||||
#include <nouveau_bo.h>
|
||||
|
||||
static void
|
||||
corec37d_update(struct nv50_core *core, u32 *interlock, bool ntfy)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&core->chan, 9))) {
|
||||
if (ntfy) {
|
||||
evo_mthd(push, 0x020c, 1);
|
||||
evo_data(push, 0x00001000 | NV50_DISP_CORE_NTFY);
|
||||
}
|
||||
|
||||
evo_mthd(push, 0x0218, 2);
|
||||
evo_data(push, interlock[NV50_DISP_INTERLOCK_CURS]);
|
||||
evo_data(push, interlock[NV50_DISP_INTERLOCK_WNDW]);
|
||||
evo_mthd(push, 0x0200, 1);
|
||||
evo_data(push, 0x00000001);
|
||||
|
||||
if (ntfy) {
|
||||
evo_mthd(push, 0x020c, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
}
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
corec37d_ntfy_wait_done(struct nouveau_bo *bo, u32 offset,
|
||||
struct nvif_device *device)
|
||||
{
|
||||
u32 data;
|
||||
s64 time = nvif_msec(device, 2000ULL,
|
||||
data = nouveau_bo_rd32(bo, offset / 4 + 0);
|
||||
if ((data & 0xc0000000) == 0x80000000)
|
||||
break;
|
||||
usleep_range(1, 2);
|
||||
);
|
||||
return time < 0 ? time : 0;
|
||||
}
|
||||
|
||||
void
|
||||
corec37d_ntfy_init(struct nouveau_bo *bo, u32 offset)
|
||||
{
|
||||
nouveau_bo_wr32(bo, offset / 4 + 0, 0x00000000);
|
||||
nouveau_bo_wr32(bo, offset / 4 + 1, 0x00000000);
|
||||
nouveau_bo_wr32(bo, offset / 4 + 2, 0x00000000);
|
||||
nouveau_bo_wr32(bo, offset / 4 + 3, 0x00000000);
|
||||
}
|
||||
|
||||
void
|
||||
corec37d_init(struct nv50_core *core)
|
||||
{
|
||||
const u32 windows = 8; /*XXX*/
|
||||
u32 *push, i;
|
||||
if ((push = evo_wait(&core->chan, 2 + 6 * windows + 2))) {
|
||||
evo_mthd(push, 0x0208, 1);
|
||||
evo_data(push, core->chan.sync.handle);
|
||||
for (i = 0; i < windows; i++) {
|
||||
evo_mthd(push, 0x1000 + (i * 0x080), 3);
|
||||
evo_data(push, i >> 1);
|
||||
evo_data(push, 0x00000017);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x1010 + (i * 0x080), 1);
|
||||
evo_data(push, 0x00127fff);
|
||||
}
|
||||
evo_mthd(push, 0x0200, 1);
|
||||
evo_data(push, 0x00000001);
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct nv50_core_func
|
||||
corec37d = {
|
||||
.init = corec37d_init,
|
||||
.ntfy_init = corec37d_ntfy_init,
|
||||
.ntfy_wait_done = corec37d_ntfy_wait_done,
|
||||
.update = corec37d_update,
|
||||
.head = &headc37d,
|
||||
.sor = &sorc37d,
|
||||
};
|
||||
|
||||
int
|
||||
corec37d_new(struct nouveau_drm *drm, s32 oclass, struct nv50_core **pcore)
|
||||
{
|
||||
return core507d_new_(&corec37d, drm, oclass, pcore);
|
||||
}
|
||||
52
drivers/gpu/drm/nouveau/dispnv50/curs.c
Normal file
52
drivers/gpu/drm/nouveau/dispnv50/curs.c
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "curs.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
int
|
||||
nv50_curs_new(struct nouveau_drm *drm, int head, struct nv50_wndw **pwndw)
|
||||
{
|
||||
struct {
|
||||
s32 oclass;
|
||||
int version;
|
||||
int (*new)(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
} curses[] = {
|
||||
{ GV100_DISP_CURSOR, 0, cursc37a_new },
|
||||
{ GK104_DISP_CURSOR, 0, curs907a_new },
|
||||
{ GF110_DISP_CURSOR, 0, curs907a_new },
|
||||
{ GT214_DISP_CURSOR, 0, curs507a_new },
|
||||
{ G82_DISP_CURSOR, 0, curs507a_new },
|
||||
{ NV50_DISP_CURSOR, 0, curs507a_new },
|
||||
{}
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
int cid;
|
||||
|
||||
cid = nvif_mclass(&disp->disp->object, curses);
|
||||
if (cid < 0) {
|
||||
NV_ERROR(drm, "No supported cursor immediate class\n");
|
||||
return cid;
|
||||
}
|
||||
|
||||
return curses[cid].new(drm, head, curses[cid].oclass, pwndw);
|
||||
}
|
||||
14
drivers/gpu/drm/nouveau/dispnv50/curs.h
Normal file
14
drivers/gpu/drm/nouveau/dispnv50/curs.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __NV50_KMS_CURS_H__
|
||||
#define __NV50_KMS_CURS_H__
|
||||
#include "wndw.h"
|
||||
|
||||
int curs507a_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
int curs507a_new_(const struct nv50_wimm_func *, struct nouveau_drm *,
|
||||
int head, s32 oclass, u32 interlock_data,
|
||||
struct nv50_wndw **);
|
||||
|
||||
int curs907a_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
int cursc37a_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
|
||||
int nv50_curs_new(struct nouveau_drm *, int head, struct nv50_wndw **);
|
||||
#endif
|
||||
145
drivers/gpu/drm/nouveau/dispnv50/curs507a.c
Normal file
145
drivers/gpu/drm/nouveau/dispnv50/curs507a.c
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "curs.h"
|
||||
#include "core.h"
|
||||
#include "head.h"
|
||||
|
||||
#include <nvif/cl507a.h>
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_plane_helper.h>
|
||||
|
||||
static void
|
||||
curs507a_update(struct nv50_wndw *wndw, u32 *interlock)
|
||||
{
|
||||
nvif_wr32(&wndw->wimm.base.user, 0x0080, 0x00000000);
|
||||
}
|
||||
|
||||
static void
|
||||
curs507a_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
nvif_wr32(&wndw->wimm.base.user, 0x0084, asyw->point.y << 16 |
|
||||
asyw->point.x);
|
||||
}
|
||||
|
||||
const struct nv50_wimm_func
|
||||
curs507a = {
|
||||
.point = curs507a_point,
|
||||
.update = curs507a_update,
|
||||
};
|
||||
|
||||
static void
|
||||
curs507a_prepare(struct nv50_wndw *wndw, struct nv50_head_atom *asyh,
|
||||
struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 handle = nv50_disp(wndw->plane.dev)->core->chan.vram.handle;
|
||||
u32 offset = asyw->image.offset[0];
|
||||
if (asyh->curs.handle != handle || asyh->curs.offset != offset) {
|
||||
asyh->curs.handle = handle;
|
||||
asyh->curs.offset = offset;
|
||||
asyh->set.curs = asyh->curs.visible;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
curs507a_release(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
asyh->curs.visible = false;
|
||||
}
|
||||
|
||||
static int
|
||||
curs507a_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_head *head = nv50_head(asyw->state.crtc);
|
||||
int ret;
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
true, true);
|
||||
asyh->curs.visible = asyw->state.visible;
|
||||
if (ret || !asyh->curs.visible)
|
||||
return ret;
|
||||
|
||||
if (asyw->image.w != asyw->image.h)
|
||||
return -EINVAL;
|
||||
|
||||
ret = head->func->curs_layout(head, asyw, asyh);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return head->func->curs_format(head, asyw, asyh);
|
||||
}
|
||||
|
||||
static const u32
|
||||
curs507a_format[] = {
|
||||
DRM_FORMAT_ARGB8888,
|
||||
0
|
||||
};
|
||||
|
||||
static const struct nv50_wndw_func
|
||||
curs507a_wndw = {
|
||||
.acquire = curs507a_acquire,
|
||||
.release = curs507a_release,
|
||||
.prepare = curs507a_prepare,
|
||||
};
|
||||
|
||||
int
|
||||
curs507a_new_(const struct nv50_wimm_func *func, struct nouveau_drm *drm,
|
||||
int head, s32 oclass, u32 interlock_data,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
struct nv50_disp_cursor_v0 args = {
|
||||
.head = head,
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
struct nv50_wndw *wndw;
|
||||
int ret;
|
||||
|
||||
ret = nv50_wndw_new_(&curs507a_wndw, drm->dev, DRM_PLANE_TYPE_CURSOR,
|
||||
"curs", head, curs507a_format, BIT(head),
|
||||
NV50_DISP_INTERLOCK_CURS, interlock_data, &wndw);
|
||||
if (*pwndw = wndw, ret)
|
||||
return ret;
|
||||
|
||||
ret = nvif_object_init(&disp->disp->object, 0, oclass, &args,
|
||||
sizeof(args), &wndw->wimm.base.user);
|
||||
if (ret) {
|
||||
NV_ERROR(drm, "curs%04x allocation failed: %d\n", oclass, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
nvif_object_map(&wndw->wimm.base.user, NULL, 0);
|
||||
wndw->immd = func;
|
||||
wndw->ctxdma.parent = &disp->core->chan.base.user;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
curs507a_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return curs507a_new_(&curs507a, drm, head, oclass,
|
||||
0x00000001 << (head * 8), pwndw);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat Inc.
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -18,17 +18,13 @@
|
|||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Ben Skeggs
|
||||
*/
|
||||
#include "changk104.h"
|
||||
#include "curs.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
const struct nvkm_fifo_chan_oclass
|
||||
gk110_fifo_gpfifo_oclass = {
|
||||
.base.oclass = KEPLER_CHANNEL_GPFIFO_B,
|
||||
.base.minver = 0,
|
||||
.base.maxver = 0,
|
||||
.ctor = gk104_fifo_gpfifo_new,
|
||||
};
|
||||
int
|
||||
curs907a_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return curs507a_new_(&curs507a, drm, head, oclass,
|
||||
0x00000001 << (head * 4), pwndw);
|
||||
}
|
||||
50
drivers/gpu/drm/nouveau/dispnv50/cursc37a.c
Normal file
50
drivers/gpu/drm/nouveau/dispnv50/cursc37a.c
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "curs.h"
|
||||
#include "atom.h"
|
||||
|
||||
static void
|
||||
cursc37a_update(struct nv50_wndw *wndw, u32 *interlock)
|
||||
{
|
||||
nvif_wr32(&wndw->wimm.base.user, 0x0200, 0x00000001);
|
||||
}
|
||||
|
||||
static void
|
||||
cursc37a_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
nvif_wr32(&wndw->wimm.base.user, 0x0208, asyw->point.y << 16 |
|
||||
asyw->point.x);
|
||||
}
|
||||
|
||||
static const struct nv50_wimm_func
|
||||
cursc37a = {
|
||||
.point = cursc37a_point,
|
||||
.update = cursc37a_update,
|
||||
};
|
||||
|
||||
int
|
||||
cursc37a_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return curs507a_new_(&cursc37a, drm, head, oclass,
|
||||
0x00000001 << head, pwndw);
|
||||
}
|
||||
44
drivers/gpu/drm/nouveau/dispnv50/dac507d.c
Normal file
44
drivers/gpu/drm/nouveau/dispnv50/dac507d.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "core.h"
|
||||
|
||||
static void
|
||||
dac507d_ctrl(struct nv50_core *core, int or, u32 ctrl,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
u32 *push, sync = 0;
|
||||
if ((push = evo_wait(&core->chan, 3))) {
|
||||
if (asyh) {
|
||||
sync |= asyh->or.nvsync << 1;
|
||||
sync |= asyh->or.nhsync;
|
||||
}
|
||||
evo_mthd(push, 0x0400 + (or * 0x080), 2);
|
||||
evo_data(push, ctrl);
|
||||
evo_data(push, sync);
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_outp_func
|
||||
dac507d = {
|
||||
.ctrl = dac507d_ctrl,
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat Inc.
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -18,20 +18,22 @@
|
|||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Ben Skeggs <bskeggs@redhat.com>
|
||||
*/
|
||||
#include "channv50.h"
|
||||
#include "rootnv50.h"
|
||||
#include "core.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
static void
|
||||
dac907d_ctrl(struct nv50_core *core, int or, u32 ctrl,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&core->chan, 2))) {
|
||||
evo_mthd(push, 0x0180 + (or * 0x020), 1);
|
||||
evo_data(push, ctrl);
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_disp_pioc_oclass
|
||||
gt215_disp_curs_oclass = {
|
||||
.base.oclass = GT214_DISP_CURSOR,
|
||||
.base.minver = 0,
|
||||
.base.maxver = 0,
|
||||
.ctor = nv50_disp_curs_new,
|
||||
.func = &nv50_disp_pioc_func,
|
||||
.chid = { 7, 7 },
|
||||
const struct nv50_outp_func
|
||||
dac907d = {
|
||||
.ctrl = dac907d_ctrl,
|
||||
};
|
||||
2238
drivers/gpu/drm/nouveau/dispnv50/disp.c
Normal file
2238
drivers/gpu/drm/nouveau/dispnv50/disp.c
Normal file
File diff suppressed because it is too large
Load diff
89
drivers/gpu/drm/nouveau/dispnv50/disp.h
Normal file
89
drivers/gpu/drm/nouveau/dispnv50/disp.h
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#ifndef __NV50_KMS_H__
|
||||
#define __NV50_KMS_H__
|
||||
#include <nvif/mem.h>
|
||||
|
||||
#include "nouveau_display.h"
|
||||
|
||||
struct nv50_disp {
|
||||
struct nvif_disp *disp;
|
||||
struct nv50_core *core;
|
||||
|
||||
#define NV50_DISP_SYNC(c, o) ((c) * 0x040 + (o))
|
||||
#define NV50_DISP_CORE_NTFY NV50_DISP_SYNC(0 , 0x00)
|
||||
#define NV50_DISP_WNDW_SEM0(c) NV50_DISP_SYNC(1 + (c), 0x00)
|
||||
#define NV50_DISP_WNDW_SEM1(c) NV50_DISP_SYNC(1 + (c), 0x10)
|
||||
#define NV50_DISP_WNDW_NTFY(c) NV50_DISP_SYNC(1 + (c), 0x20)
|
||||
#define NV50_DISP_BASE_SEM0(c) NV50_DISP_WNDW_SEM0(0 + (c))
|
||||
#define NV50_DISP_BASE_SEM1(c) NV50_DISP_WNDW_SEM1(0 + (c))
|
||||
#define NV50_DISP_BASE_NTFY(c) NV50_DISP_WNDW_NTFY(0 + (c))
|
||||
#define NV50_DISP_OVLY_SEM0(c) NV50_DISP_WNDW_SEM0(4 + (c))
|
||||
#define NV50_DISP_OVLY_SEM1(c) NV50_DISP_WNDW_SEM1(4 + (c))
|
||||
#define NV50_DISP_OVLY_NTFY(c) NV50_DISP_WNDW_NTFY(4 + (c))
|
||||
struct nouveau_bo *sync;
|
||||
|
||||
struct mutex mutex;
|
||||
};
|
||||
|
||||
static inline struct nv50_disp *
|
||||
nv50_disp(struct drm_device *dev)
|
||||
{
|
||||
return nouveau_display(dev)->priv;
|
||||
}
|
||||
|
||||
struct nv50_disp_interlock {
|
||||
enum nv50_disp_interlock_type {
|
||||
NV50_DISP_INTERLOCK_CORE = 0,
|
||||
NV50_DISP_INTERLOCK_CURS,
|
||||
NV50_DISP_INTERLOCK_BASE,
|
||||
NV50_DISP_INTERLOCK_OVLY,
|
||||
NV50_DISP_INTERLOCK_WNDW,
|
||||
NV50_DISP_INTERLOCK_WIMM,
|
||||
NV50_DISP_INTERLOCK__SIZE
|
||||
} type;
|
||||
u32 data;
|
||||
};
|
||||
|
||||
void corec37d_ntfy_init(struct nouveau_bo *, u32);
|
||||
|
||||
struct nv50_chan {
|
||||
struct nvif_object user;
|
||||
struct nvif_device *device;
|
||||
};
|
||||
|
||||
struct nv50_dmac {
|
||||
struct nv50_chan base;
|
||||
|
||||
struct nvif_mem push;
|
||||
u32 *ptr;
|
||||
|
||||
struct nvif_object sync;
|
||||
struct nvif_object vram;
|
||||
|
||||
/* Protects against concurrent pushbuf access to this channel, lock is
|
||||
* grabbed by evo_wait (if the pushbuf reservation is successful) and
|
||||
* dropped again by evo_kick. */
|
||||
struct mutex lock;
|
||||
};
|
||||
|
||||
int nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp,
|
||||
const s32 *oclass, u8 head, void *data, u32 size,
|
||||
u64 syncbuf, struct nv50_dmac *dmac);
|
||||
void nv50_dmac_destroy(struct nv50_dmac *);
|
||||
|
||||
u32 *evo_wait(struct nv50_dmac *, int nr);
|
||||
void evo_kick(u32 *, struct nv50_dmac *);
|
||||
|
||||
#define evo_mthd(p, m, s) do { \
|
||||
const u32 _m = (m), _s = (s); \
|
||||
if (drm_debug & DRM_UT_KMS) \
|
||||
pr_err("%04x %d %s\n", _m, _s, __func__); \
|
||||
*((p)++) = ((_s << 18) | _m); \
|
||||
} while(0)
|
||||
|
||||
#define evo_data(p, d) do { \
|
||||
const u32 _d = (d); \
|
||||
if (drm_debug & DRM_UT_KMS) \
|
||||
pr_err("\t%08x\n", _d); \
|
||||
*((p)++) = _d; \
|
||||
} while(0)
|
||||
#endif
|
||||
511
drivers/gpu/drm/nouveau/dispnv50/head.c
Normal file
511
drivers/gpu/drm/nouveau/dispnv50/head.c
Normal file
|
|
@ -0,0 +1,511 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "head.h"
|
||||
#include "base.h"
|
||||
#include "core.h"
|
||||
#include "curs.h"
|
||||
#include "ovly.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include "nouveau_connector.h"
|
||||
void
|
||||
nv50_head_flush_clr(struct nv50_head *head,
|
||||
struct nv50_head_atom *asyh, bool flush)
|
||||
{
|
||||
union nv50_head_atom_mask clr = {
|
||||
.mask = asyh->clr.mask & ~(flush ? 0 : asyh->set.mask),
|
||||
};
|
||||
if (clr.olut) head->func->olut_clr(head);
|
||||
if (clr.core) head->func->core_clr(head);
|
||||
if (clr.curs) head->func->curs_clr(head);
|
||||
}
|
||||
|
||||
void
|
||||
nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
if (asyh->set.view ) head->func->view (head, asyh);
|
||||
if (asyh->set.mode ) head->func->mode (head, asyh);
|
||||
if (asyh->set.core ) head->func->core_set(head, asyh);
|
||||
if (asyh->set.olut ) {
|
||||
asyh->olut.offset = nv50_lut_load(&head->olut,
|
||||
asyh->olut.mode <= 1,
|
||||
asyh->olut.buffer,
|
||||
asyh->state.gamma_lut);
|
||||
head->func->olut_set(head, asyh);
|
||||
}
|
||||
if (asyh->set.curs ) head->func->curs_set(head, asyh);
|
||||
if (asyh->set.base ) head->func->base (head, asyh);
|
||||
if (asyh->set.ovly ) head->func->ovly (head, asyh);
|
||||
if (asyh->set.dither ) head->func->dither (head, asyh);
|
||||
if (asyh->set.procamp) head->func->procamp (head, asyh);
|
||||
if (asyh->set.or ) head->func->or (head, asyh);
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_head_atomic_check_procamp(struct nv50_head_atom *armh,
|
||||
struct nv50_head_atom *asyh,
|
||||
struct nouveau_conn_atom *asyc)
|
||||
{
|
||||
const int vib = asyc->procamp.color_vibrance - 100;
|
||||
const int hue = asyc->procamp.vibrant_hue - 90;
|
||||
const int adj = (vib > 0) ? 50 : 0;
|
||||
asyh->procamp.sat.cos = ((vib * 2047 + adj) / 100) & 0xfff;
|
||||
asyh->procamp.sat.sin = ((hue * 2047) / 100) & 0xfff;
|
||||
asyh->set.procamp = true;
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_head_atomic_check_dither(struct nv50_head_atom *armh,
|
||||
struct nv50_head_atom *asyh,
|
||||
struct nouveau_conn_atom *asyc)
|
||||
{
|
||||
struct drm_connector *connector = asyc->state.connector;
|
||||
u32 mode = 0x00;
|
||||
|
||||
if (asyc->dither.mode == DITHERING_MODE_AUTO) {
|
||||
if (asyh->base.depth > connector->display_info.bpc * 3)
|
||||
mode = DITHERING_MODE_DYNAMIC2X2;
|
||||
} else {
|
||||
mode = asyc->dither.mode;
|
||||
}
|
||||
|
||||
if (asyc->dither.depth == DITHERING_DEPTH_AUTO) {
|
||||
if (connector->display_info.bpc >= 8)
|
||||
mode |= DITHERING_DEPTH_8BPC;
|
||||
} else {
|
||||
mode |= asyc->dither.depth;
|
||||
}
|
||||
|
||||
asyh->dither.enable = mode;
|
||||
asyh->dither.bits = mode >> 1;
|
||||
asyh->dither.mode = mode >> 3;
|
||||
asyh->set.dither = true;
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_head_atomic_check_view(struct nv50_head_atom *armh,
|
||||
struct nv50_head_atom *asyh,
|
||||
struct nouveau_conn_atom *asyc)
|
||||
{
|
||||
struct drm_connector *connector = asyc->state.connector;
|
||||
struct drm_display_mode *omode = &asyh->state.adjusted_mode;
|
||||
struct drm_display_mode *umode = &asyh->state.mode;
|
||||
int mode = asyc->scaler.mode;
|
||||
struct edid *edid;
|
||||
int umode_vdisplay, omode_hdisplay, omode_vdisplay;
|
||||
|
||||
if (connector->edid_blob_ptr)
|
||||
edid = (struct edid *)connector->edid_blob_ptr->data;
|
||||
else
|
||||
edid = NULL;
|
||||
|
||||
if (!asyc->scaler.full) {
|
||||
if (mode == DRM_MODE_SCALE_NONE)
|
||||
omode = umode;
|
||||
} else {
|
||||
/* Non-EDID LVDS/eDP mode. */
|
||||
mode = DRM_MODE_SCALE_FULLSCREEN;
|
||||
}
|
||||
|
||||
/* For the user-specified mode, we must ignore doublescan and
|
||||
* the like, but honor frame packing.
|
||||
*/
|
||||
umode_vdisplay = umode->vdisplay;
|
||||
if ((umode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
|
||||
umode_vdisplay += umode->vtotal;
|
||||
asyh->view.iW = umode->hdisplay;
|
||||
asyh->view.iH = umode_vdisplay;
|
||||
/* For the output mode, we can just use the stock helper. */
|
||||
drm_mode_get_hv_timing(omode, &omode_hdisplay, &omode_vdisplay);
|
||||
asyh->view.oW = omode_hdisplay;
|
||||
asyh->view.oH = omode_vdisplay;
|
||||
|
||||
/* Add overscan compensation if necessary, will keep the aspect
|
||||
* ratio the same as the backend mode unless overridden by the
|
||||
* user setting both hborder and vborder properties.
|
||||
*/
|
||||
if ((asyc->scaler.underscan.mode == UNDERSCAN_ON ||
|
||||
(asyc->scaler.underscan.mode == UNDERSCAN_AUTO &&
|
||||
drm_detect_hdmi_monitor(edid)))) {
|
||||
u32 bX = asyc->scaler.underscan.hborder;
|
||||
u32 bY = asyc->scaler.underscan.vborder;
|
||||
u32 r = (asyh->view.oH << 19) / asyh->view.oW;
|
||||
|
||||
if (bX) {
|
||||
asyh->view.oW -= (bX * 2);
|
||||
if (bY) asyh->view.oH -= (bY * 2);
|
||||
else asyh->view.oH = ((asyh->view.oW * r) + (r / 2)) >> 19;
|
||||
} else {
|
||||
asyh->view.oW -= (asyh->view.oW >> 4) + 32;
|
||||
if (bY) asyh->view.oH -= (bY * 2);
|
||||
else asyh->view.oH = ((asyh->view.oW * r) + (r / 2)) >> 19;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle CENTER/ASPECT scaling, taking into account the areas
|
||||
* removed already for overscan compensation.
|
||||
*/
|
||||
switch (mode) {
|
||||
case DRM_MODE_SCALE_CENTER:
|
||||
asyh->view.oW = min((u16)umode->hdisplay, asyh->view.oW);
|
||||
asyh->view.oH = min((u16)umode_vdisplay, asyh->view.oH);
|
||||
/* fall-through */
|
||||
case DRM_MODE_SCALE_ASPECT:
|
||||
if (asyh->view.oH < asyh->view.oW) {
|
||||
u32 r = (asyh->view.iW << 19) / asyh->view.iH;
|
||||
asyh->view.oW = ((asyh->view.oH * r) + (r / 2)) >> 19;
|
||||
} else {
|
||||
u32 r = (asyh->view.iH << 19) / asyh->view.iW;
|
||||
asyh->view.oH = ((asyh->view.oW * r) + (r / 2)) >> 19;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
asyh->set.view = true;
|
||||
}
|
||||
|
||||
static int
|
||||
nv50_head_atomic_check_lut(struct nv50_head *head,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_disp *disp = nv50_disp(head->base.base.dev);
|
||||
struct drm_property_blob *olut = asyh->state.gamma_lut;
|
||||
|
||||
/* Determine whether core output LUT should be enabled. */
|
||||
if (olut) {
|
||||
/* Check if any window(s) have stolen the core output LUT
|
||||
* to as an input LUT for legacy gamma + I8 colour format.
|
||||
*/
|
||||
if (asyh->wndw.olut) {
|
||||
/* If any window has stolen the core output LUT,
|
||||
* all of them must.
|
||||
*/
|
||||
if (asyh->wndw.olut != asyh->wndw.mask)
|
||||
return -EINVAL;
|
||||
olut = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!olut) {
|
||||
asyh->olut.handle = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
asyh->olut.handle = disp->core->chan.vram.handle;
|
||||
asyh->olut.buffer = !asyh->olut.buffer;
|
||||
head->func->olut(head, asyh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_head_atomic_check_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct drm_display_mode *mode = &asyh->state.adjusted_mode;
|
||||
struct nv50_head_mode *m = &asyh->mode;
|
||||
u32 blankus;
|
||||
|
||||
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V | CRTC_STEREO_DOUBLE);
|
||||
|
||||
/*
|
||||
* DRM modes are defined in terms of a repeating interval
|
||||
* starting with the active display area. The hardware modes
|
||||
* are defined in terms of a repeating interval starting one
|
||||
* unit (pixel or line) into the sync pulse. So, add bias.
|
||||
*/
|
||||
|
||||
m->h.active = mode->crtc_htotal;
|
||||
m->h.synce = mode->crtc_hsync_end - mode->crtc_hsync_start - 1;
|
||||
m->h.blanke = mode->crtc_hblank_end - mode->crtc_hsync_start - 1;
|
||||
m->h.blanks = m->h.blanke + mode->crtc_hdisplay;
|
||||
|
||||
m->v.active = mode->crtc_vtotal;
|
||||
m->v.synce = mode->crtc_vsync_end - mode->crtc_vsync_start - 1;
|
||||
m->v.blanke = mode->crtc_vblank_end - mode->crtc_vsync_start - 1;
|
||||
m->v.blanks = m->v.blanke + mode->crtc_vdisplay;
|
||||
|
||||
/*XXX: Safe underestimate, even "0" works */
|
||||
blankus = (m->v.active - mode->crtc_vdisplay - 2) * m->h.active;
|
||||
blankus *= 1000;
|
||||
blankus /= mode->crtc_clock;
|
||||
m->v.blankus = blankus;
|
||||
|
||||
if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
|
||||
m->v.blank2e = m->v.active + m->v.blanke;
|
||||
m->v.blank2s = m->v.blank2e + mode->crtc_vdisplay;
|
||||
m->v.active = (m->v.active * 2) + 1;
|
||||
m->interlace = true;
|
||||
} else {
|
||||
m->v.blank2e = 0;
|
||||
m->v.blank2s = 1;
|
||||
m->interlace = false;
|
||||
}
|
||||
m->clock = mode->crtc_clock;
|
||||
|
||||
asyh->or.nhsync = !!(mode->flags & DRM_MODE_FLAG_NHSYNC);
|
||||
asyh->or.nvsync = !!(mode->flags & DRM_MODE_FLAG_NVSYNC);
|
||||
asyh->set.or = head->func->or != NULL;
|
||||
asyh->set.mode = true;
|
||||
}
|
||||
|
||||
static int
|
||||
nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
|
||||
{
|
||||
struct nouveau_drm *drm = nouveau_drm(crtc->dev);
|
||||
struct nv50_head *head = nv50_head(crtc);
|
||||
struct nv50_head_atom *armh = nv50_head_atom(crtc->state);
|
||||
struct nv50_head_atom *asyh = nv50_head_atom(state);
|
||||
struct nouveau_conn_atom *asyc = NULL;
|
||||
struct drm_connector_state *conns;
|
||||
struct drm_connector *conn;
|
||||
int i;
|
||||
|
||||
NV_ATOMIC(drm, "%s atomic_check %d\n", crtc->name, asyh->state.active);
|
||||
if (asyh->state.active) {
|
||||
for_each_new_connector_in_state(asyh->state.state, conn, conns, i) {
|
||||
if (conns->crtc == crtc) {
|
||||
asyc = nouveau_conn_atom(conns);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (armh->state.active) {
|
||||
if (asyc) {
|
||||
if (asyh->state.mode_changed)
|
||||
asyc->set.scaler = true;
|
||||
if (armh->base.depth != asyh->base.depth)
|
||||
asyc->set.dither = true;
|
||||
}
|
||||
} else {
|
||||
if (asyc)
|
||||
asyc->set.mask = ~0;
|
||||
asyh->set.mask = ~0;
|
||||
asyh->set.or = head->func->or != NULL;
|
||||
}
|
||||
|
||||
if (asyh->state.mode_changed)
|
||||
nv50_head_atomic_check_mode(head, asyh);
|
||||
|
||||
if (asyh->state.color_mgmt_changed ||
|
||||
memcmp(&armh->wndw, &asyh->wndw, sizeof(asyh->wndw))) {
|
||||
int ret = nv50_head_atomic_check_lut(head, asyh);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
asyh->olut.visible = asyh->olut.handle != 0;
|
||||
}
|
||||
|
||||
if (asyc) {
|
||||
if (asyc->set.scaler)
|
||||
nv50_head_atomic_check_view(armh, asyh, asyc);
|
||||
if (asyc->set.dither)
|
||||
nv50_head_atomic_check_dither(armh, asyh, asyc);
|
||||
if (asyc->set.procamp)
|
||||
nv50_head_atomic_check_procamp(armh, asyh, asyc);
|
||||
}
|
||||
|
||||
if (head->func->core_calc) {
|
||||
head->func->core_calc(head, asyh);
|
||||
if (!asyh->core.visible)
|
||||
asyh->olut.visible = false;
|
||||
}
|
||||
|
||||
asyh->set.base = armh->base.cpp != asyh->base.cpp;
|
||||
asyh->set.ovly = armh->ovly.cpp != asyh->ovly.cpp;
|
||||
} else {
|
||||
asyh->olut.visible = false;
|
||||
asyh->core.visible = false;
|
||||
asyh->curs.visible = false;
|
||||
asyh->base.cpp = 0;
|
||||
asyh->ovly.cpp = 0;
|
||||
}
|
||||
|
||||
if (!drm_atomic_crtc_needs_modeset(&asyh->state)) {
|
||||
if (asyh->core.visible) {
|
||||
if (memcmp(&armh->core, &asyh->core, sizeof(asyh->core)))
|
||||
asyh->set.core = true;
|
||||
} else
|
||||
if (armh->core.visible) {
|
||||
asyh->clr.core = true;
|
||||
}
|
||||
|
||||
if (asyh->curs.visible) {
|
||||
if (memcmp(&armh->curs, &asyh->curs, sizeof(asyh->curs)))
|
||||
asyh->set.curs = true;
|
||||
} else
|
||||
if (armh->curs.visible) {
|
||||
asyh->clr.curs = true;
|
||||
}
|
||||
|
||||
if (asyh->olut.visible) {
|
||||
if (memcmp(&armh->olut, &asyh->olut, sizeof(asyh->olut)))
|
||||
asyh->set.olut = true;
|
||||
} else
|
||||
if (armh->olut.visible) {
|
||||
asyh->clr.olut = true;
|
||||
}
|
||||
} else {
|
||||
asyh->clr.olut = armh->olut.visible;
|
||||
asyh->clr.core = armh->core.visible;
|
||||
asyh->clr.curs = armh->curs.visible;
|
||||
asyh->set.olut = asyh->olut.visible;
|
||||
asyh->set.core = asyh->core.visible;
|
||||
asyh->set.curs = asyh->curs.visible;
|
||||
}
|
||||
|
||||
if (asyh->clr.mask || asyh->set.mask)
|
||||
nv50_atom(asyh->state.state)->lock_core = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct drm_crtc_helper_funcs
|
||||
nv50_head_help = {
|
||||
.atomic_check = nv50_head_atomic_check,
|
||||
};
|
||||
|
||||
static void
|
||||
nv50_head_atomic_destroy_state(struct drm_crtc *crtc,
|
||||
struct drm_crtc_state *state)
|
||||
{
|
||||
struct nv50_head_atom *asyh = nv50_head_atom(state);
|
||||
__drm_atomic_helper_crtc_destroy_state(&asyh->state);
|
||||
kfree(asyh);
|
||||
}
|
||||
|
||||
static struct drm_crtc_state *
|
||||
nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)
|
||||
{
|
||||
struct nv50_head_atom *armh = nv50_head_atom(crtc->state);
|
||||
struct nv50_head_atom *asyh;
|
||||
if (!(asyh = kmalloc(sizeof(*asyh), GFP_KERNEL)))
|
||||
return NULL;
|
||||
__drm_atomic_helper_crtc_duplicate_state(crtc, &asyh->state);
|
||||
asyh->wndw = armh->wndw;
|
||||
asyh->view = armh->view;
|
||||
asyh->mode = armh->mode;
|
||||
asyh->olut = armh->olut;
|
||||
asyh->core = armh->core;
|
||||
asyh->curs = armh->curs;
|
||||
asyh->base = armh->base;
|
||||
asyh->ovly = armh->ovly;
|
||||
asyh->dither = armh->dither;
|
||||
asyh->procamp = armh->procamp;
|
||||
asyh->clr.mask = 0;
|
||||
asyh->set.mask = 0;
|
||||
return &asyh->state;
|
||||
}
|
||||
|
||||
static void
|
||||
__drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
|
||||
struct drm_crtc_state *state)
|
||||
{
|
||||
if (crtc->state)
|
||||
crtc->funcs->atomic_destroy_state(crtc, crtc->state);
|
||||
crtc->state = state;
|
||||
crtc->state->crtc = crtc;
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_head_reset(struct drm_crtc *crtc)
|
||||
{
|
||||
struct nv50_head_atom *asyh;
|
||||
|
||||
if (WARN_ON(!(asyh = kzalloc(sizeof(*asyh), GFP_KERNEL))))
|
||||
return;
|
||||
|
||||
__drm_atomic_helper_crtc_reset(crtc, &asyh->state);
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_head_destroy(struct drm_crtc *crtc)
|
||||
{
|
||||
struct nv50_head *head = nv50_head(crtc);
|
||||
nv50_lut_fini(&head->olut);
|
||||
drm_crtc_cleanup(crtc);
|
||||
kfree(head);
|
||||
}
|
||||
|
||||
static const struct drm_crtc_funcs
|
||||
nv50_head_func = {
|
||||
.reset = nv50_head_reset,
|
||||
.gamma_set = drm_atomic_helper_legacy_gamma_set,
|
||||
.destroy = nv50_head_destroy,
|
||||
.set_config = drm_atomic_helper_set_config,
|
||||
.page_flip = drm_atomic_helper_page_flip,
|
||||
.atomic_duplicate_state = nv50_head_atomic_duplicate_state,
|
||||
.atomic_destroy_state = nv50_head_atomic_destroy_state,
|
||||
};
|
||||
|
||||
int
|
||||
nv50_head_create(struct drm_device *dev, int index)
|
||||
{
|
||||
struct nouveau_drm *drm = nouveau_drm(dev);
|
||||
struct nv50_disp *disp = nv50_disp(dev);
|
||||
struct nv50_head *head;
|
||||
struct nv50_wndw *curs, *wndw;
|
||||
struct drm_crtc *crtc;
|
||||
int ret;
|
||||
|
||||
head = kzalloc(sizeof(*head), GFP_KERNEL);
|
||||
if (!head)
|
||||
return -ENOMEM;
|
||||
|
||||
head->func = disp->core->func->head;
|
||||
head->base.index = index;
|
||||
|
||||
if (disp->disp->object.oclass < GV100_DISP) {
|
||||
ret = nv50_ovly_new(drm, head->base.index, &wndw);
|
||||
ret = nv50_base_new(drm, head->base.index, &wndw);
|
||||
} else {
|
||||
ret = nv50_wndw_new(drm, DRM_PLANE_TYPE_OVERLAY,
|
||||
head->base.index * 2 + 1, &wndw);
|
||||
ret = nv50_wndw_new(drm, DRM_PLANE_TYPE_PRIMARY,
|
||||
head->base.index * 2 + 0, &wndw);
|
||||
}
|
||||
if (ret == 0)
|
||||
ret = nv50_curs_new(drm, head->base.index, &curs);
|
||||
if (ret) {
|
||||
kfree(head);
|
||||
return ret;
|
||||
}
|
||||
|
||||
crtc = &head->base.base;
|
||||
drm_crtc_init_with_planes(dev, crtc, &wndw->plane, &curs->plane,
|
||||
&nv50_head_func, "head-%d", head->base.index);
|
||||
drm_crtc_helper_add(crtc, &nv50_head_help);
|
||||
drm_mode_crtc_set_gamma_size(crtc, 256);
|
||||
|
||||
if (head->func->olut_set) {
|
||||
ret = nv50_lut_init(disp, &drm->client.mmu, &head->olut);
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
if (ret)
|
||||
nv50_head_destroy(crtc);
|
||||
return ret;
|
||||
}
|
||||
78
drivers/gpu/drm/nouveau/dispnv50/head.h
Normal file
78
drivers/gpu/drm/nouveau/dispnv50/head.h
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#ifndef __NV50_KMS_HEAD_H__
|
||||
#define __NV50_KMS_HEAD_H__
|
||||
#define nv50_head(c) container_of((c), struct nv50_head, base.base)
|
||||
#include "disp.h"
|
||||
#include "atom.h"
|
||||
#include "lut.h"
|
||||
|
||||
#include "nouveau_crtc.h"
|
||||
|
||||
struct nv50_head {
|
||||
const struct nv50_head_func *func;
|
||||
struct nouveau_crtc base;
|
||||
struct nv50_lut olut;
|
||||
};
|
||||
|
||||
int nv50_head_create(struct drm_device *, int index);
|
||||
void nv50_head_flush_set(struct nv50_head *, struct nv50_head_atom *);
|
||||
void nv50_head_flush_clr(struct nv50_head *, struct nv50_head_atom *, bool y);
|
||||
|
||||
struct nv50_head_func {
|
||||
void (*view)(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 *);
|
||||
void (*olut_set)(struct nv50_head *, struct nv50_head_atom *);
|
||||
void (*olut_clr)(struct nv50_head *);
|
||||
void (*core_calc)(struct nv50_head *, struct nv50_head_atom *);
|
||||
void (*core_set)(struct nv50_head *, struct nv50_head_atom *);
|
||||
void (*core_clr)(struct nv50_head *);
|
||||
int (*curs_layout)(struct nv50_head *, struct nv50_wndw_atom *,
|
||||
struct nv50_head_atom *);
|
||||
int (*curs_format)(struct nv50_head *, struct nv50_wndw_atom *,
|
||||
struct nv50_head_atom *);
|
||||
void (*curs_set)(struct nv50_head *, struct nv50_head_atom *);
|
||||
void (*curs_clr)(struct nv50_head *);
|
||||
void (*base)(struct nv50_head *, struct nv50_head_atom *);
|
||||
void (*ovly)(struct nv50_head *, struct nv50_head_atom *);
|
||||
void (*dither)(struct nv50_head *, struct nv50_head_atom *);
|
||||
void (*procamp)(struct nv50_head *, struct nv50_head_atom *);
|
||||
void (*or)(struct nv50_head *, struct nv50_head_atom *);
|
||||
};
|
||||
|
||||
extern const struct nv50_head_func head507d;
|
||||
void head507d_view(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 *);
|
||||
void head507d_core_calc(struct nv50_head *, struct nv50_head_atom *);
|
||||
void head507d_core_clr(struct nv50_head *);
|
||||
int head507d_curs_layout(struct nv50_head *, struct nv50_wndw_atom *,
|
||||
struct nv50_head_atom *);
|
||||
int head507d_curs_format(struct nv50_head *, struct nv50_wndw_atom *,
|
||||
struct nv50_head_atom *);
|
||||
void head507d_base(struct nv50_head *, struct nv50_head_atom *);
|
||||
void head507d_ovly(struct nv50_head *, struct nv50_head_atom *);
|
||||
void head507d_dither(struct nv50_head *, struct nv50_head_atom *);
|
||||
void head507d_procamp(struct nv50_head *, struct nv50_head_atom *);
|
||||
|
||||
extern const struct nv50_head_func head827d;
|
||||
|
||||
extern const struct nv50_head_func head907d;
|
||||
void head907d_view(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 *);
|
||||
void head907d_olut_set(struct nv50_head *, struct nv50_head_atom *);
|
||||
void head907d_olut_clr(struct nv50_head *);
|
||||
void head907d_core_set(struct nv50_head *, struct nv50_head_atom *);
|
||||
void head907d_core_clr(struct nv50_head *);
|
||||
void head907d_curs_set(struct nv50_head *, struct nv50_head_atom *);
|
||||
void head907d_curs_clr(struct nv50_head *);
|
||||
void head907d_ovly(struct nv50_head *, struct nv50_head_atom *);
|
||||
void head907d_procamp(struct nv50_head *, struct nv50_head_atom *);
|
||||
void head907d_or(struct nv50_head *, struct nv50_head_atom *);
|
||||
|
||||
extern const struct nv50_head_func head917d;
|
||||
int head917d_curs_layout(struct nv50_head *, struct nv50_wndw_atom *,
|
||||
struct nv50_head_atom *);
|
||||
|
||||
extern const struct nv50_head_func headc37d;
|
||||
#endif
|
||||
325
drivers/gpu/drm/nouveau/dispnv50/head507d.c
Normal file
325
drivers/gpu/drm/nouveau/dispnv50/head507d.c
Normal file
|
|
@ -0,0 +1,325 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "head.h"
|
||||
#include "core.h"
|
||||
|
||||
void
|
||||
head507d_procamp(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x08a8 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, asyh->procamp.sat.sin << 20 |
|
||||
asyh->procamp.sat.cos << 8);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head507d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x08a0 + (head->base.index * 0x0400), 1);
|
||||
evo_data(push, asyh->dither.mode << 3 |
|
||||
asyh->dither.bits << 1 |
|
||||
asyh->dither.enable);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head507d_ovly(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 bounds = 0;
|
||||
u32 *push;
|
||||
|
||||
if (asyh->ovly.cpp) {
|
||||
switch (asyh->ovly.cpp) {
|
||||
case 4: bounds |= 0x00000300; break;
|
||||
case 2: bounds |= 0x00000100; break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
break;
|
||||
}
|
||||
bounds |= 0x00000001;
|
||||
} else {
|
||||
bounds |= 0x00000100;
|
||||
}
|
||||
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x0904 + head->base.index * 0x400, 1);
|
||||
evo_data(push, bounds);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head507d_base(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 bounds = 0;
|
||||
u32 *push;
|
||||
|
||||
if (asyh->base.cpp) {
|
||||
switch (asyh->base.cpp) {
|
||||
case 8: bounds |= 0x00000500; break;
|
||||
case 4: bounds |= 0x00000300; break;
|
||||
case 2: bounds |= 0x00000100; break;
|
||||
case 1: bounds |= 0x00000000; break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
break;
|
||||
}
|
||||
bounds |= 0x00000001;
|
||||
}
|
||||
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x0900 + head->base.index * 0x400, 1);
|
||||
evo_data(push, bounds);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head507d_curs_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x0880 + head->base.index * 0x400, 1);
|
||||
evo_data(push, 0x05000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head507d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 3))) {
|
||||
evo_mthd(push, 0x0880 + head->base.index * 0x400, 2);
|
||||
evo_data(push, 0x80000000 | asyh->curs.layout << 26 |
|
||||
asyh->curs.format << 24);
|
||||
evo_data(push, asyh->curs.offset >> 8);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
head507d_curs_format(struct nv50_head *head, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
switch (asyw->image.format) {
|
||||
case 0xcf: asyh->curs.format = 1; break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
head507d_curs_layout(struct nv50_head *head, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
switch (asyw->image.w) {
|
||||
case 32: asyh->curs.layout = 0; break;
|
||||
case 64: asyh->curs.layout = 1; break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
head507d_core_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x0874 + head->base.index * 0x400, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head507d_core_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 9))) {
|
||||
evo_mthd(push, 0x0860 + head->base.index * 0x400, 1);
|
||||
evo_data(push, asyh->core.offset >> 8);
|
||||
evo_mthd(push, 0x0868 + head->base.index * 0x400, 4);
|
||||
evo_data(push, asyh->core.h << 16 | asyh->core.w);
|
||||
evo_data(push, asyh->core.layout << 20 |
|
||||
(asyh->core.pitch >> 8) << 8 |
|
||||
asyh->core.blocks << 8 |
|
||||
asyh->core.blockh);
|
||||
evo_data(push, asyh->core.kind << 16 |
|
||||
asyh->core.format << 8);
|
||||
evo_data(push, asyh->core.handle);
|
||||
evo_mthd(push, 0x08c0 + head->base.index * 0x400, 1);
|
||||
evo_data(push, asyh->core.y << 16 | asyh->core.x);
|
||||
evo_kick(push, core);
|
||||
|
||||
/* EVO will complain with INVALID_STATE if we have an
|
||||
* active cursor and (re)specify HeadSetContextDmaIso
|
||||
* without also updating HeadSetOffsetCursor.
|
||||
*/
|
||||
asyh->set.curs = asyh->curs.visible;
|
||||
asyh->set.olut = asyh->olut.handle != 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head507d_core_calc(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_disp *disp = nv50_disp(head->base.base.dev);
|
||||
if ((asyh->core.visible = (asyh->base.cpp != 0))) {
|
||||
asyh->core.x = asyh->base.x;
|
||||
asyh->core.y = asyh->base.y;
|
||||
asyh->core.w = asyh->base.w;
|
||||
asyh->core.h = asyh->base.h;
|
||||
} else
|
||||
if ((asyh->core.visible = (asyh->ovly.cpp != 0)) ||
|
||||
(asyh->core.visible = asyh->curs.visible)) {
|
||||
/*XXX: We need to either find some way of having the
|
||||
* primary base layer appear black, while still
|
||||
* being able to display the other layers, or we
|
||||
* need to allocate a dummy black surface here.
|
||||
*/
|
||||
asyh->core.x = 0;
|
||||
asyh->core.y = 0;
|
||||
asyh->core.w = asyh->state.mode.hdisplay;
|
||||
asyh->core.h = asyh->state.mode.vdisplay;
|
||||
}
|
||||
asyh->core.handle = disp->core->chan.vram.handle;
|
||||
asyh->core.offset = 0;
|
||||
asyh->core.format = 0xcf;
|
||||
asyh->core.kind = 0;
|
||||
asyh->core.layout = 1;
|
||||
asyh->core.blockh = 0;
|
||||
asyh->core.blocks = 0;
|
||||
asyh->core.pitch = ALIGN(asyh->core.w, 64) * 4;
|
||||
}
|
||||
|
||||
static void
|
||||
head507d_olut_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x0840 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head507d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 3))) {
|
||||
evo_mthd(push, 0x0840 + (head->base.index * 0x400), 2);
|
||||
evo_data(push, 0x80000000 | asyh->olut.mode << 30);
|
||||
evo_data(push, asyh->olut.offset >> 8);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head507d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
if (asyh->base.cpp == 1)
|
||||
asyh->olut.mode = 0;
|
||||
else
|
||||
asyh->olut.mode = 1;
|
||||
}
|
||||
|
||||
void
|
||||
head507d_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
struct nv50_head_mode *m = &asyh->mode;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 13))) {
|
||||
evo_mthd(push, 0x0804 + (head->base.index * 0x400), 2);
|
||||
evo_data(push, 0x00800000 | m->clock);
|
||||
evo_data(push, m->interlace ? 0x00000002 : 0x00000000);
|
||||
evo_mthd(push, 0x0810 + (head->base.index * 0x400), 7);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_data(push, m->v.active << 16 | m->h.active );
|
||||
evo_data(push, m->v.synce << 16 | m->h.synce );
|
||||
evo_data(push, m->v.blanke << 16 | m->h.blanke );
|
||||
evo_data(push, m->v.blanks << 16 | m->h.blanks );
|
||||
evo_data(push, m->v.blank2e << 16 | m->v.blank2s);
|
||||
evo_data(push, asyh->mode.v.blankus);
|
||||
evo_mthd(push, 0x082c + (head->base.index * 0x400), 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head507d_view(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 7))) {
|
||||
evo_mthd(push, 0x08a4 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x08c8 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, asyh->view.iH << 16 | asyh->view.iW);
|
||||
evo_mthd(push, 0x08d8 + (head->base.index * 0x400), 2);
|
||||
evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
|
||||
evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_head_func
|
||||
head507d = {
|
||||
.view = head507d_view,
|
||||
.mode = head507d_mode,
|
||||
.olut = head507d_olut,
|
||||
.olut_set = head507d_olut_set,
|
||||
.olut_clr = head507d_olut_clr,
|
||||
.core_calc = head507d_core_calc,
|
||||
.core_set = head507d_core_set,
|
||||
.core_clr = head507d_core_clr,
|
||||
.curs_layout = head507d_curs_layout,
|
||||
.curs_format = head507d_curs_format,
|
||||
.curs_set = head507d_curs_set,
|
||||
.curs_clr = head507d_curs_clr,
|
||||
.base = head507d_base,
|
||||
.ovly = head507d_ovly,
|
||||
.dither = head507d_dither,
|
||||
.procamp = head507d_procamp,
|
||||
};
|
||||
124
drivers/gpu/drm/nouveau/dispnv50/head827d.c
Normal file
124
drivers/gpu/drm/nouveau/dispnv50/head827d.c
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "head.h"
|
||||
#include "core.h"
|
||||
|
||||
static void
|
||||
head827d_curs_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 4))) {
|
||||
evo_mthd(push, 0x0880 + head->base.index * 0x400, 1);
|
||||
evo_data(push, 0x05000000);
|
||||
evo_mthd(push, 0x089c + head->base.index * 0x400, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head827d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 5))) {
|
||||
evo_mthd(push, 0x0880 + head->base.index * 0x400, 2);
|
||||
evo_data(push, 0x80000000 | asyh->curs.layout << 26 |
|
||||
asyh->curs.format << 24);
|
||||
evo_data(push, asyh->curs.offset >> 8);
|
||||
evo_mthd(push, 0x089c + head->base.index * 0x400, 1);
|
||||
evo_data(push, asyh->curs.handle);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head827d_core_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 9))) {
|
||||
evo_mthd(push, 0x0860 + head->base.index * 0x400, 1);
|
||||
evo_data(push, asyh->core.offset >> 8);
|
||||
evo_mthd(push, 0x0868 + head->base.index * 0x400, 4);
|
||||
evo_data(push, asyh->core.h << 16 | asyh->core.w);
|
||||
evo_data(push, asyh->core.layout << 20 |
|
||||
(asyh->core.pitch >> 8) << 8 |
|
||||
asyh->core.blocks << 8 |
|
||||
asyh->core.blockh);
|
||||
evo_data(push, asyh->core.format << 8);
|
||||
evo_data(push, asyh->core.handle);
|
||||
evo_mthd(push, 0x08c0 + head->base.index * 0x400, 1);
|
||||
evo_data(push, asyh->core.y << 16 | asyh->core.x);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head827d_olut_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 4))) {
|
||||
evo_mthd(push, 0x0840 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x085c + (head->base.index * 0x400), 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head827d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 5))) {
|
||||
evo_mthd(push, 0x0840 + (head->base.index * 0x400), 2);
|
||||
evo_data(push, 0x80000000 | asyh->olut.mode << 30);
|
||||
evo_data(push, asyh->olut.offset >> 8);
|
||||
evo_mthd(push, 0x085c + (head->base.index * 0x400), 1);
|
||||
evo_data(push, asyh->olut.handle);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_head_func
|
||||
head827d = {
|
||||
.view = head507d_view,
|
||||
.mode = head507d_mode,
|
||||
.olut = head507d_olut,
|
||||
.olut_set = head827d_olut_set,
|
||||
.olut_clr = head827d_olut_clr,
|
||||
.core_calc = head507d_core_calc,
|
||||
.core_set = head827d_core_set,
|
||||
.core_clr = head507d_core_clr,
|
||||
.curs_layout = head507d_curs_layout,
|
||||
.curs_format = head507d_curs_format,
|
||||
.curs_set = head827d_curs_set,
|
||||
.curs_clr = head827d_curs_clr,
|
||||
.base = head507d_base,
|
||||
.ovly = head507d_ovly,
|
||||
.dither = head507d_dither,
|
||||
.procamp = head507d_procamp,
|
||||
};
|
||||
284
drivers/gpu/drm/nouveau/dispnv50/head907d.c
Normal file
284
drivers/gpu/drm/nouveau/dispnv50/head907d.c
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "head.h"
|
||||
#include "core.h"
|
||||
|
||||
void
|
||||
head907d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 3))) {
|
||||
evo_mthd(push, 0x0404 + (head->base.index * 0x300), 2);
|
||||
evo_data(push, 0x00000001 | asyh->or.depth << 6 |
|
||||
asyh->or.nvsync << 4 |
|
||||
asyh->or.nhsync << 3);
|
||||
evo_data(push, 0x31ec6000 | head->base.index << 25 |
|
||||
asyh->mode.interlace);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_procamp(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x0498 + (head->base.index * 0x300), 1);
|
||||
evo_data(push, asyh->procamp.sat.sin << 20 |
|
||||
asyh->procamp.sat.cos << 8);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head907d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x0490 + (head->base.index * 0x0300), 1);
|
||||
evo_data(push, asyh->dither.mode << 3 |
|
||||
asyh->dither.bits << 1 |
|
||||
asyh->dither.enable);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_ovly(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 bounds = 0;
|
||||
u32 *push;
|
||||
|
||||
if (asyh->ovly.cpp) {
|
||||
switch (asyh->ovly.cpp) {
|
||||
case 8: bounds |= 0x00000500; break;
|
||||
case 4: bounds |= 0x00000300; break;
|
||||
case 2: bounds |= 0x00000100; break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
break;
|
||||
}
|
||||
bounds |= 0x00000001;
|
||||
} else {
|
||||
bounds |= 0x00000100;
|
||||
}
|
||||
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x04d4 + head->base.index * 0x300, 1);
|
||||
evo_data(push, bounds);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head907d_base(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 bounds = 0;
|
||||
u32 *push;
|
||||
|
||||
if (asyh->base.cpp) {
|
||||
switch (asyh->base.cpp) {
|
||||
case 8: bounds |= 0x00000500; break;
|
||||
case 4: bounds |= 0x00000300; break;
|
||||
case 2: bounds |= 0x00000100; break;
|
||||
case 1: bounds |= 0x00000000; break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
break;
|
||||
}
|
||||
bounds |= 0x00000001;
|
||||
}
|
||||
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x04d0 + head->base.index * 0x300, 1);
|
||||
evo_data(push, bounds);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_curs_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 4))) {
|
||||
evo_mthd(push, 0x0480 + head->base.index * 0x300, 1);
|
||||
evo_data(push, 0x05000000);
|
||||
evo_mthd(push, 0x048c + head->base.index * 0x300, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 5))) {
|
||||
evo_mthd(push, 0x0480 + head->base.index * 0x300, 2);
|
||||
evo_data(push, 0x80000000 | asyh->curs.layout << 26 |
|
||||
asyh->curs.format << 24);
|
||||
evo_data(push, asyh->curs.offset >> 8);
|
||||
evo_mthd(push, 0x048c + head->base.index * 0x300, 1);
|
||||
evo_data(push, asyh->curs.handle);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_core_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x0474 + head->base.index * 0x300, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_core_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 9))) {
|
||||
evo_mthd(push, 0x0460 + head->base.index * 0x300, 1);
|
||||
evo_data(push, asyh->core.offset >> 8);
|
||||
evo_mthd(push, 0x0468 + head->base.index * 0x300, 4);
|
||||
evo_data(push, asyh->core.h << 16 | asyh->core.w);
|
||||
evo_data(push, asyh->core.layout << 24 |
|
||||
(asyh->core.pitch >> 8) << 8 |
|
||||
asyh->core.blocks << 8 |
|
||||
asyh->core.blockh);
|
||||
evo_data(push, asyh->core.format << 8);
|
||||
evo_data(push, asyh->core.handle);
|
||||
evo_mthd(push, 0x04b0 + head->base.index * 0x300, 1);
|
||||
evo_data(push, asyh->core.y << 16 | asyh->core.x);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_olut_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 4))) {
|
||||
evo_mthd(push, 0x0448 + (head->base.index * 0x300), 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x045c + (head->base.index * 0x300), 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 5))) {
|
||||
evo_mthd(push, 0x0448 + (head->base.index * 0x300), 2);
|
||||
evo_data(push, 0x80000000 | asyh->olut.mode << 24);
|
||||
evo_data(push, asyh->olut.offset >> 8);
|
||||
evo_mthd(push, 0x045c + (head->base.index * 0x300), 1);
|
||||
evo_data(push, asyh->olut.handle);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
asyh->olut.mode = 7;
|
||||
}
|
||||
|
||||
void
|
||||
head907d_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
struct nv50_head_mode *m = &asyh->mode;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 14))) {
|
||||
evo_mthd(push, 0x0410 + (head->base.index * 0x300), 6);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_data(push, m->v.active << 16 | m->h.active );
|
||||
evo_data(push, m->v.synce << 16 | m->h.synce );
|
||||
evo_data(push, m->v.blanke << 16 | m->h.blanke );
|
||||
evo_data(push, m->v.blanks << 16 | m->h.blanks );
|
||||
evo_data(push, m->v.blank2e << 16 | m->v.blank2s);
|
||||
evo_mthd(push, 0x042c + (head->base.index * 0x300), 2);
|
||||
evo_data(push, 0x00000000); /* ??? */
|
||||
evo_data(push, 0xffffff00);
|
||||
evo_mthd(push, 0x0450 + (head->base.index * 0x300), 3);
|
||||
evo_data(push, m->clock * 1000);
|
||||
evo_data(push, 0x00200000); /* ??? */
|
||||
evo_data(push, m->clock * 1000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
head907d_view(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 8))) {
|
||||
evo_mthd(push, 0x0494 + (head->base.index * 0x300), 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x04b8 + (head->base.index * 0x300), 1);
|
||||
evo_data(push, asyh->view.iH << 16 | asyh->view.iW);
|
||||
evo_mthd(push, 0x04c0 + (head->base.index * 0x300), 3);
|
||||
evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
|
||||
evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
|
||||
evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_head_func
|
||||
head907d = {
|
||||
.view = head907d_view,
|
||||
.mode = head907d_mode,
|
||||
.olut = head907d_olut,
|
||||
.olut_set = head907d_olut_set,
|
||||
.olut_clr = head907d_olut_clr,
|
||||
.core_calc = head507d_core_calc,
|
||||
.core_set = head907d_core_set,
|
||||
.core_clr = head907d_core_clr,
|
||||
.curs_layout = head507d_curs_layout,
|
||||
.curs_format = head507d_curs_format,
|
||||
.curs_set = head907d_curs_set,
|
||||
.curs_clr = head907d_curs_clr,
|
||||
.base = head907d_base,
|
||||
.ovly = head907d_ovly,
|
||||
.dither = head907d_dither,
|
||||
.procamp = head907d_procamp,
|
||||
.or = head907d_or,
|
||||
};
|
||||
100
drivers/gpu/drm/nouveau/dispnv50/head917d.c
Normal file
100
drivers/gpu/drm/nouveau/dispnv50/head917d.c
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "head.h"
|
||||
#include "core.h"
|
||||
|
||||
static void
|
||||
head917d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x04a0 + (head->base.index * 0x0300), 1);
|
||||
evo_data(push, asyh->dither.mode << 3 |
|
||||
asyh->dither.bits << 1 |
|
||||
asyh->dither.enable);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
head917d_base(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 bounds = 0;
|
||||
u32 *push;
|
||||
|
||||
if (asyh->base.cpp) {
|
||||
switch (asyh->base.cpp) {
|
||||
case 8: bounds |= 0x00000500; break;
|
||||
case 4: bounds |= 0x00000300; break;
|
||||
case 2: bounds |= 0x00000100; break;
|
||||
case 1: bounds |= 0x00000000; break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
break;
|
||||
}
|
||||
bounds |= 0x00020001;
|
||||
}
|
||||
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x04d0 + head->base.index * 0x300, 1);
|
||||
evo_data(push, bounds);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
head917d_curs_layout(struct nv50_head *head, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
switch (asyw->state.fb->width) {
|
||||
case 32: asyh->curs.layout = 0; break;
|
||||
case 64: asyh->curs.layout = 1; break;
|
||||
case 128: asyh->curs.layout = 2; break;
|
||||
case 256: asyh->curs.layout = 3; break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct nv50_head_func
|
||||
head917d = {
|
||||
.view = head907d_view,
|
||||
.mode = head907d_mode,
|
||||
.olut = head907d_olut,
|
||||
.olut_set = head907d_olut_set,
|
||||
.olut_clr = head907d_olut_clr,
|
||||
.core_calc = head507d_core_calc,
|
||||
.core_set = head907d_core_set,
|
||||
.core_clr = head907d_core_clr,
|
||||
.curs_layout = head917d_curs_layout,
|
||||
.curs_format = head507d_curs_format,
|
||||
.curs_set = head907d_curs_set,
|
||||
.curs_clr = head907d_curs_clr,
|
||||
.base = head917d_base,
|
||||
.ovly = head907d_ovly,
|
||||
.dither = head917d_dither,
|
||||
.procamp = head907d_procamp,
|
||||
.or = head907d_or,
|
||||
};
|
||||
212
drivers/gpu/drm/nouveau/dispnv50/headc37d.c
Normal file
212
drivers/gpu/drm/nouveau/dispnv50/headc37d.c
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "head.h"
|
||||
#include "atom.h"
|
||||
#include "core.h"
|
||||
|
||||
static void
|
||||
headc37d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
/*XXX: This is a dirty hack until OR depth handling is
|
||||
* improved later for deep colour etc.
|
||||
*/
|
||||
switch (asyh->or.depth) {
|
||||
case 6: asyh->or.depth = 5; break;
|
||||
case 5: asyh->or.depth = 4; break;
|
||||
case 2: asyh->or.depth = 1; break;
|
||||
case 0: asyh->or.depth = 4; break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
break;
|
||||
}
|
||||
|
||||
evo_mthd(push, 0x2004 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, 0x00000001 |
|
||||
asyh->or.depth << 4 |
|
||||
asyh->or.nvsync << 3 |
|
||||
asyh->or.nhsync << 2);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
headc37d_procamp(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x2000 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, 0x80000000 |
|
||||
asyh->procamp.sat.sin << 16 |
|
||||
asyh->procamp.sat.cos << 4);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
headc37d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x2018 + (head->base.index * 0x0400), 1);
|
||||
evo_data(push, asyh->dither.mode << 8 |
|
||||
asyh->dither.bits << 4 |
|
||||
asyh->dither.enable);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
headc37d_curs_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 4))) {
|
||||
evo_mthd(push, 0x209c + head->base.index * 0x400, 1);
|
||||
evo_data(push, 0x000000cf);
|
||||
evo_mthd(push, 0x2088 + head->base.index * 0x400, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
headc37d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 7))) {
|
||||
evo_mthd(push, 0x209c + head->base.index * 0x400, 2);
|
||||
evo_data(push, 0x80000000 |
|
||||
asyh->curs.layout << 8 |
|
||||
asyh->curs.format << 0);
|
||||
evo_data(push, 0x000072ff);
|
||||
evo_mthd(push, 0x2088 + head->base.index * 0x400, 1);
|
||||
evo_data(push, asyh->curs.handle);
|
||||
evo_mthd(push, 0x2090 + head->base.index * 0x400, 1);
|
||||
evo_data(push, asyh->curs.offset >> 8);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
headc37d_curs_format(struct nv50_head *head, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
asyh->curs.format = asyw->image.format;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
headc37d_olut_clr(struct nv50_head *head)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 2))) {
|
||||
evo_mthd(push, 0x20ac + (head->base.index * 0x400), 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
headc37d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 4))) {
|
||||
evo_mthd(push, 0x20a4 + (head->base.index * 0x400), 3);
|
||||
evo_data(push, asyh->olut.output_mode << 8 |
|
||||
asyh->olut.range << 4 |
|
||||
asyh->olut.size);
|
||||
evo_data(push, asyh->olut.offset >> 8);
|
||||
evo_data(push, asyh->olut.handle);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
headc37d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
asyh->olut.mode = 2;
|
||||
asyh->olut.size = 0;
|
||||
asyh->olut.range = 0;
|
||||
asyh->olut.output_mode = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
headc37d_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
struct nv50_head_mode *m = &asyh->mode;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 12))) {
|
||||
evo_mthd(push, 0x2064 + (head->base.index * 0x400), 5);
|
||||
evo_data(push, (m->v.active << 16) | m->h.active );
|
||||
evo_data(push, (m->v.synce << 16) | m->h.synce );
|
||||
evo_data(push, (m->v.blanke << 16) | m->h.blanke );
|
||||
evo_data(push, (m->v.blanks << 16) | m->h.blanks );
|
||||
evo_data(push, (m->v.blank2e << 16) | m->v.blank2s);
|
||||
evo_mthd(push, 0x200c + (head->base.index * 0x400), 1);
|
||||
evo_data(push, m->clock * 1000);
|
||||
evo_mthd(push, 0x2028 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, m->clock * 1000);
|
||||
/*XXX: HEAD_USAGE_BOUNDS, doesn't belong here. */
|
||||
evo_mthd(push, 0x2030 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, 0x00000124);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
headc37d_view(struct nv50_head *head, struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
|
||||
u32 *push;
|
||||
if ((push = evo_wait(core, 4))) {
|
||||
evo_mthd(push, 0x204c + (head->base.index * 0x400), 1);
|
||||
evo_data(push, (asyh->view.iH << 16) | asyh->view.iW);
|
||||
evo_mthd(push, 0x2058 + (head->base.index * 0x400), 1);
|
||||
evo_data(push, (asyh->view.oH << 16) | asyh->view.oW);
|
||||
evo_kick(push, core);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_head_func
|
||||
headc37d = {
|
||||
.view = headc37d_view,
|
||||
.mode = headc37d_mode,
|
||||
.olut = headc37d_olut,
|
||||
.olut_set = headc37d_olut_set,
|
||||
.olut_clr = headc37d_olut_clr,
|
||||
.curs_layout = head917d_curs_layout,
|
||||
.curs_format = headc37d_curs_format,
|
||||
.curs_set = headc37d_curs_set,
|
||||
.curs_clr = headc37d_curs_clr,
|
||||
.dither = headc37d_dither,
|
||||
.procamp = headc37d_procamp,
|
||||
.or = headc37d_or,
|
||||
};
|
||||
95
drivers/gpu/drm/nouveau/dispnv50/lut.c
Normal file
95
drivers/gpu/drm/nouveau/dispnv50/lut.c
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "lut.h"
|
||||
#include "disp.h"
|
||||
|
||||
#include <drm/drm_color_mgmt.h>
|
||||
#include <drm/drm_mode.h>
|
||||
#include <drm/drm_property.h>
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
u32
|
||||
nv50_lut_load(struct nv50_lut *lut, bool legacy, int buffer,
|
||||
struct drm_property_blob *blob)
|
||||
{
|
||||
struct drm_color_lut *in = (struct drm_color_lut *)blob->data;
|
||||
void __iomem *mem = lut->mem[buffer].object.map.ptr;
|
||||
const int size = blob->length / sizeof(*in);
|
||||
int bits, shift, i;
|
||||
u16 zero, r, g, b;
|
||||
u32 addr = lut->mem[buffer].addr;
|
||||
|
||||
/* This can't happen.. But it shuts the compiler up. */
|
||||
if (WARN_ON(size != 256))
|
||||
return 0;
|
||||
|
||||
if (legacy) {
|
||||
bits = 11;
|
||||
shift = 3;
|
||||
zero = 0x0000;
|
||||
} else {
|
||||
bits = 14;
|
||||
shift = 0;
|
||||
zero = 0x6000;
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
r = (drm_color_lut_extract(in[i]. red, bits) + zero) << shift;
|
||||
g = (drm_color_lut_extract(in[i].green, bits) + zero) << shift;
|
||||
b = (drm_color_lut_extract(in[i]. blue, bits) + zero) << shift;
|
||||
writew(r, mem + (i * 0x08) + 0);
|
||||
writew(g, mem + (i * 0x08) + 2);
|
||||
writew(b, mem + (i * 0x08) + 4);
|
||||
}
|
||||
|
||||
/* INTERPOLATE modes require a "next" entry to interpolate with,
|
||||
* so we replicate the last entry to deal with this for now.
|
||||
*/
|
||||
writew(r, mem + (i * 0x08) + 0);
|
||||
writew(g, mem + (i * 0x08) + 2);
|
||||
writew(b, mem + (i * 0x08) + 4);
|
||||
return addr;
|
||||
}
|
||||
|
||||
void
|
||||
nv50_lut_fini(struct nv50_lut *lut)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(lut->mem); i++)
|
||||
nvif_mem_fini(&lut->mem[i]);
|
||||
}
|
||||
|
||||
int
|
||||
nv50_lut_init(struct nv50_disp *disp, struct nvif_mmu *mmu,
|
||||
struct nv50_lut *lut)
|
||||
{
|
||||
const u32 size = disp->disp->object.oclass < GF110_DISP ? 257 : 1025;
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(lut->mem); i++) {
|
||||
int ret = nvif_mem_init_map(mmu, NVIF_MEM_VRAM, size * 8,
|
||||
&lut->mem[i]);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
15
drivers/gpu/drm/nouveau/dispnv50/lut.h
Normal file
15
drivers/gpu/drm/nouveau/dispnv50/lut.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __NV50_KMS_LUT_H__
|
||||
#define __NV50_KMS_LUT_H__
|
||||
#include <nvif/mem.h>
|
||||
struct drm_property_blob;
|
||||
struct nv50_disp;
|
||||
|
||||
struct nv50_lut {
|
||||
struct nvif_mem mem[2];
|
||||
};
|
||||
|
||||
int nv50_lut_init(struct nv50_disp *, struct nvif_mmu *, struct nv50_lut *);
|
||||
void nv50_lut_fini(struct nv50_lut *);
|
||||
u32 nv50_lut_load(struct nv50_lut *, bool legacy, int buffer,
|
||||
struct drm_property_blob *);
|
||||
#endif
|
||||
51
drivers/gpu/drm/nouveau/dispnv50/oimm.c
Normal file
51
drivers/gpu/drm/nouveau/dispnv50/oimm.c
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "oimm.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
int
|
||||
nv50_oimm_init(struct nouveau_drm *drm, struct nv50_wndw *wndw)
|
||||
{
|
||||
static const struct {
|
||||
s32 oclass;
|
||||
int version;
|
||||
int (*init)(struct nouveau_drm *, s32, struct nv50_wndw *);
|
||||
} oimms[] = {
|
||||
{ GK104_DISP_OVERLAY, 0, oimm507b_init },
|
||||
{ GF110_DISP_OVERLAY, 0, oimm507b_init },
|
||||
{ GT214_DISP_OVERLAY, 0, oimm507b_init },
|
||||
{ G82_DISP_OVERLAY, 0, oimm507b_init },
|
||||
{ NV50_DISP_OVERLAY, 0, oimm507b_init },
|
||||
{}
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
int cid;
|
||||
|
||||
cid = nvif_mclass(&disp->disp->object, oimms);
|
||||
if (cid < 0) {
|
||||
NV_ERROR(drm, "No supported overlay immediate class\n");
|
||||
return cid;
|
||||
}
|
||||
|
||||
return oimms[cid].init(drm, oimms[cid].oclass, wndw);
|
||||
}
|
||||
8
drivers/gpu/drm/nouveau/dispnv50/oimm.h
Normal file
8
drivers/gpu/drm/nouveau/dispnv50/oimm.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __NV50_KMS_OIMM_H__
|
||||
#define __NV50_KMS_OIMM_H__
|
||||
#include "wndw.h"
|
||||
|
||||
int oimm507b_init(struct nouveau_drm *, s32, struct nv50_wndw *);
|
||||
|
||||
int nv50_oimm_init(struct nouveau_drm *, struct nv50_wndw *);
|
||||
#endif
|
||||
52
drivers/gpu/drm/nouveau/dispnv50/oimm507b.c
Normal file
52
drivers/gpu/drm/nouveau/dispnv50/oimm507b.c
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "oimm.h"
|
||||
|
||||
#include <nvif/cl507b.h>
|
||||
|
||||
static int
|
||||
oimm507b_init_(const struct nv50_wimm_func *func, struct nouveau_drm *drm,
|
||||
s32 oclass, struct nv50_wndw *wndw)
|
||||
{
|
||||
struct nv50_disp_overlay_v0 args = {
|
||||
.head = wndw->id,
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
int ret;
|
||||
|
||||
ret = nvif_object_init(&disp->disp->object, 0, oclass, &args,
|
||||
sizeof(args), &wndw->wimm.base.user);
|
||||
if (ret) {
|
||||
NV_ERROR(drm, "oimm%04x allocation failed: %d\n", oclass, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
nvif_object_map(&wndw->wimm.base.user, NULL, 0);
|
||||
wndw->immd = func;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
oimm507b_init(struct nouveau_drm *drm, s32 oclass, struct nv50_wndw *wndw)
|
||||
{
|
||||
return oimm507b_init_(&curs507a, drm, oclass, wndw);
|
||||
}
|
||||
57
drivers/gpu/drm/nouveau/dispnv50/ovly.c
Normal file
57
drivers/gpu/drm/nouveau/dispnv50/ovly.c
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "ovly.h"
|
||||
#include "oimm.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
int
|
||||
nv50_ovly_new(struct nouveau_drm *drm, int head, struct nv50_wndw **pwndw)
|
||||
{
|
||||
static const struct {
|
||||
s32 oclass;
|
||||
int version;
|
||||
int (*new)(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
} ovlys[] = {
|
||||
{ GK104_DISP_OVERLAY_CONTROL_DMA, 0, ovly917e_new },
|
||||
{ GF110_DISP_OVERLAY_CONTROL_DMA, 0, ovly907e_new },
|
||||
{ GT214_DISP_OVERLAY_CHANNEL_DMA, 0, ovly827e_new },
|
||||
{ GT200_DISP_OVERLAY_CHANNEL_DMA, 0, ovly827e_new },
|
||||
{ G82_DISP_OVERLAY_CHANNEL_DMA, 0, ovly827e_new },
|
||||
{ NV50_DISP_OVERLAY_CHANNEL_DMA, 0, ovly507e_new },
|
||||
{}
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
int cid, ret;
|
||||
|
||||
cid = nvif_mclass(&disp->disp->object, ovlys);
|
||||
if (cid < 0) {
|
||||
NV_ERROR(drm, "No supported overlay class\n");
|
||||
return cid;
|
||||
}
|
||||
|
||||
ret = ovlys[cid].new(drm, head, ovlys[cid].oclass, pwndw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return nv50_oimm_init(drm, *pwndw);
|
||||
}
|
||||
30
drivers/gpu/drm/nouveau/dispnv50/ovly.h
Normal file
30
drivers/gpu/drm/nouveau/dispnv50/ovly.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef __NV50_KMS_OVLY_H__
|
||||
#define __NV50_KMS_OVLY_H__
|
||||
#include "wndw.h"
|
||||
|
||||
int ovly507e_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
int ovly507e_new_(const struct nv50_wndw_func *, const u32 *format,
|
||||
struct nouveau_drm *, int head, s32 oclass,
|
||||
u32 interlock_data, struct nv50_wndw **);
|
||||
int ovly507e_acquire(struct nv50_wndw *, struct nv50_wndw_atom *,
|
||||
struct nv50_head_atom *);
|
||||
void ovly507e_release(struct nv50_wndw *, struct nv50_wndw_atom *,
|
||||
struct nv50_head_atom *);
|
||||
void ovly507e_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
void ovly507e_ntfy_clr(struct nv50_wndw *);
|
||||
void ovly507e_image_clr(struct nv50_wndw *);
|
||||
void ovly507e_scale_set(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
void ovly507e_update(struct nv50_wndw *, u32 *);
|
||||
|
||||
extern const u32 ovly827e_format[];
|
||||
void ovly827e_ntfy_reset(struct nouveau_bo *, u32);
|
||||
int ovly827e_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *);
|
||||
|
||||
extern const struct nv50_wndw_func ovly907e;
|
||||
|
||||
int ovly827e_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
int ovly907e_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
int ovly917e_new(struct nouveau_drm *, int, s32, struct nv50_wndw **);
|
||||
|
||||
int nv50_ovly_new(struct nouveau_drm *, int head, struct nv50_wndw **);
|
||||
#endif
|
||||
217
drivers/gpu/drm/nouveau/dispnv50/ovly507e.c
Normal file
217
drivers/gpu/drm/nouveau/dispnv50/ovly507e.c
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "ovly.h"
|
||||
#include "atom.h"
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_plane_helper.h>
|
||||
|
||||
#include <nvif/cl507e.h>
|
||||
#include <nvif/event.h>
|
||||
|
||||
void
|
||||
ovly507e_update(struct nv50_wndw *wndw, u32 *interlock)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x0080, 1);
|
||||
evo_data(push, interlock[NV50_DISP_INTERLOCK_CORE]);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ovly507e_scale_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 4))) {
|
||||
evo_mthd(push, 0x00e0, 3);
|
||||
evo_data(push, asyw->scale.sy << 16 | asyw->scale.sx);
|
||||
evo_data(push, asyw->scale.sh << 16 | asyw->scale.sw);
|
||||
evo_data(push, asyw->scale.dw);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ovly507e_image_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 4))) {
|
||||
evo_mthd(push, 0x0084, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x00c0, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ovly507e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 12))) {
|
||||
evo_mthd(push, 0x0084, 1);
|
||||
evo_data(push, asyw->image.interval << 4);
|
||||
evo_mthd(push, 0x00c0, 1);
|
||||
evo_data(push, asyw->image.handle[0]);
|
||||
evo_mthd(push, 0x0100, 1);
|
||||
evo_data(push, 0x00000002);
|
||||
evo_mthd(push, 0x0800, 1);
|
||||
evo_data(push, asyw->image.offset[0] >> 8);
|
||||
evo_mthd(push, 0x0808, 3);
|
||||
evo_data(push, asyw->image.h << 16 | asyw->image.w);
|
||||
evo_data(push, asyw->image.layout << 20 |
|
||||
(asyw->image.pitch[0] >> 8) << 8 |
|
||||
asyw->image.blocks[0] << 8 |
|
||||
asyw->image.blockh);
|
||||
evo_data(push, asyw->image.kind << 16 |
|
||||
asyw->image.format << 8 |
|
||||
asyw->image.colorspace);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ovly507e_ntfy_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x00a4, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ovly507e_ntfy_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 3))) {
|
||||
evo_mthd(push, 0x00a0, 2);
|
||||
evo_data(push, asyw->ntfy.awaken << 30 | asyw->ntfy.offset);
|
||||
evo_data(push, asyw->ntfy.handle);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ovly507e_release(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
asyh->ovly.cpp = 0;
|
||||
}
|
||||
|
||||
int
|
||||
ovly507e_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
const struct drm_framebuffer *fb = asyw->state.fb;
|
||||
int ret;
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
true, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
asyh->ovly.cpp = fb->format->cpp[0];
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "nouveau_bo.h"
|
||||
|
||||
static const struct nv50_wndw_func
|
||||
ovly507e = {
|
||||
.acquire = ovly507e_acquire,
|
||||
.release = ovly507e_release,
|
||||
.ntfy_set = ovly507e_ntfy_set,
|
||||
.ntfy_clr = ovly507e_ntfy_clr,
|
||||
.ntfy_reset = base507c_ntfy_reset,
|
||||
.ntfy_wait_begun = base507c_ntfy_wait_begun,
|
||||
.image_set = ovly507e_image_set,
|
||||
.image_clr = ovly507e_image_clr,
|
||||
.scale_set = ovly507e_scale_set,
|
||||
.update = ovly507e_update,
|
||||
};
|
||||
|
||||
static const u32
|
||||
ovly507e_format[] = {
|
||||
DRM_FORMAT_YUYV,
|
||||
DRM_FORMAT_UYVY,
|
||||
DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_XRGB1555,
|
||||
DRM_FORMAT_ARGB1555,
|
||||
0
|
||||
};
|
||||
|
||||
int
|
||||
ovly507e_new_(const struct nv50_wndw_func *func, const u32 *format,
|
||||
struct nouveau_drm *drm, int head, s32 oclass, u32 interlock_data,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
struct nv50_disp_overlay_channel_dma_v0 args = {
|
||||
.head = head,
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
struct nv50_wndw *wndw;
|
||||
int ret;
|
||||
|
||||
ret = nv50_wndw_new_(func, drm->dev, DRM_PLANE_TYPE_OVERLAY,
|
||||
"ovly", head, format, BIT(head),
|
||||
NV50_DISP_INTERLOCK_OVLY, interlock_data,
|
||||
&wndw);
|
||||
if (*pwndw = wndw, ret)
|
||||
return ret;
|
||||
|
||||
ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
|
||||
&oclass, 0, &args, sizeof(args),
|
||||
disp->sync->bo.offset, &wndw->wndw);
|
||||
if (ret) {
|
||||
NV_ERROR(drm, "ovly%04x allocation failed: %d\n", oclass, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = nvif_notify_init(&wndw->wndw.base.user, wndw->notify.func, false,
|
||||
NV50_DISP_OVERLAY_CHANNEL_DMA_V0_NTFY_UEVENT,
|
||||
&(struct nvif_notify_uevent_req) {},
|
||||
sizeof(struct nvif_notify_uevent_req),
|
||||
sizeof(struct nvif_notify_uevent_rep),
|
||||
&wndw->notify);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
wndw->ntfy = NV50_DISP_OVLY_NTFY(wndw->id);
|
||||
wndw->sema = NV50_DISP_OVLY_SEM0(wndw->id);
|
||||
wndw->data = 0x00000000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ovly507e_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return ovly507e_new_(&ovly507e, ovly507e_format, drm, head, oclass,
|
||||
0x00000004 << (head * 8), pwndw);
|
||||
}
|
||||
107
drivers/gpu/drm/nouveau/dispnv50/ovly827e.c
Normal file
107
drivers/gpu/drm/nouveau/dispnv50/ovly827e.c
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "ovly.h"
|
||||
#include "atom.h"
|
||||
|
||||
#include <nouveau_bo.h>
|
||||
|
||||
static void
|
||||
ovly827e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 12))) {
|
||||
evo_mthd(push, 0x0084, 1);
|
||||
evo_data(push, asyw->image.interval << 4);
|
||||
evo_mthd(push, 0x00c0, 1);
|
||||
evo_data(push, asyw->image.handle[0]);
|
||||
evo_mthd(push, 0x0100, 1);
|
||||
evo_data(push, 0x00000002);
|
||||
evo_mthd(push, 0x0800, 1);
|
||||
evo_data(push, asyw->image.offset[0] >> 8);
|
||||
evo_mthd(push, 0x0808, 3);
|
||||
evo_data(push, asyw->image.h << 16 | asyw->image.w);
|
||||
evo_data(push, asyw->image.layout << 20 |
|
||||
(asyw->image.pitch[0] >> 8) << 8 |
|
||||
asyw->image.blocks[0] << 8 |
|
||||
asyw->image.blockh);
|
||||
evo_data(push, asyw->image.format << 8 |
|
||||
asyw->image.colorspace);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ovly827e_ntfy_wait_begun(struct nouveau_bo *bo, u32 offset,
|
||||
struct nvif_device *device)
|
||||
{
|
||||
s64 time = nvif_msec(device, 2000ULL,
|
||||
u32 data = nouveau_bo_rd32(bo, offset / 4 + 3);
|
||||
if ((data & 0xffff0000) == 0xffff0000)
|
||||
break;
|
||||
usleep_range(1, 2);
|
||||
);
|
||||
return time < 0 ? time : 0;
|
||||
}
|
||||
|
||||
void
|
||||
ovly827e_ntfy_reset(struct nouveau_bo *bo, u32 offset)
|
||||
{
|
||||
nouveau_bo_wr32(bo, offset / 4 + 0, 0x00000000);
|
||||
nouveau_bo_wr32(bo, offset / 4 + 1, 0x00000000);
|
||||
nouveau_bo_wr32(bo, offset / 4 + 2, 0x00000000);
|
||||
nouveau_bo_wr32(bo, offset / 4 + 3, 0x80000000);
|
||||
}
|
||||
|
||||
static const struct nv50_wndw_func
|
||||
ovly827e = {
|
||||
.acquire = ovly507e_acquire,
|
||||
.release = ovly507e_release,
|
||||
.ntfy_set = ovly507e_ntfy_set,
|
||||
.ntfy_clr = ovly507e_ntfy_clr,
|
||||
.ntfy_reset = ovly827e_ntfy_reset,
|
||||
.ntfy_wait_begun = ovly827e_ntfy_wait_begun,
|
||||
.image_set = ovly827e_image_set,
|
||||
.image_clr = ovly507e_image_clr,
|
||||
.scale_set = ovly507e_scale_set,
|
||||
.update = ovly507e_update,
|
||||
};
|
||||
|
||||
const u32
|
||||
ovly827e_format[] = {
|
||||
DRM_FORMAT_YUYV,
|
||||
DRM_FORMAT_UYVY,
|
||||
DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_XRGB1555,
|
||||
DRM_FORMAT_ARGB1555,
|
||||
DRM_FORMAT_XBGR2101010,
|
||||
DRM_FORMAT_ABGR2101010,
|
||||
0
|
||||
};
|
||||
|
||||
int
|
||||
ovly827e_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return ovly507e_new_(&ovly827e, ovly827e_format, drm, head, oclass,
|
||||
0x00000004 << (head * 8), pwndw);
|
||||
}
|
||||
70
drivers/gpu/drm/nouveau/dispnv50/ovly907e.c
Normal file
70
drivers/gpu/drm/nouveau/dispnv50/ovly907e.c
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "ovly.h"
|
||||
#include "atom.h"
|
||||
|
||||
static void
|
||||
ovly907e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 12))) {
|
||||
evo_mthd(push, 0x0084, 1);
|
||||
evo_data(push, asyw->image.interval << 4);
|
||||
evo_mthd(push, 0x00c0, 1);
|
||||
evo_data(push, asyw->image.handle[0]);
|
||||
evo_mthd(push, 0x0100, 1);
|
||||
evo_data(push, 0x00000002);
|
||||
evo_mthd(push, 0x0400, 1);
|
||||
evo_data(push, asyw->image.offset[0] >> 8);
|
||||
evo_mthd(push, 0x0408, 3);
|
||||
evo_data(push, asyw->image.h << 16 | asyw->image.w);
|
||||
evo_data(push, asyw->image.layout << 24 |
|
||||
(asyw->image.pitch[0] >> 8) << 8 |
|
||||
asyw->image.blocks[0] << 8 |
|
||||
asyw->image.blockh);
|
||||
evo_data(push, asyw->image.format << 8 |
|
||||
asyw->image.colorspace);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_wndw_func
|
||||
ovly907e = {
|
||||
.acquire = ovly507e_acquire,
|
||||
.release = ovly507e_release,
|
||||
.ntfy_set = ovly507e_ntfy_set,
|
||||
.ntfy_clr = ovly507e_ntfy_clr,
|
||||
.ntfy_reset = ovly827e_ntfy_reset,
|
||||
.ntfy_wait_begun = ovly827e_ntfy_wait_begun,
|
||||
.image_set = ovly907e_image_set,
|
||||
.image_clr = ovly507e_image_clr,
|
||||
.scale_set = ovly507e_scale_set,
|
||||
.update = ovly507e_update,
|
||||
};
|
||||
|
||||
int
|
||||
ovly907e_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return ovly507e_new_(&ovly907e, ovly827e_format, drm, head, oclass,
|
||||
0x00000004 << (head * 4), pwndw);
|
||||
}
|
||||
45
drivers/gpu/drm/nouveau/dispnv50/ovly917e.c
Normal file
45
drivers/gpu/drm/nouveau/dispnv50/ovly917e.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "ovly.h"
|
||||
|
||||
static const u32
|
||||
ovly917e_format[] = {
|
||||
DRM_FORMAT_YUYV,
|
||||
DRM_FORMAT_UYVY,
|
||||
DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_XRGB1555,
|
||||
DRM_FORMAT_ARGB1555,
|
||||
DRM_FORMAT_XBGR2101010,
|
||||
DRM_FORMAT_ABGR2101010,
|
||||
DRM_FORMAT_XRGB2101010,
|
||||
DRM_FORMAT_ARGB2101010,
|
||||
0
|
||||
};
|
||||
|
||||
int
|
||||
ovly917e_new(struct nouveau_drm *drm, int head, s32 oclass,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
return ovly507e_new_(&ovly907e, ovly917e_format, drm, head, oclass,
|
||||
0x00000004 << (head * 4), pwndw);
|
||||
}
|
||||
44
drivers/gpu/drm/nouveau/dispnv50/pior507d.c
Normal file
44
drivers/gpu/drm/nouveau/dispnv50/pior507d.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "core.h"
|
||||
|
||||
static void
|
||||
pior507d_ctrl(struct nv50_core *core, int or, u32 ctrl,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&core->chan, 2))) {
|
||||
if (asyh) {
|
||||
ctrl |= asyh->or.depth << 16;
|
||||
ctrl |= asyh->or.nvsync << 13;
|
||||
ctrl |= asyh->or.nhsync << 12;
|
||||
}
|
||||
evo_mthd(push, 0x0700 + (or * 0x040), 1);
|
||||
evo_data(push, ctrl);
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_outp_func
|
||||
pior507d = {
|
||||
.ctrl = pior507d_ctrl,
|
||||
};
|
||||
44
drivers/gpu/drm/nouveau/dispnv50/sor507d.c
Normal file
44
drivers/gpu/drm/nouveau/dispnv50/sor507d.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "core.h"
|
||||
|
||||
static void
|
||||
sor507d_ctrl(struct nv50_core *core, int or, u32 ctrl,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&core->chan, 2))) {
|
||||
if (asyh) {
|
||||
ctrl |= asyh->or.depth << 16;
|
||||
ctrl |= asyh->or.nvsync << 13;
|
||||
ctrl |= asyh->or.nhsync << 12;
|
||||
}
|
||||
evo_mthd(push, 0x0600 + (or * 0x40), 1);
|
||||
evo_data(push, ctrl);
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_outp_func
|
||||
sor507d = {
|
||||
.ctrl = sor507d_ctrl,
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat Inc.
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -18,21 +18,24 @@
|
|||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Ben Skeggs <bskeggs@redhat.com>
|
||||
*/
|
||||
#include "dmacnv50.h"
|
||||
#include "rootnv50.h"
|
||||
#include "core.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
const struct nv50_disp_dmac_oclass
|
||||
gt215_disp_base_oclass = {
|
||||
.base.oclass = GT214_DISP_BASE_CHANNEL_DMA,
|
||||
.base.minver = 0,
|
||||
.base.maxver = 0,
|
||||
.ctor = nv50_disp_base_new,
|
||||
.func = &nv50_disp_dmac_func,
|
||||
.mthd = &g84_disp_base_chan_mthd,
|
||||
.chid = 1,
|
||||
static void
|
||||
sor907d_ctrl(struct nv50_core *core, int or, u32 ctrl,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&core->chan, 2))) {
|
||||
evo_mthd(push, 0x0200 + (or * 0x20), 1);
|
||||
evo_data(push, ctrl);
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_outp_func
|
||||
sor907d = {
|
||||
.ctrl = sor907d_ctrl,
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -18,20 +18,22 @@
|
|||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Ben Skeggs
|
||||
*/
|
||||
#include "channv50.h"
|
||||
#include "rootnv50.h"
|
||||
#include "core.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
static void
|
||||
sorc37d_ctrl(struct nv50_core *core, int or, u32 ctrl,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&core->chan, 2))) {
|
||||
evo_mthd(push, 0x0300 + (or * 0x20), 1);
|
||||
evo_data(push, ctrl);
|
||||
evo_kick(push, &core->chan);
|
||||
}
|
||||
}
|
||||
|
||||
const struct nv50_disp_pioc_oclass
|
||||
gk104_disp_curs_oclass = {
|
||||
.base.oclass = GK104_DISP_CURSOR,
|
||||
.base.minver = 0,
|
||||
.base.maxver = 0,
|
||||
.ctor = nv50_disp_curs_new,
|
||||
.func = &gf119_disp_pioc_func,
|
||||
.chid = { 13, 13 },
|
||||
const struct nv50_outp_func
|
||||
sorc37d = {
|
||||
.ctrl = sorc37d_ctrl,
|
||||
};
|
||||
47
drivers/gpu/drm/nouveau/dispnv50/wimm.c
Normal file
47
drivers/gpu/drm/nouveau/dispnv50/wimm.c
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "wimm.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
int
|
||||
nv50_wimm_init(struct nouveau_drm *drm, struct nv50_wndw *wndw)
|
||||
{
|
||||
struct {
|
||||
s32 oclass;
|
||||
int version;
|
||||
int (*init)(struct nouveau_drm *, s32, struct nv50_wndw *);
|
||||
} wimms[] = {
|
||||
{ GV100_DISP_WINDOW_IMM_CHANNEL_DMA, 0, wimmc37b_init },
|
||||
{}
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
int cid;
|
||||
|
||||
cid = nvif_mclass(&disp->disp->object, wimms);
|
||||
if (cid < 0) {
|
||||
NV_ERROR(drm, "No supported window immediate class\n");
|
||||
return cid;
|
||||
}
|
||||
|
||||
return wimms[cid].init(drm, wimms[cid].oclass, wndw);
|
||||
}
|
||||
8
drivers/gpu/drm/nouveau/dispnv50/wimm.h
Normal file
8
drivers/gpu/drm/nouveau/dispnv50/wimm.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __NV50_KMS_WIMM_H__
|
||||
#define __NV50_KMS_WIMM_H__
|
||||
#include "wndw.h"
|
||||
|
||||
int nv50_wimm_init(struct nouveau_drm *drm, struct nv50_wndw *);
|
||||
|
||||
int wimmc37b_init(struct nouveau_drm *, s32, struct nv50_wndw *);
|
||||
#endif
|
||||
86
drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c
Normal file
86
drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "wimm.h"
|
||||
#include "atom.h"
|
||||
#include "wndw.h"
|
||||
|
||||
#include <nvif/clc37b.h>
|
||||
|
||||
static void
|
||||
wimmc37b_update(struct nv50_wndw *wndw, u32 *interlock)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wimm, 2))) {
|
||||
evo_mthd(push, 0x0200, 1);
|
||||
if (interlock[NV50_DISP_INTERLOCK_WNDW] & wndw->interlock.data)
|
||||
evo_data(push, 0x00000003);
|
||||
else
|
||||
evo_data(push, 0x00000001);
|
||||
evo_kick(push, &wndw->wimm);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wimmc37b_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wimm, 2))) {
|
||||
evo_mthd(push, 0x0208, 1);
|
||||
evo_data(push, asyw->point.y << 16 | asyw->point.x);
|
||||
evo_kick(push, &wndw->wimm);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct nv50_wimm_func
|
||||
wimmc37b = {
|
||||
.point = wimmc37b_point,
|
||||
.update = wimmc37b_update,
|
||||
};
|
||||
|
||||
static int
|
||||
wimmc37b_init_(const struct nv50_wimm_func *func, struct nouveau_drm *drm,
|
||||
s32 oclass, struct nv50_wndw *wndw)
|
||||
{
|
||||
struct nvc37b_window_imm_channel_dma_v0 args = {
|
||||
.pushbuf = 0xb0007b00 | wndw->id,
|
||||
.index = wndw->id,
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
int ret;
|
||||
|
||||
ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
|
||||
&oclass, 0, &args, sizeof(args), 0,
|
||||
&wndw->wimm);
|
||||
if (ret) {
|
||||
NV_ERROR(drm, "wimm%04x allocation failed: %d\n", oclass, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
wndw->immd = func;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
wimmc37b_init(struct nouveau_drm *drm, s32 oclass, struct nv50_wndw *wndw)
|
||||
{
|
||||
return wimmc37b_init_(&wimmc37b, drm, oclass, wndw);
|
||||
}
|
||||
641
drivers/gpu/drm/nouveau/dispnv50/wndw.c
Normal file
641
drivers/gpu/drm/nouveau/dispnv50/wndw.c
Normal file
|
|
@ -0,0 +1,641 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "wndw.h"
|
||||
#include "wimm.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
#include <nvif/cl0002.h>
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include "nouveau_bo.h"
|
||||
|
||||
static void
|
||||
nv50_wndw_ctxdma_del(struct nv50_wndw_ctxdma *ctxdma)
|
||||
{
|
||||
nvif_object_fini(&ctxdma->object);
|
||||
list_del(&ctxdma->head);
|
||||
kfree(ctxdma);
|
||||
}
|
||||
|
||||
static struct nv50_wndw_ctxdma *
|
||||
nv50_wndw_ctxdma_new(struct nv50_wndw *wndw, struct nouveau_framebuffer *fb)
|
||||
{
|
||||
struct nouveau_drm *drm = nouveau_drm(fb->base.dev);
|
||||
struct nv50_wndw_ctxdma *ctxdma;
|
||||
const u8 kind = fb->nvbo->kind;
|
||||
const u32 handle = 0xfb000000 | kind;
|
||||
struct {
|
||||
struct nv_dma_v0 base;
|
||||
union {
|
||||
struct nv50_dma_v0 nv50;
|
||||
struct gf100_dma_v0 gf100;
|
||||
struct gf119_dma_v0 gf119;
|
||||
};
|
||||
} args = {};
|
||||
u32 argc = sizeof(args.base);
|
||||
int ret;
|
||||
|
||||
list_for_each_entry(ctxdma, &wndw->ctxdma.list, head) {
|
||||
if (ctxdma->object.handle == handle)
|
||||
return ctxdma;
|
||||
}
|
||||
|
||||
if (!(ctxdma = kzalloc(sizeof(*ctxdma), GFP_KERNEL)))
|
||||
return ERR_PTR(-ENOMEM);
|
||||
list_add(&ctxdma->head, &wndw->ctxdma.list);
|
||||
|
||||
args.base.target = NV_DMA_V0_TARGET_VRAM;
|
||||
args.base.access = NV_DMA_V0_ACCESS_RDWR;
|
||||
args.base.start = 0;
|
||||
args.base.limit = drm->client.device.info.ram_user - 1;
|
||||
|
||||
if (drm->client.device.info.chipset < 0x80) {
|
||||
args.nv50.part = NV50_DMA_V0_PART_256;
|
||||
argc += sizeof(args.nv50);
|
||||
} else
|
||||
if (drm->client.device.info.chipset < 0xc0) {
|
||||
args.nv50.part = NV50_DMA_V0_PART_256;
|
||||
args.nv50.kind = kind;
|
||||
argc += sizeof(args.nv50);
|
||||
} else
|
||||
if (drm->client.device.info.chipset < 0xd0) {
|
||||
args.gf100.kind = kind;
|
||||
argc += sizeof(args.gf100);
|
||||
} else {
|
||||
args.gf119.page = GF119_DMA_V0_PAGE_LP;
|
||||
args.gf119.kind = kind;
|
||||
argc += sizeof(args.gf119);
|
||||
}
|
||||
|
||||
ret = nvif_object_init(wndw->ctxdma.parent, handle, NV_DMA_IN_MEMORY,
|
||||
&args, argc, &ctxdma->object);
|
||||
if (ret) {
|
||||
nv50_wndw_ctxdma_del(ctxdma);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return ctxdma;
|
||||
}
|
||||
|
||||
int
|
||||
nv50_wndw_wait_armed(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
struct nv50_disp *disp = nv50_disp(wndw->plane.dev);
|
||||
if (asyw->set.ntfy) {
|
||||
return wndw->func->ntfy_wait_begun(disp->sync,
|
||||
asyw->ntfy.offset,
|
||||
wndw->wndw.base.device);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nv50_wndw_flush_clr(struct nv50_wndw *wndw, u32 *interlock, bool flush,
|
||||
struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
union nv50_wndw_atom_mask clr = {
|
||||
.mask = asyw->clr.mask & ~(flush ? 0 : asyw->set.mask),
|
||||
};
|
||||
if (clr.sema ) wndw->func-> sema_clr(wndw);
|
||||
if (clr.ntfy ) wndw->func-> ntfy_clr(wndw);
|
||||
if (clr.xlut ) wndw->func-> xlut_clr(wndw);
|
||||
if (clr.image) wndw->func->image_clr(wndw);
|
||||
|
||||
interlock[wndw->interlock.type] |= wndw->interlock.data;
|
||||
}
|
||||
|
||||
void
|
||||
nv50_wndw_flush_set(struct nv50_wndw *wndw, u32 *interlock,
|
||||
struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
if (interlock) {
|
||||
asyw->image.mode = 0;
|
||||
asyw->image.interval = 1;
|
||||
}
|
||||
|
||||
if (asyw->set.sema ) wndw->func->sema_set (wndw, asyw);
|
||||
if (asyw->set.ntfy ) wndw->func->ntfy_set (wndw, asyw);
|
||||
if (asyw->set.image) wndw->func->image_set(wndw, asyw);
|
||||
|
||||
if (asyw->set.xlut ) {
|
||||
if (asyw->ilut) {
|
||||
asyw->xlut.i.offset =
|
||||
nv50_lut_load(&wndw->ilut,
|
||||
asyw->xlut.i.mode <= 1,
|
||||
asyw->xlut.i.buffer,
|
||||
asyw->ilut);
|
||||
}
|
||||
wndw->func->xlut_set(wndw, asyw);
|
||||
}
|
||||
|
||||
if (asyw->set.scale) wndw->func->scale_set(wndw, asyw);
|
||||
if (asyw->set.point) {
|
||||
if (asyw->set.point = false, asyw->set.mask)
|
||||
interlock[wndw->interlock.type] |= wndw->interlock.data;
|
||||
interlock[NV50_DISP_INTERLOCK_WIMM] |= wndw->interlock.data;
|
||||
|
||||
wndw->immd->point(wndw, asyw);
|
||||
wndw->immd->update(wndw, interlock);
|
||||
} else {
|
||||
interlock[wndw->interlock.type] |= wndw->interlock.data;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nv50_wndw_ntfy_enable(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
struct nv50_disp *disp = nv50_disp(wndw->plane.dev);
|
||||
|
||||
asyw->ntfy.handle = wndw->wndw.sync.handle;
|
||||
asyw->ntfy.offset = wndw->ntfy;
|
||||
asyw->ntfy.awaken = false;
|
||||
asyw->set.ntfy = true;
|
||||
|
||||
wndw->func->ntfy_reset(disp->sync, wndw->ntfy);
|
||||
wndw->ntfy ^= 0x10;
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_wndw_atomic_check_release(struct nv50_wndw *wndw,
|
||||
struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nouveau_drm *drm = nouveau_drm(wndw->plane.dev);
|
||||
NV_ATOMIC(drm, "%s release\n", wndw->plane.name);
|
||||
wndw->func->release(wndw, asyw, asyh);
|
||||
asyw->ntfy.handle = 0;
|
||||
asyw->sema.handle = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nv50_wndw_atomic_check_acquire_yuv(struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
switch (asyw->state.fb->format->format) {
|
||||
case DRM_FORMAT_YUYV: asyw->image.format = 0x28; break;
|
||||
case DRM_FORMAT_UYVY: asyw->image.format = 0x29; break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
return -EINVAL;
|
||||
}
|
||||
asyw->image.colorspace = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nv50_wndw_atomic_check_acquire_rgb(struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
switch (asyw->state.fb->format->format) {
|
||||
case DRM_FORMAT_C8 : asyw->image.format = 0x1e; break;
|
||||
case DRM_FORMAT_XRGB8888 :
|
||||
case DRM_FORMAT_ARGB8888 : asyw->image.format = 0xcf; break;
|
||||
case DRM_FORMAT_RGB565 : asyw->image.format = 0xe8; break;
|
||||
case DRM_FORMAT_XRGB1555 :
|
||||
case DRM_FORMAT_ARGB1555 : asyw->image.format = 0xe9; break;
|
||||
case DRM_FORMAT_XBGR2101010:
|
||||
case DRM_FORMAT_ABGR2101010: asyw->image.format = 0xd1; break;
|
||||
case DRM_FORMAT_XBGR8888 :
|
||||
case DRM_FORMAT_ABGR8888 : asyw->image.format = 0xd5; break;
|
||||
case DRM_FORMAT_XRGB2101010:
|
||||
case DRM_FORMAT_ARGB2101010: asyw->image.format = 0xdf; break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
asyw->image.colorspace = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nv50_wndw_atomic_check_acquire(struct nv50_wndw *wndw, bool modeset,
|
||||
struct nv50_wndw_atom *armw,
|
||||
struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct nouveau_framebuffer *fb = nouveau_framebuffer(asyw->state.fb);
|
||||
struct nouveau_drm *drm = nouveau_drm(wndw->plane.dev);
|
||||
int ret;
|
||||
|
||||
NV_ATOMIC(drm, "%s acquire\n", wndw->plane.name);
|
||||
|
||||
if (asyw->state.fb != armw->state.fb || !armw->visible || modeset) {
|
||||
asyw->image.w = fb->base.width;
|
||||
asyw->image.h = fb->base.height;
|
||||
asyw->image.kind = fb->nvbo->kind;
|
||||
|
||||
ret = nv50_wndw_atomic_check_acquire_rgb(asyw);
|
||||
if (ret) {
|
||||
ret = nv50_wndw_atomic_check_acquire_yuv(asyw);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (asyw->image.kind) {
|
||||
asyw->image.layout = 0;
|
||||
if (drm->client.device.info.chipset >= 0xc0)
|
||||
asyw->image.blockh = fb->nvbo->mode >> 4;
|
||||
else
|
||||
asyw->image.blockh = fb->nvbo->mode;
|
||||
asyw->image.blocks[0] = fb->base.pitches[0] / 64;
|
||||
asyw->image.pitch[0] = 0;
|
||||
} else {
|
||||
asyw->image.layout = 1;
|
||||
asyw->image.blockh = 0;
|
||||
asyw->image.blocks[0] = 0;
|
||||
asyw->image.pitch[0] = fb->base.pitches[0];
|
||||
}
|
||||
|
||||
if (!(asyh->state.pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC))
|
||||
asyw->image.interval = 1;
|
||||
else
|
||||
asyw->image.interval = 0;
|
||||
asyw->image.mode = asyw->image.interval ? 0 : 1;
|
||||
asyw->set.image = wndw->func->image_set != NULL;
|
||||
}
|
||||
|
||||
if (wndw->func->scale_set) {
|
||||
asyw->scale.sx = asyw->state.src_x >> 16;
|
||||
asyw->scale.sy = asyw->state.src_y >> 16;
|
||||
asyw->scale.sw = asyw->state.src_w >> 16;
|
||||
asyw->scale.sh = asyw->state.src_h >> 16;
|
||||
asyw->scale.dw = asyw->state.crtc_w;
|
||||
asyw->scale.dh = asyw->state.crtc_h;
|
||||
if (memcmp(&armw->scale, &asyw->scale, sizeof(asyw->scale)))
|
||||
asyw->set.scale = true;
|
||||
}
|
||||
|
||||
if (wndw->immd) {
|
||||
asyw->point.x = asyw->state.crtc_x;
|
||||
asyw->point.y = asyw->state.crtc_y;
|
||||
if (memcmp(&armw->point, &asyw->point, sizeof(asyw->point)))
|
||||
asyw->set.point = true;
|
||||
}
|
||||
|
||||
return wndw->func->acquire(wndw, asyw, asyh);
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_wndw_atomic_check_lut(struct nv50_wndw *wndw,
|
||||
struct nv50_wndw_atom *armw,
|
||||
struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
struct drm_property_blob *ilut = asyh->state.degamma_lut;
|
||||
|
||||
/* I8 format without an input LUT makes no sense, and the
|
||||
* HW error-checks for this.
|
||||
*
|
||||
* In order to handle legacy gamma, when there's no input
|
||||
* LUT we need to steal the output LUT and use it instead.
|
||||
*/
|
||||
if (!ilut && asyw->state.fb->format->format == DRM_FORMAT_C8) {
|
||||
/* This should be an error, but there's legacy clients
|
||||
* that do a modeset before providing a gamma table.
|
||||
*
|
||||
* We keep the window disabled to avoid angering HW.
|
||||
*/
|
||||
if (!(ilut = asyh->state.gamma_lut)) {
|
||||
asyw->visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (wndw->func->ilut)
|
||||
asyh->wndw.olut |= BIT(wndw->id);
|
||||
} else {
|
||||
asyh->wndw.olut &= ~BIT(wndw->id);
|
||||
}
|
||||
|
||||
/* Recalculate LUT state. */
|
||||
memset(&asyw->xlut, 0x00, sizeof(asyw->xlut));
|
||||
if ((asyw->ilut = wndw->func->ilut ? ilut : NULL)) {
|
||||
wndw->func->ilut(wndw, asyw);
|
||||
asyw->xlut.handle = wndw->wndw.vram.handle;
|
||||
asyw->xlut.i.buffer = !asyw->xlut.i.buffer;
|
||||
asyw->set.xlut = true;
|
||||
}
|
||||
|
||||
/* Handle setting base SET_OUTPUT_LUT_LO_ENABLE_USE_CORE_LUT. */
|
||||
if (wndw->func->olut_core &&
|
||||
(!armw->visible || (armw->xlut.handle && !asyw->xlut.handle)))
|
||||
asyw->set.xlut = true;
|
||||
|
||||
/* Can't do an immediate flip while changing the LUT. */
|
||||
asyh->state.pageflip_flags &= ~DRM_MODE_PAGE_FLIP_ASYNC;
|
||||
}
|
||||
|
||||
static int
|
||||
nv50_wndw_atomic_check(struct drm_plane *plane, struct drm_plane_state *state)
|
||||
{
|
||||
struct nouveau_drm *drm = nouveau_drm(plane->dev);
|
||||
struct nv50_wndw *wndw = nv50_wndw(plane);
|
||||
struct nv50_wndw_atom *armw = nv50_wndw_atom(wndw->plane.state);
|
||||
struct nv50_wndw_atom *asyw = nv50_wndw_atom(state);
|
||||
struct nv50_head_atom *harm = NULL, *asyh = NULL;
|
||||
bool modeset = false;
|
||||
int ret;
|
||||
|
||||
NV_ATOMIC(drm, "%s atomic_check\n", plane->name);
|
||||
|
||||
/* Fetch the assembly state for the head the window will belong to,
|
||||
* and determine whether the window will be visible.
|
||||
*/
|
||||
if (asyw->state.crtc) {
|
||||
asyh = nv50_head_atom_get(asyw->state.state, asyw->state.crtc);
|
||||
if (IS_ERR(asyh))
|
||||
return PTR_ERR(asyh);
|
||||
modeset = drm_atomic_crtc_needs_modeset(&asyh->state);
|
||||
asyw->visible = asyh->state.active;
|
||||
} else {
|
||||
asyw->visible = false;
|
||||
}
|
||||
|
||||
/* Fetch assembly state for the head the window used to belong to. */
|
||||
if (armw->state.crtc) {
|
||||
harm = nv50_head_atom_get(asyw->state.state, armw->state.crtc);
|
||||
if (IS_ERR(harm))
|
||||
return PTR_ERR(harm);
|
||||
}
|
||||
|
||||
/* LUT configuration can potentially cause the window to be disabled. */
|
||||
if (asyw->visible && wndw->func->xlut_set &&
|
||||
(!armw->visible ||
|
||||
asyh->state.color_mgmt_changed ||
|
||||
asyw->state.fb->format->format !=
|
||||
armw->state.fb->format->format))
|
||||
nv50_wndw_atomic_check_lut(wndw, armw, asyw, asyh);
|
||||
|
||||
/* Calculate new window state. */
|
||||
if (asyw->visible) {
|
||||
ret = nv50_wndw_atomic_check_acquire(wndw, modeset,
|
||||
armw, asyw, asyh);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
asyh->wndw.mask |= BIT(wndw->id);
|
||||
} else
|
||||
if (armw->visible) {
|
||||
nv50_wndw_atomic_check_release(wndw, asyw, harm);
|
||||
harm->wndw.mask &= ~BIT(wndw->id);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Aside from the obvious case where the window is actively being
|
||||
* disabled, we might also need to temporarily disable the window
|
||||
* when performing certain modeset operations.
|
||||
*/
|
||||
if (!asyw->visible || modeset) {
|
||||
asyw->clr.ntfy = armw->ntfy.handle != 0;
|
||||
asyw->clr.sema = armw->sema.handle != 0;
|
||||
asyw->clr.xlut = armw->xlut.handle != 0;
|
||||
if (wndw->func->image_clr)
|
||||
asyw->clr.image = armw->image.handle[0] != 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_wndw_cleanup_fb(struct drm_plane *plane, struct drm_plane_state *old_state)
|
||||
{
|
||||
struct nouveau_framebuffer *fb = nouveau_framebuffer(old_state->fb);
|
||||
struct nouveau_drm *drm = nouveau_drm(plane->dev);
|
||||
|
||||
NV_ATOMIC(drm, "%s cleanup: %p\n", plane->name, old_state->fb);
|
||||
if (!old_state->fb)
|
||||
return;
|
||||
|
||||
nouveau_bo_unpin(fb->nvbo);
|
||||
}
|
||||
|
||||
static int
|
||||
nv50_wndw_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state)
|
||||
{
|
||||
struct nouveau_framebuffer *fb = nouveau_framebuffer(state->fb);
|
||||
struct nouveau_drm *drm = nouveau_drm(plane->dev);
|
||||
struct nv50_wndw *wndw = nv50_wndw(plane);
|
||||
struct nv50_wndw_atom *asyw = nv50_wndw_atom(state);
|
||||
struct nv50_head_atom *asyh;
|
||||
struct nv50_wndw_ctxdma *ctxdma;
|
||||
int ret;
|
||||
|
||||
NV_ATOMIC(drm, "%s prepare: %p\n", plane->name, state->fb);
|
||||
if (!asyw->state.fb)
|
||||
return 0;
|
||||
|
||||
ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ctxdma = nv50_wndw_ctxdma_new(wndw, fb);
|
||||
if (IS_ERR(ctxdma)) {
|
||||
nouveau_bo_unpin(fb->nvbo);
|
||||
return PTR_ERR(ctxdma);
|
||||
}
|
||||
|
||||
asyw->state.fence = reservation_object_get_excl_rcu(fb->nvbo->bo.resv);
|
||||
asyw->image.handle[0] = ctxdma->object.handle;
|
||||
asyw->image.offset[0] = fb->nvbo->bo.offset;
|
||||
|
||||
if (wndw->func->prepare) {
|
||||
asyh = nv50_head_atom_get(asyw->state.state, asyw->state.crtc);
|
||||
if (IS_ERR(asyh))
|
||||
return PTR_ERR(asyh);
|
||||
|
||||
wndw->func->prepare(wndw, asyh, asyw);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct drm_plane_helper_funcs
|
||||
nv50_wndw_helper = {
|
||||
.prepare_fb = nv50_wndw_prepare_fb,
|
||||
.cleanup_fb = nv50_wndw_cleanup_fb,
|
||||
.atomic_check = nv50_wndw_atomic_check,
|
||||
};
|
||||
|
||||
static void
|
||||
nv50_wndw_atomic_destroy_state(struct drm_plane *plane,
|
||||
struct drm_plane_state *state)
|
||||
{
|
||||
struct nv50_wndw_atom *asyw = nv50_wndw_atom(state);
|
||||
__drm_atomic_helper_plane_destroy_state(&asyw->state);
|
||||
kfree(asyw);
|
||||
}
|
||||
|
||||
static struct drm_plane_state *
|
||||
nv50_wndw_atomic_duplicate_state(struct drm_plane *plane)
|
||||
{
|
||||
struct nv50_wndw_atom *armw = nv50_wndw_atom(plane->state);
|
||||
struct nv50_wndw_atom *asyw;
|
||||
if (!(asyw = kmalloc(sizeof(*asyw), GFP_KERNEL)))
|
||||
return NULL;
|
||||
__drm_atomic_helper_plane_duplicate_state(plane, &asyw->state);
|
||||
asyw->sema = armw->sema;
|
||||
asyw->ntfy = armw->ntfy;
|
||||
asyw->ilut = NULL;
|
||||
asyw->xlut = armw->xlut;
|
||||
asyw->image = armw->image;
|
||||
asyw->point = armw->point;
|
||||
asyw->clr.mask = 0;
|
||||
asyw->set.mask = 0;
|
||||
return &asyw->state;
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_wndw_reset(struct drm_plane *plane)
|
||||
{
|
||||
struct nv50_wndw_atom *asyw;
|
||||
|
||||
if (WARN_ON(!(asyw = kzalloc(sizeof(*asyw), GFP_KERNEL))))
|
||||
return;
|
||||
|
||||
if (plane->state)
|
||||
plane->funcs->atomic_destroy_state(plane, plane->state);
|
||||
plane->state = &asyw->state;
|
||||
plane->state->plane = plane;
|
||||
plane->state->rotation = DRM_MODE_ROTATE_0;
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_wndw_destroy(struct drm_plane *plane)
|
||||
{
|
||||
struct nv50_wndw *wndw = nv50_wndw(plane);
|
||||
struct nv50_wndw_ctxdma *ctxdma, *ctxtmp;
|
||||
|
||||
list_for_each_entry_safe(ctxdma, ctxtmp, &wndw->ctxdma.list, head) {
|
||||
nv50_wndw_ctxdma_del(ctxdma);
|
||||
}
|
||||
|
||||
nvif_notify_fini(&wndw->notify);
|
||||
nv50_dmac_destroy(&wndw->wimm);
|
||||
nv50_dmac_destroy(&wndw->wndw);
|
||||
|
||||
nv50_lut_fini(&wndw->ilut);
|
||||
|
||||
drm_plane_cleanup(&wndw->plane);
|
||||
kfree(wndw);
|
||||
}
|
||||
|
||||
const struct drm_plane_funcs
|
||||
nv50_wndw = {
|
||||
.update_plane = drm_atomic_helper_update_plane,
|
||||
.disable_plane = drm_atomic_helper_disable_plane,
|
||||
.destroy = nv50_wndw_destroy,
|
||||
.reset = nv50_wndw_reset,
|
||||
.atomic_duplicate_state = nv50_wndw_atomic_duplicate_state,
|
||||
.atomic_destroy_state = nv50_wndw_atomic_destroy_state,
|
||||
};
|
||||
|
||||
static int
|
||||
nv50_wndw_notify(struct nvif_notify *notify)
|
||||
{
|
||||
return NVIF_NOTIFY_KEEP;
|
||||
}
|
||||
|
||||
void
|
||||
nv50_wndw_fini(struct nv50_wndw *wndw)
|
||||
{
|
||||
nvif_notify_put(&wndw->notify);
|
||||
}
|
||||
|
||||
void
|
||||
nv50_wndw_init(struct nv50_wndw *wndw)
|
||||
{
|
||||
nvif_notify_get(&wndw->notify);
|
||||
}
|
||||
|
||||
int
|
||||
nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
|
||||
enum drm_plane_type type, const char *name, int index,
|
||||
const u32 *format, u32 heads,
|
||||
enum nv50_disp_interlock_type interlock_type, u32 interlock_data,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
struct nouveau_drm *drm = nouveau_drm(dev);
|
||||
struct nvif_mmu *mmu = &drm->client.mmu;
|
||||
struct nv50_disp *disp = nv50_disp(dev);
|
||||
struct nv50_wndw *wndw;
|
||||
int nformat;
|
||||
int ret;
|
||||
|
||||
if (!(wndw = *pwndw = kzalloc(sizeof(*wndw), GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
wndw->func = func;
|
||||
wndw->id = index;
|
||||
wndw->interlock.type = interlock_type;
|
||||
wndw->interlock.data = interlock_data;
|
||||
wndw->ctxdma.parent = &wndw->wndw.base.user;
|
||||
|
||||
wndw->ctxdma.parent = &wndw->wndw.base.user;
|
||||
INIT_LIST_HEAD(&wndw->ctxdma.list);
|
||||
|
||||
for (nformat = 0; format[nformat]; nformat++);
|
||||
|
||||
ret = drm_universal_plane_init(dev, &wndw->plane, heads, &nv50_wndw,
|
||||
format, nformat, NULL,
|
||||
type, "%s-%d", name, index);
|
||||
if (ret) {
|
||||
kfree(*pwndw);
|
||||
*pwndw = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
drm_plane_helper_add(&wndw->plane, &nv50_wndw_helper);
|
||||
|
||||
if (wndw->func->ilut) {
|
||||
ret = nv50_lut_init(disp, mmu, &wndw->ilut);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
wndw->notify.func = nv50_wndw_notify;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nv50_wndw_new(struct nouveau_drm *drm, enum drm_plane_type type, int index,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
struct {
|
||||
s32 oclass;
|
||||
int version;
|
||||
int (*new)(struct nouveau_drm *, enum drm_plane_type,
|
||||
int, s32, struct nv50_wndw **);
|
||||
} wndws[] = {
|
||||
{ GV100_DISP_WINDOW_CHANNEL_DMA, 0, wndwc37e_new },
|
||||
{}
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
int cid, ret;
|
||||
|
||||
cid = nvif_mclass(&disp->disp->object, wndws);
|
||||
if (cid < 0) {
|
||||
NV_ERROR(drm, "No supported window class\n");
|
||||
return cid;
|
||||
}
|
||||
|
||||
ret = wndws[cid].new(drm, type, index, wndws[cid].oclass, pwndw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return nv50_wimm_init(drm, *pwndw);
|
||||
}
|
||||
96
drivers/gpu/drm/nouveau/dispnv50/wndw.h
Normal file
96
drivers/gpu/drm/nouveau/dispnv50/wndw.h
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
#ifndef __NV50_KMS_WNDW_H__
|
||||
#define __NV50_KMS_WNDW_H__
|
||||
#define nv50_wndw(p) container_of((p), struct nv50_wndw, plane)
|
||||
#include "disp.h"
|
||||
#include "atom.h"
|
||||
#include "lut.h"
|
||||
|
||||
#include <nvif/notify.h>
|
||||
|
||||
struct nv50_wndw_ctxdma {
|
||||
struct list_head head;
|
||||
struct nvif_object object;
|
||||
};
|
||||
|
||||
struct nv50_wndw {
|
||||
const struct nv50_wndw_func *func;
|
||||
const struct nv50_wimm_func *immd;
|
||||
int id;
|
||||
struct nv50_disp_interlock interlock;
|
||||
|
||||
struct {
|
||||
struct nvif_object *parent;
|
||||
struct list_head list;
|
||||
} ctxdma;
|
||||
|
||||
struct drm_plane plane;
|
||||
|
||||
struct nv50_lut ilut;
|
||||
|
||||
struct nv50_dmac wndw;
|
||||
struct nv50_dmac wimm;
|
||||
|
||||
struct nvif_notify notify;
|
||||
u16 ntfy;
|
||||
u16 sema;
|
||||
u32 data;
|
||||
};
|
||||
|
||||
int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
|
||||
enum drm_plane_type, const char *name, int index,
|
||||
const u32 *format, enum nv50_disp_interlock_type,
|
||||
u32 interlock_data, u32 heads, struct nv50_wndw **);
|
||||
void nv50_wndw_init(struct nv50_wndw *);
|
||||
void nv50_wndw_fini(struct nv50_wndw *);
|
||||
void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock,
|
||||
struct nv50_wndw_atom *);
|
||||
void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush,
|
||||
struct nv50_wndw_atom *);
|
||||
void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
|
||||
struct nv50_wndw_func {
|
||||
int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh);
|
||||
void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh);
|
||||
void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh,
|
||||
struct nv50_wndw_atom *asyw);
|
||||
|
||||
void (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
void (*sema_clr)(struct nv50_wndw *);
|
||||
void (*ntfy_reset)(struct nouveau_bo *, u32 offset);
|
||||
void (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
void (*ntfy_clr)(struct nv50_wndw *);
|
||||
int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset,
|
||||
struct nvif_device *);
|
||||
void (*ilut)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
bool olut_core;
|
||||
void (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
void (*xlut_clr)(struct nv50_wndw *);
|
||||
void (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
void (*image_clr)(struct nv50_wndw *);
|
||||
void (*scale_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
|
||||
void (*update)(struct nv50_wndw *, u32 *interlock);
|
||||
};
|
||||
|
||||
extern const struct drm_plane_funcs nv50_wndw;
|
||||
|
||||
void base507c_ntfy_reset(struct nouveau_bo *, u32);
|
||||
int base507c_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *);
|
||||
|
||||
struct nv50_wimm_func {
|
||||
void (*point)(struct nv50_wndw *, struct nv50_wndw_atom *);
|
||||
|
||||
void (*update)(struct nv50_wndw *, u32 *interlock);
|
||||
};
|
||||
|
||||
extern const struct nv50_wimm_func curs507a;
|
||||
|
||||
int wndwc37e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
|
||||
struct nv50_wndw **);
|
||||
|
||||
int nv50_wndw_new(struct nouveau_drm *, enum drm_plane_type, int index,
|
||||
struct nv50_wndw **);
|
||||
#endif
|
||||
278
drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c
Normal file
278
drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
/*
|
||||
* Copyright 2018 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "wndw.h"
|
||||
#include "atom.h"
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_plane_helper.h>
|
||||
#include <nouveau_bo.h>
|
||||
|
||||
#include <nvif/clc37e.h>
|
||||
|
||||
static void
|
||||
wndwc37e_ilut_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x02b8, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_ilut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 4))) {
|
||||
evo_mthd(push, 0x02b0, 3);
|
||||
evo_data(push, asyw->xlut.i.output_mode << 8 |
|
||||
asyw->xlut.i.range << 4 |
|
||||
asyw->xlut.i.size);
|
||||
evo_data(push, asyw->xlut.i.offset >> 8);
|
||||
evo_data(push, asyw->xlut.handle);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
asyw->xlut.i.mode = 2;
|
||||
asyw->xlut.i.size = 0;
|
||||
asyw->xlut.i.range = 0;
|
||||
asyw->xlut.i.output_mode = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_image_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 4))) {
|
||||
evo_mthd(push, 0x0308, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_mthd(push, 0x0240, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
|
||||
if (!(push = evo_wait(&wndw->wndw, 25)))
|
||||
return;
|
||||
|
||||
evo_mthd(push, 0x0308, 1);
|
||||
evo_data(push, asyw->image.mode << 4 | asyw->image.interval);
|
||||
evo_mthd(push, 0x0224, 4);
|
||||
evo_data(push, asyw->image.h << 16 | asyw->image.w);
|
||||
evo_data(push, asyw->image.layout << 4 | asyw->image.blockh);
|
||||
evo_data(push, asyw->image.colorspace << 8 | asyw->image.format);
|
||||
evo_data(push, asyw->image.blocks[0] | (asyw->image.pitch[0] >> 6));
|
||||
evo_mthd(push, 0x0240, 1);
|
||||
evo_data(push, asyw->image.handle[0]);
|
||||
evo_mthd(push, 0x0260, 1);
|
||||
evo_data(push, asyw->image.offset[0] >> 8);
|
||||
evo_mthd(push, 0x0290, 1);
|
||||
evo_data(push, (asyw->state.src_y >> 16) << 16 |
|
||||
(asyw->state.src_x >> 16));
|
||||
evo_mthd(push, 0x0298, 1);
|
||||
evo_data(push, (asyw->state.src_h >> 16) << 16 |
|
||||
(asyw->state.src_w >> 16));
|
||||
evo_mthd(push, 0x02a4, 1);
|
||||
evo_data(push, asyw->state.crtc_h << 16 |
|
||||
asyw->state.crtc_w);
|
||||
|
||||
/*XXX: Composition-related stuff. Need to implement properly. */
|
||||
evo_mthd(push, 0x02ec, 1);
|
||||
evo_data(push, (2 - (wndw->id & 1)) << 4);
|
||||
evo_mthd(push, 0x02f4, 5);
|
||||
evo_data(push, 0x00000011);
|
||||
evo_data(push, 0xffff0000);
|
||||
evo_data(push, 0xffff0000);
|
||||
evo_data(push, 0xffff0000);
|
||||
evo_data(push, 0xffff0000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_ntfy_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x021c, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_ntfy_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 3))) {
|
||||
evo_mthd(push, 0x021c, 2);
|
||||
evo_data(push, asyw->ntfy.handle);
|
||||
evo_data(push, asyw->ntfy.offset | asyw->ntfy.awaken);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_sema_clr(struct nv50_wndw *wndw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 2))) {
|
||||
evo_mthd(push, 0x0218, 1);
|
||||
evo_data(push, 0x00000000);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_sema_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 5))) {
|
||||
evo_mthd(push, 0x020c, 4);
|
||||
evo_data(push, asyw->sema.offset);
|
||||
evo_data(push, asyw->sema.acquire);
|
||||
evo_data(push, asyw->sema.release);
|
||||
evo_data(push, asyw->sema.handle);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_update(struct nv50_wndw *wndw, u32 *interlock)
|
||||
{
|
||||
u32 *push;
|
||||
if ((push = evo_wait(&wndw->wndw, 5))) {
|
||||
evo_mthd(push, 0x0370, 2);
|
||||
evo_data(push, interlock[NV50_DISP_INTERLOCK_CURS] << 1 |
|
||||
interlock[NV50_DISP_INTERLOCK_CORE]);
|
||||
evo_data(push, interlock[NV50_DISP_INTERLOCK_WNDW]);
|
||||
evo_mthd(push, 0x0200, 1);
|
||||
if (interlock[NV50_DISP_INTERLOCK_WIMM] & wndw->interlock.data)
|
||||
evo_data(push, 0x00001001);
|
||||
else
|
||||
evo_data(push, 0x00000001);
|
||||
evo_kick(push, &wndw->wndw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wndwc37e_release(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
wndwc37e_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
struct nv50_head_atom *asyh)
|
||||
{
|
||||
return drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
true, true);
|
||||
}
|
||||
|
||||
static const u32
|
||||
wndwc37e_format[] = {
|
||||
DRM_FORMAT_C8,
|
||||
DRM_FORMAT_YUYV,
|
||||
DRM_FORMAT_UYVY,
|
||||
DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XRGB1555,
|
||||
DRM_FORMAT_ARGB1555,
|
||||
DRM_FORMAT_XBGR2101010,
|
||||
DRM_FORMAT_ABGR2101010,
|
||||
DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_ABGR8888,
|
||||
DRM_FORMAT_XRGB2101010,
|
||||
DRM_FORMAT_ARGB2101010,
|
||||
0
|
||||
};
|
||||
|
||||
static const struct nv50_wndw_func
|
||||
wndwc37e = {
|
||||
.acquire = wndwc37e_acquire,
|
||||
.release = wndwc37e_release,
|
||||
.sema_set = wndwc37e_sema_set,
|
||||
.sema_clr = wndwc37e_sema_clr,
|
||||
.ntfy_set = wndwc37e_ntfy_set,
|
||||
.ntfy_clr = wndwc37e_ntfy_clr,
|
||||
.ntfy_reset = corec37d_ntfy_init,
|
||||
.ntfy_wait_begun = base507c_ntfy_wait_begun,
|
||||
.ilut = wndwc37e_ilut,
|
||||
.xlut_set = wndwc37e_ilut_set,
|
||||
.xlut_clr = wndwc37e_ilut_clr,
|
||||
.image_set = wndwc37e_image_set,
|
||||
.image_clr = wndwc37e_image_clr,
|
||||
.update = wndwc37e_update,
|
||||
};
|
||||
|
||||
static int
|
||||
wndwc37e_new_(const struct nv50_wndw_func *func, struct nouveau_drm *drm,
|
||||
enum drm_plane_type type, int index, s32 oclass, u32 heads,
|
||||
struct nv50_wndw **pwndw)
|
||||
{
|
||||
struct nvc37e_window_channel_dma_v0 args = {
|
||||
.pushbuf = 0xb0007e00 | index,
|
||||
.index = index,
|
||||
};
|
||||
struct nv50_disp *disp = nv50_disp(drm->dev);
|
||||
struct nv50_wndw *wndw;
|
||||
int ret;
|
||||
|
||||
ret = nv50_wndw_new_(func, drm->dev, type, "wndw", index,
|
||||
wndwc37e_format, heads, NV50_DISP_INTERLOCK_WNDW,
|
||||
BIT(index), &wndw);
|
||||
if (*pwndw = wndw, ret)
|
||||
return ret;
|
||||
|
||||
ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
|
||||
&oclass, 0, &args, sizeof(args),
|
||||
disp->sync->bo.offset, &wndw->wndw);
|
||||
if (ret) {
|
||||
NV_ERROR(drm, "qndw%04x allocation failed: %d\n", oclass, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
wndw->ntfy = NV50_DISP_WNDW_NTFY(wndw->id);
|
||||
wndw->sema = NV50_DISP_WNDW_SEM0(wndw->id);
|
||||
wndw->data = 0x00000000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
wndwc37e_new(struct nouveau_drm *drm, enum drm_plane_type type, int index,
|
||||
s32 oclass, struct nv50_wndw **pwndw)
|
||||
{
|
||||
return wndwc37e_new_(&wndwc37e, drm, type, index, oclass,
|
||||
BIT(index >> 1), pwndw);
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ struct nv_device_info_v0 {
|
|||
#define NV_DEVICE_INFO_V0_KEPLER 0x08
|
||||
#define NV_DEVICE_INFO_V0_MAXWELL 0x09
|
||||
#define NV_DEVICE_INFO_V0_PASCAL 0x0a
|
||||
#define NV_DEVICE_INFO_V0_VOLTA 0x0b
|
||||
__u8 family;
|
||||
__u8 pad06[2];
|
||||
__u64 ram_size;
|
||||
|
|
@ -39,9 +40,55 @@ struct nv_device_info_v0 {
|
|||
char name[64];
|
||||
};
|
||||
|
||||
struct nv_device_info_v1 {
|
||||
__u8 version;
|
||||
__u8 count;
|
||||
__u8 pad02[6];
|
||||
struct nv_device_info_v1_data {
|
||||
__u64 mthd; /* NV_DEVICE_INFO_* (see below). */
|
||||
__u64 data;
|
||||
} data[];
|
||||
};
|
||||
|
||||
struct nv_device_time_v0 {
|
||||
__u8 version;
|
||||
__u8 pad01[7];
|
||||
__u64 time;
|
||||
};
|
||||
|
||||
#define NV_DEVICE_INFO_UNIT (0xffffffffULL << 32)
|
||||
#define NV_DEVICE_INFO(n) ((n) | (0x00000000ULL << 32))
|
||||
#define NV_DEVICE_FIFO(n) ((n) | (0x00000001ULL << 32))
|
||||
|
||||
/* This will be returned for unsupported queries. */
|
||||
#define NV_DEVICE_INFO_INVALID ~0ULL
|
||||
|
||||
/* These return a mask of available engines of particular type. */
|
||||
#define NV_DEVICE_INFO_ENGINE_SW NV_DEVICE_INFO(0x00000000)
|
||||
#define NV_DEVICE_INFO_ENGINE_GR NV_DEVICE_INFO(0x00000001)
|
||||
#define NV_DEVICE_INFO_ENGINE_MPEG NV_DEVICE_INFO(0x00000002)
|
||||
#define NV_DEVICE_INFO_ENGINE_ME NV_DEVICE_INFO(0x00000003)
|
||||
#define NV_DEVICE_INFO_ENGINE_CIPHER NV_DEVICE_INFO(0x00000004)
|
||||
#define NV_DEVICE_INFO_ENGINE_BSP NV_DEVICE_INFO(0x00000005)
|
||||
#define NV_DEVICE_INFO_ENGINE_VP NV_DEVICE_INFO(0x00000006)
|
||||
#define NV_DEVICE_INFO_ENGINE_CE NV_DEVICE_INFO(0x00000007)
|
||||
#define NV_DEVICE_INFO_ENGINE_SEC NV_DEVICE_INFO(0x00000008)
|
||||
#define NV_DEVICE_INFO_ENGINE_MSVLD NV_DEVICE_INFO(0x00000009)
|
||||
#define NV_DEVICE_INFO_ENGINE_MSPDEC NV_DEVICE_INFO(0x0000000a)
|
||||
#define NV_DEVICE_INFO_ENGINE_MSPPP NV_DEVICE_INFO(0x0000000b)
|
||||
#define NV_DEVICE_INFO_ENGINE_MSENC NV_DEVICE_INFO(0x0000000c)
|
||||
#define NV_DEVICE_INFO_ENGINE_VIC NV_DEVICE_INFO(0x0000000d)
|
||||
#define NV_DEVICE_INFO_ENGINE_SEC2 NV_DEVICE_INFO(0x0000000e)
|
||||
#define NV_DEVICE_INFO_ENGINE_NVDEC NV_DEVICE_INFO(0x0000000f)
|
||||
#define NV_DEVICE_INFO_ENGINE_NVENC NV_DEVICE_INFO(0x00000010)
|
||||
|
||||
/* Returns the number of available channels. */
|
||||
#define NV_DEVICE_FIFO_CHANNELS NV_DEVICE_FIFO(0x00000000)
|
||||
|
||||
/* Returns a mask of available runlists. */
|
||||
#define NV_DEVICE_FIFO_RUNLISTS NV_DEVICE_FIFO(0x00000001)
|
||||
|
||||
/* These return a mask of engines available on a particular runlist. */
|
||||
#define NV_DEVICE_FIFO_RUNLIST_ENGINES(n) ((n) + NV_DEVICE_FIFO(0x00000010))
|
||||
#define NV_DEVICE_FIFO_RUNLIST_ENGINES__SIZE 64
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,25 +4,11 @@
|
|||
|
||||
struct kepler_channel_gpfifo_a_v0 {
|
||||
__u8 version;
|
||||
__u8 pad01[5];
|
||||
__u8 pad01[1];
|
||||
__u16 chid;
|
||||
#define NVA06F_V0_ENGINE_SW 0x00000001
|
||||
#define NVA06F_V0_ENGINE_GR 0x00000002
|
||||
#define NVA06F_V0_ENGINE_SEC 0x00000004
|
||||
#define NVA06F_V0_ENGINE_MSVLD 0x00000010
|
||||
#define NVA06F_V0_ENGINE_MSPDEC 0x00000020
|
||||
#define NVA06F_V0_ENGINE_MSPPP 0x00000040
|
||||
#define NVA06F_V0_ENGINE_MSENC 0x00000080
|
||||
#define NVA06F_V0_ENGINE_VIC 0x00000100
|
||||
#define NVA06F_V0_ENGINE_NVDEC 0x00000200
|
||||
#define NVA06F_V0_ENGINE_NVENC0 0x00000400
|
||||
#define NVA06F_V0_ENGINE_NVENC1 0x00000800
|
||||
#define NVA06F_V0_ENGINE_CE0 0x00010000
|
||||
#define NVA06F_V0_ENGINE_CE1 0x00020000
|
||||
#define NVA06F_V0_ENGINE_CE2 0x00040000
|
||||
__u32 engines;
|
||||
__u32 ilength;
|
||||
__u64 ioffset;
|
||||
__u64 runlist;
|
||||
__u64 vmm;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@
|
|||
|
||||
#define NV04_DISP /* cl0046.h */ 0x00000046
|
||||
|
||||
#define VOLTA_USERMODE_A 0x0000c361
|
||||
|
||||
#define NV03_CHANNEL_DMA /* cl506b.h */ 0x0000006b
|
||||
#define NV10_CHANNEL_DMA /* cl506b.h */ 0x0000006e
|
||||
#define NV17_CHANNEL_DMA /* cl506b.h */ 0x0000176e
|
||||
|
|
@ -66,6 +68,7 @@
|
|||
#define KEPLER_CHANNEL_GPFIFO_B /* cla06f.h */ 0x0000a16f
|
||||
#define MAXWELL_CHANNEL_GPFIFO_A /* cla06f.h */ 0x0000b06f
|
||||
#define PASCAL_CHANNEL_GPFIFO_A /* cla06f.h */ 0x0000c06f
|
||||
#define VOLTA_CHANNEL_GPFIFO_A /* cla06f.h */ 0x0000c36f
|
||||
|
||||
#define NV50_DISP /* cl5070.h */ 0x00005070
|
||||
#define G82_DISP /* cl5070.h */ 0x00008270
|
||||
|
|
@ -79,6 +82,7 @@
|
|||
#define GM200_DISP /* cl5070.h */ 0x00009570
|
||||
#define GP100_DISP /* cl5070.h */ 0x00009770
|
||||
#define GP102_DISP /* cl5070.h */ 0x00009870
|
||||
#define GV100_DISP /* cl5070.h */ 0x0000c370
|
||||
|
||||
#define NV31_MPEG 0x00003174
|
||||
#define G82_MPEG 0x00008274
|
||||
|
|
@ -90,6 +94,7 @@
|
|||
#define GT214_DISP_CURSOR /* cl507a.h */ 0x0000857a
|
||||
#define GF110_DISP_CURSOR /* cl507a.h */ 0x0000907a
|
||||
#define GK104_DISP_CURSOR /* cl507a.h */ 0x0000917a
|
||||
#define GV100_DISP_CURSOR /* cl507a.h */ 0x0000c37a
|
||||
|
||||
#define NV50_DISP_OVERLAY /* cl507b.h */ 0x0000507b
|
||||
#define G82_DISP_OVERLAY /* cl507b.h */ 0x0000827b
|
||||
|
|
@ -97,6 +102,8 @@
|
|||
#define GF110_DISP_OVERLAY /* cl507b.h */ 0x0000907b
|
||||
#define GK104_DISP_OVERLAY /* cl507b.h */ 0x0000917b
|
||||
|
||||
#define GV100_DISP_WINDOW_IMM_CHANNEL_DMA /* clc37b.h */ 0x0000c37b
|
||||
|
||||
#define NV50_DISP_BASE_CHANNEL_DMA /* cl507c.h */ 0x0000507c
|
||||
#define G82_DISP_BASE_CHANNEL_DMA /* cl507c.h */ 0x0000827c
|
||||
#define GT200_DISP_BASE_CHANNEL_DMA /* cl507c.h */ 0x0000837c
|
||||
|
|
@ -117,6 +124,7 @@
|
|||
#define GM200_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000957d
|
||||
#define GP100_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000977d
|
||||
#define GP102_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000987d
|
||||
#define GV100_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000c37d
|
||||
|
||||
#define NV50_DISP_OVERLAY_CHANNEL_DMA /* cl507e.h */ 0x0000507e
|
||||
#define G82_DISP_OVERLAY_CHANNEL_DMA /* cl507e.h */ 0x0000827e
|
||||
|
|
@ -125,6 +133,8 @@
|
|||
#define GF110_DISP_OVERLAY_CONTROL_DMA /* cl507e.h */ 0x0000907e
|
||||
#define GK104_DISP_OVERLAY_CONTROL_DMA /* cl507e.h */ 0x0000917e
|
||||
|
||||
#define GV100_DISP_WINDOW_CHANNEL_DMA /* clc37e.h */ 0x0000c37e
|
||||
|
||||
#define NV50_TESLA 0x00005097
|
||||
#define G82_TESLA 0x00008297
|
||||
#define GT200_TESLA 0x00008397
|
||||
|
|
@ -145,6 +155,8 @@
|
|||
#define PASCAL_A /* cl9097.h */ 0x0000c097
|
||||
#define PASCAL_B /* cl9097.h */ 0x0000c197
|
||||
|
||||
#define VOLTA_A /* cl9097.h */ 0x0000c397
|
||||
|
||||
#define NV74_BSP 0x000074b0
|
||||
|
||||
#define GT212_MSVLD 0x000085b1
|
||||
|
|
@ -170,6 +182,7 @@
|
|||
#define MAXWELL_DMA_COPY_A 0x0000b0b5
|
||||
#define PASCAL_DMA_COPY_A 0x0000c0b5
|
||||
#define PASCAL_DMA_COPY_B 0x0000c1b5
|
||||
#define VOLTA_DMA_COPY_A 0x0000c3b5
|
||||
|
||||
#define FERMI_DECOMPRESS 0x000090b8
|
||||
|
||||
|
|
@ -183,6 +196,7 @@
|
|||
#define MAXWELL_COMPUTE_B 0x0000b1c0
|
||||
#define PASCAL_COMPUTE_A 0x0000c0c0
|
||||
#define PASCAL_COMPUTE_B 0x0000c1c0
|
||||
#define VOLTA_COMPUTE_A 0x0000c3c0
|
||||
|
||||
#define NV74_CIPHER 0x000074c1
|
||||
#endif
|
||||
|
|
|
|||
11
drivers/gpu/drm/nouveau/include/nvif/clc37b.h
Normal file
11
drivers/gpu/drm/nouveau/include/nvif/clc37b.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __NVIF_CLC37B_H__
|
||||
#define __NVIF_CLC37B_H__
|
||||
|
||||
struct nvc37b_window_imm_channel_dma_v0 {
|
||||
__u8 version;
|
||||
__u8 index;
|
||||
__u8 pad02[6];
|
||||
__u64 pushbuf;
|
||||
};
|
||||
#endif
|
||||
13
drivers/gpu/drm/nouveau/include/nvif/clc37e.h
Normal file
13
drivers/gpu/drm/nouveau/include/nvif/clc37e.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __NVIF_CLC37E_H__
|
||||
#define __NVIF_CLC37E_H__
|
||||
|
||||
struct nvc37e_window_channel_dma_v0 {
|
||||
__u8 version;
|
||||
__u8 index;
|
||||
__u8 pad02[6];
|
||||
__u64 pushbuf;
|
||||
};
|
||||
|
||||
#define NVC37E_WINDOW_CHANNEL_DMA_V0_NTFY_UEVENT 0x00
|
||||
#endif
|
||||
|
|
@ -4,10 +4,18 @@
|
|||
|
||||
#include <nvif/object.h>
|
||||
#include <nvif/cl0080.h>
|
||||
#include <nvif/user.h>
|
||||
|
||||
struct nvif_device {
|
||||
struct nvif_object object;
|
||||
struct nv_device_info_v0 info;
|
||||
|
||||
struct nvif_fifo_runlist {
|
||||
u64 engines;
|
||||
} *runlist;
|
||||
int runlists;
|
||||
|
||||
struct nvif_user user;
|
||||
};
|
||||
|
||||
int nvif_device_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32,
|
||||
|
|
@ -67,6 +75,5 @@ u64 nvif_device_time(struct nvif_device *);
|
|||
#include <engine/fifo.h>
|
||||
#include <engine/gr.h>
|
||||
|
||||
#define nvxx_fifo(a) nvxx_device(a)->fifo
|
||||
#define nvxx_gr(a) nvxx_device(a)->gr
|
||||
#endif
|
||||
|
|
|
|||
12
drivers/gpu/drm/nouveau/include/nvif/disp.h
Normal file
12
drivers/gpu/drm/nouveau/include/nvif/disp.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __NVIF_DISP_H__
|
||||
#define __NVIF_DISP_H__
|
||||
#include <nvif/object.h>
|
||||
struct nvif_device;
|
||||
|
||||
struct nvif_disp {
|
||||
struct nvif_object object;
|
||||
};
|
||||
|
||||
int nvif_disp_ctor(struct nvif_device *, s32 oclass, struct nvif_disp *);
|
||||
void nvif_disp_dtor(struct nvif_disp *);
|
||||
#endif
|
||||
18
drivers/gpu/drm/nouveau/include/nvif/fifo.h
Normal file
18
drivers/gpu/drm/nouveau/include/nvif/fifo.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef __NVIF_FIFO_H__
|
||||
#define __NVIF_FIFO_H__
|
||||
#include <nvif/device.h>
|
||||
|
||||
/* Returns mask of runlists that support a NV_DEVICE_INFO_ENGINE_* type. */
|
||||
u64 nvif_fifo_runlist(struct nvif_device *, u64 engine);
|
||||
|
||||
/* CE-supporting runlists (excluding GRCE, if others exist). */
|
||||
static inline u64
|
||||
nvif_fifo_runlist_ce(struct nvif_device *device)
|
||||
{
|
||||
u64 runmgr = nvif_fifo_runlist(device, NV_DEVICE_INFO_ENGINE_GR);
|
||||
u64 runmce = nvif_fifo_runlist(device, NV_DEVICE_INFO_ENGINE_CE);
|
||||
if (runmce && !(runmce &= ~runmgr))
|
||||
runmce = runmgr;
|
||||
return runmce;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -15,4 +15,6 @@ int nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page,
|
|||
int nvif_mem_init(struct nvif_mmu *mmu, s32 oclass, u8 type, u8 page,
|
||||
u64 size, void *argv, u32 argc, struct nvif_mem *);
|
||||
void nvif_mem_fini(struct nvif_mem *);
|
||||
|
||||
int nvif_mem_init_map(struct nvif_mmu *, u8 type, u64 size, struct nvif_mem *);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ struct nvif_mmu {
|
|||
u8 heap_nr;
|
||||
u8 type_nr;
|
||||
u16 kind_nr;
|
||||
s32 mem;
|
||||
|
||||
struct {
|
||||
u64 size;
|
||||
|
|
|
|||
|
|
@ -99,6 +99,22 @@ struct nvif_mclass {
|
|||
ret; \
|
||||
})
|
||||
|
||||
#define nvif_sclass(o,m,u) ({ \
|
||||
const typeof(m[0]) *_mclass = (m); \
|
||||
s32 _oclass = (u); \
|
||||
int _cid; \
|
||||
if (_oclass) { \
|
||||
for (_cid = 0; _mclass[_cid].oclass; _cid++) { \
|
||||
if (_mclass[_cid].oclass == _oclass) \
|
||||
break; \
|
||||
} \
|
||||
_cid = _mclass[_cid].oclass ? _cid : -ENOSYS; \
|
||||
} else { \
|
||||
_cid = nvif_mclass((o), _mclass); \
|
||||
} \
|
||||
_cid; \
|
||||
})
|
||||
|
||||
/*XXX*/
|
||||
#include <core/object.h>
|
||||
#define nvxx_object(a) ({ \
|
||||
|
|
|
|||
19
drivers/gpu/drm/nouveau/include/nvif/user.h
Normal file
19
drivers/gpu/drm/nouveau/include/nvif/user.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __NVIF_USER_H__
|
||||
#define __NVIF_USER_H__
|
||||
#include <nvif/object.h>
|
||||
struct nvif_device;
|
||||
|
||||
struct nvif_user {
|
||||
const struct nvif_user_func *func;
|
||||
struct nvif_object object;
|
||||
};
|
||||
|
||||
struct nvif_user_func {
|
||||
void (*doorbell)(struct nvif_user *, u32 token);
|
||||
};
|
||||
|
||||
int nvif_user_init(struct nvif_device *);
|
||||
void nvif_user_fini(struct nvif_device *);
|
||||
|
||||
extern const struct nvif_user_func nvif_userc361;
|
||||
#endif
|
||||
|
|
@ -22,6 +22,7 @@ enum nvkm_devidx {
|
|||
NVKM_SUBDEV_LTC,
|
||||
NVKM_SUBDEV_MMU,
|
||||
NVKM_SUBDEV_BAR,
|
||||
NVKM_SUBDEV_FAULT,
|
||||
NVKM_SUBDEV_PMU,
|
||||
NVKM_SUBDEV_VOLT,
|
||||
NVKM_SUBDEV_ICCSENSE,
|
||||
|
|
@ -37,7 +38,10 @@ enum nvkm_devidx {
|
|||
NVKM_ENGINE_CE3,
|
||||
NVKM_ENGINE_CE4,
|
||||
NVKM_ENGINE_CE5,
|
||||
NVKM_ENGINE_CE_LAST = NVKM_ENGINE_CE5,
|
||||
NVKM_ENGINE_CE6,
|
||||
NVKM_ENGINE_CE7,
|
||||
NVKM_ENGINE_CE8,
|
||||
NVKM_ENGINE_CE_LAST = NVKM_ENGINE_CE8,
|
||||
|
||||
NVKM_ENGINE_CIPHER,
|
||||
NVKM_ENGINE_DISP,
|
||||
|
|
@ -109,6 +113,7 @@ struct nvkm_device {
|
|||
NV_E0 = 0xe0,
|
||||
GM100 = 0x110,
|
||||
GP100 = 0x130,
|
||||
GV100 = 0x140,
|
||||
} card_type;
|
||||
u32 chipset;
|
||||
u8 chiprev;
|
||||
|
|
@ -123,6 +128,7 @@ struct nvkm_device {
|
|||
struct nvkm_bus *bus;
|
||||
struct nvkm_clk *clk;
|
||||
struct nvkm_devinit *devinit;
|
||||
struct nvkm_fault *fault;
|
||||
struct nvkm_fb *fb;
|
||||
struct nvkm_fuse *fuse;
|
||||
struct nvkm_gpio *gpio;
|
||||
|
|
@ -143,7 +149,7 @@ struct nvkm_device {
|
|||
struct nvkm_volt *volt;
|
||||
|
||||
struct nvkm_engine *bsp;
|
||||
struct nvkm_engine *ce[6];
|
||||
struct nvkm_engine *ce[9];
|
||||
struct nvkm_engine *cipher;
|
||||
struct nvkm_disp *disp;
|
||||
struct nvkm_dma *dma;
|
||||
|
|
@ -194,6 +200,7 @@ struct nvkm_device_chip {
|
|||
int (*bus )(struct nvkm_device *, int idx, struct nvkm_bus **);
|
||||
int (*clk )(struct nvkm_device *, int idx, struct nvkm_clk **);
|
||||
int (*devinit )(struct nvkm_device *, int idx, struct nvkm_devinit **);
|
||||
int (*fault )(struct nvkm_device *, int idx, struct nvkm_fault **);
|
||||
int (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **);
|
||||
int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **);
|
||||
int (*gpio )(struct nvkm_device *, int idx, struct nvkm_gpio **);
|
||||
|
|
@ -214,7 +221,7 @@ struct nvkm_device_chip {
|
|||
int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **);
|
||||
|
||||
int (*bsp )(struct nvkm_device *, int idx, struct nvkm_engine **);
|
||||
int (*ce[6] )(struct nvkm_device *, int idx, struct nvkm_engine **);
|
||||
int (*ce[9] )(struct nvkm_device *, int idx, struct nvkm_engine **);
|
||||
int (*cipher )(struct nvkm_device *, int idx, struct nvkm_engine **);
|
||||
int (*disp )(struct nvkm_device *, int idx, struct nvkm_disp **);
|
||||
int (*dma )(struct nvkm_device *, int idx, struct nvkm_dma **);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ struct nvkm_engine_func {
|
|||
void *(*dtor)(struct nvkm_engine *);
|
||||
void (*preinit)(struct nvkm_engine *);
|
||||
int (*oneinit)(struct nvkm_engine *);
|
||||
int (*info)(struct nvkm_engine *, u64 mthd, u64 *data);
|
||||
int (*init)(struct nvkm_engine *);
|
||||
int (*fini)(struct nvkm_engine *, bool suspend);
|
||||
void (*intr)(struct nvkm_engine *);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ struct nvkm_subdev_func {
|
|||
void *(*dtor)(struct nvkm_subdev *);
|
||||
int (*preinit)(struct nvkm_subdev *);
|
||||
int (*oneinit)(struct nvkm_subdev *);
|
||||
int (*info)(struct nvkm_subdev *, u64 mthd, u64 *data);
|
||||
int (*init)(struct nvkm_subdev *);
|
||||
int (*fini)(struct nvkm_subdev *, bool suspend);
|
||||
void (*intr)(struct nvkm_subdev *);
|
||||
|
|
@ -29,6 +30,7 @@ void nvkm_subdev_del(struct nvkm_subdev **);
|
|||
int nvkm_subdev_preinit(struct nvkm_subdev *);
|
||||
int nvkm_subdev_init(struct nvkm_subdev *);
|
||||
int nvkm_subdev_fini(struct nvkm_subdev *, bool suspend);
|
||||
int nvkm_subdev_info(struct nvkm_subdev *, u64, u64 *);
|
||||
void nvkm_subdev_intr(struct nvkm_subdev *);
|
||||
|
||||
/* subdev logging */
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@ int gm107_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
|
|||
int gm200_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
|
||||
int gp100_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
|
||||
int gp102_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
|
||||
int gv100_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,4 +35,5 @@ int gm107_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
|
|||
int gm200_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
|
||||
int gp100_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
|
||||
int gp102_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
|
||||
int gv100_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,4 +27,5 @@ int nv04_dma_new(struct nvkm_device *, int, struct nvkm_dma **);
|
|||
int nv50_dma_new(struct nvkm_device *, int, struct nvkm_dma **);
|
||||
int gf100_dma_new(struct nvkm_device *, int, struct nvkm_dma **);
|
||||
int gf119_dma_new(struct nvkm_device *, int, struct nvkm_dma **);
|
||||
int gv100_dma_new(struct nvkm_device *, int, struct nvkm_dma **);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <core/engine.h>
|
||||
#include <core/object.h>
|
||||
#include <core/event.h>
|
||||
struct nvkm_fault_data;
|
||||
|
||||
#define NVKM_FIFO_CHID_NR 4096
|
||||
|
||||
|
|
@ -45,6 +46,7 @@ struct nvkm_fifo {
|
|||
struct nvkm_event kevent; /* channel killed */
|
||||
};
|
||||
|
||||
void nvkm_fifo_fault(struct nvkm_fifo *, struct nvkm_fault_data *);
|
||||
void nvkm_fifo_pause(struct nvkm_fifo *, unsigned long *);
|
||||
void nvkm_fifo_start(struct nvkm_fifo *, unsigned long *);
|
||||
|
||||
|
|
@ -71,4 +73,5 @@ int gm200_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
|
|||
int gm20b_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
|
||||
int gp100_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
|
||||
int gp10b_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
|
||||
int gv100_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ int gm200_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
|
|||
int gm20b_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
|
||||
int gp100_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
|
||||
int gp102_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
|
||||
int gp104_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
|
||||
int gp107_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
|
||||
int gp10b_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
|
||||
int gv100_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __NVBIOS_DP_H__
|
||||
#define __NVBIOS_DP_H__
|
||||
|
||||
u16
|
||||
nvbios_dp_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len);
|
||||
|
||||
struct nvbios_dpout {
|
||||
u16 type;
|
||||
u16 mask;
|
||||
|
|
|
|||
|
|
@ -30,4 +30,5 @@ int mcp89_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
|
|||
int gf100_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
|
||||
int gm107_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
|
||||
int gm200_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
|
||||
int gv100_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
|
||||
#endif
|
||||
|
|
|
|||
33
drivers/gpu/drm/nouveau/include/nvkm/subdev/fault.h
Normal file
33
drivers/gpu/drm/nouveau/include/nvkm/subdev/fault.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef __NVKM_FAULT_H__
|
||||
#define __NVKM_FAULT_H__
|
||||
#include <core/subdev.h>
|
||||
#include <core/notify.h>
|
||||
|
||||
struct nvkm_fault {
|
||||
const struct nvkm_fault_func *func;
|
||||
struct nvkm_subdev subdev;
|
||||
|
||||
struct nvkm_fault_buffer *buffer[2];
|
||||
int buffer_nr;
|
||||
|
||||
struct nvkm_event event;
|
||||
|
||||
struct nvkm_notify nrpfb;
|
||||
};
|
||||
|
||||
struct nvkm_fault_data {
|
||||
u64 addr;
|
||||
u64 inst;
|
||||
u64 time;
|
||||
u8 engine;
|
||||
u8 valid;
|
||||
u8 gpc;
|
||||
u8 hub;
|
||||
u8 access;
|
||||
u8 client;
|
||||
u8 reason;
|
||||
};
|
||||
|
||||
int gp100_fault_new(struct nvkm_device *, int, struct nvkm_fault **);
|
||||
int gv100_fault_new(struct nvkm_device *, int, struct nvkm_fault **);
|
||||
#endif
|
||||
|
|
@ -83,6 +83,7 @@ int gm20b_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
|
|||
int gp100_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
|
||||
int gp102_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
|
||||
int gp10b_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
|
||||
int gv100_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
|
||||
|
||||
#include <subdev/bios.h>
|
||||
#include <subdev/bios/ramcfg.h>
|
||||
|
|
|
|||
|
|
@ -21,12 +21,14 @@ struct nvkm_ltc {
|
|||
int zbc_max;
|
||||
u32 zbc_color[NVKM_LTC_MAX_ZBC_CNT][4];
|
||||
u32 zbc_depth[NVKM_LTC_MAX_ZBC_CNT];
|
||||
u32 zbc_stencil[NVKM_LTC_MAX_ZBC_CNT];
|
||||
};
|
||||
|
||||
void nvkm_ltc_tags_clear(struct nvkm_device *, u32 first, u32 count);
|
||||
|
||||
int nvkm_ltc_zbc_color_get(struct nvkm_ltc *, int index, const u32[4]);
|
||||
int nvkm_ltc_zbc_depth_get(struct nvkm_ltc *, int index, const u32);
|
||||
int nvkm_ltc_zbc_stencil_get(struct nvkm_ltc *, int index, const u32);
|
||||
|
||||
void nvkm_ltc_invalidate(struct nvkm_ltc *);
|
||||
void nvkm_ltc_flush(struct nvkm_ltc *);
|
||||
|
|
@ -37,4 +39,5 @@ int gk20a_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
|
|||
int gm107_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
|
||||
int gm200_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
|
||||
int gp100_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
|
||||
int gp102_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -129,4 +129,5 @@ int gm200_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
|
|||
int gm20b_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
|
||||
int gp100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
|
||||
int gp10b_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
|
||||
int gv100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <nvif/client.h>
|
||||
#include <nvif/driver.h>
|
||||
#include <nvif/fifo.h>
|
||||
#include <nvif/ioctl.h>
|
||||
#include <nvif/class.h>
|
||||
#include <nvif/cl0002.h>
|
||||
|
|
@ -102,6 +103,7 @@ nouveau_abi16_swclass(struct nouveau_drm *drm)
|
|||
case NV_DEVICE_INFO_V0_KEPLER:
|
||||
case NV_DEVICE_INFO_V0_MAXWELL:
|
||||
case NV_DEVICE_INFO_V0_PASCAL:
|
||||
case NV_DEVICE_INFO_V0_VOLTA:
|
||||
return NVIF_CLASS_SW_GF100;
|
||||
}
|
||||
|
||||
|
|
@ -256,6 +258,7 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
|
|||
struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv);
|
||||
struct nouveau_abi16_chan *chan;
|
||||
struct nvif_device *device;
|
||||
u64 engine;
|
||||
int ret;
|
||||
|
||||
if (unlikely(!abi16))
|
||||
|
|
@ -268,25 +271,26 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
|
|||
|
||||
/* hack to allow channel engine type specification on kepler */
|
||||
if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) {
|
||||
if (init->fb_ctxdma_handle != ~0)
|
||||
init->fb_ctxdma_handle = NVA06F_V0_ENGINE_GR;
|
||||
else {
|
||||
init->fb_ctxdma_handle = 0;
|
||||
#define _(A,B) if (init->tt_ctxdma_handle & (A)) init->fb_ctxdma_handle |= (B)
|
||||
_(0x01, NVA06F_V0_ENGINE_GR);
|
||||
_(0x02, NVA06F_V0_ENGINE_MSPDEC);
|
||||
_(0x04, NVA06F_V0_ENGINE_MSPPP);
|
||||
_(0x08, NVA06F_V0_ENGINE_MSVLD);
|
||||
_(0x10, NVA06F_V0_ENGINE_CE0);
|
||||
_(0x20, NVA06F_V0_ENGINE_CE1);
|
||||
_(0x40, NVA06F_V0_ENGINE_MSENC);
|
||||
#undef _
|
||||
if (init->fb_ctxdma_handle == ~0) {
|
||||
switch (init->tt_ctxdma_handle) {
|
||||
case 0x01: engine = NV_DEVICE_INFO_ENGINE_GR ; break;
|
||||
case 0x02: engine = NV_DEVICE_INFO_ENGINE_MSPDEC; break;
|
||||
case 0x04: engine = NV_DEVICE_INFO_ENGINE_MSPPP ; break;
|
||||
case 0x08: engine = NV_DEVICE_INFO_ENGINE_MSVLD ; break;
|
||||
case 0x30: engine = NV_DEVICE_INFO_ENGINE_CE ; break;
|
||||
default:
|
||||
return nouveau_abi16_put(abi16, -ENOSYS);
|
||||
}
|
||||
} else {
|
||||
engine = NV_DEVICE_INFO_ENGINE_GR;
|
||||
}
|
||||
|
||||
/* allow flips to be executed if this is a graphics channel */
|
||||
if (engine != NV_DEVICE_INFO_ENGINE_CE)
|
||||
engine = nvif_fifo_runlist(device, engine);
|
||||
else
|
||||
engine = nvif_fifo_runlist_ce(device);
|
||||
init->fb_ctxdma_handle = engine;
|
||||
init->tt_ctxdma_handle = 0;
|
||||
if (init->fb_ctxdma_handle == NVA06F_V0_ENGINE_GR)
|
||||
init->tt_ctxdma_handle = 1;
|
||||
}
|
||||
|
||||
if (init->fb_ctxdma_handle == ~0 || init->tt_ctxdma_handle == ~0)
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ static int nouveau_dsm_power_state(enum vga_switcheroo_client_id id,
|
|||
return nouveau_dsm_set_discrete_state(nouveau_dsm_priv.dhandle, state);
|
||||
}
|
||||
|
||||
static int nouveau_dsm_get_client_id(struct pci_dev *pdev)
|
||||
static enum vga_switcheroo_client_id nouveau_dsm_get_client_id(struct pci_dev *pdev)
|
||||
{
|
||||
/* easy option one - intel vendor ID means Integrated */
|
||||
if (pdev->vendor == PCI_VENDOR_ID_INTEL)
|
||||
|
|
|
|||
|
|
@ -1141,6 +1141,8 @@ nouveau_bo_move_init(struct nouveau_drm *drm)
|
|||
struct ttm_mem_reg *, struct ttm_mem_reg *);
|
||||
int (*init)(struct nouveau_channel *, u32 handle);
|
||||
} _methods[] = {
|
||||
{ "COPY", 4, 0xc3b5, nve0_bo_move_copy, nve0_bo_move_init },
|
||||
{ "GRCE", 0, 0xc3b5, nve0_bo_move_copy, nvc0_bo_move_init },
|
||||
{ "COPY", 4, 0xc1b5, nve0_bo_move_copy, nve0_bo_move_init },
|
||||
{ "GRCE", 0, 0xc1b5, nve0_bo_move_copy, nvc0_bo_move_init },
|
||||
{ "COPY", 4, 0xc0b5, nve0_bo_move_copy, nve0_bo_move_init },
|
||||
|
|
|
|||
|
|
@ -163,12 +163,15 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
|
|||
return ret;
|
||||
}
|
||||
|
||||
chan->push.addr = chan->push.vma->addr;
|
||||
|
||||
if (device->info.family >= NV_DEVICE_INFO_V0_FERMI)
|
||||
return 0;
|
||||
|
||||
args.target = NV_DMA_V0_TARGET_VM;
|
||||
args.access = NV_DMA_V0_ACCESS_VM;
|
||||
args.start = 0;
|
||||
args.limit = cli->vmm.vmm.limit - 1;
|
||||
|
||||
chan->push.addr = chan->push.vma->addr;
|
||||
} else
|
||||
if (chan->push.buffer->bo.mem.mem_type == TTM_PL_VRAM) {
|
||||
if (device->info.family == NV_DEVICE_INFO_V0_TNT) {
|
||||
|
|
@ -214,10 +217,11 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
|
|||
|
||||
static int
|
||||
nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
|
||||
u32 engine, struct nouveau_channel **pchan)
|
||||
u64 runlist, struct nouveau_channel **pchan)
|
||||
{
|
||||
struct nouveau_cli *cli = (void *)device->object.client;
|
||||
static const u16 oclasses[] = { PASCAL_CHANNEL_GPFIFO_A,
|
||||
static const u16 oclasses[] = { VOLTA_CHANNEL_GPFIFO_A,
|
||||
PASCAL_CHANNEL_GPFIFO_A,
|
||||
MAXWELL_CHANNEL_GPFIFO_A,
|
||||
KEPLER_CHANNEL_GPFIFO_B,
|
||||
KEPLER_CHANNEL_GPFIFO_A,
|
||||
|
|
@ -245,9 +249,9 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
|
|||
do {
|
||||
if (oclass[0] >= KEPLER_CHANNEL_GPFIFO_A) {
|
||||
args.kepler.version = 0;
|
||||
args.kepler.engines = engine;
|
||||
args.kepler.ilength = 0x02000;
|
||||
args.kepler.ioffset = 0x10000 + chan->push.addr;
|
||||
args.kepler.runlist = runlist;
|
||||
args.kepler.vmm = nvif_handle(&cli->vmm.vmm.object);
|
||||
size = sizeof(args.kepler);
|
||||
} else
|
||||
|
|
@ -474,3 +478,28 @@ done:
|
|||
cli->base.super = super;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
nouveau_channels_init(struct nouveau_drm *drm)
|
||||
{
|
||||
struct {
|
||||
struct nv_device_info_v1 m;
|
||||
struct {
|
||||
struct nv_device_info_v1_data channels;
|
||||
} v;
|
||||
} args = {
|
||||
.m.version = 1,
|
||||
.m.count = sizeof(args.v) / sizeof(args.v.channels),
|
||||
.v.channels.mthd = NV_DEVICE_FIFO_CHANNELS,
|
||||
};
|
||||
struct nvif_object *device = &drm->client.device.object;
|
||||
int ret;
|
||||
|
||||
ret = nvif_object_mthd(device, NV_DEVICE_V0_INFO, &args, sizeof(args));
|
||||
if (ret || args.v.channels.mthd == NV_DEVICE_INFO_INVALID)
|
||||
return -ENODEV;
|
||||
|
||||
drm->chan.nr = args.v.channels.data;
|
||||
drm->chan.context_base = dma_fence_context_alloc(drm->chan.nr);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ struct nouveau_channel {
|
|||
atomic_t killed;
|
||||
};
|
||||
|
||||
int nouveau_channels_init(struct nouveau_drm *);
|
||||
|
||||
int nouveau_channel_new(struct nouveau_drm *, struct nvif_device *,
|
||||
u32 arg0, u32 arg1, struct nouveau_channel **);
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ nouveau_conn_atomic_set_property(struct drm_connector *connector,
|
|||
/* ... except prior to G80, where the code
|
||||
* doesn't support such things.
|
||||
*/
|
||||
if (disp->disp.oclass < NV50_DISP)
|
||||
if (disp->disp.object.oclass < NV50_DISP)
|
||||
return -EINVAL;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -260,7 +260,7 @@ nouveau_conn_reset(struct drm_connector *connector)
|
|||
asyc->procamp.color_vibrance = 150;
|
||||
asyc->procamp.vibrant_hue = 90;
|
||||
|
||||
if (nouveau_display(connector->dev)->disp.oclass < NV50_DISP) {
|
||||
if (nouveau_display(connector->dev)->disp.object.oclass < NV50_DISP) {
|
||||
switch (connector->connector_type) {
|
||||
case DRM_MODE_CONNECTOR_LVDS:
|
||||
/* See note in nouveau_conn_atomic_set_property(). */
|
||||
|
|
@ -314,7 +314,7 @@ nouveau_conn_attach_properties(struct drm_connector *connector)
|
|||
case DRM_MODE_CONNECTOR_TV:
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_VGA:
|
||||
if (disp->disp.oclass < NV50_DISP)
|
||||
if (disp->disp.object.oclass < NV50_DISP)
|
||||
break; /* Can only scale on DFPs. */
|
||||
/* Fall-through. */
|
||||
default:
|
||||
|
|
@ -1005,7 +1005,7 @@ get_tmds_link_bandwidth(struct drm_connector *connector, bool hdmi)
|
|||
return 112000;
|
||||
}
|
||||
|
||||
static int
|
||||
static enum drm_mode_status
|
||||
nouveau_connector_mode_valid(struct drm_connector *connector,
|
||||
struct drm_display_mode *mode)
|
||||
{
|
||||
|
|
@ -1321,7 +1321,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
|
|||
}
|
||||
|
||||
/* HDMI 3D support */
|
||||
if ((disp->disp.oclass >= G82_DISP)
|
||||
if ((disp->disp.object.oclass >= G82_DISP)
|
||||
&& ((type == DRM_MODE_CONNECTOR_DisplayPort)
|
||||
|| (type == DRM_MODE_CONNECTOR_eDP)
|
||||
|| (type == DRM_MODE_CONNECTOR_HDMIA)))
|
||||
|
|
@ -1343,7 +1343,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
|
|||
case DCB_CONNECTOR_LVDS_SPWG:
|
||||
case DCB_CONNECTOR_eDP:
|
||||
/* see note in nouveau_connector_set_property() */
|
||||
if (disp->disp.oclass < NV50_DISP) {
|
||||
if (disp->disp.object.oclass < NV50_DISP) {
|
||||
nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1366,8 +1366,8 @@ nouveau_connector_create(struct drm_device *dev, int index)
|
|||
break;
|
||||
}
|
||||
|
||||
ret = nvif_notify_init(&disp->disp, nouveau_connector_hotplug, true,
|
||||
NV04_DISP_NTFY_CONN,
|
||||
ret = nvif_notify_init(&disp->disp.object, nouveau_connector_hotplug,
|
||||
true, NV04_DISP_NTFY_CONN,
|
||||
&(struct nvif_notify_conn_req_v0) {
|
||||
.mask = NVIF_NOTIFY_CONN_V0_ANY,
|
||||
.conn = index,
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
|
|||
bool ret = false;
|
||||
|
||||
do {
|
||||
ret = nvif_mthd(&disp->disp, 0, &args, sizeof(args));
|
||||
ret = nvif_mthd(&disp->disp.object, 0, &args, sizeof(args));
|
||||
if (ret != 0)
|
||||
return false;
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ nouveau_display_vblank_init(struct drm_device *dev)
|
|||
|
||||
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
||||
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
|
||||
ret = nvif_notify_init(&disp->disp,
|
||||
ret = nvif_notify_init(&disp->disp.object,
|
||||
nouveau_display_vblank_handler, false,
|
||||
NV04_DISP_NTFY_VBLANK,
|
||||
&(struct nvif_notify_head_req_v0) {
|
||||
|
|
@ -454,10 +454,10 @@ nouveau_display_create_properties(struct drm_device *dev)
|
|||
struct nouveau_display *disp = nouveau_display(dev);
|
||||
int gen;
|
||||
|
||||
if (disp->disp.oclass < NV50_DISP)
|
||||
if (disp->disp.object.oclass < NV50_DISP)
|
||||
gen = 0;
|
||||
else
|
||||
if (disp->disp.oclass < GF110_DISP)
|
||||
if (disp->disp.object.oclass < GF110_DISP)
|
||||
gen = 1;
|
||||
else
|
||||
gen = 2;
|
||||
|
|
@ -533,31 +533,10 @@ nouveau_display_create(struct drm_device *dev)
|
|||
drm_kms_helper_poll_disable(dev);
|
||||
|
||||
if (nouveau_modeset != 2 && drm->vbios.dcb.entries) {
|
||||
static const u16 oclass[] = {
|
||||
GP102_DISP,
|
||||
GP100_DISP,
|
||||
GM200_DISP,
|
||||
GM107_DISP,
|
||||
GK110_DISP,
|
||||
GK104_DISP,
|
||||
GF110_DISP,
|
||||
GT214_DISP,
|
||||
GT206_DISP,
|
||||
GT200_DISP,
|
||||
G82_DISP,
|
||||
NV50_DISP,
|
||||
NV04_DISP,
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0, ret = -ENODEV; ret && i < ARRAY_SIZE(oclass); i++) {
|
||||
ret = nvif_object_init(&drm->client.device.object, 0,
|
||||
oclass[i], NULL, 0, &disp->disp);
|
||||
}
|
||||
|
||||
ret = nvif_disp_ctor(&drm->client.device, 0, &disp->disp);
|
||||
if (ret == 0) {
|
||||
nouveau_display_create_properties(dev);
|
||||
if (disp->disp.oclass < NV50_DISP)
|
||||
if (disp->disp.object.oclass < NV50_DISP)
|
||||
ret = nv04_display_create(dev);
|
||||
else
|
||||
ret = nv50_display_create(dev);
|
||||
|
|
@ -611,7 +590,7 @@ nouveau_display_destroy(struct drm_device *dev)
|
|||
if (disp->dtor)
|
||||
disp->dtor(dev);
|
||||
|
||||
nvif_object_fini(&disp->disp);
|
||||
nvif_disp_dtor(&disp->disp);
|
||||
|
||||
nouveau_drm(dev)->display = NULL;
|
||||
kfree(disp);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#ifndef __NOUVEAU_DISPLAY_H__
|
||||
#define __NOUVEAU_DISPLAY_H__
|
||||
#include "nouveau_drv.h"
|
||||
#include <nvif/disp.h>
|
||||
|
||||
struct nouveau_framebuffer {
|
||||
struct drm_framebuffer base;
|
||||
|
|
@ -38,7 +39,7 @@ struct nouveau_display {
|
|||
int (*init)(struct drm_device *);
|
||||
void (*fini)(struct drm_device *);
|
||||
|
||||
struct nvif_object disp;
|
||||
struct nvif_disp disp;
|
||||
|
||||
struct drm_property *dithering_mode;
|
||||
struct drm_property *dithering_depth;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
#include "nouveau_dma.h"
|
||||
#include "nouveau_vmm.h"
|
||||
|
||||
#include <nvif/user.h>
|
||||
|
||||
void
|
||||
OUT_RINGp(struct nouveau_channel *chan, const void *data, unsigned nr_dwords)
|
||||
{
|
||||
|
|
@ -80,18 +82,11 @@ READ_GET(struct nouveau_channel *chan, uint64_t *prev_get, int *timeout)
|
|||
}
|
||||
|
||||
void
|
||||
nv50_dma_push(struct nouveau_channel *chan, struct nouveau_bo *bo,
|
||||
int delta, int length)
|
||||
nv50_dma_push(struct nouveau_channel *chan, u64 offset, int length)
|
||||
{
|
||||
struct nouveau_cli *cli = (void *)chan->user.client;
|
||||
struct nvif_user *user = &chan->drm->client.device.user;
|
||||
struct nouveau_bo *pb = chan->push.buffer;
|
||||
struct nouveau_vma *vma;
|
||||
int ip = (chan->dma.ib_put * 2) + chan->dma.ib_base;
|
||||
u64 offset;
|
||||
|
||||
vma = nouveau_vma_find(bo, &cli->vmm);
|
||||
BUG_ON(!vma);
|
||||
offset = vma->addr + delta;
|
||||
|
||||
BUG_ON(chan->dma.ib_free < 1);
|
||||
|
||||
|
|
@ -105,6 +100,8 @@ nv50_dma_push(struct nouveau_channel *chan, struct nouveau_bo *bo,
|
|||
nouveau_bo_rd32(pb, 0);
|
||||
|
||||
nvif_wr32(&chan->user, 0x8c, chan->dma.ib_put);
|
||||
if (user->func && user->func->doorbell)
|
||||
user->func->doorbell(user, chan->chid);
|
||||
chan->dma.ib_free--;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@
|
|||
#include "nouveau_chan.h"
|
||||
|
||||
int nouveau_dma_wait(struct nouveau_channel *, int slots, int size);
|
||||
void nv50_dma_push(struct nouveau_channel *, struct nouveau_bo *,
|
||||
int delta, int length);
|
||||
void nv50_dma_push(struct nouveau_channel *, u64 addr, int length);
|
||||
|
||||
/*
|
||||
* There's a hw race condition where you can't jump to your PUT offset,
|
||||
|
|
@ -55,7 +54,6 @@ enum {
|
|||
|
||||
NvSub2D = 3, /* DO NOT CHANGE - hardcoded for kepler gr fifo */
|
||||
NvSubCopy = 4, /* DO NOT CHANGE - hardcoded for kepler gr fifo */
|
||||
FermiSw = 5, /* DO NOT CHANGE (well.. 6/7 will work...) */
|
||||
};
|
||||
|
||||
/* Object handles - for stuff that's doesn't use handle == oclass. */
|
||||
|
|
@ -151,7 +149,7 @@ FIRE_RING(struct nouveau_channel *chan)
|
|||
chan->accel_done = true;
|
||||
|
||||
if (chan->dma.ib_max) {
|
||||
nv50_dma_push(chan, chan->push.buffer, chan->dma.put << 2,
|
||||
nv50_dma_push(chan, chan->push.addr + (chan->dma.put << 2),
|
||||
(chan->dma.cur - chan->dma.put) << 2);
|
||||
} else {
|
||||
WRITE_PUT(chan->dma.cur);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@
|
|||
#include <core/tegra.h>
|
||||
|
||||
#include <nvif/driver.h>
|
||||
#include <nvif/fifo.h>
|
||||
#include <nvif/user.h>
|
||||
|
||||
#include <nvif/class.h>
|
||||
#include <nvif/cl0002.h>
|
||||
|
|
@ -112,24 +114,22 @@ nouveau_name(struct drm_device *dev)
|
|||
}
|
||||
|
||||
static inline bool
|
||||
nouveau_cli_work_ready(struct dma_fence *fence, bool wait)
|
||||
nouveau_cli_work_ready(struct dma_fence *fence)
|
||||
{
|
||||
if (!dma_fence_is_signaled(fence)) {
|
||||
if (!wait)
|
||||
return false;
|
||||
WARN_ON(dma_fence_wait_timeout(fence, false, 2 * HZ) <= 0);
|
||||
}
|
||||
if (!dma_fence_is_signaled(fence))
|
||||
return false;
|
||||
dma_fence_put(fence);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_cli_work_flush(struct nouveau_cli *cli, bool wait)
|
||||
nouveau_cli_work(struct work_struct *w)
|
||||
{
|
||||
struct nouveau_cli *cli = container_of(w, typeof(*cli), work);
|
||||
struct nouveau_cli_work *work, *wtmp;
|
||||
mutex_lock(&cli->lock);
|
||||
list_for_each_entry_safe(work, wtmp, &cli->worker, head) {
|
||||
if (!work->fence || nouveau_cli_work_ready(work->fence, wait)) {
|
||||
if (!work->fence || nouveau_cli_work_ready(work->fence)) {
|
||||
list_del(&work->head);
|
||||
work->func(work);
|
||||
}
|
||||
|
|
@ -157,17 +157,17 @@ nouveau_cli_work_queue(struct nouveau_cli *cli, struct dma_fence *fence,
|
|||
mutex_unlock(&cli->lock);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_cli_work(struct work_struct *w)
|
||||
{
|
||||
struct nouveau_cli *cli = container_of(w, typeof(*cli), work);
|
||||
nouveau_cli_work_flush(cli, false);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_cli_fini(struct nouveau_cli *cli)
|
||||
{
|
||||
nouveau_cli_work_flush(cli, true);
|
||||
/* All our channels are dead now, which means all the fences they
|
||||
* own are signalled, and all callback functions have been called.
|
||||
*
|
||||
* So, after flushing the workqueue, there should be nothing left.
|
||||
*/
|
||||
flush_work(&cli->work);
|
||||
WARN_ON(!list_empty(&cli->worker));
|
||||
|
||||
usif_client_fini(cli);
|
||||
nouveau_vmm_fini(&cli->vmm);
|
||||
nvif_mmu_fini(&cli->mmu);
|
||||
|
|
@ -307,6 +307,16 @@ nouveau_accel_init(struct nouveau_drm *drm)
|
|||
if (nouveau_noaccel)
|
||||
return;
|
||||
|
||||
ret = nouveau_channels_init(drm);
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_VOLTA) {
|
||||
ret = nvif_user_init(device);
|
||||
if (ret)
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialise synchronisation routines */
|
||||
/*XXX: this is crap, but the fence/channel stuff is a little
|
||||
* backwards in some places. this will be fixed.
|
||||
|
|
@ -338,6 +348,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
|
|||
case KEPLER_CHANNEL_GPFIFO_B:
|
||||
case MAXWELL_CHANNEL_GPFIFO_A:
|
||||
case PASCAL_CHANNEL_GPFIFO_A:
|
||||
case VOLTA_CHANNEL_GPFIFO_A:
|
||||
ret = nvc0_fence_create(drm);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -354,13 +365,12 @@ nouveau_accel_init(struct nouveau_drm *drm)
|
|||
|
||||
if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) {
|
||||
ret = nouveau_channel_new(drm, &drm->client.device,
|
||||
NVA06F_V0_ENGINE_CE0 |
|
||||
NVA06F_V0_ENGINE_CE1,
|
||||
0, &drm->cechan);
|
||||
nvif_fifo_runlist_ce(device), 0,
|
||||
&drm->cechan);
|
||||
if (ret)
|
||||
NV_ERROR(drm, "failed to create ce channel, %d\n", ret);
|
||||
|
||||
arg0 = NVA06F_V0_ENGINE_GR;
|
||||
arg0 = nvif_fifo_runlist(device, NV_DEVICE_INFO_ENGINE_GR);
|
||||
arg1 = 1;
|
||||
} else
|
||||
if (device->info.chipset >= 0xa3 &&
|
||||
|
|
@ -386,38 +396,36 @@ nouveau_accel_init(struct nouveau_drm *drm)
|
|||
return;
|
||||
}
|
||||
|
||||
ret = nvif_object_init(&drm->channel->user, NVDRM_NVSW,
|
||||
nouveau_abi16_swclass(drm), NULL, 0, &drm->nvsw);
|
||||
if (ret == 0) {
|
||||
ret = RING_SPACE(drm->channel, 2);
|
||||
if (device->info.family < NV_DEVICE_INFO_V0_TESLA) {
|
||||
ret = nvif_object_init(&drm->channel->user, NVDRM_NVSW,
|
||||
nouveau_abi16_swclass(drm), NULL, 0,
|
||||
&drm->nvsw);
|
||||
if (ret == 0) {
|
||||
if (device->info.family < NV_DEVICE_INFO_V0_FERMI) {
|
||||
ret = RING_SPACE(drm->channel, 2);
|
||||
if (ret == 0) {
|
||||
BEGIN_NV04(drm->channel, NvSubSw, 0, 1);
|
||||
OUT_RING (drm->channel, NVDRM_NVSW);
|
||||
} else
|
||||
if (device->info.family < NV_DEVICE_INFO_V0_KEPLER) {
|
||||
BEGIN_NVC0(drm->channel, FermiSw, 0, 1);
|
||||
OUT_RING (drm->channel, 0x001f0000);
|
||||
OUT_RING (drm->channel, drm->nvsw.handle);
|
||||
}
|
||||
|
||||
ret = nvif_notify_init(&drm->nvsw,
|
||||
nouveau_flip_complete,
|
||||
false, NV04_NVSW_NTFY_UEVENT,
|
||||
NULL, 0, 0, &drm->flip);
|
||||
if (ret == 0)
|
||||
ret = nvif_notify_get(&drm->flip);
|
||||
if (ret) {
|
||||
nouveau_accel_fini(drm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ret = nvif_notify_init(&drm->nvsw, nouveau_flip_complete,
|
||||
false, NV04_NVSW_NTFY_UEVENT,
|
||||
NULL, 0, 0, &drm->flip);
|
||||
if (ret == 0)
|
||||
ret = nvif_notify_get(&drm->flip);
|
||||
if (ret) {
|
||||
NV_ERROR(drm, "failed to allocate sw class, %d\n", ret);
|
||||
nouveau_accel_fini(drm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
NV_ERROR(drm, "failed to allocate software object, %d\n", ret);
|
||||
nouveau_accel_fini(drm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (device->info.family < NV_DEVICE_INFO_V0_FERMI) {
|
||||
ret = nvkm_gpuobj_new(nvxx_device(&drm->client.device), 32, 0,
|
||||
false, NULL, &drm->notify);
|
||||
|
|
|
|||
|
|
@ -170,6 +170,12 @@ struct nouveau_drm {
|
|||
/* synchronisation */
|
||||
void *fence;
|
||||
|
||||
/* Global channel management. */
|
||||
struct {
|
||||
int nr;
|
||||
u64 context_base;
|
||||
} chan;
|
||||
|
||||
/* context for accelerated drm-internal operations */
|
||||
struct nouveau_channel *cechan;
|
||||
struct nouveau_channel *channel;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <drm/drm_encoder_slave.h>
|
||||
#include <drm/drm_dp_mst_helper.h>
|
||||
#include "dispnv04/disp.h"
|
||||
struct nv50_head_atom;
|
||||
|
||||
#define NV_DPMS_CLEARED 0x80
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ struct nouveau_encoder {
|
|||
void (*enc_save)(struct drm_encoder *encoder);
|
||||
void (*enc_restore)(struct drm_encoder *encoder);
|
||||
void (*update)(struct nouveau_encoder *, u8 head,
|
||||
struct drm_display_mode *, u8 proto, u8 depth);
|
||||
struct nv50_head_atom *, u8 proto, u8 depth);
|
||||
};
|
||||
|
||||
struct nouveau_encoder *
|
||||
|
|
|
|||
|
|
@ -74,15 +74,14 @@ nouveau_fence_signal(struct nouveau_fence *fence)
|
|||
}
|
||||
|
||||
static struct nouveau_fence *
|
||||
nouveau_local_fence(struct dma_fence *fence, struct nouveau_drm *drm) {
|
||||
struct nouveau_fence_priv *priv = (void*)drm->fence;
|
||||
|
||||
nouveau_local_fence(struct dma_fence *fence, struct nouveau_drm *drm)
|
||||
{
|
||||
if (fence->ops != &nouveau_fence_ops_legacy &&
|
||||
fence->ops != &nouveau_fence_ops_uevent)
|
||||
return NULL;
|
||||
|
||||
if (fence->context < priv->context_base ||
|
||||
fence->context >= priv->context_base + priv->contexts)
|
||||
if (fence->context < drm->chan.context_base ||
|
||||
fence->context >= drm->chan.context_base + drm->chan.nr)
|
||||
return NULL;
|
||||
|
||||
return from_fence(fence);
|
||||
|
|
@ -176,7 +175,7 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha
|
|||
INIT_LIST_HEAD(&fctx->flip);
|
||||
INIT_LIST_HEAD(&fctx->pending);
|
||||
spin_lock_init(&fctx->lock);
|
||||
fctx->context = priv->context_base + chan->chid;
|
||||
fctx->context = chan->drm->chan.context_base + chan->chid;
|
||||
|
||||
if (chan == chan->drm->cechan)
|
||||
strcpy(fctx->name, "copy engine channel");
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ struct nouveau_fence_priv {
|
|||
int (*context_new)(struct nouveau_channel *);
|
||||
void (*context_del)(struct nouveau_channel *);
|
||||
|
||||
u32 contexts;
|
||||
u64 context_base;
|
||||
bool uevent;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ struct nouveau_gem_object_unmap {
|
|||
static void
|
||||
nouveau_gem_object_delete(struct nouveau_vma *vma)
|
||||
{
|
||||
nouveau_fence_unref(&vma->fence);
|
||||
nouveau_vma_del(&vma);
|
||||
}
|
||||
|
||||
|
|
@ -114,25 +115,12 @@ nouveau_gem_object_delete_work(struct nouveau_cli_work *w)
|
|||
static void
|
||||
nouveau_gem_object_unmap(struct nouveau_bo *nvbo, struct nouveau_vma *vma)
|
||||
{
|
||||
const bool mapped = nvbo->bo.mem.mem_type != TTM_PL_SYSTEM;
|
||||
struct reservation_object *resv = nvbo->bo.resv;
|
||||
struct reservation_object_list *fobj;
|
||||
struct dma_fence *fence = vma->fence ? &vma->fence->base : NULL;
|
||||
struct nouveau_gem_object_unmap *work;
|
||||
struct dma_fence *fence = NULL;
|
||||
|
||||
fobj = reservation_object_get_list(resv);
|
||||
|
||||
list_del_init(&vma->head);
|
||||
|
||||
if (fobj && fobj->shared_count > 1)
|
||||
ttm_bo_wait(&nvbo->bo, false, false);
|
||||
else if (fobj && fobj->shared_count == 1)
|
||||
fence = rcu_dereference_protected(fobj->shared[0],
|
||||
reservation_object_held(resv));
|
||||
else
|
||||
fence = reservation_object_get_excl(nvbo->bo.resv);
|
||||
|
||||
if (!fence || !mapped) {
|
||||
if (!fence) {
|
||||
nouveau_gem_object_delete(vma);
|
||||
return;
|
||||
}
|
||||
|
|
@ -344,9 +332,20 @@ validate_fini_no_ticket(struct validate_op *op, struct nouveau_fence *fence,
|
|||
nvbo = list_entry(op->list.next, struct nouveau_bo, entry);
|
||||
b = &pbbo[nvbo->pbbo_index];
|
||||
|
||||
if (likely(fence))
|
||||
if (likely(fence)) {
|
||||
struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev);
|
||||
struct nouveau_vma *vma;
|
||||
|
||||
nouveau_bo_fence(nvbo, fence, !!b->write_domains);
|
||||
|
||||
if (drm->client.vmm.vmm.object.oclass >= NVIF_CLASS_VMM_NV50) {
|
||||
vma = (void *)(unsigned long)b->user_priv;
|
||||
nouveau_fence_unref(&vma->fence);
|
||||
dma_fence_get(&fence->base);
|
||||
vma->fence = fence;
|
||||
}
|
||||
}
|
||||
|
||||
if (unlikely(nvbo->validate_mapped)) {
|
||||
ttm_bo_kunmap(&nvbo->kmap);
|
||||
nvbo->validate_mapped = false;
|
||||
|
|
@ -432,7 +431,20 @@ retry:
|
|||
}
|
||||
}
|
||||
|
||||
b->user_priv = (uint64_t)(unsigned long)nvbo;
|
||||
if (cli->vmm.vmm.object.oclass >= NVIF_CLASS_VMM_NV50) {
|
||||
struct nouveau_vmm *vmm = &cli->vmm;
|
||||
struct nouveau_vma *vma = nouveau_vma_find(nvbo, vmm);
|
||||
if (!vma) {
|
||||
NV_PRINTK(err, cli, "vma not found!\n");
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
b->user_priv = (uint64_t)(unsigned long)vma;
|
||||
} else {
|
||||
b->user_priv = (uint64_t)(unsigned long)nvbo;
|
||||
}
|
||||
|
||||
nvbo->reserved_by = file_priv;
|
||||
nvbo->pbbo_index = i;
|
||||
if ((b->valid_domains & NOUVEAU_GEM_DOMAIN_VRAM) &&
|
||||
|
|
@ -763,10 +775,10 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
|
|||
}
|
||||
|
||||
for (i = 0; i < req->nr_push; i++) {
|
||||
struct nouveau_bo *nvbo = (void *)(unsigned long)
|
||||
struct nouveau_vma *vma = (void *)(unsigned long)
|
||||
bo[push[i].bo_index].user_priv;
|
||||
|
||||
nv50_dma_push(chan, nvbo, push[i].offset,
|
||||
nv50_dma_push(chan, vma->addr + push[i].offset,
|
||||
push[i].length);
|
||||
}
|
||||
} else
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ nouveau_temp_is_visible(const void *data, u32 attr, int channel)
|
|||
struct nouveau_drm *drm = nouveau_drm((struct drm_device *)data);
|
||||
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
|
||||
|
||||
if (therm && therm->attr_get && nvkm_therm_temp_get(therm) < 0)
|
||||
if (!therm || !therm->attr_get || nvkm_therm_temp_get(therm) < 0)
|
||||
return 0;
|
||||
|
||||
switch (attr) {
|
||||
|
|
@ -351,8 +351,8 @@ nouveau_pwm_is_visible(const void *data, u32 attr, int channel)
|
|||
struct nouveau_drm *drm = nouveau_drm((struct drm_device *)data);
|
||||
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
|
||||
|
||||
if (therm && therm->attr_get && therm->fan_get &&
|
||||
therm->fan_get(therm) < 0)
|
||||
if (!therm || !therm->attr_get || !therm->fan_get ||
|
||||
therm->fan_get(therm) < 0)
|
||||
return 0;
|
||||
|
||||
switch (attr) {
|
||||
|
|
@ -707,13 +707,20 @@ nouveau_hwmon_init(struct drm_device *dev)
|
|||
{
|
||||
#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
|
||||
struct nouveau_drm *drm = nouveau_drm(dev);
|
||||
struct nvkm_iccsense *iccsense = nvxx_iccsense(&drm->client.device);
|
||||
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
|
||||
struct nvkm_volt *volt = nvxx_volt(&drm->client.device);
|
||||
const struct attribute_group *special_groups[N_ATTR_GROUPS];
|
||||
struct nouveau_hwmon *hwmon;
|
||||
struct device *hwmon_dev;
|
||||
int ret = 0;
|
||||
int i = 0;
|
||||
|
||||
if (!iccsense && !therm && !volt) {
|
||||
NV_DEBUG(drm, "Skipping hwmon registration\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
hwmon = drm->hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL);
|
||||
if (!hwmon)
|
||||
return -ENOMEM;
|
||||
|
|
@ -749,6 +756,9 @@ nouveau_hwmon_fini(struct drm_device *dev)
|
|||
#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
|
||||
struct nouveau_hwmon *hwmon = nouveau_hwmon(dev);
|
||||
|
||||
if (!hwmon)
|
||||
return;
|
||||
|
||||
if (hwmon->hwmon)
|
||||
hwmon_device_unregister(hwmon->hwmon);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ nouveau_vma_new(struct nouveau_bo *nvbo, struct nouveau_vmm *vmm,
|
|||
vma->refs = 1;
|
||||
vma->addr = ~0ULL;
|
||||
vma->mem = NULL;
|
||||
vma->fence = NULL;
|
||||
list_add_tail(&vma->head, &nvbo->vma_list);
|
||||
|
||||
if (nvbo->bo.mem.mem_type != TTM_PL_SYSTEM &&
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ struct nouveau_vma {
|
|||
u64 addr;
|
||||
|
||||
struct nouveau_mem *mem;
|
||||
|
||||
struct nouveau_fence *fence;
|
||||
};
|
||||
|
||||
struct nouveau_vma *nouveau_vma_find(struct nouveau_bo *, struct nouveau_vmm *);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,5 @@ nv04_fence_create(struct nouveau_drm *drm)
|
|||
priv->base.dtor = nv04_fence_destroy;
|
||||
priv->base.context_new = nv04_fence_context_new;
|
||||
priv->base.context_del = nv04_fence_context_del;
|
||||
priv->base.contexts = 15;
|
||||
priv->base.context_base = dma_fence_context_alloc(priv->base.contexts);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,8 +103,6 @@ nv10_fence_create(struct nouveau_drm *drm)
|
|||
priv->base.dtor = nv10_fence_destroy;
|
||||
priv->base.context_new = nv10_fence_context_new;
|
||||
priv->base.context_del = nv10_fence_context_del;
|
||||
priv->base.contexts = 31;
|
||||
priv->base.context_base = dma_fence_context_alloc(priv->base.contexts);
|
||||
spin_lock_init(&priv->lock);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue