drm/nouveau/kms/nv50-: move drm format->hw conversion into common code
This will be required to support additional HW features. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
f88bc9d3ec
commit
43c181e9de
@ -186,22 +186,6 @@ base507c_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
asyh->base.w = asyw->state.fb->width;
|
||||
asyh->base.h = asyw->state.fb->height;
|
||||
|
||||
switch (fb->format->format) {
|
||||
case DRM_FORMAT_C8 : asyw->image.format = 0x1e; 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_XRGB8888 :
|
||||
case DRM_FORMAT_ARGB8888 : asyw->image.format = 0xcf; 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;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
asyw->lut.enable = 1;
|
||||
asyw->set.image = true;
|
||||
return 0;
|
||||
|
@ -91,8 +91,8 @@ curs507a_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
|
||||
if (asyw->state.fb->width != asyw->state.fb->height)
|
||||
return -EINVAL;
|
||||
|
||||
switch (asyw->state.fb->format->format) {
|
||||
case DRM_FORMAT_ARGB8888: asyh->curs.format = 1; break;
|
||||
switch (asyw->image.format) {
|
||||
case 0xcf: asyh->curs.format = 1; break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
return -EINVAL;
|
||||
|
@ -168,6 +168,27 @@ nv50_wndw_atomic_check_release(struct nv50_wndw *wndw,
|
||||
asyw->sema.handle = 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;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nv50_wndw_atomic_check_acquire(struct nv50_wndw *wndw,
|
||||
struct nv50_wndw_atom *asyw,
|
||||
@ -183,6 +204,10 @@ nv50_wndw_atomic_check_acquire(struct nv50_wndw *wndw,
|
||||
asyw->image.h = fb->base.height;
|
||||
asyw->image.kind = fb->nvbo->kind;
|
||||
|
||||
ret = nv50_wndw_atomic_check_acquire_rgb(asyw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (asyh->state.pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC)
|
||||
asyw->interval = 0;
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user