1 From 43b93fbffc2c080dba2e84df6fce8d7e6c0a2581 Mon Sep 17 00:00:00 2001
2 From: Alex Deucher <alexdeucher@gmail.com>
3 Date: Wed, 27 Oct 2010 01:02:35 -0400
4 Subject: drm/radeon/kms: fix handling of tex lookup disable in cs checker on r2xx
6 From: Alex Deucher <alexdeucher@gmail.com>
8 commit 43b93fbffc2c080dba2e84df6fce8d7e6c0a2581 upstream.
10 There are cases when multiple texture units have to be enabled,
11 but not actually used to sample. This patch checks to see if
12 the lookup_disable bit is set and if so, skips the texture check.
15 https://bugs.freedesktop.org/show_bug.cgi?id=25544
17 Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
18 Signed-off-by: Dave Airlie <airlied@redhat.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
22 drivers/gpu/drm/radeon/r100.c | 3 +++
23 drivers/gpu/drm/radeon/r100_track.h | 1 +
24 drivers/gpu/drm/radeon/r200.c | 2 ++
25 drivers/gpu/drm/radeon/radeon_reg.h | 1 +
26 4 files changed, 7 insertions(+)
28 --- a/drivers/gpu/drm/radeon/r100.c
29 +++ b/drivers/gpu/drm/radeon/r100.c
30 @@ -3228,6 +3228,8 @@ static int r100_cs_track_texture_check(s
31 for (u = 0; u < track->num_texture; u++) {
32 if (!track->textures[u].enabled)
34 + if (track->textures[u].lookup_disable)
36 robj = track->textures[u].robj;
38 DRM_ERROR("No texture bound to unit %u\n", u);
39 @@ -3462,6 +3464,7 @@ void r100_cs_track_clear(struct radeon_d
40 track->textures[i].robj = NULL;
41 /* CS IB emission code makes sure texture unit are disabled */
42 track->textures[i].enabled = false;
43 + track->textures[i].lookup_disable = false;
44 track->textures[i].roundup_w = true;
45 track->textures[i].roundup_h = true;
46 if (track->separate_cube)
47 --- a/drivers/gpu/drm/radeon/r100_track.h
48 +++ b/drivers/gpu/drm/radeon/r100_track.h
49 @@ -46,6 +46,7 @@ struct r100_cs_track_texture {
53 + bool lookup_disable;
56 unsigned compress_format;
57 --- a/drivers/gpu/drm/radeon/r200.c
58 +++ b/drivers/gpu/drm/radeon/r200.c
59 @@ -447,6 +447,8 @@ int r200_packet0_check(struct radeon_cs_
60 track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK);
61 track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK);
63 + if (idx_value & R200_TXFORMAT_LOOKUP_DISABLE)
64 + track->textures[i].lookup_disable = true;
65 switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) {
66 case R200_TXFORMAT_I8:
67 case R200_TXFORMAT_RGB332:
68 --- a/drivers/gpu/drm/radeon/radeon_reg.h
69 +++ b/drivers/gpu/drm/radeon/radeon_reg.h
71 # define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
72 # define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
73 # define R200_TXFORMAT_ST_ROUTE_SHIFT 24
74 +# define R200_TXFORMAT_LOOKUP_DISABLE (1 << 27)
75 # define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
76 # define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
77 # define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)