Skip to contentSkip to conversation

drm/radeon/kms: fix nsample tracking in r6xx/r7xx CS tracker

PATCH In review Alex Deucher 3 participants 8 messages Aug 13, 2010 – Aug 16, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon/kms: fix nsample tracking in r6xx/r7xx CS tracker

Initialize nsamples to 1 in case userspace does not emit PA_SC_AA_CONFIG.

Cc Andre Maasikas <[email protected]>
---
 drivers/gpu/drm/radeon/r600_cs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600_cs.c +1 -0
index 8e165b2..b03f93b 100644
@@ -163,6 +163,7 @@ static void r600_cs_track_init(struct r600_cs_track *track)
 	track->db_depth_size = 0xFFFFFFFF;
 	track->db_depth_size_idx = 0;
 	track->db_depth_control = 0xFFFFFFFF;
+	track->nsamples = 1;
 }
 
 static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)
Signature · 1 line
1.7.1.1
#1 lore raw
Quoted 14 lines · Alex Deucher

Initialize nsamples to 1 in case userspace does not emit PA_SC_AA_CONFIG.

Cc Andre Maasikas <[email protected]>
---
 drivers/gpu/drm/radeon/r600_cs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600_cs.c +0 -0
index 8e165b2..b03f93b 100644

drivers/gpu/drm/radeon/r600_cs.c static void r600_cs_track_init(struct r600_cs_track *track) · line 169

Quoted 7 lines
drivers/gpu/drm/radeon/r600_cs.c +1 -0
@@ -163,6 +163,7 @@ static void r600_cs_track_init(struct r600_cs_track *track)
 	track->db_depth_size = 0xFFFFFFFF;
 	track->db_depth_size_idx = 0;
 	track->db_depth_control = 0xFFFFFFFF;
+	track->nsamples = 1;
 }
 
 static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)

I would NAK this one, accepting such things pretty much defeat the idea of checker, i think userspace should always set nsamples as otherwise it might trick kernel and overwritte others memory. ie:
cs1 set nsample 8 & all others properly so cs1 is accepted cs2 don't set nsample but bind a smaller bo and so can overwritte others buffer

Cheers,
Jerome

#2 lore raw
Quoted 21 lines · Jerome Glisse
Quoted 20 lines · Alex Deucher

Initialize nsamples to 1 in case userspace does not emit PA_SC_AA_CONFIG.

Cc Andre Maasikas <[email protected]>

---
 drivers/gpu/drm/radeon/r600_cs.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600_cs.c +1 -0
index 8e165b2..b03f93b 100644
@@ -163,6 +163,7 @@ static void r600_cs_track_init(struct r600_cs_track *track)
       track->db_depth_size = 0xFFFFFFFF;
       track->db_depth_size_idx = 0;
       track->db_depth_control = 0xFFFFFFFF;
+     track->nsamples = 1;
  }
 
Quoted 8 lines

drivers/gpu/drm/radeon/r600_cs.c static void r600_cs_track_init(struct r600_cs_track *track) · line 169

Quoted 1 line
drivers/gpu/drm/radeon/r600_cs.c +0 -0
  static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)

I would NAK this one, accepting such things pretty much defeat the idea of checker, i think userspace should always set nsamples as otherwise it might trick kernel and overwritte others memory. ie:
cs1 set nsample 8 & all others properly so cs1 is accepted cs2 don't set nsample but bind a smaller bo and so can overwritte others buffer

Unfortunately, existing userspace already sends buffers without this reg set. It's just that prior to tiling we didn't care what it was set to.

Alex

#3 lore raw
Quoted 31 lines · Alex Deucher
Quoted 21 lines · Jerome Glisse
Quoted 20 lines · Alex Deucher

Initialize nsamples to 1 in case userspace does not emit PA_SC_AA_CONFIG.

Cc Andre Maasikas <[email protected]>
---
 drivers/gpu/drm/radeon/r600_cs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600_cs.c +1 -0
index 8e165b2..b03f93b 100644
@@ -163,6 +163,7 @@ static void r600_cs_track_init(struct r600_cs_track *track)
      track->db_depth_size = 0xFFFFFFFF;
      track->db_depth_size_idx = 0;
      track->db_depth_control = 0xFFFFFFFF;
+     track->nsamples = 1;
 }
 
Quoted 8 lines

drivers/gpu/drm/radeon/r600_cs.c static void r600_cs_track_init(struct r600_cs_track *track) · line 169

Quoted 1 line
drivers/gpu/drm/radeon/r600_cs.c +0 -0
 static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)

I would NAK this one, accepting such things pretty much defeat the idea of checker, i think userspace should always set nsamples as otherwise it might trick kernel and overwritte others memory. ie:
cs1 set nsample 8 & all others properly so cs1 is accepted cs2 don't set nsample but bind a smaller bo and so can overwritte others buffer

Quoted 5 lines

Unfortunately, existing userspace already sends buffers without this reg set. It's just that prior to tiling we didn't care what it was set to.

Alex

I guess once again we hit by our own fault of prematurely going out of staging.

Jerome

#4 lore raw
Quoted 32 lines · Jerome Glisse
Quoted 31 lines · Alex Deucher
Quoted 29 lines · Jerome Glisse
Quoted 14 lines · Alex Deucher

Initialize nsamples to 1 in case userspace does not emit PA_SC_AA_CONFIG.

Cc Andre Maasikas <[email protected]>

---
 drivers/gpu/drm/radeon/r600_cs.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600_cs.c +0 -0
index 8e165b2..b03f93b 100644

drivers/gpu/drm/radeon/r600_cs.c static void r600_cs_track_init(struct r600_cs_track *track) · line 169

Quoted 7 lines
drivers/gpu/drm/radeon/r600_cs.c +1 -0
@@ -163,6 +163,7 @@ static void r600_cs_track_init(struct r600_cs_track *track)
       track->db_depth_size = 0xFFFFFFFF;
       track->db_depth_size_idx = 0;
       track->db_depth_control = 0xFFFFFFFF;
+     track->nsamples = 1;
  }
 
  static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)

I would NAK this one, accepting such things pretty much defeat the idea of checker, i think userspace should always set nsamples as otherwise it might trick kernel and overwritte others memory. ie:
cs1 set nsample 8 & all others properly so cs1 is accepted cs2 don't set nsample but bind a smaller bo and so can overwritte others buffer

Quoted 8 lines
Quoted 5 lines

Unfortunately, existing userspace already sends buffers without this reg set. It's just that prior to tiling we didn't care what it was set to.

Alex

I guess once again we hit by our own fault of prematurely going out of staging.

I *think* the only thing that doesn't emit this reg is the blit code in mesa git master, so we could just fix it there as it's not officially released, but there's quite a bit of mesa git master out in the wild.

Alex

#5 lore raw
In reply to Jerome Glisse
Quoted 32 lines · Jerome Glisse
Quoted 31 lines · Alex Deucher
Quoted 29 lines · Jerome Glisse
Quoted 14 lines · Alex Deucher

Initialize nsamples to 1 in case userspace does not emit PA_SC_AA_CONFIG.

Cc Andre Maasikas <[email protected]>
---
 drivers/gpu/drm/radeon/r600_cs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600_cs.c +0 -0
index 8e165b2..b03f93b 100644

drivers/gpu/drm/radeon/r600_cs.c static void r600_cs_track_init(struct r600_cs_track *track) · line 169

Quoted 7 lines
drivers/gpu/drm/radeon/r600_cs.c +1 -0
@@ -163,6 +163,7 @@ static void r600_cs_track_init(struct r600_cs_track *track)
      track->db_depth_size = 0xFFFFFFFF;
      track->db_depth_size_idx = 0;
      track->db_depth_control = 0xFFFFFFFF;
+     track->nsamples = 1;
 }
 
 static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)

I would NAK this one, accepting such things pretty much defeat the idea of checker, i think userspace should always set nsamples as otherwise it might trick kernel and overwritte others memory. ie:
cs1 set nsample 8 & all others properly so cs1 is accepted cs2 don't set nsample but bind a smaller bo and so can overwritte others buffer

Quoted 8 lines
Quoted 5 lines

Unfortunately, existing userspace already sends buffers without this reg set. It's just that prior to tiling we didn't care what it was set to.

Alex

I guess once again we hit by our own fault of prematurely going out of staging.

Jerome, staying in staging forever until every feature of the hw is implemented isn't possible, at some point you have to do real engineer work and this sounds like its workaroundable

How about if we get a tiling CB in the checker, we make sure nsamples is set? will that work?

Dave.

