Commit 43c181e9 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/kms/nv50-: move drm format->hw conversion into common code

This will be required to support additional HW features.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent f88bc9d3
...@@ -186,22 +186,6 @@ base507c_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, ...@@ -186,22 +186,6 @@ base507c_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
asyh->base.w = asyw->state.fb->width; asyh->base.w = asyw->state.fb->width;
asyh->base.h = asyw->state.fb->height; 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->lut.enable = 1;
asyw->set.image = true; asyw->set.image = true;
return 0; return 0;
......
...@@ -91,8 +91,8 @@ curs507a_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, ...@@ -91,8 +91,8 @@ curs507a_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
if (asyw->state.fb->width != asyw->state.fb->height) if (asyw->state.fb->width != asyw->state.fb->height)
return -EINVAL; return -EINVAL;
switch (asyw->state.fb->format->format) { switch (asyw->image.format) {
case DRM_FORMAT_ARGB8888: asyh->curs.format = 1; break; case 0xcf: asyh->curs.format = 1; break;
default: default:
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
......
...@@ -168,6 +168,27 @@ nv50_wndw_atomic_check_release(struct nv50_wndw *wndw, ...@@ -168,6 +168,27 @@ nv50_wndw_atomic_check_release(struct nv50_wndw *wndw,
asyw->sema.handle = 0; 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 static int
nv50_wndw_atomic_check_acquire(struct nv50_wndw *wndw, nv50_wndw_atomic_check_acquire(struct nv50_wndw *wndw,
struct nv50_wndw_atom *asyw, struct nv50_wndw_atom *asyw,
...@@ -183,6 +204,10 @@ nv50_wndw_atomic_check_acquire(struct nv50_wndw *wndw, ...@@ -183,6 +204,10 @@ nv50_wndw_atomic_check_acquire(struct nv50_wndw *wndw,
asyw->image.h = fb->base.height; asyw->image.h = fb->base.height;
asyw->image.kind = fb->nvbo->kind; 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) if (asyh->state.pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC)
asyw->interval = 0; asyw->interval = 0;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment