add da_fb_linebytes to drmfb_attach_args and use it to pass linebytes

from nouveau code to drmfb. keep the same linebytes logic for i915.

nvidia hardware needs 256 byte alignment, so aligning to just 64 was
not enough.

fixes broken console with a width of 1440px (PR kern/51181)
ok riastradh
This commit is contained in:
maya 2016-12-12 19:45:56 +00:00
parent 899aca2e24
commit 8538f99c2c
4 changed files with 13 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: drmfb.c,v 1.2 2015/11/09 23:11:18 jmcneill Exp $ */ /* $NetBSD: drmfb.c,v 1.3 2016/12/12 19:45:56 maya Exp $ */
/*- /*-
* Copyright (c) 2014 The NetBSD Foundation, Inc. * Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.2 2015/11/09 23:11:18 jmcneill Exp $"); __KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.3 2016/12/12 19:45:56 maya Exp $");
#ifdef _KERNEL_OPT #ifdef _KERNEL_OPT
#include "vga.h" #include "vga.h"
@ -103,9 +103,7 @@ drmfb_attach(struct drmfb_softc *sc, const struct drmfb_attach_args *da)
prop_dictionary_set_uint32(dict, "width", sizes->surface_width); prop_dictionary_set_uint32(dict, "width", sizes->surface_width);
prop_dictionary_set_uint32(dict, "height", sizes->surface_height); prop_dictionary_set_uint32(dict, "height", sizes->surface_height);
prop_dictionary_set_uint8(dict, "depth", sizes->surface_bpp); prop_dictionary_set_uint8(dict, "depth", sizes->surface_bpp);
prop_dictionary_set_uint16(dict, "linebytes", prop_dictionary_set_uint16(dict, "linebytes", da->da_fb_linebytes);
roundup2((sizes->surface_width * howmany(sizes->surface_bpp, 8)),
64));
prop_dictionary_set_uint32(dict, "address", 0); /* XXX >32-bit */ prop_dictionary_set_uint32(dict, "address", 0); /* XXX >32-bit */
CTASSERT(sizeof(uintptr_t) <= sizeof(uint64_t)); CTASSERT(sizeof(uintptr_t) <= sizeof(uint64_t));
prop_dictionary_set_uint64(dict, "virtual_address", prop_dictionary_set_uint64(dict, "virtual_address",

View File

@ -1,4 +1,4 @@
/* $NetBSD: intelfb.c,v 1.13 2015/04/04 15:12:39 jmcneill Exp $ */ /* $NetBSD: intelfb.c,v 1.14 2016/12/12 19:45:56 maya Exp $ */
/*- /*-
* Copyright (c) 2014 The NetBSD Foundation, Inc. * Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.13 2015/04/04 15:12:39 jmcneill Exp $"); __KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.14 2016/12/12 19:45:56 maya Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -164,11 +164,14 @@ intelfb_attach_task(struct i915drmkms_task *task)
struct intelfb_softc *const sc = container_of(task, struct intelfb_softc *const sc = container_of(task,
struct intelfb_softc, sc_attach_task); struct intelfb_softc, sc_attach_task);
const struct intelfb_attach_args *const ifa = &sc->sc_ifa; const struct intelfb_attach_args *const ifa = &sc->sc_ifa;
const struct drm_fb_helper_surface_size *const sizes = &ifa->ifa_fb_sizes;
const struct drmfb_attach_args da = { const struct drmfb_attach_args da = {
.da_dev = sc->sc_dev, .da_dev = sc->sc_dev,
.da_fb_helper = ifa->ifa_fb_helper, .da_fb_helper = ifa->ifa_fb_helper,
.da_fb_sizes = &ifa->ifa_fb_sizes, .da_fb_sizes = &ifa->ifa_fb_sizes,
.da_fb_vaddr = bus_space_vaddr(ifa->ifa_fb_bst, sc->sc_fb_bsh), .da_fb_vaddr = bus_space_vaddr(ifa->ifa_fb_bst, sc->sc_fb_bsh),
.da_fb_linebytes = roundup2((sizes->surface_width *
howmany(sizes->surface_bpp, 8)), 64),
.da_params = &intelfb_drmfb_params, .da_params = &intelfb_drmfb_params,
}; };
int error; int error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: drmfb.h,v 1.1 2015/03/05 17:50:41 riastradh Exp $ */ /* $NetBSD: drmfb.h,v 1.2 2016/12/12 19:45:56 maya Exp $ */
/*- /*-
* Copyright (c) 2014 The NetBSD Foundation, Inc. * Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -76,6 +76,7 @@ struct drmfb_attach_args {
struct drm_fb_helper *da_fb_helper; struct drm_fb_helper *da_fb_helper;
const struct drm_fb_helper_surface_size *da_fb_sizes; const struct drm_fb_helper_surface_size *da_fb_sizes;
void *da_fb_vaddr; void *da_fb_vaddr;
uint32_t da_fb_linebytes;
const struct drmfb_params *da_params; const struct drmfb_params *da_params;
}; };

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveaufb.c,v 1.3 2015/10/17 12:02:44 jmcneill Exp $ */ /* $NetBSD: nouveaufb.c,v 1.4 2016/12/12 19:45:56 maya Exp $ */
/*- /*-
* Copyright (c) 2015 The NetBSD Foundation, Inc. * Copyright (c) 2015 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveaufb.c,v 1.3 2015/10/17 12:02:44 jmcneill Exp $"); __KERNEL_RCSID(0, "$NetBSD: nouveaufb.c,v 1.4 2016/12/12 19:45:56 maya Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -147,6 +147,7 @@ nouveaufb_attach_task(struct nouveau_pci_task *task)
.da_fb_helper = nfa->nfa_fb_helper, .da_fb_helper = nfa->nfa_fb_helper,
.da_fb_sizes = &nfa->nfa_fb_sizes, .da_fb_sizes = &nfa->nfa_fb_sizes,
.da_fb_vaddr = __UNVOLATILE(nfa->nfa_fb_ptr), .da_fb_vaddr = __UNVOLATILE(nfa->nfa_fb_ptr),
.da_fb_linebytes = nfa->nfa_fb_linebytes,
.da_params = &nouveaufb_drmfb_params, .da_params = &nouveaufb_drmfb_params,
}; };
int error; int error;