#6 lore raw
Quoted 42 lines · Dave Airlie
Quoted 32 lines · Jerome Glisse
Quoted 31 lines · Alex Deucher
Quoted 29 lines · Jerome Glisse
Quoted 14 lines · Alex Deucher

Initialize nsamples to 1 in case userspace does not emit PA_SC_AA_CONFIG.

Cc Andre Maasikas <[email protected]>

---
 drivers/gpu/drm/radeon/r600_cs.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600_cs.c +0 -0
index 8e165b2..b03f93b 100644

drivers/gpu/drm/radeon/r600_cs.c static void r600_cs_track_init(struct r600_cs_track *track) · line 169

Quoted 7 lines
drivers/gpu/drm/radeon/r600_cs.c +1 -0
@@ -163,6 +163,7 @@ static void r600_cs_track_init(struct r600_cs_track *track)
       track->db_depth_size = 0xFFFFFFFF;
       track->db_depth_size_idx = 0;
       track->db_depth_control = 0xFFFFFFFF;
+     track->nsamples = 1;
  }
 
  static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)

I would NAK this one, accepting such things pretty much defeat the idea of checker, i think userspace should always set nsamples as otherwise it might trick kernel and overwritte others memory. ie:
cs1 set nsample 8 & all others properly so cs1 is accepted cs2 don't set nsample but bind a smaller bo and so can overwritte others buffer

Quoted 8 lines
Quoted 5 lines

Unfortunately, existing userspace already sends buffers without this reg set. It's just that prior to tiling we didn't care what it was set to.

Alex

I guess once again we hit by our own fault of prematurely going out of staging.

Quoted 7 lines

Jerome, staying in staging forever until every feature of the hw is implemented isn't possible, at some point you have to do real engineer work and this sounds like its workaroundable

How about if we get a tiling CB in the checker, we make sure nsamples is set? will that work?

I've fixed the issue in mesa. The problematic mesa code has not been officially part of a release yet. That said, I think 1 is a reasonable default for nsamples regardless as unless MSAA is enabled, you can pretty safely assume 1.

Alex

Quoted 4 lines

Dave.

#7 lore raw
Quoted 47 lines · Alex Deucher
Quoted 46 lines · Dave Airlie
Quoted 32 lines · Jerome Glisse
Quoted 31 lines · Alex Deucher
Quoted 29 lines · Jerome Glisse
Quoted 14 lines · Alex Deucher

Initialize nsamples to 1 in case userspace does not emit PA_SC_AA_CONFIG.

Cc Andre Maasikas <[email protected]>

---
 drivers/gpu/drm/radeon/r600_cs.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600_cs.c +0 -0
index 8e165b2..b03f93b 100644

drivers/gpu/drm/radeon/r600_cs.c static void r600_cs_track_init(struct r600_cs_track *track) · line 169

Quoted 7 lines
drivers/gpu/drm/radeon/r600_cs.c +1 -0
@@ -163,6 +163,7 @@ static void r600_cs_track_init(struct r600_cs_track *track)
       track->db_depth_size = 0xFFFFFFFF;
       track->db_depth_size_idx = 0;
       track->db_depth_control = 0xFFFFFFFF;
+     track->nsamples = 1;
  }
 
  static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)

I would NAK this one, accepting such things pretty much defeat the idea of checker, i think userspace should always set nsamples as otherwise it might trick kernel and overwritte others memory. ie:
cs1 set nsample 8 & all others properly so cs1 is accepted cs2 don't set nsample but bind a smaller bo and so can overwritte others buffer

Quoted 8 lines
Quoted 5 lines

Unfortunately, existing userspace already sends buffers without this reg set. It's just that prior to tiling we didn't care what it was set to.

Alex

I guess once again we hit by our own fault of prematurely going out of staging.

Jerome, staying in staging forever until every feature of the hw is implemented isn't possible, at some point you have to do real engineer work and this sounds like its workaroundable

Quoted 9 lines
Quoted 3 lines

How about if we get a tiling CB in the checker, we make sure nsamples is set? will that work?

I've fixed the issue in mesa.  The problematic mesa code has not been officially part of a release yet.  That said, I think 1 is a reasonable default for nsamples regardless as unless MSAA is enabled, you can pretty safely assume 1.

If we don't set a default value, we would need to make sure IBs always contain PA_SC_AA_CONFIG which is nor currently enforced. Thoughts?

Alex

Quoted 7 lines

Alex

Quoted 4 lines

Dave.