      out_mat = &s->rear_frame_mat;
    }
    glActiveTexture(GL_TEXTURE0);
  
    if (s->stream.last_idx >= 0) {
      glBindTexture(GL_TEXTURE_2D, s->frame_texs[s->stream.last_idx]);
  #ifndef QCOM
      // this is handled in ion on QCOM
      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, s->stream.bufs_info.width, s->stream.bufs_info.height,
                   0, GL_RGB, GL_UNSIGNED_BYTE, s->priv_hnds[s->stream.last_idx]);
  #endif
 
</s> remove     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, s->stream.bufs_info.width, s->stream.bufs_info.height,
                 0, GL_RGB, GL_UNSIGNED_BYTE, s->priv_hnds[s->stream.last_idx]);
 </s> add     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, s->last_frame->width, s->last_frame->height,
                 0, GL_RGB, GL_UNSIGNED_BYTE, s->priv_hnds[s->last_frame->idx]); </s> remove GLuint visionimg_to_gl(const VisionImg *img, EGLImageKHR *pkhr, void **pph) {
  unsigned int texture;
  glGenTextures(1, &texture);
  glBindTexture(GL_TEXTURE_2D, texture);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img->width, img->height, 0, GL_RGB, GL_UNSIGNED_BYTE, *pph);
  glGenerateMipmap(GL_TEXTURE_2D);
  *pkhr = (EGLImageKHR)1; // not NULL
  return texture;
}

void visionimg_destroy_gl(EGLImageKHR khr, void *ph) {
  // empty
}
 </s> add  </s> remove     s->priv_hnds[i] = s->stream.bufs[i].addr;
 </s> add     s->priv_hnds[i] = buf->addr; </s> remove   if (draw_vision && s->vision_connected) {
 </s> add   if (draw_vision) { </s> remove     // one frame in memory
    VisionBuf yuv_ion = visionbuf_allocate_cl(buf_info.buf_len, device_id, context);

 </s> add 
  if (s->last_frame) {
    glBindTexture(GL_TEXTURE_2D, s->frame_texs[s->last_frame->idx]);
      out_mat = &s->rear_frame_mat;
    }
    glActiveTexture(GL_TEXTURE0);
  
  if (s->last_frame) {
    glBindTexture(GL_TEXTURE_2D, s->frame_texs[s->last_frame->idx]);
  if (s->last_frame) {
    glBindTexture(GL_TEXTURE_2D, s->frame_texs[s->last_frame->idx]);
  #ifndef QCOM
      // this is handled in ion on QCOM
      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, s->stream.bufs_info.width, s->stream.bufs_info.height,
                   0, GL_RGB, GL_UNSIGNED_BYTE, s->priv_hnds[s->stream.last_idx]);
  #endif
keep keep keep keep replace replace keep keep keep keep keep
 VisionIPC 2.0 (#19641)

* Squashed vipc

* Update release files

* Remove else

* add visionipc to release files

* use poller in vipc receive

* opencl framework instead of lib on macos

* Fix camera webcam

* Fix opencl on mac in ui

* more webcam fixes

* typo in ui sconsfile

* Use cur_yuv_buf

* visionbuf c++ class

* Camera qcom was still using visionbuf_allocate

* Turn loggerd back on

* fix snapshot

* No build needed

* update test camerad

* no more release callback

* make encoder c++

* Revert "no more release callback"

This reverts commit e5707b07002fee665d0483d90713154efc2d70d4.

* fix exit handlers

* No need to check errno

* move release callback call

* s/VIPCBufExtra/VisionIpcBufExtra/g

* use non blocking connect

* ui use non blocking connect

* Lower condition variable wait time

* Snapshot cleanup

* bump cereal

* bump cereal 
selfdrive/ui/paint.cc