diff mbox

drm/radeon/kms: allow "invalid" DB formats as a means to disable DB

Message ID 1343571897-25281-1-git-send-email-maraeo@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marek Olšák July 29, 2012, 2:24 p.m. UTC
Signed-off-by: Marek Olšák <maraeo@gmail.com>
---
 drivers/gpu/drm/radeon/evergreen_cs.c |    6 ++++--
 drivers/gpu/drm/radeon/evergreend.h   |    2 ++
 drivers/gpu/drm/radeon/r600_cs.c      |    6 ++++--
 drivers/gpu/drm/radeon/radeon_drv.c   |    3 ++-
 4 files changed, 12 insertions(+), 5 deletions(-)

Comments

Alex Deucher July 30, 2012, 1:41 p.m. UTC | #1
On Sun, Jul 29, 2012 at 10:24 AM, Marek Olšák <maraeo@gmail.com> wrote:
> Signed-off-by: Marek Olšák <maraeo@gmail.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/radeon/evergreen_cs.c |    6 ++++--
>  drivers/gpu/drm/radeon/evergreend.h   |    2 ++
>  drivers/gpu/drm/radeon/r600_cs.c      |    6 ++++--
>  drivers/gpu/drm/radeon/radeon_drv.c   |    3 ++-
>  4 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
> index c1655412..f2e5c54 100644
> --- a/drivers/gpu/drm/radeon/evergreen_cs.c
> +++ b/drivers/gpu/drm/radeon/evergreen_cs.c
> @@ -961,13 +961,15 @@ static int evergreen_cs_track_check(struct radeon_cs_parser *p)
>
>         if (track->db_dirty) {
>                 /* Check stencil buffer */
> -               if (G_028800_STENCIL_ENABLE(track->db_depth_control)) {
> +               if (G_028044_FORMAT(track->db_s_info) != V_028044_STENCIL_INVALID &&
> +                   G_028800_STENCIL_ENABLE(track->db_depth_control)) {
>                         r = evergreen_cs_track_validate_stencil(p);
>                         if (r)
>                                 return r;
>                 }
>                 /* Check depth buffer */
> -               if (G_028800_Z_ENABLE(track->db_depth_control)) {
> +               if (G_028040_FORMAT(track->db_z_info) != V_028040_Z_INVALID &&
> +                   G_028800_Z_ENABLE(track->db_depth_control)) {
>                         r = evergreen_cs_track_validate_depth(p);
>                         if (r)
>                                 return r;
> diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
> index b50b15c..4a43b46 100644
> --- a/drivers/gpu/drm/radeon/evergreend.h
> +++ b/drivers/gpu/drm/radeon/evergreend.h
> @@ -1273,6 +1273,8 @@
>  #define   S_028044_FORMAT(x)                           (((x) & 0x1) << 0)
>  #define   G_028044_FORMAT(x)                           (((x) >> 0) & 0x1)
>  #define   C_028044_FORMAT                              0xFFFFFFFE
> +#define            V_028044_STENCIL_INVALID                    0
> +#define            V_028044_STENCIL_8                          1
>  #define   G_028044_TILE_SPLIT(x)                       (((x) >> 8) & 0x7)
>  #define DB_Z_READ_BASE                                 0x28048
>  #define DB_STENCIL_READ_BASE                           0x2804c
> diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
> index ca87f7a..1119e31 100644
> --- a/drivers/gpu/drm/radeon/r600_cs.c
> +++ b/drivers/gpu/drm/radeon/r600_cs.c
> @@ -764,8 +764,10 @@ static int r600_cs_track_check(struct radeon_cs_parser *p)
>         }
>
>         /* Check depth buffer */
> -       if (track->db_dirty && (G_028800_STENCIL_ENABLE(track->db_depth_control) ||
> -               G_028800_Z_ENABLE(track->db_depth_control))) {
> +       if (track->db_dirty &&
> +           G_028010_FORMAT(track->db_depth_info) != V_028010_DEPTH_INVALID &&
> +           (G_028800_STENCIL_ENABLE(track->db_depth_control) ||
> +            G_028800_Z_ENABLE(track->db_depth_control))) {
>                 r = r600_cs_track_validate_db(p);
>                 if (r)
>                         return r;
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 2c4d53f..ed13538 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -59,9 +59,10 @@
>   *   2.15.0 - add max_pipes query
>   *   2.16.0 - fix evergreen 2D tiled surface calculation
>   *   2.17.0 - add STRMOUT_BASE_UPDATE for r7xx
> + *   2.18.0 - r600-eg: allow "invalid" DB formats
>   */
>  #define KMS_DRIVER_MAJOR       2
> -#define KMS_DRIVER_MINOR       17
> +#define KMS_DRIVER_MINOR       18
>  #define KMS_DRIVER_PATCHLEVEL  0
>  int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
>  int radeon_driver_unload_kms(struct drm_device *dev);
> --
> 1.7.9.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Marek Olšák July 30, 2012, 7:45 p.m. UTC | #2
After some discussion in private, we've come to the conclusion that
this is a very important fix. So if it's possible:

Cc: stable@kernel.org

Applicable to 3.5 stable kernel only.

Marek

On Sun, Jul 29, 2012 at 4:24 PM, Marek Olšák <maraeo@gmail.com> wrote:
> Signed-off-by: Marek Olšák <maraeo@gmail.com>
> ---
>  drivers/gpu/drm/radeon/evergreen_cs.c |    6 ++++--
>  drivers/gpu/drm/radeon/evergreend.h   |    2 ++
>  drivers/gpu/drm/radeon/r600_cs.c      |    6 ++++--
>  drivers/gpu/drm/radeon/radeon_drv.c   |    3 ++-
>  4 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
> index c1655412..f2e5c54 100644
> --- a/drivers/gpu/drm/radeon/evergreen_cs.c
> +++ b/drivers/gpu/drm/radeon/evergreen_cs.c
> @@ -961,13 +961,15 @@ static int evergreen_cs_track_check(struct radeon_cs_parser *p)
>
>         if (track->db_dirty) {
>                 /* Check stencil buffer */
> -               if (G_028800_STENCIL_ENABLE(track->db_depth_control)) {
> +               if (G_028044_FORMAT(track->db_s_info) != V_028044_STENCIL_INVALID &&
> +                   G_028800_STENCIL_ENABLE(track->db_depth_control)) {
>                         r = evergreen_cs_track_validate_stencil(p);
>                         if (r)
>                                 return r;
>                 }
>                 /* Check depth buffer */
> -               if (G_028800_Z_ENABLE(track->db_depth_control)) {
> +               if (G_028040_FORMAT(track->db_z_info) != V_028040_Z_INVALID &&
> +                   G_028800_Z_ENABLE(track->db_depth_control)) {
>                         r = evergreen_cs_track_validate_depth(p);
>                         if (r)
>                                 return r;
> diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
> index b50b15c..4a43b46 100644
> --- a/drivers/gpu/drm/radeon/evergreend.h
> +++ b/drivers/gpu/drm/radeon/evergreend.h
> @@ -1273,6 +1273,8 @@
>  #define   S_028044_FORMAT(x)                           (((x) & 0x1) << 0)
>  #define   G_028044_FORMAT(x)                           (((x) >> 0) & 0x1)
>  #define   C_028044_FORMAT                              0xFFFFFFFE
> +#define            V_028044_STENCIL_INVALID                    0
> +#define            V_028044_STENCIL_8                          1
>  #define   G_028044_TILE_SPLIT(x)                       (((x) >> 8) & 0x7)
>  #define DB_Z_READ_BASE                                 0x28048
>  #define DB_STENCIL_READ_BASE                           0x2804c
> diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
> index ca87f7a..1119e31 100644
> --- a/drivers/gpu/drm/radeon/r600_cs.c
> +++ b/drivers/gpu/drm/radeon/r600_cs.c
> @@ -764,8 +764,10 @@ static int r600_cs_track_check(struct radeon_cs_parser *p)
>         }
>
>         /* Check depth buffer */
> -       if (track->db_dirty && (G_028800_STENCIL_ENABLE(track->db_depth_control) ||
> -               G_028800_Z_ENABLE(track->db_depth_control))) {
> +       if (track->db_dirty &&
> +           G_028010_FORMAT(track->db_depth_info) != V_028010_DEPTH_INVALID &&
> +           (G_028800_STENCIL_ENABLE(track->db_depth_control) ||
> +            G_028800_Z_ENABLE(track->db_depth_control))) {
>                 r = r600_cs_track_validate_db(p);
>                 if (r)
>                         return r;
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 2c4d53f..ed13538 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -59,9 +59,10 @@
>   *   2.15.0 - add max_pipes query
>   *   2.16.0 - fix evergreen 2D tiled surface calculation
>   *   2.17.0 - add STRMOUT_BASE_UPDATE for r7xx
> + *   2.18.0 - r600-eg: allow "invalid" DB formats
>   */
>  #define KMS_DRIVER_MAJOR       2
> -#define KMS_DRIVER_MINOR       17
> +#define KMS_DRIVER_MINOR       18
>  #define KMS_DRIVER_PATCHLEVEL  0
>  int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
>  int radeon_driver_unload_kms(struct drm_device *dev);
> --
> 1.7.9.5
>
Michel Dänzer July 31, 2012, 5:38 a.m. UTC | #3
On Mon, 2012-07-30 at 21:45 +0200, Marek Olšák wrote: 
> After some discussion in private, we've come to the conclusion that
> this is a very important fix. So if it's possible:
> 
> Cc: stable@kernel.org
> 
> Applicable to 3.5 stable kernel only.

Add

Cc: stable@vger.kernel.org [3.5]

(but don't send the patch there by e-mail) and

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

then. :)
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index c1655412..f2e5c54 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -961,13 +961,15 @@  static int evergreen_cs_track_check(struct radeon_cs_parser *p)
 
 	if (track->db_dirty) {
 		/* Check stencil buffer */
-		if (G_028800_STENCIL_ENABLE(track->db_depth_control)) {
+		if (G_028044_FORMAT(track->db_s_info) != V_028044_STENCIL_INVALID &&
+		    G_028800_STENCIL_ENABLE(track->db_depth_control)) {
 			r = evergreen_cs_track_validate_stencil(p);
 			if (r)
 				return r;
 		}
 		/* Check depth buffer */
-		if (G_028800_Z_ENABLE(track->db_depth_control)) {
+		if (G_028040_FORMAT(track->db_z_info) != V_028040_Z_INVALID &&
+		    G_028800_Z_ENABLE(track->db_depth_control)) {
 			r = evergreen_cs_track_validate_depth(p);
 			if (r)
 				return r;
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index b50b15c..4a43b46 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -1273,6 +1273,8 @@ 
 #define   S_028044_FORMAT(x)                           (((x) & 0x1) << 0)
 #define   G_028044_FORMAT(x)                           (((x) >> 0) & 0x1)
 #define   C_028044_FORMAT                              0xFFFFFFFE
+#define	    V_028044_STENCIL_INVALID			0
+#define	    V_028044_STENCIL_8				1
 #define   G_028044_TILE_SPLIT(x)                       (((x) >> 8) & 0x7)
 #define DB_Z_READ_BASE					0x28048
 #define DB_STENCIL_READ_BASE				0x2804c
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index ca87f7a..1119e31 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -764,8 +764,10 @@  static int r600_cs_track_check(struct radeon_cs_parser *p)
 	}
 
 	/* Check depth buffer */
-	if (track->db_dirty && (G_028800_STENCIL_ENABLE(track->db_depth_control) ||
-		G_028800_Z_ENABLE(track->db_depth_control))) {
+	if (track->db_dirty &&
+	    G_028010_FORMAT(track->db_depth_info) != V_028010_DEPTH_INVALID &&
+	    (G_028800_STENCIL_ENABLE(track->db_depth_control) ||
+	     G_028800_Z_ENABLE(track->db_depth_control))) {
 		r = r600_cs_track_validate_db(p);
 		if (r)
 			return r;
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 2c4d53f..ed13538 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -59,9 +59,10 @@ 
  *   2.15.0 - add max_pipes query
  *   2.16.0 - fix evergreen 2D tiled surface calculation
  *   2.17.0 - add STRMOUT_BASE_UPDATE for r7xx
+ *   2.18.0 - r600-eg: allow "invalid" DB formats
  */
 #define KMS_DRIVER_MAJOR	2
-#define KMS_DRIVER_MINOR	17
+#define KMS_DRIVER_MINOR	18
 #define KMS_DRIVER_PATCHLEVEL	0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);