drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Red Hat Inc.
|
|
|
|
* Parts based on xf86-video-ast
|
|
|
|
* Copyright (c) 2005 ASPEED Technology 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, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial portions
|
|
|
|
* of the Software.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Authors: Dave Airlie <airlied@redhat.com>
|
|
|
|
*/
|
2019-06-30 08:19:21 +02:00
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
#include <linux/export.h>
|
2019-06-30 08:19:21 +02:00
|
|
|
#include <linux/pci.h>
|
|
|
|
|
2019-12-02 12:15:54 +01:00
|
|
|
#include <drm/drm_atomic.h>
|
2019-11-07 09:34:01 +01:00
|
|
|
#include <drm/drm_atomic_helper.h>
|
|
|
|
#include <drm/drm_atomic_state_helper.h>
|
2012-10-02 18:01:07 +01:00
|
|
|
#include <drm/drm_crtc.h>
|
|
|
|
#include <drm/drm_crtc_helper.h>
|
2019-06-30 08:19:21 +02:00
|
|
|
#include <drm/drm_fourcc.h>
|
2020-07-02 13:50:29 +02:00
|
|
|
#include <drm/drm_gem_framebuffer_helper.h>
|
2019-06-30 08:19:21 +02:00
|
|
|
#include <drm/drm_gem_vram_helper.h>
|
2014-10-29 10:03:57 +01:00
|
|
|
#include <drm/drm_plane_helper.h>
|
2019-01-17 22:03:34 +01:00
|
|
|
#include <drm/drm_probe_helper.h>
|
2020-02-28 09:18:26 +01:00
|
|
|
#include <drm/drm_simple_kms_helper.h>
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2019-06-30 08:19:21 +02:00
|
|
|
#include "ast_drv.h"
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
#include "ast_tables.h"
|
|
|
|
|
|
|
|
static struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev);
|
|
|
|
static void ast_i2c_destroy(struct ast_i2c_chan *i2c);
|
2019-11-07 09:34:03 +01:00
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
static inline void ast_load_palette_index(struct ast_private *ast,
|
|
|
|
u8 index, u8 red, u8 green,
|
|
|
|
u8 blue)
|
|
|
|
{
|
|
|
|
ast_io_write8(ast, AST_IO_DAC_INDEX_WRITE, index);
|
|
|
|
ast_io_read8(ast, AST_IO_SEQ_PORT);
|
|
|
|
ast_io_write8(ast, AST_IO_DAC_DATA, red);
|
|
|
|
ast_io_read8(ast, AST_IO_SEQ_PORT);
|
|
|
|
ast_io_write8(ast, AST_IO_DAC_DATA, green);
|
|
|
|
ast_io_read8(ast, AST_IO_SEQ_PORT);
|
|
|
|
ast_io_write8(ast, AST_IO_DAC_DATA, blue);
|
|
|
|
ast_io_read8(ast, AST_IO_SEQ_PORT);
|
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_crtc_load_lut(struct ast_private *ast, struct drm_crtc *crtc)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
{
|
2017-07-13 18:25:30 +02:00
|
|
|
u16 *r, *g, *b;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!crtc->enabled)
|
|
|
|
return;
|
|
|
|
|
2017-07-13 18:25:30 +02:00
|
|
|
r = crtc->gamma_store;
|
|
|
|
g = r + crtc->gamma_size;
|
|
|
|
b = g + crtc->gamma_size;
|
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
for (i = 0; i < 256; i++)
|
2017-07-13 18:25:30 +02:00
|
|
|
ast_load_palette_index(ast, i, *r++ >> 8, *g++ >> 8, *b++ >> 8);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static bool ast_get_vbios_mode_info(const struct drm_format_info *format,
|
2019-11-07 09:34:00 +01:00
|
|
|
const struct drm_display_mode *mode,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
struct drm_display_mode *adjusted_mode,
|
|
|
|
struct ast_vbios_mode_info *vbios_mode)
|
|
|
|
{
|
2019-11-07 09:34:00 +01:00
|
|
|
u32 refresh_rate_index = 0, refresh_rate;
|
2017-02-17 13:45:24 +11:00
|
|
|
const struct ast_vbios_enhtable *best = NULL;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
u32 hborder, vborder;
|
2014-08-28 17:11:04 +08:00
|
|
|
bool check_sync;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
switch (format->cpp[0] * 8) {
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
case 8:
|
|
|
|
vbios_mode->std_table = &vbios_stdtable[VGAModeIndex];
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
vbios_mode->std_table = &vbios_stdtable[HiCModeIndex];
|
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
case 32:
|
|
|
|
vbios_mode->std_table = &vbios_stdtable[TrueCModeIndex];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-11-07 09:34:00 +01:00
|
|
|
switch (mode->crtc_hdisplay) {
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
case 640:
|
|
|
|
vbios_mode->enh_table = &res_640x480[refresh_rate_index];
|
|
|
|
break;
|
|
|
|
case 800:
|
|
|
|
vbios_mode->enh_table = &res_800x600[refresh_rate_index];
|
|
|
|
break;
|
|
|
|
case 1024:
|
|
|
|
vbios_mode->enh_table = &res_1024x768[refresh_rate_index];
|
|
|
|
break;
|
|
|
|
case 1280:
|
2019-11-07 09:34:00 +01:00
|
|
|
if (mode->crtc_vdisplay == 800)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
vbios_mode->enh_table = &res_1280x800[refresh_rate_index];
|
|
|
|
else
|
|
|
|
vbios_mode->enh_table = &res_1280x1024[refresh_rate_index];
|
|
|
|
break;
|
2014-01-17 10:56:09 +10:00
|
|
|
case 1360:
|
|
|
|
vbios_mode->enh_table = &res_1360x768[refresh_rate_index];
|
|
|
|
break;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
case 1440:
|
|
|
|
vbios_mode->enh_table = &res_1440x900[refresh_rate_index];
|
|
|
|
break;
|
|
|
|
case 1600:
|
2019-11-07 09:34:00 +01:00
|
|
|
if (mode->crtc_vdisplay == 900)
|
2014-01-17 10:56:09 +10:00
|
|
|
vbios_mode->enh_table = &res_1600x900[refresh_rate_index];
|
|
|
|
else
|
|
|
|
vbios_mode->enh_table = &res_1600x1200[refresh_rate_index];
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
break;
|
|
|
|
case 1680:
|
|
|
|
vbios_mode->enh_table = &res_1680x1050[refresh_rate_index];
|
|
|
|
break;
|
|
|
|
case 1920:
|
2019-11-07 09:34:00 +01:00
|
|
|
if (mode->crtc_vdisplay == 1080)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
vbios_mode->enh_table = &res_1920x1080[refresh_rate_index];
|
|
|
|
else
|
|
|
|
vbios_mode->enh_table = &res_1920x1200[refresh_rate_index];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
refresh_rate = drm_mode_vrefresh(mode);
|
2014-08-28 17:11:04 +08:00
|
|
|
check_sync = vbios_mode->enh_table->flags & WideScreenMode;
|
2019-11-07 09:34:00 +01:00
|
|
|
|
|
|
|
while (1) {
|
2017-02-17 13:45:24 +11:00
|
|
|
const struct ast_vbios_enhtable *loop = vbios_mode->enh_table;
|
2014-08-28 17:11:04 +08:00
|
|
|
|
|
|
|
while (loop->refresh_rate != 0xff) {
|
|
|
|
if ((check_sync) &&
|
|
|
|
(((mode->flags & DRM_MODE_FLAG_NVSYNC) &&
|
|
|
|
(loop->flags & PVSync)) ||
|
|
|
|
((mode->flags & DRM_MODE_FLAG_PVSYNC) &&
|
|
|
|
(loop->flags & NVSync)) ||
|
|
|
|
((mode->flags & DRM_MODE_FLAG_NHSYNC) &&
|
|
|
|
(loop->flags & PHSync)) ||
|
|
|
|
((mode->flags & DRM_MODE_FLAG_PHSYNC) &&
|
|
|
|
(loop->flags & NHSync)))) {
|
|
|
|
loop++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (loop->refresh_rate <= refresh_rate
|
|
|
|
&& (!best || loop->refresh_rate > best->refresh_rate))
|
|
|
|
best = loop;
|
|
|
|
loop++;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
}
|
2014-08-28 17:11:04 +08:00
|
|
|
if (best || !check_sync)
|
|
|
|
break;
|
|
|
|
check_sync = 0;
|
2019-11-07 09:34:00 +01:00
|
|
|
}
|
|
|
|
|
2014-08-28 17:11:04 +08:00
|
|
|
if (best)
|
|
|
|
vbios_mode->enh_table = best;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
|
|
|
hborder = (vbios_mode->enh_table->flags & HBorder) ? 8 : 0;
|
|
|
|
vborder = (vbios_mode->enh_table->flags & VBorder) ? 8 : 0;
|
|
|
|
|
|
|
|
adjusted_mode->crtc_htotal = vbios_mode->enh_table->ht;
|
|
|
|
adjusted_mode->crtc_hblank_start = vbios_mode->enh_table->hde + hborder;
|
|
|
|
adjusted_mode->crtc_hblank_end = vbios_mode->enh_table->ht - hborder;
|
|
|
|
adjusted_mode->crtc_hsync_start = vbios_mode->enh_table->hde + hborder +
|
|
|
|
vbios_mode->enh_table->hfp;
|
|
|
|
adjusted_mode->crtc_hsync_end = (vbios_mode->enh_table->hde + hborder +
|
|
|
|
vbios_mode->enh_table->hfp +
|
|
|
|
vbios_mode->enh_table->hsync);
|
|
|
|
|
|
|
|
adjusted_mode->crtc_vtotal = vbios_mode->enh_table->vt;
|
|
|
|
adjusted_mode->crtc_vblank_start = vbios_mode->enh_table->vde + vborder;
|
|
|
|
adjusted_mode->crtc_vblank_end = vbios_mode->enh_table->vt - vborder;
|
|
|
|
adjusted_mode->crtc_vsync_start = vbios_mode->enh_table->vde + vborder +
|
|
|
|
vbios_mode->enh_table->vfp;
|
|
|
|
adjusted_mode->crtc_vsync_end = (vbios_mode->enh_table->vde + vborder +
|
|
|
|
vbios_mode->enh_table->vfp +
|
|
|
|
vbios_mode->enh_table->vsync);
|
|
|
|
|
2019-11-07 09:34:00 +01:00
|
|
|
return true;
|
|
|
|
}
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_vbios_color_reg(struct ast_private *ast,
|
|
|
|
const struct drm_format_info *format,
|
2019-11-07 09:34:00 +01:00
|
|
|
const struct ast_vbios_mode_info *vbios_mode)
|
|
|
|
{
|
|
|
|
u32 color_index;
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
switch (format->cpp[0]) {
|
2019-11-07 09:34:00 +01:00
|
|
|
case 1:
|
|
|
|
color_index = VGAModeIndex - 1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
color_index = HiCModeIndex;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
color_index = TrueCModeIndex;
|
2020-06-10 12:58:04 +01:00
|
|
|
break;
|
2019-11-07 09:34:00 +01:00
|
|
|
default:
|
|
|
|
return;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
}
|
|
|
|
|
2019-11-07 09:34:00 +01:00
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8c, (u8)((color_index & 0x0f) << 4));
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2019-11-07 09:34:00 +01:00
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0x00);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2019-11-07 09:34:00 +01:00
|
|
|
if (vbios_mode->enh_table->flags & NewModeInfo) {
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8);
|
2019-12-02 12:15:53 +01:00
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x92, format->cpp[0] * 8);
|
2019-11-07 09:34:00 +01:00
|
|
|
}
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
}
|
2019-11-07 09:34:00 +01:00
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_vbios_mode_reg(struct ast_private *ast,
|
2019-11-07 09:34:00 +01:00
|
|
|
const struct drm_display_mode *adjusted_mode,
|
|
|
|
const struct ast_vbios_mode_info *vbios_mode)
|
|
|
|
{
|
|
|
|
u32 refresh_rate_index, mode_id;
|
|
|
|
|
|
|
|
refresh_rate_index = vbios_mode->enh_table->refresh_rate_index;
|
|
|
|
mode_id = vbios_mode->enh_table->mode_id;
|
|
|
|
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8d, refresh_rate_index & 0xff);
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8e, mode_id & 0xff);
|
|
|
|
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0x00);
|
|
|
|
|
|
|
|
if (vbios_mode->enh_table->flags & NewModeInfo) {
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8);
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x93, adjusted_mode->clock / 1000);
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x94, adjusted_mode->crtc_hdisplay);
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x95, adjusted_mode->crtc_hdisplay >> 8);
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x96, adjusted_mode->crtc_vdisplay);
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x97, adjusted_mode->crtc_vdisplay >> 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_std_reg(struct ast_private *ast,
|
|
|
|
struct drm_display_mode *mode,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
struct ast_vbios_mode_info *vbios_mode)
|
|
|
|
{
|
2017-02-17 13:45:24 +11:00
|
|
|
const struct ast_vbios_stdtable *stdtable;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
u32 i;
|
|
|
|
u8 jreg;
|
|
|
|
|
|
|
|
stdtable = vbios_mode->std_table;
|
|
|
|
|
|
|
|
jreg = stdtable->misc;
|
|
|
|
ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg);
|
|
|
|
|
2019-12-02 12:15:52 +01:00
|
|
|
/* Set SEQ; except Screen Disable field */
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
ast_set_index_reg(ast, AST_IO_SEQ_PORT, 0x00, 0x03);
|
2019-12-02 12:15:52 +01:00
|
|
|
ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x01, 0xdf, stdtable->seq[0]);
|
|
|
|
for (i = 1; i < 4; i++) {
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
jreg = stdtable->seq[i];
|
|
|
|
ast_set_index_reg(ast, AST_IO_SEQ_PORT, (i + 1) , jreg);
|
|
|
|
}
|
|
|
|
|
2019-11-07 09:33:58 +01:00
|
|
|
/* Set CRTC; except base address and offset */
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00);
|
2019-11-07 09:33:58 +01:00
|
|
|
for (i = 0; i < 12; i++)
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]);
|
|
|
|
for (i = 14; i < 19; i++)
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]);
|
|
|
|
for (i = 20; i < 25; i++)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]);
|
|
|
|
|
|
|
|
/* set AR */
|
|
|
|
jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ);
|
|
|
|
for (i = 0; i < 20; i++) {
|
|
|
|
jreg = stdtable->ar[i];
|
|
|
|
ast_io_write8(ast, AST_IO_AR_PORT_WRITE, (u8)i);
|
|
|
|
ast_io_write8(ast, AST_IO_AR_PORT_WRITE, jreg);
|
|
|
|
}
|
|
|
|
ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x14);
|
|
|
|
ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x00);
|
|
|
|
|
|
|
|
jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ);
|
|
|
|
ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x20);
|
|
|
|
|
|
|
|
/* Set GR */
|
|
|
|
for (i = 0; i < 9; i++)
|
|
|
|
ast_set_index_reg(ast, AST_IO_GR_PORT, i, stdtable->gr[i]);
|
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_crtc_reg(struct ast_private *ast,
|
|
|
|
struct drm_display_mode *mode,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
struct ast_vbios_mode_info *vbios_mode)
|
|
|
|
{
|
|
|
|
u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0;
|
2017-02-17 14:36:46 +11:00
|
|
|
u16 temp, precache = 0;
|
|
|
|
|
|
|
|
if ((ast->chip == AST2500) &&
|
|
|
|
(vbios_mode->enh_table->flags & AST2500PreCatchCRT))
|
|
|
|
precache = 40;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00);
|
|
|
|
|
|
|
|
temp = (mode->crtc_htotal >> 3) - 5;
|
|
|
|
if (temp & 0x100)
|
|
|
|
jregAC |= 0x01; /* HT D[8] */
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x00, 0x00, temp);
|
|
|
|
|
|
|
|
temp = (mode->crtc_hdisplay >> 3) - 1;
|
|
|
|
if (temp & 0x100)
|
|
|
|
jregAC |= 0x04; /* HDE D[8] */
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x01, 0x00, temp);
|
|
|
|
|
|
|
|
temp = (mode->crtc_hblank_start >> 3) - 1;
|
|
|
|
if (temp & 0x100)
|
|
|
|
jregAC |= 0x10; /* HBS D[8] */
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x02, 0x00, temp);
|
|
|
|
|
|
|
|
temp = ((mode->crtc_hblank_end >> 3) - 1) & 0x7f;
|
|
|
|
if (temp & 0x20)
|
|
|
|
jreg05 |= 0x80; /* HBE D[5] */
|
|
|
|
if (temp & 0x40)
|
|
|
|
jregAD |= 0x01; /* HBE D[5] */
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x03, 0xE0, (temp & 0x1f));
|
|
|
|
|
2017-02-17 14:36:46 +11:00
|
|
|
temp = ((mode->crtc_hsync_start-precache) >> 3) - 1;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
if (temp & 0x100)
|
|
|
|
jregAC |= 0x40; /* HRS D[5] */
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x04, 0x00, temp);
|
|
|
|
|
2017-02-17 14:36:46 +11:00
|
|
|
temp = (((mode->crtc_hsync_end-precache) >> 3) - 1) & 0x3f;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
if (temp & 0x20)
|
|
|
|
jregAD |= 0x04; /* HRE D[5] */
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05));
|
|
|
|
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC);
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD);
|
|
|
|
|
|
|
|
/* vert timings */
|
|
|
|
temp = (mode->crtc_vtotal) - 2;
|
|
|
|
if (temp & 0x100)
|
|
|
|
jreg07 |= 0x01;
|
|
|
|
if (temp & 0x200)
|
|
|
|
jreg07 |= 0x20;
|
|
|
|
if (temp & 0x400)
|
|
|
|
jregAE |= 0x01;
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x06, 0x00, temp);
|
|
|
|
|
|
|
|
temp = (mode->crtc_vsync_start) - 1;
|
|
|
|
if (temp & 0x100)
|
|
|
|
jreg07 |= 0x04;
|
|
|
|
if (temp & 0x200)
|
|
|
|
jreg07 |= 0x80;
|
|
|
|
if (temp & 0x400)
|
|
|
|
jregAE |= 0x08;
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x10, 0x00, temp);
|
|
|
|
|
|
|
|
temp = (mode->crtc_vsync_end - 1) & 0x3f;
|
|
|
|
if (temp & 0x10)
|
|
|
|
jregAE |= 0x20;
|
|
|
|
if (temp & 0x20)
|
|
|
|
jregAE |= 0x40;
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x70, temp & 0xf);
|
|
|
|
|
|
|
|
temp = mode->crtc_vdisplay - 1;
|
|
|
|
if (temp & 0x100)
|
|
|
|
jreg07 |= 0x02;
|
|
|
|
if (temp & 0x200)
|
|
|
|
jreg07 |= 0x40;
|
|
|
|
if (temp & 0x400)
|
|
|
|
jregAE |= 0x02;
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x12, 0x00, temp);
|
|
|
|
|
|
|
|
temp = mode->crtc_vblank_start - 1;
|
|
|
|
if (temp & 0x100)
|
|
|
|
jreg07 |= 0x08;
|
|
|
|
if (temp & 0x200)
|
|
|
|
jreg09 |= 0x20;
|
|
|
|
if (temp & 0x400)
|
|
|
|
jregAE |= 0x04;
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x15, 0x00, temp);
|
|
|
|
|
|
|
|
temp = mode->crtc_vblank_end - 1;
|
|
|
|
if (temp & 0x100)
|
|
|
|
jregAE |= 0x10;
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x16, 0x00, temp);
|
|
|
|
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x07, 0x00, jreg07);
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x09, 0xdf, jreg09);
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAE, 0x00, (jregAE | 0x80));
|
|
|
|
|
2017-02-17 14:36:46 +11:00
|
|
|
if (precache)
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x80);
|
|
|
|
else
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x00);
|
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x80);
|
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_offset_reg(struct ast_private *ast,
|
|
|
|
struct drm_framebuffer *fb)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
{
|
|
|
|
u16 offset;
|
|
|
|
|
2016-11-18 21:52:41 +02:00
|
|
|
offset = fb->pitches[0] >> 3;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x13, (offset & 0xff));
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xb0, (offset >> 8) & 0x3f);
|
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_dclk_reg(struct ast_private *ast,
|
|
|
|
struct drm_display_mode *mode,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
struct ast_vbios_mode_info *vbios_mode)
|
|
|
|
{
|
2017-02-17 13:45:24 +11:00
|
|
|
const struct ast_vbios_dclk_info *clk_info;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2017-02-17 14:36:46 +11:00
|
|
|
if (ast->chip == AST2500)
|
|
|
|
clk_info = &dclk_table_ast2500[vbios_mode->enh_table->dclk_index];
|
|
|
|
else
|
|
|
|
clk_info = &dclk_table[vbios_mode->enh_table->dclk_index];
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc0, 0x00, clk_info->param1);
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc1, 0x00, clk_info->param2);
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xbb, 0x0f,
|
2017-02-17 14:36:46 +11:00
|
|
|
(clk_info->param3 & 0xc0) |
|
|
|
|
((clk_info->param3 & 0x3) << 4));
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_color_reg(struct ast_private *ast,
|
|
|
|
const struct drm_format_info *format)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
{
|
|
|
|
u8 jregA0 = 0, jregA3 = 0, jregA8 = 0;
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
switch (format->cpp[0] * 8) {
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
case 8:
|
|
|
|
jregA0 = 0x70;
|
|
|
|
jregA3 = 0x01;
|
|
|
|
jregA8 = 0x00;
|
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
case 16:
|
|
|
|
jregA0 = 0x70;
|
|
|
|
jregA3 = 0x04;
|
|
|
|
jregA8 = 0x02;
|
|
|
|
break;
|
|
|
|
case 32:
|
|
|
|
jregA0 = 0x70;
|
|
|
|
jregA3 = 0x08;
|
|
|
|
jregA8 = 0x02;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa0, 0x8f, jregA0);
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xf0, jregA3);
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa8, 0xfd, jregA8);
|
2019-11-07 09:33:59 +01:00
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_crtthd_reg(struct ast_private *ast)
|
2019-11-07 09:33:59 +01:00
|
|
|
{
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
/* Set Threshold */
|
2017-02-17 14:36:46 +11:00
|
|
|
if (ast->chip == AST2300 || ast->chip == AST2400 ||
|
|
|
|
ast->chip == AST2500) {
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78);
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60);
|
|
|
|
} else if (ast->chip == AST2100 ||
|
|
|
|
ast->chip == AST1100 ||
|
|
|
|
ast->chip == AST2200 ||
|
|
|
|
ast->chip == AST2150) {
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x3f);
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x2f);
|
|
|
|
} else {
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x2f);
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x1f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_sync_reg(struct ast_private *ast,
|
|
|
|
struct drm_display_mode *mode,
|
2019-11-07 09:33:59 +01:00
|
|
|
struct ast_vbios_mode_info *vbios_mode)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
{
|
|
|
|
u8 jreg;
|
|
|
|
|
2014-08-28 17:11:04 +08:00
|
|
|
jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ);
|
|
|
|
jreg &= ~0xC0;
|
|
|
|
if (vbios_mode->enh_table->flags & NVSync) jreg |= 0x80;
|
|
|
|
if (vbios_mode->enh_table->flags & NHSync) jreg |= 0x40;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg);
|
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:53 +01:00
|
|
|
static void ast_set_start_address_crt1(struct ast_private *ast,
|
|
|
|
unsigned offset)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
{
|
|
|
|
u32 addr;
|
|
|
|
|
|
|
|
addr = offset >> 2;
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0d, (u8)(addr & 0xff));
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0c, (u8)((addr >> 8) & 0xff));
|
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xaf, (u8)((addr >> 16) & 0xff));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-14 09:22:34 +02:00
|
|
|
static void ast_wait_for_vretrace(struct ast_private *ast)
|
|
|
|
{
|
|
|
|
unsigned long timeout = jiffies + HZ;
|
|
|
|
u8 vgair1;
|
|
|
|
|
|
|
|
do {
|
|
|
|
vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ);
|
|
|
|
} while (!(vgair1 & AST_IO_VGAIR1_VREFRESH) && time_before(jiffies, timeout));
|
|
|
|
}
|
|
|
|
|
2019-11-07 09:34:01 +01:00
|
|
|
/*
|
|
|
|
* Primary plane
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const uint32_t ast_primary_plane_formats[] = {
|
|
|
|
DRM_FORMAT_XRGB8888,
|
|
|
|
DRM_FORMAT_RGB565,
|
|
|
|
DRM_FORMAT_C8,
|
|
|
|
};
|
|
|
|
|
2019-12-02 12:15:54 +01:00
|
|
|
static int ast_primary_plane_helper_atomic_check(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *state)
|
2019-11-07 09:34:01 +01:00
|
|
|
{
|
2019-12-02 12:15:54 +01:00
|
|
|
struct drm_crtc_state *crtc_state;
|
2019-12-02 12:15:57 +01:00
|
|
|
struct ast_crtc_state *ast_crtc_state;
|
2019-12-02 12:15:54 +01:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!state->crtc)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
|
|
|
|
|
|
|
|
ret = drm_atomic_helper_check_plane_state(state, crtc_state,
|
|
|
|
DRM_PLANE_HELPER_NO_SCALING,
|
|
|
|
DRM_PLANE_HELPER_NO_SCALING,
|
|
|
|
false, true);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2019-12-02 12:15:57 +01:00
|
|
|
if (!state->visible)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ast_crtc_state = to_ast_crtc_state(crtc_state);
|
|
|
|
|
|
|
|
ast_crtc_state->format = state->fb->format;
|
|
|
|
|
2019-11-07 09:34:01 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-05-07 10:40:06 +08:00
|
|
|
static void
|
|
|
|
ast_primary_plane_helper_atomic_update(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *old_state)
|
2019-11-07 09:34:01 +01:00
|
|
|
{
|
2020-06-17 10:03:40 +02:00
|
|
|
struct drm_device *dev = plane->dev;
|
|
|
|
struct ast_private *ast = to_ast_private(dev);
|
2019-11-07 09:34:01 +01:00
|
|
|
struct drm_plane_state *state = plane->state;
|
|
|
|
struct drm_gem_vram_object *gbo;
|
|
|
|
s64 gpu_addr;
|
2020-09-14 09:22:33 +02:00
|
|
|
struct drm_framebuffer *fb = state->fb;
|
|
|
|
struct drm_framebuffer *old_fb = old_state->fb;
|
|
|
|
|
|
|
|
if (!old_fb || (fb->format != old_fb->format)) {
|
|
|
|
struct drm_crtc_state *crtc_state = state->crtc->state;
|
|
|
|
struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state);
|
|
|
|
struct ast_vbios_mode_info *vbios_mode_info = &ast_crtc_state->vbios_mode_info;
|
|
|
|
|
|
|
|
ast_set_color_reg(ast, fb->format);
|
|
|
|
ast_set_vbios_color_reg(ast, fb->format, vbios_mode_info);
|
|
|
|
}
|
2019-11-07 09:34:01 +01:00
|
|
|
|
2020-09-14 09:22:33 +02:00
|
|
|
gbo = drm_gem_vram_of_gem(fb->obj[0]);
|
2019-11-07 09:34:01 +01:00
|
|
|
gpu_addr = drm_gem_vram_offset(gbo);
|
2020-06-17 10:03:40 +02:00
|
|
|
if (drm_WARN_ON_ONCE(dev, gpu_addr < 0))
|
2019-11-07 09:34:01 +01:00
|
|
|
return; /* Bug: we didn't pin the BO to VRAM in prepare_fb. */
|
|
|
|
|
2020-09-14 09:22:33 +02:00
|
|
|
ast_set_offset_reg(ast, fb);
|
2019-12-02 12:15:53 +01:00
|
|
|
ast_set_start_address_crt1(ast, (u32)gpu_addr);
|
2019-12-02 12:15:52 +01:00
|
|
|
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0x00);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ast_primary_plane_helper_atomic_disable(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *old_state)
|
|
|
|
{
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(plane->dev);
|
2019-12-02 12:15:52 +01:00
|
|
|
|
|
|
|
ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0x20);
|
2019-11-07 09:34:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct drm_plane_helper_funcs ast_primary_plane_helper_funcs = {
|
|
|
|
.prepare_fb = drm_gem_vram_plane_helper_prepare_fb,
|
|
|
|
.cleanup_fb = drm_gem_vram_plane_helper_cleanup_fb,
|
|
|
|
.atomic_check = ast_primary_plane_helper_atomic_check,
|
|
|
|
.atomic_update = ast_primary_plane_helper_atomic_update,
|
2019-12-02 12:15:52 +01:00
|
|
|
.atomic_disable = ast_primary_plane_helper_atomic_disable,
|
2019-11-07 09:34:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct drm_plane_funcs ast_primary_plane_funcs = {
|
|
|
|
.update_plane = drm_atomic_helper_update_plane,
|
|
|
|
.disable_plane = drm_atomic_helper_disable_plane,
|
|
|
|
.destroy = drm_plane_cleanup,
|
|
|
|
.reset = drm_atomic_helper_plane_reset,
|
|
|
|
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
|
|
|
|
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
|
|
|
|
};
|
|
|
|
|
2019-11-07 09:34:03 +01:00
|
|
|
/*
|
|
|
|
* Cursor plane
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const uint32_t ast_cursor_plane_formats[] = {
|
|
|
|
DRM_FORMAT_ARGB8888,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
ast_cursor_plane_helper_prepare_fb(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *new_state)
|
|
|
|
{
|
|
|
|
struct drm_framebuffer *fb = new_state->fb;
|
|
|
|
struct drm_crtc *crtc = new_state->crtc;
|
|
|
|
struct ast_private *ast;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!crtc || !fb)
|
|
|
|
return 0;
|
|
|
|
|
2020-07-02 13:50:18 +02:00
|
|
|
ast = to_ast_private(plane->dev);
|
2019-11-07 09:34:03 +01:00
|
|
|
|
2020-07-02 13:50:18 +02:00
|
|
|
ret = ast_cursor_blit(ast, fb);
|
2019-11-07 09:34:03 +01:00
|
|
|
if (ret)
|
2020-07-02 13:50:18 +02:00
|
|
|
return ret;
|
2019-11-07 09:34:03 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ast_cursor_plane_helper_atomic_check(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *state)
|
|
|
|
{
|
2019-12-02 12:15:54 +01:00
|
|
|
struct drm_framebuffer *fb = state->fb;
|
|
|
|
struct drm_crtc_state *crtc_state;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!state->crtc)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
|
|
|
|
|
|
|
|
ret = drm_atomic_helper_check_plane_state(state, crtc_state,
|
|
|
|
DRM_PLANE_HELPER_NO_SCALING,
|
|
|
|
DRM_PLANE_HELPER_NO_SCALING,
|
|
|
|
true, true);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
if (!state->visible)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (fb->width > AST_MAX_HWC_WIDTH || fb->height > AST_MAX_HWC_HEIGHT)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2019-11-07 09:34:03 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ast_cursor_plane_helper_atomic_update(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *old_state)
|
|
|
|
{
|
|
|
|
struct drm_plane_state *state = plane->state;
|
|
|
|
struct drm_framebuffer *fb = state->fb;
|
2020-07-30 15:52:01 +02:00
|
|
|
struct ast_private *ast = to_ast_private(plane->dev);
|
2020-07-02 13:50:21 +02:00
|
|
|
unsigned int offset_x, offset_y;
|
2019-11-07 09:34:03 +01:00
|
|
|
|
2020-07-02 13:50:21 +02:00
|
|
|
offset_x = AST_MAX_HWC_WIDTH - fb->width;
|
|
|
|
offset_y = AST_MAX_HWC_WIDTH - fb->height;
|
2019-11-07 09:34:03 +01:00
|
|
|
|
|
|
|
if (state->fb != old_state->fb) {
|
|
|
|
/* A new cursor image was installed. */
|
2020-07-02 13:50:20 +02:00
|
|
|
ast_cursor_page_flip(ast);
|
2019-11-07 09:34:03 +01:00
|
|
|
}
|
|
|
|
|
2020-07-02 13:50:21 +02:00
|
|
|
ast_cursor_show(ast, state->crtc_x, state->crtc_y,
|
|
|
|
offset_x, offset_y);
|
2019-11-07 09:34:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ast_cursor_plane_helper_atomic_disable(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *old_state)
|
|
|
|
{
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(plane->dev);
|
2019-11-07 09:34:03 +01:00
|
|
|
|
2020-07-02 13:50:23 +02:00
|
|
|
ast_cursor_hide(ast);
|
2019-11-07 09:34:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct drm_plane_helper_funcs ast_cursor_plane_helper_funcs = {
|
|
|
|
.prepare_fb = ast_cursor_plane_helper_prepare_fb,
|
|
|
|
.cleanup_fb = NULL, /* not required for cursor plane */
|
|
|
|
.atomic_check = ast_cursor_plane_helper_atomic_check,
|
|
|
|
.atomic_update = ast_cursor_plane_helper_atomic_update,
|
|
|
|
.atomic_disable = ast_cursor_plane_helper_atomic_disable,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct drm_plane_funcs ast_cursor_plane_funcs = {
|
|
|
|
.update_plane = drm_atomic_helper_update_plane,
|
|
|
|
.disable_plane = drm_atomic_helper_disable_plane,
|
|
|
|
.destroy = drm_plane_cleanup,
|
|
|
|
.reset = drm_atomic_helper_plane_reset,
|
|
|
|
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
|
|
|
|
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
|
|
|
|
};
|
|
|
|
|
2019-11-07 09:34:01 +01:00
|
|
|
/*
|
|
|
|
* CRTC
|
|
|
|
*/
|
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
|
|
|
|
{
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(crtc->dev);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2019-12-02 12:15:52 +01:00
|
|
|
/* TODO: Maybe control display signal generation with
|
|
|
|
* Sync Enable (bit CR17.7).
|
|
|
|
*/
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
switch (mode) {
|
|
|
|
case DRM_MODE_DPMS_ON:
|
|
|
|
case DRM_MODE_DPMS_STANDBY:
|
|
|
|
case DRM_MODE_DPMS_SUSPEND:
|
2014-03-28 11:05:12 +10:00
|
|
|
if (ast->tx_chip_type == AST_TX_DP501)
|
|
|
|
ast_set_dp501_video_output(crtc->dev, 1);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
break;
|
|
|
|
case DRM_MODE_DPMS_OFF:
|
2014-03-28 11:05:12 +10:00
|
|
|
if (ast->tx_chip_type == AST_TX_DP501)
|
|
|
|
ast_set_dp501_video_output(crtc->dev, 0);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-07 09:34:02 +01:00
|
|
|
static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,
|
drm/atomic: Pass the full state to CRTC atomic_check
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_check.
The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier ret, f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- ret = FUNCS->atomic_check(crtc, crtc_state);
+ ret = FUNCS->atomic_check(crtc, state);
...>
}
@@
identifier crtc, new_state;
@@
struct drm_crtc_helper_funcs {
...
- int (*atomic_check)(struct drm_crtc *crtc, struct drm_crtc_state *new_state);
+ int (*atomic_check)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};
@ ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc,
struct drm_crtc_state *new_state)
{
... when != new_state
}
@ adds_new_state depends on crtc_atomic_func && !ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc, struct drm_crtc_state *new_state)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
int func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
int func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier new_state;
identifier crtc;
@@
int func(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{ ... }
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
);
@ include depends on adds_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_new_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-maxime@cerno.tech
2020-10-28 13:32:21 +01:00
|
|
|
struct drm_atomic_state *state)
|
2019-11-07 09:34:02 +01:00
|
|
|
{
|
drm/atomic: Pass the full state to CRTC atomic_check
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_check.
The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier ret, f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- ret = FUNCS->atomic_check(crtc, crtc_state);
+ ret = FUNCS->atomic_check(crtc, state);
...>
}
@@
identifier crtc, new_state;
@@
struct drm_crtc_helper_funcs {
...
- int (*atomic_check)(struct drm_crtc *crtc, struct drm_crtc_state *new_state);
+ int (*atomic_check)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};
@ ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc,
struct drm_crtc_state *new_state)
{
... when != new_state
}
@ adds_new_state depends on crtc_atomic_func && !ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc, struct drm_crtc_state *new_state)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
int func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
int func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier new_state;
identifier crtc;
@@
int func(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{ ... }
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
);
@ include depends on adds_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_new_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-maxime@cerno.tech
2020-10-28 13:32:21 +01:00
|
|
|
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
|
|
|
|
crtc);
|
2020-09-14 09:22:33 +02:00
|
|
|
struct drm_device *dev = crtc->dev;
|
2019-12-02 12:15:56 +01:00
|
|
|
struct ast_crtc_state *ast_state;
|
2019-12-02 12:15:57 +01:00
|
|
|
const struct drm_format_info *format;
|
2019-11-07 09:34:02 +01:00
|
|
|
bool succ;
|
|
|
|
|
drm/atomic: Pass the full state to CRTC atomic_check
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_check.
The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier ret, f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- ret = FUNCS->atomic_check(crtc, crtc_state);
+ ret = FUNCS->atomic_check(crtc, state);
...>
}
@@
identifier crtc, new_state;
@@
struct drm_crtc_helper_funcs {
...
- int (*atomic_check)(struct drm_crtc *crtc, struct drm_crtc_state *new_state);
+ int (*atomic_check)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};
@ ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc,
struct drm_crtc_state *new_state)
{
... when != new_state
}
@ adds_new_state depends on crtc_atomic_func && !ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc, struct drm_crtc_state *new_state)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
int func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
int func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier new_state;
identifier crtc;
@@
int func(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{ ... }
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
);
@ include depends on adds_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_new_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-maxime@cerno.tech
2020-10-28 13:32:21 +01:00
|
|
|
if (!crtc_state->enable)
|
2020-05-07 11:06:40 +02:00
|
|
|
return 0; /* no mode checks if CRTC is being disabled */
|
|
|
|
|
drm/atomic: Pass the full state to CRTC atomic_check
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_check.
The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier ret, f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- ret = FUNCS->atomic_check(crtc, crtc_state);
+ ret = FUNCS->atomic_check(crtc, state);
...>
}
@@
identifier crtc, new_state;
@@
struct drm_crtc_helper_funcs {
...
- int (*atomic_check)(struct drm_crtc *crtc, struct drm_crtc_state *new_state);
+ int (*atomic_check)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};
@ ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc,
struct drm_crtc_state *new_state)
{
... when != new_state
}
@ adds_new_state depends on crtc_atomic_func && !ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc, struct drm_crtc_state *new_state)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
int func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
int func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier new_state;
identifier crtc;
@@
int func(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{ ... }
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
);
@ include depends on adds_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_new_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-maxime@cerno.tech
2020-10-28 13:32:21 +01:00
|
|
|
ast_state = to_ast_crtc_state(crtc_state);
|
2019-11-07 09:34:02 +01:00
|
|
|
|
2019-12-02 12:15:57 +01:00
|
|
|
format = ast_state->format;
|
2020-09-14 09:22:33 +02:00
|
|
|
if (drm_WARN_ON_ONCE(dev, !format))
|
|
|
|
return -EINVAL; /* BUG: We didn't set format in primary check(). */
|
2019-12-02 12:15:56 +01:00
|
|
|
|
drm/atomic: Pass the full state to CRTC atomic_check
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_check.
The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier ret, f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- ret = FUNCS->atomic_check(crtc, crtc_state);
+ ret = FUNCS->atomic_check(crtc, state);
...>
}
@@
identifier crtc, new_state;
@@
struct drm_crtc_helper_funcs {
...
- int (*atomic_check)(struct drm_crtc *crtc, struct drm_crtc_state *new_state);
+ int (*atomic_check)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};
@ ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc,
struct drm_crtc_state *new_state)
{
... when != new_state
}
@ adds_new_state depends on crtc_atomic_func && !ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc, struct drm_crtc_state *new_state)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
int func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
int func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier new_state;
identifier crtc;
@@
int func(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{ ... }
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
);
@ include depends on adds_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_new_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-maxime@cerno.tech
2020-10-28 13:32:21 +01:00
|
|
|
succ = ast_get_vbios_mode_info(format, &crtc_state->mode,
|
|
|
|
&crtc_state->adjusted_mode,
|
2019-12-02 12:15:56 +01:00
|
|
|
&ast_state->vbios_mode_info);
|
|
|
|
if (!succ)
|
|
|
|
return -EINVAL;
|
2019-11-07 09:34:02 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-09-22 16:46:55 +02:00
|
|
|
static void
|
drm/atomic: Pass the full state to CRTC atomic begin and flush
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_begin and atomic_flush.
The conversion was done using the coccinelle script below, built tested on
all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@
f(struct drm_crtc_state *old_crtc_state)
{
...
struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_begin(crtc, old_crtc_state);
+ FUNCS->atomic_begin(crtc, old_state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@
f(struct drm_crtc_state *old_crtc_state)
{
...
struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_flush(crtc, old_crtc_state);
+ FUNCS->atomic_flush(crtc, old_state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state, ...)
{
<...
- FUNCS->atomic_begin(crtc, crtc_state);
+ FUNCS->atomic_begin(crtc, state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state, ...)
{
<...
- FUNCS->atomic_flush(crtc, crtc_state);
+ FUNCS->atomic_flush(crtc, state);
...>
}
@@
identifier crtc, old_state;
@@
struct drm_crtc_helper_funcs {
...
- void (*atomic_begin)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_begin)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_flush)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_flush)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_begin = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_flush = func,
...,
};
)
@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}
@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@@
identifier old_state;
identifier crtc;
@@
void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@@
identifier old_state;
identifier crtc;
@@
void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
...
}
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
...
}
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@
void func(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_old_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_old_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-2-maxime@cerno.tech
2020-10-28 13:32:22 +01:00
|
|
|
ast_crtc_helper_atomic_flush(struct drm_crtc *crtc,
|
|
|
|
struct drm_atomic_state *state)
|
2020-09-22 16:46:55 +02:00
|
|
|
{
|
drm: Use state helper instead of CRTC state pointer
Many drivers reference the crtc->pointer in order to get the current CRTC
state in their atomic_begin or atomic_flush hooks, which would be the new
CRTC state in the global atomic state since _swap_state happened when those
hooks are run.
Use the drm_atomic_get_new_crtc_state helper to get that state to make it
more obvious.
This was made using the coccinelle script below:
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_begin = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_flush = func,
...,
};
)
@@
identifier crtc_atomic_func.func;
identifier crtc, state;
symbol crtc_state;
expression e;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- struct tegra_dc_state *crtc_state = e;
+ struct tegra_dc_state *dc_state = e;
<+...
- crtc_state
+ dc_state
...+>
}
@@
identifier crtc_atomic_func.func;
identifier crtc, state;
symbol crtc_state;
expression e;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- struct mtk_crtc_state *crtc_state = e;
+ struct mtk_crtc_state *mtk_crtc_state = e;
<+...
- crtc_state
+ mtk_crtc_state
...+>
}
@ replaces_new_state @
identifier crtc_atomic_func.func;
identifier crtc, state, crtc_state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- struct drm_crtc_state *crtc_state = crtc->state;
+ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@@
identifier crtc_atomic_func.func;
identifier crtc, state, crtc_state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
...
- crtc->state
+ crtc_state
...
}
@ adds_new_state @
identifier crtc_atomic_func.func;
identifier crtc, state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
+ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
...
- crtc->state
+ crtc_state
...
}
@ include depends on adds_new_state || replaces_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && (adds_new_state || replaces_new_state) @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "James (Qian) Wang" <james.qian.wang@arm.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Mihail Atanassov <mihail.atanassov@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201105164518.392891-1-maxime@cerno.tech
2020-11-05 17:45:18 +01:00
|
|
|
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
|
|
|
|
crtc);
|
drm/atomic: Pass the full state to CRTC atomic begin and flush
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_begin and atomic_flush.
The conversion was done using the coccinelle script below, built tested on
all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@
f(struct drm_crtc_state *old_crtc_state)
{
...
struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_begin(crtc, old_crtc_state);
+ FUNCS->atomic_begin(crtc, old_state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@
f(struct drm_crtc_state *old_crtc_state)
{
...
struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_flush(crtc, old_crtc_state);
+ FUNCS->atomic_flush(crtc, old_state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state, ...)
{
<...
- FUNCS->atomic_begin(crtc, crtc_state);
+ FUNCS->atomic_begin(crtc, state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state, ...)
{
<...
- FUNCS->atomic_flush(crtc, crtc_state);
+ FUNCS->atomic_flush(crtc, state);
...>
}
@@
identifier crtc, old_state;
@@
struct drm_crtc_helper_funcs {
...
- void (*atomic_begin)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_begin)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_flush)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_flush)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_begin = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_flush = func,
...,
};
)
@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}
@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@@
identifier old_state;
identifier crtc;
@@
void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@@
identifier old_state;
identifier crtc;
@@
void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
...
}
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
...
}
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@
void func(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_old_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_old_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-2-maxime@cerno.tech
2020-10-28 13:32:22 +01:00
|
|
|
struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
|
|
|
|
crtc);
|
2020-09-22 16:46:55 +02:00
|
|
|
struct ast_private *ast = to_ast_private(crtc->dev);
|
drm: Use state helper instead of CRTC state pointer
Many drivers reference the crtc->pointer in order to get the current CRTC
state in their atomic_begin or atomic_flush hooks, which would be the new
CRTC state in the global atomic state since _swap_state happened when those
hooks are run.
Use the drm_atomic_get_new_crtc_state helper to get that state to make it
more obvious.
This was made using the coccinelle script below:
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_begin = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_flush = func,
...,
};
)
@@
identifier crtc_atomic_func.func;
identifier crtc, state;
symbol crtc_state;
expression e;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- struct tegra_dc_state *crtc_state = e;
+ struct tegra_dc_state *dc_state = e;
<+...
- crtc_state
+ dc_state
...+>
}
@@
identifier crtc_atomic_func.func;
identifier crtc, state;
symbol crtc_state;
expression e;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- struct mtk_crtc_state *crtc_state = e;
+ struct mtk_crtc_state *mtk_crtc_state = e;
<+...
- crtc_state
+ mtk_crtc_state
...+>
}
@ replaces_new_state @
identifier crtc_atomic_func.func;
identifier crtc, state, crtc_state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- struct drm_crtc_state *crtc_state = crtc->state;
+ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@@
identifier crtc_atomic_func.func;
identifier crtc, state, crtc_state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
...
- crtc->state
+ crtc_state
...
}
@ adds_new_state @
identifier crtc_atomic_func.func;
identifier crtc, state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
+ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
...
- crtc->state
+ crtc_state
...
}
@ include depends on adds_new_state || replaces_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && (adds_new_state || replaces_new_state) @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "James (Qian) Wang" <james.qian.wang@arm.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Mihail Atanassov <mihail.atanassov@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201105164518.392891-1-maxime@cerno.tech
2020-11-05 17:45:18 +01:00
|
|
|
struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state);
|
2020-09-22 16:46:55 +02:00
|
|
|
struct ast_crtc_state *old_ast_crtc_state = to_ast_crtc_state(old_crtc_state);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The gamma LUT has to be reloaded after changing the primary
|
|
|
|
* plane's color format.
|
|
|
|
*/
|
|
|
|
if (old_ast_crtc_state->format != ast_crtc_state->format)
|
|
|
|
ast_crtc_load_lut(ast, crtc);
|
|
|
|
}
|
|
|
|
|
2020-09-14 09:22:35 +02:00
|
|
|
static void
|
|
|
|
ast_crtc_helper_atomic_enable(struct drm_crtc *crtc,
|
drm/atomic: Pass the full state to CRTC atomic enable/disable
If the CRTC driver ever needs to access the full DRM state, it can't do so
at atomic_enable / atomic_disable time since drm_atomic_helper_swap_state
will have cleared the pointer from the struct drm_crtc_state to the struct
drm_atomic_state before calling those hooks.
In order to allow that, let's pass the full DRM state to atomic_enable and
atomic_disable. The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_disable(crtc, crtc_state);
+ FUNCS->atomic_disable(crtc, state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_enable(crtc, crtc_state);
+ FUNCS->atomic_enable(crtc, state);
...>
}
@@
identifier crtc, old_state;
@@
struct drm_crtc_helper_funcs {
...
- void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_enable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_disable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_enable = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
)
@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}
@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@
void func(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_old_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_old_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
2020-10-08 14:44:08 +02:00
|
|
|
struct drm_atomic_state *state)
|
2019-11-07 09:34:02 +01:00
|
|
|
{
|
2019-12-02 12:15:51 +01:00
|
|
|
struct drm_device *dev = crtc->dev;
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(dev);
|
2020-09-14 09:22:33 +02:00
|
|
|
struct drm_crtc_state *crtc_state = crtc->state;
|
|
|
|
struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state);
|
|
|
|
struct ast_vbios_mode_info *vbios_mode_info =
|
|
|
|
&ast_crtc_state->vbios_mode_info;
|
|
|
|
struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
|
2019-11-07 09:34:02 +01:00
|
|
|
|
2019-12-02 12:15:56 +01:00
|
|
|
ast_set_vbios_mode_reg(ast, adjusted_mode, vbios_mode_info);
|
2019-11-07 09:34:02 +01:00
|
|
|
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
|
2019-12-02 12:15:56 +01:00
|
|
|
ast_set_std_reg(ast, adjusted_mode, vbios_mode_info);
|
|
|
|
ast_set_crtc_reg(ast, adjusted_mode, vbios_mode_info);
|
|
|
|
ast_set_dclk_reg(ast, adjusted_mode, vbios_mode_info);
|
2019-12-02 12:15:53 +01:00
|
|
|
ast_set_crtthd_reg(ast);
|
2019-12-02 12:15:56 +01:00
|
|
|
ast_set_sync_reg(ast, adjusted_mode, vbios_mode_info);
|
2019-11-07 09:34:02 +01:00
|
|
|
|
|
|
|
ast_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ast_crtc_helper_atomic_disable(struct drm_crtc *crtc,
|
drm/atomic: Pass the full state to CRTC atomic enable/disable
If the CRTC driver ever needs to access the full DRM state, it can't do so
at atomic_enable / atomic_disable time since drm_atomic_helper_swap_state
will have cleared the pointer from the struct drm_crtc_state to the struct
drm_atomic_state before calling those hooks.
In order to allow that, let's pass the full DRM state to atomic_enable and
atomic_disable. The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_disable(crtc, crtc_state);
+ FUNCS->atomic_disable(crtc, state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_enable(crtc, crtc_state);
+ FUNCS->atomic_enable(crtc, state);
...>
}
@@
identifier crtc, old_state;
@@
struct drm_crtc_helper_funcs {
...
- void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_enable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_disable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_enable = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
)
@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}
@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@
void func(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_old_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_old_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
2020-10-08 14:44:08 +02:00
|
|
|
struct drm_atomic_state *state)
|
2019-11-07 09:34:02 +01:00
|
|
|
{
|
drm/atomic: Pass the full state to CRTC atomic enable/disable
If the CRTC driver ever needs to access the full DRM state, it can't do so
at atomic_enable / atomic_disable time since drm_atomic_helper_swap_state
will have cleared the pointer from the struct drm_crtc_state to the struct
drm_atomic_state before calling those hooks.
In order to allow that, let's pass the full DRM state to atomic_enable and
atomic_disable. The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_disable(crtc, crtc_state);
+ FUNCS->atomic_disable(crtc, state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_enable(crtc, crtc_state);
+ FUNCS->atomic_enable(crtc, state);
...>
}
@@
identifier crtc, old_state;
@@
struct drm_crtc_helper_funcs {
...
- void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_enable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_disable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_enable = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
)
@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}
@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@
void func(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_old_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_old_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
2020-10-08 14:44:08 +02:00
|
|
|
struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
|
|
|
|
crtc);
|
2020-09-14 09:22:34 +02:00
|
|
|
struct drm_device *dev = crtc->dev;
|
|
|
|
struct ast_private *ast = to_ast_private(dev);
|
|
|
|
|
2019-11-07 09:34:02 +01:00
|
|
|
ast_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
|
2020-09-14 09:22:34 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* HW cursors require the underlying primary plane and CRTC to
|
|
|
|
* display a valid mode and image. This is not the case during
|
|
|
|
* full modeset operations. So we temporarily disable any active
|
|
|
|
* plane, including the HW cursor. Each plane's atomic_update()
|
|
|
|
* helper will re-enable it if necessary.
|
|
|
|
*
|
|
|
|
* We only do this during *full* modesets. It does not affect
|
|
|
|
* simple pageflips on the planes.
|
|
|
|
*/
|
|
|
|
drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, false);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ensure that no scanout takes place before reprogramming mode
|
|
|
|
* and format registers.
|
|
|
|
*/
|
|
|
|
ast_wait_for_vretrace(ast);
|
2019-11-07 09:34:02 +01:00
|
|
|
}
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
|
|
|
static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = {
|
2019-11-07 09:34:02 +01:00
|
|
|
.atomic_check = ast_crtc_helper_atomic_check,
|
2020-09-22 16:46:55 +02:00
|
|
|
.atomic_flush = ast_crtc_helper_atomic_flush,
|
2019-11-07 09:34:02 +01:00
|
|
|
.atomic_enable = ast_crtc_helper_atomic_enable,
|
|
|
|
.atomic_disable = ast_crtc_helper_atomic_disable,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
};
|
|
|
|
|
2020-01-30 10:40:12 +01:00
|
|
|
static void ast_crtc_reset(struct drm_crtc *crtc)
|
|
|
|
{
|
|
|
|
struct ast_crtc_state *ast_state =
|
|
|
|
kzalloc(sizeof(*ast_state), GFP_KERNEL);
|
|
|
|
|
|
|
|
if (crtc->state)
|
|
|
|
crtc->funcs->atomic_destroy_state(crtc, crtc->state);
|
|
|
|
|
|
|
|
__drm_atomic_helper_crtc_reset(crtc, &ast_state->base);
|
|
|
|
}
|
|
|
|
|
2019-12-02 12:15:55 +01:00
|
|
|
static struct drm_crtc_state *
|
|
|
|
ast_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
|
|
|
|
{
|
2019-12-02 12:15:56 +01:00
|
|
|
struct ast_crtc_state *new_ast_state, *ast_state;
|
2020-06-17 10:03:40 +02:00
|
|
|
struct drm_device *dev = crtc->dev;
|
2019-12-02 12:15:55 +01:00
|
|
|
|
2020-06-17 10:03:40 +02:00
|
|
|
if (drm_WARN_ON(dev, !crtc->state))
|
2019-12-02 12:15:55 +01:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
new_ast_state = kmalloc(sizeof(*new_ast_state), GFP_KERNEL);
|
|
|
|
if (!new_ast_state)
|
|
|
|
return NULL;
|
|
|
|
__drm_atomic_helper_crtc_duplicate_state(crtc, &new_ast_state->base);
|
|
|
|
|
2019-12-02 12:15:56 +01:00
|
|
|
ast_state = to_ast_crtc_state(crtc->state);
|
|
|
|
|
2019-12-02 12:15:57 +01:00
|
|
|
new_ast_state->format = ast_state->format;
|
2019-12-02 12:15:56 +01:00
|
|
|
memcpy(&new_ast_state->vbios_mode_info, &ast_state->vbios_mode_info,
|
|
|
|
sizeof(new_ast_state->vbios_mode_info));
|
|
|
|
|
2019-12-02 12:15:55 +01:00
|
|
|
return &new_ast_state->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ast_crtc_atomic_destroy_state(struct drm_crtc *crtc,
|
|
|
|
struct drm_crtc_state *state)
|
|
|
|
{
|
|
|
|
struct ast_crtc_state *ast_state = to_ast_crtc_state(state);
|
|
|
|
|
|
|
|
__drm_atomic_helper_crtc_destroy_state(&ast_state->base);
|
|
|
|
kfree(ast_state);
|
|
|
|
}
|
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
static const struct drm_crtc_funcs ast_crtc_funcs = {
|
2020-01-30 10:40:12 +01:00
|
|
|
.reset = ast_crtc_reset,
|
2020-07-30 15:51:58 +02:00
|
|
|
.destroy = drm_crtc_cleanup,
|
2019-11-07 09:34:04 +01:00
|
|
|
.set_config = drm_atomic_helper_set_config,
|
|
|
|
.page_flip = drm_atomic_helper_page_flip,
|
2019-12-02 12:15:55 +01:00
|
|
|
.atomic_duplicate_state = ast_crtc_atomic_duplicate_state,
|
|
|
|
.atomic_destroy_state = ast_crtc_atomic_destroy_state,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
};
|
|
|
|
|
2014-01-06 20:02:39 +05:30
|
|
|
static int ast_crtc_init(struct drm_device *dev)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
{
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(dev);
|
2020-07-30 15:51:58 +02:00
|
|
|
struct drm_crtc *crtc = &ast->crtc;
|
2019-11-07 09:34:01 +01:00
|
|
|
int ret;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2020-07-02 13:50:27 +02:00
|
|
|
ret = drm_crtc_init_with_planes(dev, crtc, &ast->primary_plane,
|
2019-11-07 09:34:03 +01:00
|
|
|
&ast->cursor_plane, &ast_crtc_funcs,
|
|
|
|
NULL);
|
2019-11-07 09:34:01 +01:00
|
|
|
if (ret)
|
2020-07-30 15:51:58 +02:00
|
|
|
return ret;
|
2019-11-07 09:34:01 +01:00
|
|
|
|
2020-07-02 13:50:27 +02:00
|
|
|
drm_mode_crtc_set_gamma_size(crtc, 256);
|
|
|
|
drm_crtc_helper_add(crtc, &ast_crtc_helper_funcs);
|
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-11-07 09:34:04 +01:00
|
|
|
/*
|
|
|
|
* Encoder
|
|
|
|
*/
|
|
|
|
|
2014-01-06 20:02:39 +05:30
|
|
|
static int ast_encoder_init(struct drm_device *dev)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
{
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(dev);
|
2020-02-28 09:18:26 +01:00
|
|
|
struct drm_encoder *encoder = &ast->encoder;
|
|
|
|
int ret;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2020-02-28 09:18:26 +01:00
|
|
|
ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2020-02-28 09:18:26 +01:00
|
|
|
encoder->possible_crtcs = 1;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-11-07 09:34:04 +01:00
|
|
|
/*
|
|
|
|
* Connector
|
|
|
|
*/
|
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
static int ast_get_modes(struct drm_connector *connector)
|
|
|
|
{
|
|
|
|
struct ast_connector *ast_connector = to_ast_connector(connector);
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(connector->dev);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
struct edid *edid;
|
|
|
|
int ret;
|
2014-03-28 11:05:12 +10:00
|
|
|
bool flags = false;
|
|
|
|
if (ast->tx_chip_type == AST_TX_DP501) {
|
|
|
|
ast->dp501_maxclk = 0xff;
|
|
|
|
edid = kmalloc(128, GFP_KERNEL);
|
|
|
|
if (!edid)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
flags = ast_dp501_read_edid(connector->dev, (u8 *)edid);
|
|
|
|
if (flags)
|
|
|
|
ast->dp501_maxclk = ast_get_dp501_max_clk(connector->dev);
|
|
|
|
else
|
|
|
|
kfree(edid);
|
|
|
|
}
|
|
|
|
if (!flags)
|
|
|
|
edid = drm_get_edid(connector, &ast_connector->i2c->adapter);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
if (edid) {
|
2018-07-09 10:40:06 +02:00
|
|
|
drm_connector_update_edid_property(&ast_connector->base, edid);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
ret = drm_add_edid_modes(connector, edid);
|
2012-08-15 09:32:37 +00:00
|
|
|
kfree(edid);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
return ret;
|
|
|
|
} else
|
2018-07-09 10:40:06 +02:00
|
|
|
drm_connector_update_edid_property(&ast_connector->base, NULL);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-24 15:14:40 +02:00
|
|
|
static enum drm_mode_status ast_mode_valid(struct drm_connector *connector,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
struct drm_display_mode *mode)
|
|
|
|
{
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(connector->dev);
|
2014-01-17 10:56:09 +10:00
|
|
|
int flags = MODE_NOMODE;
|
|
|
|
uint32_t jtemp;
|
|
|
|
|
|
|
|
if (ast->support_wide_screen) {
|
|
|
|
if ((mode->hdisplay == 1680) && (mode->vdisplay == 1050))
|
|
|
|
return MODE_OK;
|
|
|
|
if ((mode->hdisplay == 1280) && (mode->vdisplay == 800))
|
|
|
|
return MODE_OK;
|
|
|
|
if ((mode->hdisplay == 1440) && (mode->vdisplay == 900))
|
|
|
|
return MODE_OK;
|
|
|
|
if ((mode->hdisplay == 1360) && (mode->vdisplay == 768))
|
|
|
|
return MODE_OK;
|
|
|
|
if ((mode->hdisplay == 1600) && (mode->vdisplay == 900))
|
|
|
|
return MODE_OK;
|
|
|
|
|
2017-02-17 14:36:46 +11:00
|
|
|
if ((ast->chip == AST2100) || (ast->chip == AST2200) ||
|
|
|
|
(ast->chip == AST2300) || (ast->chip == AST2400) ||
|
2020-06-17 10:03:37 +02:00
|
|
|
(ast->chip == AST2500)) {
|
2014-01-17 10:56:09 +10:00
|
|
|
if ((mode->hdisplay == 1920) && (mode->vdisplay == 1080))
|
|
|
|
return MODE_OK;
|
|
|
|
|
|
|
|
if ((mode->hdisplay == 1920) && (mode->vdisplay == 1200)) {
|
|
|
|
jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff);
|
|
|
|
if (jtemp & 0x01)
|
|
|
|
return MODE_NOMODE;
|
|
|
|
else
|
|
|
|
return MODE_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch (mode->hdisplay) {
|
|
|
|
case 640:
|
|
|
|
if (mode->vdisplay == 480) flags = MODE_OK;
|
|
|
|
break;
|
|
|
|
case 800:
|
|
|
|
if (mode->vdisplay == 600) flags = MODE_OK;
|
|
|
|
break;
|
|
|
|
case 1024:
|
|
|
|
if (mode->vdisplay == 768) flags = MODE_OK;
|
|
|
|
break;
|
|
|
|
case 1280:
|
|
|
|
if (mode->vdisplay == 1024) flags = MODE_OK;
|
|
|
|
break;
|
|
|
|
case 1600:
|
|
|
|
if (mode->vdisplay == 1200) flags = MODE_OK;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
return flags;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void ast_connector_destroy(struct drm_connector *connector)
|
|
|
|
{
|
|
|
|
struct ast_connector *ast_connector = to_ast_connector(connector);
|
|
|
|
ast_i2c_destroy(ast_connector->i2c);
|
|
|
|
drm_connector_cleanup(connector);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct drm_connector_helper_funcs ast_connector_helper_funcs = {
|
|
|
|
.get_modes = ast_get_modes,
|
2019-11-07 09:34:04 +01:00
|
|
|
.mode_valid = ast_mode_valid,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct drm_connector_funcs ast_connector_funcs = {
|
2019-11-07 09:34:04 +01:00
|
|
|
.reset = drm_atomic_helper_connector_reset,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
.fill_modes = drm_helper_probe_single_connector_modes,
|
|
|
|
.destroy = ast_connector_destroy,
|
2019-11-07 09:34:04 +01:00
|
|
|
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
|
|
|
|
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
};
|
|
|
|
|
2014-01-06 20:02:39 +05:30
|
|
|
static int ast_connector_init(struct drm_device *dev)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
{
|
2020-07-30 15:51:58 +02:00
|
|
|
struct ast_private *ast = to_ast_private(dev);
|
|
|
|
struct ast_connector *ast_connector = &ast->connector;
|
|
|
|
struct drm_connector *connector = &ast_connector->base;
|
|
|
|
struct drm_encoder *encoder = &ast->encoder;
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
2019-07-26 19:23:12 +02:00
|
|
|
ast_connector->i2c = ast_i2c_create(dev);
|
|
|
|
if (!ast_connector->i2c)
|
2020-06-17 10:03:40 +02:00
|
|
|
drm_err(dev, "failed to add ddc bus for connector\n");
|
2019-07-26 19:23:12 +02:00
|
|
|
|
|
|
|
drm_connector_init_with_ddc(dev, connector,
|
|
|
|
&ast_connector_funcs,
|
|
|
|
DRM_MODE_CONNECTOR_VGA,
|
|
|
|
&ast_connector->i2c->adapter);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
|
|
|
drm_connector_helper_add(connector, &ast_connector_helper_funcs);
|
|
|
|
|
|
|
|
connector->interlace_allowed = 0;
|
|
|
|
connector->doublescan_allowed = 0;
|
|
|
|
|
|
|
|
connector->polled = DRM_CONNECTOR_POLL_CONNECT;
|
|
|
|
|
2018-07-09 10:40:07 +02:00
|
|
|
drm_connector_attach_encoder(connector, encoder);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-07-02 13:50:29 +02:00
|
|
|
/*
|
|
|
|
* Mode config
|
|
|
|
*/
|
|
|
|
|
2020-09-14 09:22:36 +02:00
|
|
|
static const struct drm_mode_config_helper_funcs
|
|
|
|
ast_mode_config_helper_funcs = {
|
|
|
|
.atomic_commit_tail = drm_atomic_helper_commit_tail_rpm,
|
|
|
|
};
|
|
|
|
|
2020-07-02 13:50:29 +02:00
|
|
|
static const struct drm_mode_config_funcs ast_mode_config_funcs = {
|
|
|
|
.fb_create = drm_gem_fb_create,
|
|
|
|
.mode_valid = drm_vram_helper_mode_valid,
|
|
|
|
.atomic_check = drm_atomic_helper_check,
|
|
|
|
.atomic_commit = drm_atomic_helper_commit,
|
|
|
|
};
|
|
|
|
|
|
|
|
int ast_mode_config_init(struct ast_private *ast)
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
{
|
2020-07-30 15:52:03 +02:00
|
|
|
struct drm_device *dev = &ast->base;
|
2019-11-07 09:34:01 +01:00
|
|
|
int ret;
|
|
|
|
|
2020-07-02 13:50:26 +02:00
|
|
|
ret = ast_cursor_init(ast);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2020-07-02 13:50:29 +02:00
|
|
|
ret = drmm_mode_config_init(dev);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
dev->mode_config.funcs = &ast_mode_config_funcs;
|
|
|
|
dev->mode_config.min_width = 0;
|
|
|
|
dev->mode_config.min_height = 0;
|
|
|
|
dev->mode_config.preferred_depth = 24;
|
|
|
|
dev->mode_config.prefer_shadow = 1;
|
2020-07-30 15:52:02 +02:00
|
|
|
dev->mode_config.fb_base = pci_resource_start(dev->pdev, 0);
|
2020-07-02 13:50:29 +02:00
|
|
|
|
|
|
|
if (ast->chip == AST2100 ||
|
|
|
|
ast->chip == AST2200 ||
|
|
|
|
ast->chip == AST2300 ||
|
|
|
|
ast->chip == AST2400 ||
|
|
|
|
ast->chip == AST2500) {
|
|
|
|
dev->mode_config.max_width = 1920;
|
|
|
|
dev->mode_config.max_height = 2048;
|
|
|
|
} else {
|
|
|
|
dev->mode_config.max_width = 1600;
|
|
|
|
dev->mode_config.max_height = 1200;
|
|
|
|
}
|
|
|
|
|
2020-09-14 09:22:36 +02:00
|
|
|
dev->mode_config.helper_private = &ast_mode_config_helper_funcs;
|
|
|
|
|
2019-11-07 09:34:01 +01:00
|
|
|
memset(&ast->primary_plane, 0, sizeof(ast->primary_plane));
|
|
|
|
ret = drm_universal_plane_init(dev, &ast->primary_plane, 0x01,
|
|
|
|
&ast_primary_plane_funcs,
|
|
|
|
ast_primary_plane_formats,
|
|
|
|
ARRAY_SIZE(ast_primary_plane_formats),
|
|
|
|
NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
|
|
|
|
if (ret) {
|
2020-06-17 10:03:40 +02:00
|
|
|
drm_err(dev, "ast: drm_universal_plane_init() failed: %d\n", ret);
|
2019-11-07 09:34:01 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
drm_plane_helper_add(&ast->primary_plane,
|
|
|
|
&ast_primary_plane_helper_funcs);
|
|
|
|
|
2019-11-07 09:34:03 +01:00
|
|
|
ret = drm_universal_plane_init(dev, &ast->cursor_plane, 0x01,
|
|
|
|
&ast_cursor_plane_funcs,
|
|
|
|
ast_cursor_plane_formats,
|
|
|
|
ARRAY_SIZE(ast_cursor_plane_formats),
|
|
|
|
NULL, DRM_PLANE_TYPE_CURSOR, NULL);
|
|
|
|
if (ret) {
|
2020-06-17 10:03:40 +02:00
|
|
|
drm_err(dev, "drm_universal_plane_failed(): %d\n", ret);
|
2019-11-07 09:34:03 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
drm_plane_helper_add(&ast->cursor_plane,
|
|
|
|
&ast_cursor_plane_helper_funcs);
|
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
ast_crtc_init(dev);
|
|
|
|
ast_encoder_init(dev);
|
|
|
|
ast_connector_init(dev);
|
2019-11-07 09:34:01 +01:00
|
|
|
|
2020-07-02 13:50:29 +02:00
|
|
|
drm_mode_config_reset(dev);
|
|
|
|
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_clock(void *i2c_priv)
|
|
|
|
{
|
|
|
|
struct ast_i2c_chan *i2c = i2c_priv;
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(i2c->dev);
|
2018-11-22 11:56:28 +08:00
|
|
|
uint32_t val, val2, count, pass;
|
|
|
|
|
|
|
|
count = 0;
|
|
|
|
pass = 0;
|
|
|
|
val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
|
|
|
|
do {
|
|
|
|
val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
|
|
|
|
if (val == val2) {
|
|
|
|
pass++;
|
|
|
|
} else {
|
|
|
|
pass = 0;
|
|
|
|
val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
|
|
|
|
}
|
|
|
|
} while ((pass < 5) && (count++ < 0x10000));
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
|
|
|
return val & 1 ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_data(void *i2c_priv)
|
|
|
|
{
|
|
|
|
struct ast_i2c_chan *i2c = i2c_priv;
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(i2c->dev);
|
2018-11-22 11:56:28 +08:00
|
|
|
uint32_t val, val2, count, pass;
|
|
|
|
|
|
|
|
count = 0;
|
|
|
|
pass = 0;
|
|
|
|
val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01;
|
|
|
|
do {
|
|
|
|
val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01;
|
|
|
|
if (val == val2) {
|
|
|
|
pass++;
|
|
|
|
} else {
|
|
|
|
pass = 0;
|
|
|
|
val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01;
|
|
|
|
}
|
|
|
|
} while ((pass < 5) && (count++ < 0x10000));
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
|
|
|
|
return val & 1 ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_clock(void *i2c_priv, int clock)
|
|
|
|
{
|
|
|
|
struct ast_i2c_chan *i2c = i2c_priv;
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(i2c->dev);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
int i;
|
|
|
|
u8 ujcrb7, jtemp;
|
|
|
|
|
|
|
|
for (i = 0; i < 0x10000; i++) {
|
|
|
|
ujcrb7 = ((clock & 0x01) ? 0 : 1);
|
2018-11-22 11:56:28 +08:00
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf4, ujcrb7);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01);
|
|
|
|
if (ujcrb7 == jtemp)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_data(void *i2c_priv, int data)
|
|
|
|
{
|
|
|
|
struct ast_i2c_chan *i2c = i2c_priv;
|
2020-06-17 10:03:39 +02:00
|
|
|
struct ast_private *ast = to_ast_private(i2c->dev);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
int i;
|
|
|
|
u8 ujcrb7, jtemp;
|
|
|
|
|
|
|
|
for (i = 0; i < 0x10000; i++) {
|
|
|
|
ujcrb7 = ((data & 0x01) ? 0 : 1) << 2;
|
2018-11-22 11:56:28 +08:00
|
|
|
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf1, ujcrb7);
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04);
|
|
|
|
if (ujcrb7 == jtemp)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev)
|
|
|
|
{
|
|
|
|
struct ast_i2c_chan *i2c;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
i2c = kzalloc(sizeof(struct ast_i2c_chan), GFP_KERNEL);
|
|
|
|
if (!i2c)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
i2c->adapter.owner = THIS_MODULE;
|
|
|
|
i2c->adapter.class = I2C_CLASS_DDC;
|
|
|
|
i2c->adapter.dev.parent = &dev->pdev->dev;
|
|
|
|
i2c->dev = dev;
|
|
|
|
i2c_set_adapdata(&i2c->adapter, i2c);
|
|
|
|
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
|
|
|
|
"AST i2c bit bus");
|
|
|
|
i2c->adapter.algo_data = &i2c->bit;
|
|
|
|
|
|
|
|
i2c->bit.udelay = 20;
|
|
|
|
i2c->bit.timeout = 2;
|
|
|
|
i2c->bit.data = i2c;
|
|
|
|
i2c->bit.setsda = set_data;
|
|
|
|
i2c->bit.setscl = set_clock;
|
|
|
|
i2c->bit.getsda = get_data;
|
|
|
|
i2c->bit.getscl = get_clock;
|
|
|
|
ret = i2c_bit_add_bus(&i2c->adapter);
|
|
|
|
if (ret) {
|
2020-06-17 10:03:40 +02:00
|
|
|
drm_err(dev, "Failed to register bit i2c\n");
|
drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)
This is the initial driver for the Aspeed Technologies chips found in
servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It
doesn't support the AST11xx due to lack of hw to test it on, and them requiring
different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but
future server chips will probably share similiar setup. As these GPUs commonly
have low video RAM, it doesn't make sense to put the kms console in VRAM
always. This driver places the kms console into system RAM, and does dirty
updates to a copy in video RAM. When userspace sets a new scanout buffer,
it forcefully evicts the video RAM console, and X can create a framebuffer
that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction
to system RAM of the console, and multiple servers.
v2: add s/r support, fix Kconfig.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-02-29 13:40:04 +00:00
|
|
|
goto out_free;
|
|
|
|
}
|
|
|
|
|
|
|
|
return i2c;
|
|
|
|
out_free:
|
|
|
|
kfree(i2c);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ast_i2c_destroy(struct ast_i2c_chan *i2c)
|
|
|
|
{
|
|
|
|
if (!i2c)
|
|
|
|
return;
|
|
|
|
i2c_del_adapter(&i2c->adapter);
|
|
|
|
kfree(i2c);
|
|
|
|
}
|