VirtualBox

Changeset 81618 in vbox


Ignore:
Timestamp:
Nov 1, 2019 12:54:34 AM (5 years ago)
Author:
vboxsync
Message:

Additions/3D/mesa: Deal with the coordinate system differences between the SVGA device and gallium utils. bugref:8893

Location:
trunk/src/VBox/Additions/3D/mesa/mesa-17.3.9/src/gallium
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/3D/mesa/mesa-17.3.9/src/gallium/drivers/svga/svga_pipe_blit.c

    r79768 r81618  
    609609   svga_toggle_render_condition(svga, blit.render_condition_enable, FALSE);
    610610
     611#ifdef VBOX_WITH_MESA3D_NINE_SVGA
     612   /* Flip Y.
     613    *
     614    * util_blitter draws a textured quad using the source as the texture and sets
     615    * the texcoords for the destination quad vertices using OpenGL texture coordinates:
     616    * bottom,left = 0,0; top,right = 1,1.
     617    *
     618    * But the VMSVGA device uses the uses D3D texture coords:
     619    * top,left=0,0; bottom,right = 1,1.
     620    */
     621   blit.dst.box.y = u_minify(dst->height0, blit.dst.level) - blit.dst.box.y - blit.dst.box.height;
     622
     623   blit.src.box.y = u_minify(src->height0, blit.src.level) - blit.src.box.y;
     624   blit.src.box.height = -blit.src.box.height;
     625#endif
    611626   util_blitter_blit(svga->blitter, &blit);
    612627
  • trunk/src/VBox/Additions/3D/mesa/mesa-17.3.9/src/gallium/drivers/svga/svga_pipe_clear.c

    r75443 r81618  
    352352                                       &svga->curr.framebuffer);
    353353         begin_blit(svga);
     354#ifdef VBOX_WITH_MESA3D_NINE_SVGA
     355         /* Flip Y.
     356          *
     357          * util_blitter draws a quad using OpenGL coordinates: y up.
     358          *
     359          * But the VMSVGA device uses the D3D coords: y down.
     360          */
     361         unsigned dsty = dsv->height - box->y - box->height;
     362         util_blitter_clear_depth_stencil(svga->blitter,
     363                                          dsv, clear_flags,
     364                                          depth,stencil,
     365                                          box->x, dsty,
     366                                          box->width, box->height);
     367#else
    354368         util_blitter_clear_depth_stencil(svga->blitter,
    355369                                          dsv, clear_flags,
     
    357371                                          box->x, box->y,
    358372                                          box->width, box->height);
     373#endif
    359374      }
    360375   }
     
    428443                                          &svga->curr.framebuffer);
    429444            begin_blit(svga);
     445#ifdef VBOX_WITH_MESA3D_NINE_SVGA
     446            /* Flip Y. See comment in svga_clear_texture */
     447            unsigned dsty = rtv->height - box->y - box->height;
     448            util_blitter_clear_render_target(svga->blitter,
     449                                             rtv,
     450                                             &color,
     451                                             box->x, dsty,
     452                                             box->width, box->height);
     453#else
    430454            util_blitter_clear_render_target(svga->blitter,
    431455                                             rtv,
     
    433457                                             box->x, box->y,
    434458                                             box->width, box->height);
     459#endif
    435460         }
    436461         else {
     
    501526   util_blitter_save_framebuffer(svga->blitter, &svga->curr.framebuffer);
    502527
     528#ifdef VBOX_WITH_MESA3D_NINE_SVGA
     529   /* Flip Y. See comment in svga_clear_texture */
     530   dsty = dst->height - dsty - height;
     531#endif
    503532   util_blitter_clear_render_target(svga->blitter, dst, color,
    504533                                    dstx, dsty, width, height);
     
    566595    begin_blit(svga);
    567596    util_blitter_save_framebuffer(svga->blitter, &svga->curr.framebuffer);
     597
     598#ifdef VBOX_WITH_MESA3D_NINE_SVGA
     599    /* Flip Y. See comment in svga_clear_texture */
     600    dsty = dst->height - dsty - height;
     601#endif
    568602    util_blitter_clear_depth_stencil(svga->blitter,
    569603                                     dst, clear_flags,
  • trunk/src/VBox/Additions/3D/mesa/mesa-17.3.9/src/gallium/state_trackers/nine/nine_state.c

    r81576 r81618  
    13511351    blit.scissor_enable = FALSE;
    13521352
    1353 #ifdef VBOX_WITH_MESA3D_NINE_SVGA
    1354     /* Flip Y because the state tracker uses the D3D texture coords:
    1355      * top,left=0,0; bottom,right = 1,1.
    1356      * While the blit draws a quad using the source as texture and sets
    1357      * the texcoords for destination vertices using the OpenGL coordinates:
    1358      * bottom,left = 0,0; top,right = 1,1.
    1359      */
    1360     {
    1361         struct pipe_blit_info b = blit;
    1362 
    1363         b.dst.box.y = b.dst.resource->height0 - b.dst.box.y - b.dst.box.height;
    1364 
    1365         b.src.box.y = b.src.resource->height0 - b.src.box.y;
    1366         b.src.box.height = -b.src.box.height;
    1367 
    1368         context->pipe->blit(context->pipe, &b);
    1369     }
    1370 #else
    13711353    context->pipe->blit(context->pipe, &blit);
    1372 #endif
    13731354}
    13741355
     
    25182499
    25192500            DBG("Clearing (%u..%u)x(%u..%u)\n", x1, x2, y1, y2);
    2520 #ifdef VBOX_WITH_MESA3D_NINE_SVGA
    2521             /* Flip Y because the nine state tracker uses the D3D coords:
    2522              * top,left=0,0; bottom,right = 1,1.
    2523              * While the clear_render_target draws a quad and sets the texcoords
    2524              * for the destination vertices using the OpenGL coordinates:
    2525              * bottom,left = 0,0; top,right = 1,1.
    2526              */
    2527             unsigned const height = y2 - y1;
    2528             y1 = cbuf->height - y1 - height;
    2529             pipe->clear_render_target(pipe, cbuf, &rgba,
    2530                                       x1, y1, x2 - x1, height, false);
    2531 #else
    25322501            pipe->clear_render_target(pipe, cbuf, &rgba,
    25332502                                      x1, y1, x2 - x1, y2 - y1, false);
    2534 #endif
    25352503        }
    25362504    }
     
    25592527        assert(zsbuf);
    25602528
    2561 #ifdef VBOX_WITH_MESA3D_NINE_SVGA
    2562         /* Flip Y because the nine state tracker uses the D3D coords:
    2563          * top,left=0,0; bottom,right = 1,1.
    2564          * While the clear_depth_stencil draws a quad and sets the texcoords
    2565          * for the destination vertices using the OpenGL coordinates:
    2566          * bottom,left = 0,0; top,right = 1,1.
    2567          */
    2568         unsigned const height = y2 - y1;
    2569         y1 = zsbuf->height - y1 - height;
    2570         pipe->clear_depth_stencil(pipe, zsbuf, bufs, Z, Stencil,
    2571                                   x1, y1, x2 - x1, height, false);
    2572 #else
    25732529        pipe->clear_depth_stencil(pipe, zsbuf, bufs, Z, Stencil,
    25742530                                  x1, y1, x2 - x1, y2 - y1, false);
    2575 #endif
    25762531    }
    25772532    return;
     
    27132668    (void) src;
    27142669
    2715 #ifdef VBOX_WITH_MESA3D_NINE_SVGA
    2716     /* This seems to work correctly and does not require Y flip. */
    2717 #endif
    27182670    context->pipe->resource_copy_region(context->pipe,
    27192671            dst_res, dst_level,
     
    27332685    (void) src;
    27342686
    2735 #ifdef VBOX_WITH_MESA3D_NINE_SVGA
    2736     /* Flip Y because the state tracker uses D3D texture coords:
    2737      * top,left=0,0; bottom,right = 1,1.
    2738      * While the blit draws a quad using the source as texture and sets
    2739      * texcoords for destination vertices using OpenGL coordinates:
    2740      * bottom,left = 0,0; top,right = 1,1.
    2741      */
    2742     {
    2743         struct pipe_blit_info b = *blit;
    2744 
    2745         b.dst.box.y = b.dst.resource->height0 - b.dst.box.y - b.dst.box.height;
    2746 
    2747         b.src.box.y = b.src.resource->height0 - b.src.box.y;
    2748         b.src.box.height = -b.src.box.height;
    2749 
    2750         context->pipe->blit(context->pipe, &b);
    2751     }
    2752 #else
    27532687    context->pipe->blit(context->pipe, blit);
    2754 #endif
    27552688}
    27562689
     
    27692702    d3dcolor_to_pipe_color_union(&rgba, color);
    27702703    surf = NineSurface9_GetSurface(surface, 0);
    2771 #ifdef VBOX_WITH_MESA3D_NINE_SVGA
    2772     /* Flip Y because the nine state tracker uses D3D coords:
    2773      * top,left=0,0; bottom,right = 1,1.
    2774      * While the clear_render_target draws a quad sets texcoords
    2775      * for destination vertices using OpenGL coordinates:
    2776      * bottom,left = 0,0; top,right = 1,1.
    2777      */
    2778     /** @todo Figure out how to avoid such mismatches in a generic way. */
    2779     y = surf->height - y - height;
    2780 #endif
    27812704    context->pipe->clear_render_target(context->pipe, surf, &rgba, x, y, width, height, false);
    27822705}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette